decibel

Amplitude and decibels

A linear fade-in or fade-out of audio is okay for quick changes that take place in a fraction of a second, but for slower fades one should generally take into account that our subjective sense of loudness more closely conforms to an exponential change in amplitude. This patch allows you to use the slider (or the mod wheel from a MIDI controller) to control the amplitude of white noise in one of three different ways: with straight linear mapping, exponentially (with an exponent of 4), or using a range of 60 decibels.

Test interaural intensity difference

One of the ways we determine where a sound is located is by comparing the sound's intensity in our two ears. A sound that is located to one side of us goes more directly into the ear that's on that side, whereas the sound has to diffract around our head to get to the other ear, so the intensity is usually greater on the side where the sound is located. That distinction is known as interaural intensity difference (IID).

Amplitude control in decibels

This patch is an abstraction for supplying an amplitude factor to control the level of an audio signal. The output of this abstraction is intended to go to a *~ object to scale the volume of a sound. The amplitude factor is expressed in decibels, which is generally a more intuitive way to refer to the volume of a sound. The abstraction fades to the new amplitude in a specified amount of time. Perceptually, a linear fade in decibels (which yields an exponential fade in amplitude) sounds smoother than a linear fade in amplitude.

Audio amplitude control

As explained in MSP Tutorial 2, in order to avoid creating clicks in audio when you change the amplitude, you need to interpolate smoothly from one gain value to another. Example A in this patch shows how to use the line~ object to do that. The gain value from the number box is combined with a transition time in the pack object (10 ms in this case) and the two numbers are sent as a list to line~.