- Home /
What is the exact equation being used for sound volume?
I'm porting a project from another engine, and I'm trying to make the audio mix match. The other engine applies the volume adjustment using this equation:
private int volumeAdjust(int sample, float volume) {
float db1 = (float) (1 / MathUtils.rangeFraction(Math.pow(10, volume), 1, 10));
int dbInv = (int) Math.round(VOLUME_RESOLUTION * db1);
return (sample) / dbInv;
}
This is a bit simplified from the actual code, but it illustrates that at this point, we are applying the volume directly to the samples, and we have the equation we want to use for this. To emulate exactly the same volume response in Unity, I would need to know what equation Unity uses for this.
Your answer
Follow this Question
Related Questions
How to get decibel's value of game's sound? 0 Answers
How do I only start the audio when player is at max distance 1 Answer
Audio from new scene begins half way through loading. 2 Answers
Audio not playing well on AudioListener move 1 Answer
Audio: -3db automatic attenuation on any audio playing? 0 Answers