Logarithmic Fades, Linearly Speaking

I had a very frustrating conversation the other day about a fade out on a song. I thought it sounded too fast. To me, it sounded very linear. I was trying to explain it should be a logarithmic fade out. Sarcastically, I was told I should teach a class on the subject if I flippin’ knew so much. So fuck it, class is in session. When speaking about audio, what does one mean when using the terms “linear” and “logarithmic?”

Nothing draws readers in like math!

For a linear fade out, a linear equation of the dB decrease could be shown simply as y=e*x+dB, where e is a negative number. That’s a straight line heading downward. When speaking about “logarithms” in audio applications, though, it’s actually describing several things: exponential and logarithmic curves, and their reverse functions. For a “logarithmic” fade out, the function would be y=ex*dB, where e is a number between 0 and 1; that is an exponential function showing decay. For fade ups, the function can be reversed to y=ex/dB to show an exponential increase in volume. Fucking confused, yet? YES!*

Your ear hears in a logarithmic way. When perceiving pitch, it hears an A note at 220Hz. It hears A again an octave up at 440Hz. Then it hears A again at 880Hz. The frequency A is heard at will rise exponentially every time, creating a curve. It’s not a straight line, but your ear doesn’t hear the numbers, it hears a straight line from each octave as it passes over 12 semitones. Similarly, ears want the same thing from volume. So, a straight linear fade will perversely sound like an exponentially increasing fade to your ear.

Though these are nice straight lines on this fade, it seem to drastically taper up at the beginning of the fade in and drastically taper down towards the end of the fade out. What we need to do to smooth things out is create a logarithmic fade.

The quieter part of the fades are extended. Our perception of a smooth transition from silence to noise and back again is aided by a mathematical curve. Did you think algebra didn’t affect you all the God-damn time? Think about it every time you turn a volume knob, because algebra is fucking with your head… in a good way.

Type A potentiometers used strictly for volume have a logarithmic taper, as can be seen by the measurements. That’s to adjust for your stupid faulty ears that can’t hear those minute changes in the quieter audio spectrum. Stupid, stupid ears. If you used type B linear pots for volume knobs, the decay would sound uneven.

So, I hear no one ask, “what about crossfades?” Cross fading is the technique of taking one segment of audio and blending it over another. DJs do it to keep the beat going between songs. Audio engineers do it to hide the fucking mistakes the guitar player made while doing a solo. The latter case is more relevant here.

To do a crossfade, one should use the opposite technique for a smooth fadeout, basically reversing the curve. We want the tracks to exponentially fade out and then back in so quickly the listener never hears the transition. A linear transition isn’t quick enough. The listener would hear where the tracks join. We use a logarithmic transition that utilizes the ear’s stupid sense and plays double foolies on it.


The listener can’t really hear the audio drop at the exact point where the tracks transition, because it’s a stupid fucking logarithmic ear. The fade in and fade out of the joined tracks is so drastic they appear and disappear without any audible click-in point. Voilá, your noodle-headed guitar player just totally nailed that solo.

Class dismissed.

* I have no clue if my math is totally correct here… just bear with me and make your fades curve, for fuck’s sake. EDIT Feb. 11: Commenter Sam does a great job cleaning up my functions in his comment linked here

3 thoughts on “Logarithmic Fades, Linearly Speaking

  1. Hey Ross – great post! Here's the bit of math you're missing:

    First, let's use "a" instead of "e" for the linear equation, as "e" is typically reserved for the natural number e which is approximately 2.718…That number appears a lot in calculations like these, so best to leave it alone. For linear decay, we have:

    y1 = -ax + b

    where a is the rate of decay (already negative) and b is the starting volume (in dB; again better to use a single variable "b" instead of "dB" which is a unit of measure, as you know). "a" here represents the slope of the line which is crucial in algebra. It's linear, so "a" constant rate (pun intended).

    With an exponential decay equation (which is also logarithmic, inversely), we have:

    y2 = b*c^x

    Here we're using "c" as the exponential/logarithmic rate of decay, with the qualification that 0 < c < 1, and "b" as the initial value/volume (in dB).

    From there, the math drops into place pretty easy with some basic calculation, and the volume change becomes evident. Letting a = 2 (linear decay rate) and c = 0.2 (exp. decay rate), b = 100 (starting volume, in dB), along with y as volume (in dB) and x as time (in sec), we have:

    y1 = 100
    y2 = 100

    y1 = 98
    y2 = 20

    y1 = 96
    y2 = 4

    In all likelihood, especially for crossfades, I'm guessing x would be in milliseconds (or ticks? beats?), but it's easy to see how "slow" the linear fade is, while how quickly the logarithmic fade cuts down/out. Adjusting "c" of course, will increase or slow that fade-out. Good stuff! Math is metal!

    1. Thanks for the great clean-up on my functions! It's been awhile since I've had to refresh myself on algebra, it's good to know I didn't totally blow it.

    2. I had a question is there a particular formula for calculating (c) rate of decay that gives a similar (y) result as the starting volume (b) decreases.

      I just trying to figure out the formula for calculating rate of decay vs start volume.

      Hopefully that makes sense.

Leave a Reply

Your email address will not be published.