amplitude control

Click resulting from amplitude change

The amplitude of a sound is controlled by multiplying the sound wave by a certain factor. A multiplier of 1 represents "unity gain", meaning no change. Multiplying by a factor between 0 and 1 reduces the amplitude of the sound. However, if the multiplier is changed very suddenly and significantly, it may create a sudden discontinuity in the waveform which will be heard as a high-frequency click. 

Simple amplitude control

When you're changing the amplitude of a sound, if the amplitude is changed very suddenly and significantly, it may create a sudden discontinuity in the waveform which will be heard as a high-frequency click. (That phenomenon is demonstrated in the example "Click resulting from amplitude change".) To avoid that problem, it's necessary to interpolate sample-by-sample from the old amplitude value to the new value, over some small period of time, to create a slightly more gentle fade to the new amplitude factor.

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.

A useful subpatch for mixing and balancing two sounds

To mix two sounds together equally, you just add them together. If you know that both sounds will frequently be at or near full amplitude (peak amplitude at or near 1) then you probably want to multiply each sound by 0.5 after you add them together, to avoid clipping. However, if you want to mix two sounds unequally, with one sound having a higher gain than the other, a good way to accomplish that is to give one sound a gain between 0 and 1 and give the other sound a gain that's equal to 1 minus that amount.