### Convolution

The *convolution* of two signals and in may be
denoted ``
'' and defined by

*circular convolution*(or ``cyclic'' convolution).

^{7.4}The importance of convolution in

*linear systems theory*is discussed in §8.3.

Cyclic convolution can be expressed in terms of previously defined operators as

*graphical convolution*, discussed below in §7.2.4.

#### Commutativity of Convolution

Convolution (cyclic or acyclic) is *commutative*, *i.e.*,

*Proof: *

In the first step we made the change of summation variable , and in the second step, we made use of the fact that any sum over all terms is equivalent to a sum from 0 to .

#### Convolution as a Filtering Operation

In a convolution of two signals
, where both and
are signals of length (real or complex), we may interpret either
or as a *filter* that operates on the other signal
which is in turn interpreted as the filter's ``input signal''.^{7.5} Let
denote a length signal that is interpreted
as a filter. Then given any input signal
, the filter output
signal
may be defined as the *cyclic convolution* of
and :

*impulse-train-response*of the associated filter at time . Specifically, the impulse-train response is the response of the filter to the

*impulse-train signal*, which, by periodic extension, is equal to

*period*of the impulse-train in samples--there is an ``impulse'' (a `') every samples. Neglecting the assumed periodic extension of all signals in , we may refer to more simply as the

*impulse signal*, and as the

*impulse response*(as opposed to impulse-

*train*response). In contrast, for the DTFT (§B.1), in which the discrete-time axis is infinitely long, the impulse signal is defined as

As discussed below (§7.2.7), one may embed *acyclic*
convolution within a larger cyclic convolution. In this way,
real-world systems may be simulated using fast DFT convolutions (see
Appendix A for more on fast convolution algorithms).

Note that only linear, time-invariant (LTI) filters can be completely represented by their impulse response (the filter output in response to an impulse at time 0). The convolution representation of LTI digital filters is fully discussed in Book II [68] of the music signal processing book series (in which this is Book I).

#### Convolution Example 1: Smoothing a Rectangular Pulse

Filter
input signal .
Filter impulse response .
Filter output signal . |

Figure 7.3 illustrates convolution of

as graphed in Fig.7.3(c). In this case, can be viewed as a ``moving three-point average'' filter. Note how the corners of the rectangular pulse are ``smoothed'' by the three-point filter. Also note that the pulse is smeared to the ``right'' (forward in time) because the filter impulse response starts at time zero. Such a filter is said to be

*causal*(see [68] for details). By shifting the impulse response left one sample to get

#### Convolution Example 2: ADSR Envelope

Filter impulse response .
Filter output signal . |

In this example, the input signal is a sequence of two
rectangular pulses, creating a piecewise constant function, depicted
in Fig.7.4(a). The filter impulse response, shown in
Fig.7.4(b), is a truncated exponential.^{7.6}

In this example, is again a causal smoothing-filter impulse
response, and we could call it a ``moving weighted average'', in which
the weighting is exponential into the past. The discontinuous steps
in the input become exponential ``asymptotes'' in the output which are
approached exponentially. The overall appearance of the output signal
resembles what is called an *attack, decay, release, and sustain
envelope*, or *ADSR envelope* for short. In a practical ADSR
envelope, the time-constants for attack, decay, and release may be set
independently. In this example, there is only one time constant, that
of . The two constant levels in the input signal may be called the
*attack level* and the *sustain level*, respectively. Thus,
the envelope approaches the attack level at the attack rate (where the
``rate'' may be defined as the reciprocal of the time constant), it
next approaches the sustain level at the ``decay rate'', and finally,
it approaches zero at the ``release rate''. These envelope parameters
are commonly used in analog synthesizers and their digital
descendants, so-called *virtual analog* synthesizers. Such an
ADSR envelope is typically used to multiply the output of a waveform
oscillator such as a sawtooth or pulse-train oscillator. For more on
virtual analog synthesis, see, for example,
[78,77].

#### Convolution Example 3: Matched Filtering

Figure 7.5 illustrates convolution of

to get

For example, could be a ``rectangularly windowed signal, zero-padded by a factor of 2,'' where the signal happened to be dc (all s). For the convolution, we need

*matched filter*for .

^{7.7}In this case, is matched to look for a ``dc component,'' and also zero-padded by a factor of . The zero-padding serves to simulate acyclic convolution using circular convolution. Note from Eq.(7.3) that the maximum is obtained in the convolution output at time 0. This peak (the largest possible if all input signals are limited to in magnitude), indicates the matched filter has ``found'' the dc signal starting at time 0. This peak would persist in the presence of some amount of noise and/or interference from other signals. Thus, matched filtering is useful for detecting known signals in the presence of noise and/or interference [34].

#### Graphical Convolution

As mentioned above, cyclic convolution can be written as

*graphically*, as depicted in Fig.7.5 above. The convolution result at time is the inner product of and , or . For the next time instant, , we shift one sample to the right and repeat the inner product operation to obtain , and so on. To capture the cyclic nature of the convolution, and can be imagined plotted on a

*cylinder*. Thus, Fig.7.5 shows the cylinder after being ``cut'' along the vertical line between and and ``unrolled'' to lay flat.

#### Polynomial Multiplication

Note that when you multiply two polynomials together, their
coefficients are *convolved*. To see this, let denote the
th-order polynomial

Denoting by

where and are doubly infinite sequences, defined as zero for and , respectively.

#### Multiplication of Decimal Numbers

Since decimal numbers are implicitly just polynomials in the powers of 10,
*e.g.*,

*multiplying two numbers convolves their digits*. The only twist is that, unlike normal polynomial multiplication, we have

*carries*. That is, when a convolution result (output digit) exceeds 10, we subtract 10 from the result and add 1 to the digit in the next higher place.

**Next Section:**

Correlation

**Previous Section:**

Shift Operator