The underlying process to control the amplitude of a signal is a linear gain change. This process involves multiplying the value of each sample in a signal by a number relative to a linear scale.

If the value of each sample is multiplied by a number less than 1, then the amplitude of the signal will be reduced. If the number is greater than 1, then the amplitude will be increased. If the number is 1, then the amplitude is unchanged. Audio engineers use the term, unity gain, to refer to a process where the amplitude is unchanged. A block diagram representing the general processing is shown here:

When we write computer code to perform a linear gain change, it is necessary to process the individual samples of a signal. One way to do this is to use a loop to index the individual elements of an array. As we access each sample, we can multiply by the desired scaling factor to change the gain.

There are many processes in audio which involve changing a signal on a sample-by-sample basis. This type of processing is called: element-wise processing.

The Matlab programming language allows for an alternative method to write a command to perform an element-wise, linear gain change. This method uses array multiplication, rather than explicitly writing a loop. By multiplying an array by a single number (called a scalar), Matlab will interpret the multiplication operator as element-wise multiplication. This operation will accomplish an identical process as the loop to index each individual element.

Audio engineers do not always think about amplitude in terms of a linear gain change. Sometimes it is more common to consider changing amplitude relative to a decibel scale, or normalize amplitude based on peak/RMS values. However, these processes are still converted to a linear gain change when actually applied to a signal.

One notable type of linear gain change can be used to perform polarity inversion. Then, let’s explore using the addition operator to perform a DC Offset