Why use db for unit of audio volume?

Discussion and feedback on Construct 2

Post » Mon Mar 10, 2014 2:31 pm

dB is a much more sensible unit of audio volume than linear scale, because audio volume is perceived with a logarithmic scale. Halving the linear volume of audio results in a drop of 6 dB, and will be perceived as just slightly quieter, not half as loud. "Half as loud" usually corresponds to about -10 dB attenuation. So if you want all your SFX at -5 dB so the music is louder, then you want another sound effect to be "half as loud", you go for -15 dB. To keep dropping the perceived volume by the same amount you'd keep going to -25 dB, -35 dB, etc. Using a linear scale you play all your SFX at about 0.562, then if you want half as loud as that, you drop it down to 0.178. Then stepping down by the same perceived amount you'd go 0.056, 0.018... Not particularly intuitive!
Scirra Founder
B
397
S
236
G
88
Posts: 24,422
Reputation: 194,553

Post » Mon Mar 10, 2014 3:05 pm

@Ashley

Thanks for this illustration, so if I want to linear fade-out, it would be better using linear interpolation with db unit?
B
108
S
26
G
271
Posts: 4,471
Reputation: 151,777

Post » Mon Mar 10, 2014 3:15 pm

Yes, absolutely. That's probably a better example: if you lerp a linear volume from 1 to 0, it will start off hardly getting quieter at all, then will appear to abruptly go silent. (In my previous example see how the last three levels are all under 0.2.) On the other hand if you lerp the dB from say 0 to -60 dB, you will get a smooth fade-out.
Scirra Founder
B
397
S
236
G
88
Posts: 24,422
Reputation: 194,553

Post » Mon Mar 10, 2014 4:14 pm

Here's a couple of formulas for converting between dB and Amplitude (0-1 scale):

Amp to dB: pow(10, dB Level/20)
DB to Amp: 20 * log10(Amp Level)

As mentioned, amplitude is not linear. (1 = 0dBFS, 0.5 = -6dBFS, 0.25 = -12dBFS, 0.125 = -18dBFS, etc..)

I've been an audio engineer for the past 8 years and a VST developer for about 4 years so this comes in handy for me. If anyone wants to play around with the values rather than plot them on a graph or whatever, here's a nice converter that helped me out when I was learning: http://www.plugindeveloper.com/05/decib ... tor-online

:)
B
16
S
2
G
4
Posts: 42
Reputation: 2,642

Post » Mon Mar 10, 2014 4:47 pm

@rexrainbow
I'm only going by my experience with one audio engineer. Whom had taken his classes from Vancouver Film school and was using Sound Forge. I my self only use Audacity as it is free. However I talked with our engineering about why db are used; the reasoning went over my head. We did however include the talk why not simpler means. The only aspect I understood is that the frequency translational levels when effected by Gain or other effects are usually not linear. Sound is a frequency and pitch and the linear scope doesn't apparently work well in audio engineering.

Again I am not the expert however if the rest of professional industry are being tought DB then it behooves us not to break the convention for the purpose of communication.

I'm not arguing that there isn't a mathematical model to use linear change in Gain, but I suspect that reducing a frequency by 50% isn't 50% of Normalized.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,028

Post » Mon Mar 10, 2014 5:00 pm

@jayderyu

Thank you, and thank @Ashley .
BTW, it might be useful to have some documents about how to use db directly (for example, fade-in sound), or concept about linear number and db in audio manual chapter.
B
108
S
26
G
271
Posts: 4,471
Reputation: 151,777

Post » Mon Mar 10, 2014 5:19 pm

I calculate a function about volume and db :
If db 0 = original volume, -10 is half, 10 is double ( but max is 0), then :

Volume = 2 ^ ( db / 10 )
db = 10 * log( Volume ) / log( 2 )

Range of value:
0 <= Volume <= 1;
1 = original volume, 0 = silence.
-Infinity ( or -60 for human ear ) <= db <= 0 ;
0 = original volume, -Infinity or -60 = silence.

And I made a little sample capx about fade in/out.

Here is Sample : https://dl.dropboxusercontent.com/u/507 ... index.html
And capx : https://drive.google.com/file/d/0BzBB_g ... sp=sharing

not sure is it correct, but sounds good to me.
If you cannot hear the sound please wait a second or refresh. :D
Thanks.
B
17
S
3
G
1
Posts: 19
Reputation: 2,402

Post » Fri May 30, 2014 4:23 am

Can't we just have a simple begin Fade-Out type behaviors as we do for Sprites but for Audio as well?
B
34
S
5
G
1
Posts: 78
Reputation: 3,397

Post » Fri May 30, 2014 4:28 am

@EddyDingDongs

I had made a plugin to fade-in/fade-out using lerp db.
Try this
B
108
S
26
G
271
Posts: 4,471
Reputation: 151,777

Post » Sat May 31, 2014 11:27 am

rexrainbow wrote:@EddyDingDongs

I had made a plugin to fade-in/fade-out using lerp db.
Try this



Thanks rex, will try it!!
B
34
S
5
G
1
Posts: 78
Reputation: 3,397

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: boybacteria, higher2003, MadSpy, TheRealDannyyy, Yahoo [Bot] and 15 guests

cron