AUDIO INTELLIGENCE · CONVOLUTION LAB
\(x\) — input \(h\) — kernel / impulse response \(y\) — output
One Operation, Four Ways of Seeing It

Convolution, animated.

Slide one function under another, multiply where they overlap, add it all up — and you've just modeled how a system responds to an input, blurred an image, smoothed a time series, and run one layer of a convolutional network. This page walks through all four, with the animation running the whole time.

a pulse \(x(\tau)\), sliding past a decaying impulse response \(h(t-\tau)\) — looping continuously below
Reading these panels: \(x\) = input, \(h\) = kernel / impulse response, \(y\) = output ▶ Play animates it · drag the slider to scrub by hand · faded bars = not reached yet
01Sampling & the Sum

A continuous signal is, in the limit, a train of impulses.

Every real measurement — a voltage, a sound wave, a sensor reading — starts out continuous. A computer can't store a continuous function, so the first move in any signal-processing pipeline is always the same: chop it into samples spaced \(\Delta t\) apart. Watch what that actually does to the curve.

Shrink \(\Delta t\) and the blocks become impulses
\(N =\) 8, \(\Delta t =\) 0.750
true signal \(x(t)\) & its \(N\)-sample approximation, width \(\Delta t\)
Why it matters: each block has width \(\Delta t = 6/N\) and height \(x(t_i)\) — a little rectangle of area \(x(t_i)\cdot\Delta t\). Slide \(N\) up and the blocks visibly hug the curve tighter. Push \(N\) further and each block becomes a sliver so thin it stops being a rectangle at all — it becomes a weighted impulse sitting at \(t_i\) with area \(x(t_i)\cdot\Delta t\). A sampled signal, in other words, isn't an approximation of a train of impulses — in the limit \(\Delta t \to 0\), it is one. That's the exact object §02 needs to predict a system's output.

Sample too coarsely (drag \(N\) down toward 4) and the blocks miss what the curve does between samples — the oscillation itself can vanish. Exactly how finely you need to sample to avoid that is its own question (the sampling theorem), covered in full in Notebook 5. Here we only need the picture: sampling turns a function into a sequence, and sequences are exactly what the sum below operates on.

Two units of measure for the same operation

Continuous convolution replaces a sum with an integral. Discrete convolution replaces the integral with a sum over samples. On a computer they're the same computation — the "continuous" plot below is just the discrete sum evaluated at a much finer step size, exactly like shrinking \(\Delta t\) above.

$$\text{continuous:}\quad (x * h)(t) = \int x(\tau)\, h(t-\tau)\, d\tau$$ $$\text{discrete:}\quad y[n] = \sum_{k} x[k]\, h[n-k]$$
Fine-grained sum \(\approx\) continuous integral
\(t =\) 0.00
\(x(\tau)\) & \(h(t-\tau)\) flipped & shifted — shaded = the product being integrated
\(y(t) \approx \Delta t \cdot \sum x(\tau)\, h(t-\tau)\) — accumulated so far
Reading it: a rectangular pulse \(x(\tau)\) (an idealized short input) meets a decaying-exponential impulse response \(h(\tau)\) (an idealized leaky system, like an RC circuit). As \(t\) sweeps, \(h\) flips in time, slides across \(x\), and the shaded overlap — multiplied and summed, then weighted by \(\Delta t\) — traces out the "charge, then discharge" curve \(y(t)\) below. That \(\Delta t\) weighting is exactly the sampling picture above, applied at every point of the sweep.
Six samples, three-tap kernel — step by step
\(n =\) 0
\(x[k]\) & \(h[n-k]\) flipped & shifted
\(y[n] = \sum_{k} x[k]\, h[n-k]\)
Same mechanism, coarser grid: \(x = [1, 3, 2, 0, 4, 1]\) is a short measured sequence; \(h = [1, 0.6, 0.3]\) is a 3-sample decaying response. Every output sample \(y[n]\) is still "flip \(h\), slide it to position \(n\), multiply, add" — just with six dots instead of a curve.
02Impulse Response & LTI Systems

Why convolution predicts a system's output at all.

You just watched a continuous signal get chopped into impulses in §01. Here's the payoff: under one specific assumption about the system, that same decomposition is exactly what you need to predict what the system does to any input, once you know how it reacts to a single sharp poke.

The assumption: linear & time-invariant (LTI)

  • Linear: scale the input, the output scales the same way; add two inputs, the outputs add. No saturation, no cross-terms.
  • Time-invariant: the system doesn't change its behavior over time — poke it now or poke it later, you get the same response, just shifted.

Neither is exactly true of any real system, but an RC filter, a room's acoustics, or a camera lens's blur are all close enough to be useful.

The consequence: superposition of impulses

Every one of the little blocks from §01 is a weighted, time-shifted impulse. LTI says the system's response to that whole train is just the sum of its response to each impulse separately — each one scaled and delayed exactly like the piece that produced it. If \(h(t)\) is the response to one unit impulse, the response to all of them together is:

$$y(t) \approx \sum_{i} x(\tau_i)\, h(t-\tau_i)\,\Delta\tau \;\xrightarrow{\;\Delta\tau \to 0\;}\; \int x(\tau)\, h(t-\tau)\, d\tau$$
Decompose \(x\) into impulses → sum their individual responses → get \(y\)
impulses = 0
each impulse of \(x\), and its faint scaled copy of \(h\)
running sum — this is \(y(t)\) taking shape
Every added impulse contributes one more faint decaying-exponential "echo" of \(h\), scaled by that impulse's height — this is the sampling widget from §01, run one system response at a time. Add them all up and the bold trace below is exactly the \(y(t)\) from §01's continuous widget — same convolution, rebuilt impulse by impulse instead of by sliding.
The output of an LTI system is fully determined by its impulse response — measure \(h\) once, and you can predict the response to any input by convolving.— the working assumption behind circuit analysis, room acoustics, and control theory alike
03Analogies

Three everyday versions of the same slide-multiply-sum.

Every kernel below is really just somebody's impulse response — a room's, a smoothing rule's, a lens's. Once you can see the mechanism from §01–02, it starts showing up everywhere. Three concrete cases:

The echo machine

A short "clap" \(x\) meets an echo kernel \(h\) with copies of itself at increasing delay and decreasing loudness. The output is literally the sound of the room.

\(n =\) 0
\(x[k]\) clap & \(h[n-k]\) room response
\(y[n]\) — what you actually hear

The moving average

\(h = [\tfrac{1}{3}, \tfrac{1}{3}, \tfrac{1}{3}]\) is a box that just averages its 3 neighbors. Convolving a noisy reading with it is exactly a rolling mean — smoothing is convolution with a flat kernel.

\(n =\) 0
\(x[k]\) daily readings & \(h[n-k]\) 3-tap average
\(y[n]\) — smoothed series

Image blur, in one dimension

Treat a row of pixel brightness as a signal and slide a 5-tap averaging kernel across it. The bright block softens at both edges exactly where the kernel window straddles the boundary.

\(n =\) 0
input row (bright block on dark background)
output row — after the 5-tap blur kernel
04Data Science & AI

The kernel is a learned impulse response.

Swap the physics for statistics and nothing about the mechanism changes. A convolutional filter still slides across data, multiplies, and sums — the only difference is that instead of deriving \(h\) from circuit equations, you let gradient descent choose it.

A "sensor" time series, three candidate kernels
\(n =\) 0
\(x[k]\) input series & \(h[n-k]\) the kernel in place
\(y[n]\) — the resulting feature map
Switch kernels and watch the same input produce a completely different feature map: the edge kernel lights up where the signal jumps, the blur kernel flattens it, the sharpen kernel exaggerates the jump. A trained CNN filter is just a kernel like these, except its numbers came from data instead of from a formula.

Impulse response as feature

In signals-and-systems, \(h(t)\) is the system's fingerprint — everything worth knowing about how it reacts. In a CNN, a trained kernel plays exactly that role for a pattern: it's the "impulse response" of a detector for edges, textures, or motifs, discovered by fitting instead of by measuring a circuit. Stacking layers of these detectors grows the receptive field the same way cascading two physical filters combines their impulse responses.

A technical footnote worth knowing

Strictly, a "true" convolution flips the kernel before sliding (as in every widget on this page); most deep-learning frameworks implement Conv1d/Conv2d as cross-correlation — no flip. It makes no practical difference, because the kernel is learned: if flipping would have helped, training just learns the flipped version instead.

05Big Picture

Four lenses, one operation.

Lens"Convolving" means\(x\) plays\(h\) plays\(y\) plays
Pure math Sliding integral / sum of a product any function or sequence any function or sequence the resulting function
Signals & systems Predicting an LTI system's output the input signal the impulse response the system's output
Image processing Sliding a small weighted window over pixels the image / a row a hand-designed kernel the filtered image
Data science & AI Sliding a learned weighted window to extract features the input tensor a trained filter a feature map

Every widget on this page is the same eight lines of code: flip, slide, multiply, sum. What changes is only what you decide to call \(x\), \(h\), and \(y\).

↳Continue in the Course