We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Does anyone know how to add sound in processing? I want to add sound when my ball moves, which only moves when I click around the ball by a specific range max. I downloaded the song, saved the file in my processing code file, but still can't get it added in my codes.
Answers
Check this post for an example:
https://forum.processing.org/two/discussion/comment/80153/#Comment_80153
Kf
So I took a look at it, and I have been getting error "couldn't load the file Ball Hit sound.mp3"
Can you please post your code. To format code in this forum, select your code and hit ctrl+o before submitting.
Kf
I stopped getting error, but now it's not even playing at all
You current code seems rather incomplete...
Can you tell me what I might be missing?
You are missing setup and draw. This code doesn't run as it is.
Kf
So I changed my code, but it's still not working...
draw() ?
There are lots of minim examples if you Google for minim audioplayer
But in almost all the examples, there draw function is empty, which is what confused me.
http://code.compartmental.net/minim/audioplayer_method_play.html
http://code.compartmental.net/minim/audioplayer_method_loop.html
http://stackoverflow.com/questions/17556228/how-to-play-only-one-audio-file-at-a-time-in-minim
http://stackoverflow.com/questions/34711022/processing-minim-audio-player-player-not-stopping-inside-if-statement
that last one has an empty draw() yes, but it's there. this might be necessary to get the code looping, which is necessary to get mousePressed working.
Okay, so I added a draw function, but it's still not working at all either.
does my example work for you?
Yes! I looked at it! I was able to get sound to work thank you!