Mute/unmute selective

Hi guys, a question about soundtrack and mute button. I’m creating a children’s game book in gdevelop. The configuration is as follows:

  • The “opening/menu scene” with a song (here is the mute/unmute button)
  • The subsequent story scenes, with another song.
  • And the narration

Question 1- how to make the mute/unmute button work for all scenes? I turn it on/off in scene 1 and it keeps working in other scenes

Question 2 - How to make the mute/unmute button turn off only the music and sound effects and not the narration?

The book has over 30 scenes. But understanding this logic above is already a good start.

Hi fernandesbeckman, wow, your art is beautiful. Hope it all goes well for you.

I can give some general advice that might help you find the answers.

For question 1, have a look at global objects. If you right click the mute button in the objects panel, there is an option to set it as a global object. You can then reference this object in all your scenes. If your events for the button use variables, then you could change it so that the button object has an object variable.

For question 2, once again, I have ideas, not answers, but you could try putting the sound effects and music in a group. And set the mute button to mute that group.

Edit: I reread your post. If you just want to mute the audio, the below would still apply except you would switch between zero and either 100 or a volume setting.

Edit: the more complicated but more efficient way would be to use booleans like playMusic and playNarration and check their value as a condition to prevent the sound or music from playing at all. You could just switch or toggle the vaue between true and false.

Condition: Boolean PlayMusic =true
Action: play music

Original repy:
Beautiful drawing. If you play the sound or music with the sound on channels you can set the volume of the individual channels. I’ve read that not all browsers work right with the music actions. It’s the browser not Gdevelop. So, I would play both the music and the narration as sound. You could play the music on channel 1 and the narration on channel 2.

To change the volume, you can use 2 Global variables. One variable for the volume of the music and one for narration. You can then use the “volume of sound on channel #” to change the volume of the matching channels. Now, just changing the volume isn’t enough. By default, sound is played at 100. You would have to put the GlobalVariable(VariableName) into the volume parameter of all of the play actions. Otherwise, any new sound would play at 100.

Here’s an example using 2 slider objects and buttons to play music and a clip.

Try it online: