setting up music/SFX volume controls

0 favourites
  • 5 posts
From the Asset Store
8 Loopable Tracks, and 90 SFX. Perfect for Metroidvania, Platformer, or Adventure games.
  • im trying to set up volume controls in my game, but because the engine uses decibles im having trouble making it a smooth volume gradient.

    eg. i would like it so volume set at 0 is mute, 50% is half of full volume, and 100% is maximum.

    i think decibles are logarithmic or something? so it needs some other approach to have normal volume controls?

    can anyone help with this?

  • Yeah, you can use this formula:

    Audio Set volume to log10(volumePercentage/100)*20

    Where volumePercentage is a value between 0 and 100

  • that works perfectly! thanks very much!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah, you can use this formula:

    Audio Set volume to log10(volumePercentage/100)*20

    Where volumePercentage is a value between 0 and 100

    Hey thanks agains for your help!

    ive run into another problem i was wondering if you could help me with.

    some of my music tracks & SFX files are too loud, so in the past i had just played them at -5 or -10dcb to try and balance them within construct rather than having to edit all the original audio files.

    the problem with playing a file at (log10(volumePercentage/100)*20)-10

    is that the additional -10 to balance my sounds is not logrythmic, so it tends to become muted before other sounds when adjusting.

    not sure if that makes sense. im basically looking for a way to adjust any given sound of mine so it plays at slightly less max volume, that will still logrythmically scale down to 0 volume(or -30dcb) when volume is brought down.

    thanks heaps again!

  • If you want to reduce volume for a particular sound, say by 30%, you can do this:

    (log10(volumePercentage*0.7/100)*20)

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