How do I increase volume in game?

0 favourites
  • 3 posts
From the Asset Store
10 different explosions rendered as transparent PNG.
  • I'm just curious, I'm using the following formula to play SFX and music in my game:

    20 * log10(SoundVolume * 10 / 100)

    SoundVolume is a global variable that the player can set from 0 (mute) to 10 (full volume).

    I have tons of sfx in my game, and every once in a while I decide one might be too soft or too loud. Without having to adjust that in my other application and re-export, is there a quick fix that I can add to the formula that can say "make this sfx 20% louder, but still stay within the confines of the formula"?

  • Have you tried simply multiplying SoundVolume by 1.2?

    SoundVolume changes linearly, so 20% increase would be SoundVolume*1.2

    You might want to add clamp() or min() to limit max volume.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • dop2000 - I thought of that, but in theory, if you did that wouldn't the volume still play through if the volume were at 0? (as I'm typing this I think you're right because anything * 0 should turn it off)

    I will give it a shot - thank you!!

    UPDATE - Perfect; thank you again!

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