Been adding background music to my game and I’m trying to make the music fade in when the scene starts. Somehow even though the action: play the music file on channel1, vol: 0, is set. I can still hear for a split second, the music starting on full volume before it is set to vol:0.
Does someone know how i can get the volume to start on vol:0 before the music plays?
This was an issue for the sound action Play Sound: Sound file is playing before volume is being applied. · Issue #2579 · 4ian/GDevelop · GitHub and it was fixed. The same fix may need to be applied here as well.
A work around could be something we used in our project, set the global volume to 0 on the previous scene, then a couple of frames in into the new scene (after the music loop has started) set it back to 100.
Try play sound rather than play music -it appears play music is a little buggy.
Scratch that - @Eiklahc has given the reason, and my suggestion makes no difference.
Thanks for replying. Will try out what Eiklahc suggested
(Edit: Updated with info for 2023 since people are finding this old post)
Play sound events should be utilized whenever you need to have perfect looping. Play music should be used if you’re streaming the audio from an external source or are in very memory limited situations. Both events use different types of buffering.
Thanks for all suggestions
If i remember correctly i startet to use the music option instead of the sound option, because i had some trouble when i used the sound option for the background music and i wanted it to loop (somehow it stopped after a while)
But since then, i have changed the background music and the new file/music is about 1 minute in lenght (not sure if that has something to do with it since the first sound file was a couple of minutes in lenght).
Will try with the sound option and see if that solves it
Be aware, if you are planning to port to iOS that the “Music” methods don’t work in conjunction with volume controls:
I had no problem with looping BG music using the “Sound” methods in GDevelop BTW
Using the sound option instead of the music option did the trick
Fading music is now working as it should.
Used also UlisesFreitas advice for the set up.
Thanks for great help guys!