We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, first time posting here. Im extremely new to coding in general, but Im in a class that uses Processing. So I need help in THE most simplest terms imaginable lol. I have an assignment to make a very simple video game. The only problem Im having is that the background music I have set up to play continually starts to play another file of the mp3 ontop of the original. The end result being the song playing over itself hundreds of times, just milliseconds apart from each other. I set up an if statement to turn the bgm to false as soon as it starts to play, which solves the multiple songs playing at once, but when the song is over I cannot get it to loop. I need the song to just immediately play again as soon as it ends. What is the simplest way to achieve this?
Answers
Sounds like you are playing the sound in draw(). which means a new copy every loop.
you should start it ONCE (maybe i setup()) and then restart it when it finishes.
which version of processing are you using (there are 3)? which sound library (there are 2)?
https://processing.org/reference/libraries/sound/SoundFile_loop_.html
^ an example for SoundFile library in processing3
Im using Processing 3, and just using the Processing sound library, not minim.
I figured it might have had something to do with being inside of draw() but when I put it inside of setup() (just as that example has it) it comes up with the error NullPointerException.
we need to see code