How do I make the music stop?

I have been having some trouble getting music to go on and go off. To make music play, I do:

The only thing is, How do I make it stop? I do not know what channel identifiers are and that’s what they are asking for! Can I get some help?

1 Like

First you need to use Play Music not Play Sound
Then with some global variable or scene variable check if is on|off
like my_var_music = 0 is off
my_var_music = 1 is on


Plus there is an example here
https://editor.gdevelop-app.com/?project=example://toggle-music-play-sound

2 Likes

Just to clarify some items here:

  1. Play music and play sound can both be used for music files.
  2. As far as I know, AAC file support is very minimal, so you could run into issues using that file type other than a .wav, .mp3, or .ogg audio file.
  3. Sound channels are just a number you define. There are infinite channels and you can assign as many as you want. They are important because without using channels you will stop all sounds/music being played.
  4. By using the “play music/sound on a channel” actions, you can also use the “Stop the sound/music of a channel” to stop that channel’s sound or music.
2 Likes

Hello experts.

I want to learn the same thing about this sound system.

Actually, I have set up a button that will pause the game. I also have a background sound attached that will play on a loop throughout the scene. How, can I stop the music when the pause button is pressed and continue playing the music when the pause button is pressed again? I cannot figure out the conditions and events for this. Please help me sort this thing out.