Getting music to play during game
tjjunior21
Member, PRO Posts: 50
I've created a wav file and wanted the music to play during the game. I tried setting it up in the initial scene that when touch is pressed it's supposed to play the sound. In the preview it's not playing though. Should I have the loop checked or run to completion? Or is there a better way to get the music to play while the game is on?
Thanks!
Comments
If you want the song to repeat itself after it has finished, then check the loop box. "Run to completion" means that no matter what, that file will play to completion. Even if you change scenes, that file will continue to play until it's finished. Use that option with care.
If the sound won't play when you click the button to make it play, check to see that the file is working correctly by just dropping a "play music" behavior in a blank actor without any rules, and select the file you want to play, drop that actor on the stage, and check the preview again to see if it does in fact play. If it does play this way, then it's something with your rules you have set up for the play button. If it doesn't play, then it could be the compression on the file. I believe the Windows version of GS is supposed to play .wav natively and not compress it into an .m4a, but I could be wrong. I don't use the Windows version, personally. In case it does convert it into an .m4a, you may want to make sure your computer has the codec for playing .m4a files.
Thanks for the reply but it still doesn't work. The original music or sound was 6 minutes long. I cut it down to about 3 minutes. GS allowed me to upload it as a wav file. When I look in my library the audio is there but it has some weird .ogg attached to it.
If I click on it and drag it onto my character or button it says to play sound attribute. I click on the audio and loop with a volume of 1. Still it doesn't play. I tried play music but the drop down menu doesn't list the audio. Is there something else I can try or is there something I'm doing wrong?
Thanks!
Remove it from your game and re add it under a different file name. And instead of sound, add it as music. This way you can use it with the play music behavior.
If that doesn't work then change it to a mp3 or m4a and try again.
Fortuna Infortuna Forti Una
Now I've tried creating a sound character and put that on the screen, used the attribute when touch is pressed to play sound. Nothing happens. Is there something I can trouble shoot. I'm assuming this is why it wasn't playing with the character. Should I shorted the size of the sound file? 30 sec?