How to mute game sounds (not songs)

From the Asset Store
five golem elements Sprites Sheet.Best for enemy or villain game characters.
  • In this topic here, the same was asked, but it was not answered. I have the same problem. I created an options menu and one of the options when clicked mutes the game sounds, but I'm not able to implement that. I've already tested set muted, set paused, set volume, stop, etc. Only the silent set works, but then it silences all the sound of the game including the songs. I created a variable that turns the sound on or off, but you can still hear little bits of it while others are really muted. How can I actually implement what I see in many games?

    Remember that when I do the same scheme for the game music it works, but not for the sounds. And remembering that I'm using the sound tags.

    Tagged:

  • A slightly complicated but successful method is to use arrays and functions to call the sounds/songs instead of using the standard audio expressions.

    This way you can control all sounds and music separately, and get rid of that awful clicking sounds that can still be heard when all audio should be muted. I can recommend checking out Advanced Menu in the Scirra Store - this includes a very effective menu select, settings like audio and language select, and achievements/trophies.

    If you purely just wanted audio, create an array that can toggle between 2 values on sound on/off button. Then use a similar code like this as the function that will be called.

    + Function: On "PlaySound" + AOption: Value at 2 = "on" -> Audio: Play Function.Param(0) not looping from Sounds at int(AOption.At(3)) dB (tag "")

    Then, to call the sound, ie a menu click or a bullet firing, instead of using -> Audio: Play bang_01.webm not looping at volume 0 dB (tag "") use the call function like this

    -> Function: Call "PlaySound" ("bang_01")

  • The method I normally use is to put play sound actions into a sub event that checks if a mute sound variable is true or not before running.

  • A slightly complicated but successful method is to use arrays and functions to call the sounds/songs instead of using the standard audio expressions.

    This way you can control all sounds and music separately, and get rid of that awful clicking sounds that can still be heard when all audio should be muted. I can recommend checking out Advanced Menu in the Scirra Store - this includes a very effective menu select, settings like audio and language select, and achievements/trophies.

    If you purely just wanted audio, create an array that can toggle between 2 values on sound on/off button. Then use a similar code like this as the function that will be called.

    + Function: On "PlaySound" + AOption: Value at 2 = "on" -> Audio: Play Function.Param(0) not looping from Sounds at int(AOption.At(3)) dB (tag "")

    Then, to call the sound, ie a menu click or a bullet firing, instead of using -> Audio: Play bang_01.webm not looping at volume 0 dB (tag "") use the call function like this

    -> Function: Call "PlaySound" ("bang_01")

    I confess that this method is too advanced for me as a beginner, but thanks for that answer.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The method I normally use is to put play sound actions into a sub event that checks if a mute sound variable is true or not before running.

    Thanks for the answers. The way a friend of mine showed me solved the problem. It would be to create a variable for SFXvol and another for MusicVol and instead of the volume of sounds put this variable. When you want to mute just set the variable to -100 and when you want volume I'm using -15. The values can vary tb. I just got it that way.

  • lincolnsalles That is the basic method for doing volume control but the method that oosyrag posted also provides a performance improvement from not actually playing the sound if your SFX volume is muted.

    To visualise this method you would create a global boolean variable called 'mute_SFX' and a global variable called 'volume_SFX'.

    Event example:

    On Object Clicked - Do actions

    Sub Event: (inverted)is Boolean mute_SFX - Play sound at volume_SFX

  • Thank you for your help

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)