Dev

Software developer & audio programmer in New York. Audio tools, DSP & interactive sound.

DSP Dictionary

Digital Audio

Sample rate sets time resolution, while bit depth sets amplitude resolution.

Sampling and quantization

Sampling and quantizationA 1 kHz sine wave sampled at 16 kHz with 4-bit signed quantization. Dots mark discrete sample values. Horizontal axis: Time (ms). Vertical axis: Amplitude.-1-0.500.5100.51AmplitudeTime (ms)
4 bits

16 sample intervals per millisecond · 16 amplitude codes · RMS quantization error 0.0435

t[n] = n / 16000; step = 2 / 16

Gain

Gain multiplies every sample, changing amplitude while preserving frequency.

Input and output waveform comparisonA sine wave multiplied by 1.0. Its output peak amplitude is 0.42, compared with an input peak of 0.42. Horizontal position represents time; vertical position represents amplitude.10−1Time →
1.0× / 0.00 dB

y[n] = 1.0 × x[n]

Delay

A delay repeats a stored signal later, with feedback controlling how long the echoes last.

An impulse and its echoes

An impulse and its echoesEach repeat is separated by the delay and multiplied by the feedback gain again. Horizontal axis: Sample. Vertical axis: Amplitude.00.51064128AmplitudeSample
14 samples
55%

Echo spacing: 14 samples · First echo: 0.55× · Next: 0.30×

y[n] = x[n] + feedback × y[n − D]

Panning

Panning distributes a mono signal between the left and right channels.

Left channel

Left channelLeft channel carries the same waveform at 71% gain. Horizontal axis: Time (cycles). Vertical axis: Amplitude.-101012AmplitudeTime (cycles)

Right channel

Right channelRight channel carries the same waveform at 71% gain. Horizontal axis: Time (cycles). Vertical axis: Amplitude.-101012AmplitudeTime (cycles)
Center

Left gain 0.707 · Right gain 0.707 · L² + R² = 1.00

θ = (pan + 1) × π / 4; L = cos(θ) × x; R = sin(θ) × x

Filter

A filter passes some frequencies and attenuates others.

What passes through?

What passes through?A lower line means more attenuation at that frequency. Horizontal axis: Frequency (Hz). Vertical axis: Gain (dB).-60-40-200201001k10k20kGain (dB)Frequency (Hz)
1.8 kHz

At cutoff: -3.01 dB

H(z) = (b₀ + b₁z⁻¹ + b₂z⁻²) / (a₀ + a₁z⁻¹ + a₂z⁻²)

EQ

EQ boosts or cuts a frequency band, with Q setting its width.

A bell-shaped EQ band

A bell-shaped EQ bandHigher Q concentrates the gain change into a narrower frequency band. Horizontal axis: Frequency (Hz). Vertical axis: Gain (dB).-12012201001k10k20kGain (dB)Frequency (Hz)
1.0 kHz
+6.0 dB
1.0

Center gain: 6.00 dB

A = 10^(gain / 40); α = sin(2πf₀ / Fs) / (2Q)

Reverb

Reverb extends a sound with reflections that decay over time.

From a short impulse to a decaying tail

From a short impulse to a decaying tailThe envelope marks the maximum late-tail amplitude; the changing signs represent reflections. Horizontal axis: Time (s). Vertical axis: Amplitude.-10101.282.56AmplitudeTime (s)
1.2 s
40 ms
65%

−60 dB after 1.2 s · Pre-delay: 40 ms

envelope(t) = 10^(−3t / T60); output = (1 − mix) × dry + mix × reflections

Convolution

Convolution applies an impulse response to every input sample.

The impulse response h[n]

The impulse response h[n]Equal weights average the current sample with earlier samples. Horizontal axis: Sample. Vertical axis: Weight.00.510816WeightSample

The convolution output

The convolution outputEach input sample adds a scaled, shifted copy of the impulse response to this result. Horizontal axis: Sample. Vertical axis: Amplitude.-10102448AmplitudeSample
6 samples

Average length: 6 samples · Sum of weights: 1.00

y[n] = Σ x[k] × h[n − k]

Cross-Correlation

Cross-correlation finds the time shift where two signals match best.

Two versions of one signal

Two versions of one signalSignal B contains a delayed copy of A plus deterministic noise. Horizontal axis: Sample. Vertical axis: Amplitude.-10103264AmplitudeSample

Where do they line up?

Where do they line up?The peak identifies the shift that aligns B with A. Horizontal axis: Alignment lag (samples). Vertical axis: Normalized correlation.-101-24024Normalized correlationAlignment lag (samples)
8 samples
10%

Peak lag: -8 samples · Similarity: 0.97

Rxy[k] = Σ x[n] × y[n − k] / √(Σx² × Σy²)

Compression

Compression reduces level differences above a threshold.

Input level becomes output level

Input level becomes output levelThe dotted diagonal is unity gain. The dot shows your selected input level. Horizontal axis: Input level (dBFS). Vertical axis: Output level (dBFS).-60-40-200-60-300Output level (dBFS)Input level (dBFS)

Apply that gain to the waveform

Apply that gain to the waveformA constant-level tone keeps its shape while its amplitude changes. Horizontal axis: Time (ms). Vertical axis: Amplitude.-0.200.201020AmplitudeTime (ms)
-24.0 dB
4.0:1
-12.0 dB

-12.0 dB in → -21.0 dB out · 9.0 dB gain reduction

Above -24.0 dB: output dB = threshold + (input dB − threshold) / 4.0

Limiting

A limiter reduces gain to keep peaks below a ceiling.

Gain reduction preserves the tone's shape

Gain reduction preserves the tone's shapeCompare the limited waveform with sample clipping, which flattens the peaks. Horizontal axis: Time (ms). Vertical axis: Amplitude.-10101020AmplitudeTime (ms)
-6.0 dB
0.0 dB

Output peak -6.0 dB · 6.0 dB gain reduction · gain ×0.501

gain = min(1, ceiling amplitude / detected peak amplitude); y[n] = gain × x[n]

Noise Gate

A noise gate attenuates a signal when its level falls below a threshold.

The envelope decides when to open

The envelope decides when to openThe gate compares an envelope with the threshold, rather than testing each waveform zero crossing. Horizontal axis: Time (ms). Vertical axis: Envelope level (dBFS).-100-50005001kEnvelope level (dBFS)Time (ms)

The resulting gain control

The resulting gain controlOpen means unity gain; closed means the chosen attenuation. Horizontal axis: Time (ms). Vertical axis: Gain (dB).-60-40-20005001kGain (dB)Time (ms)
-35.0 dB
36.0 dB

Gate open for 34% of this example · closed gain -36.0 dB

gain dB = 0 if envelope ≥ -35.0 dB, otherwise -36.0 dB

Expansion

Downward expansion makes quiet passages quieter below a threshold.

Downward expansion transfer curve

Downward expansion transfer curveBelow the threshold, each 1 dB drop in input produces a larger drop in output. Horizontal axis: Input level (dBFS). Vertical axis: Output level (dBFS).-500-60-300Output level (dBFS)Input level (dBFS)
-24.0 dB
2.0:1
-36.0 dB

-36.0 dB in → -48.0 dB out · 12.0 dB attenuation

Below -24.0 dB: output dB = threshold + (input dB − threshold) × 2.0

Multiband Compression

Multiband compression controls the dynamics of separate frequency bands.

Selected low band

Selected low bandCompression starts only where this band's envelope exceeds the threshold. Horizontal axis: Time (ms). Vertical axis: Envelope level (dBFS).-60-40-20005001kEnvelope level (dBFS)Time (ms)

Three independent band envelopes

Three independent band envelopesOnly the selected band's output changes with these settings. Horizontal axis: Time (ms). Vertical axis: Envelope level (dBFS).-60-40-20005001kEnvelope level (dBFS)Time (ms)
-24.0 dB
4.0:1

Low band: up to 9.0 dB gain reduction

selected band output dB = threshold + (band input dB − threshold) / ratio, above threshold

De-Essing

De-essing reduces excessive high-frequency sibilance.

The high-frequency detector

The high-frequency detectorOnly the high-band envelope above the threshold triggers gain reduction. Horizontal axis: Time (ms). Vertical axis: Envelope level (dBFS).-60-40-20005001kEnvelope level (dBFS)Time (ms)

Split-band processing preserves the voice body

Split-band processing preserves the voice bodyThe lower voice envelope remains unchanged while the high-band bursts are reduced. Horizontal axis: Time (ms). Vertical axis: Envelope level (dBFS).-60-40-20005001kEnvelope level (dBFS)Time (ms)
-24.0 dB
6.0:1
85%

Up to 5.2 dB high-band gain reduction

high-band gain dB = compressed high-band envelope dB − original high-band envelope dB

Saturation

Saturation rounds waveform peaks and adds harmonics.

Soft clipping

Soft clippingThe input sine wave develops rounded, broader peaks as drive increases. Horizontal axis: Time (ms). Vertical axis: Amplitude.-1-0.500.5100.51AmplitudeTime (ms)
2.00×
100%

A 0.80 input peak becomes 0.96 · 100% wet

y = 0.00x + 1.00 tanh(2.00x) / tanh(2.00)

Distortion

Hard clipping flattens waveform peaks and adds harmonics.

Hard clipping

Hard clippingThe driven waveform is clipped at positive and negative 0.70 amplitude. Horizontal axis: Time (ms). Vertical axis: Amplitude.-1-0.500.5100.51AmplitudeTime (ms)
2.0×
±0.70

Driven peak 1.60 · output limited to ±0.70

y = clamp(2.0x, −0.70, 0.70)

Aliasing

Frequencies above half the sample rate fold into lower frequencies when sampled.

Different waves, identical samples

Different waves, identical samplesA 12 kHz cosine and its 4 kHz folded counterpart pass through the same sample values at 16 kHz. Horizontal axis: Time (ms). Vertical axis: Amplitude.-1-0.500.5100.51AmplitudeTime (ms)
12 kHz

Nyquist limit 8 kHz · observed 4 kHz · aliasing

f_alias = |fold(12000, 16000)| = 4000 Hz

Oversampling

Oversampling raises the processing rate before filtering and returning to the output rate.

Output at the original sample rate

Output at the original sample rateThe 1× output is compared with 1× oversampling and an ideal low-pass filter. third harmonic aliases to 7 kHz. Horizontal axis: Time (ms). Vertical axis: Amplitude.-1-0.500.5100.51AmplitudeTime (ms)
3 kHz

Internal rate 16 kHz · generated harmonic 9 kHz · third harmonic aliases to 7 kHz

shape(x) = x − 0.3x³; process → low-pass → downsample

LFO

An LFO is a slow oscillation that moves a parameter over time.

LFO control signal

LFO control signalA 0.5 Hz oscillator spans 2 cycles in four seconds, with depth 0.75. Horizontal axis: Time (s). Vertical axis: Control value.-1-0.500.51024Control valueTime (s)
0.5 Hz
75%

2.0 cycles in 4 seconds · one cycle takes 2.00 seconds

control(t) = 0.75 × sin(2π × 0.5 × t)

Modulation Effects

Modulation uses one signal to move a parameter of another.

The gain envelope

The gain envelopeGain moves between 0.25 and 1 at 1 Hz. Horizontal axis: Time (s). Vertical axis: Gain (×).00.51012Gain (×)Time (s)

The envelope multiplies the waveform

The envelope multiplies the waveformThe output is the input multiplied by the moving gain at every point. Horizontal axis: Time (s). Vertical axis: Amplitude.-0.500.5012AmplitudeTime (s)
1.0 Hz
75%

Gain moves from 0.25× to 1.00× · 1.00 swells per second

gain(t) = 1 − depth/2 + (depth/2) × sin(2π × rate × t); y(t) = gain(t) × x(t)

Chorus

Chorus blends a signal with a delayed copy whose timing keeps changing.

The LFO moves the delay

The LFO moves the delayDelay time follows a 0.50 Hz sine wave. The dot marks the selected time. Horizontal axis: Time (s). Vertical axis: Delay (ms).1015202530024Delay (ms)Time (s)

The blend at this instant

The blend at this instantEqual dry and wet signals are mixed with the delay frozen at 25.00 ms. Horizontal axis: Frequency (Hz). Vertical axis: Magnitude (×).00.510200400Magnitude (×)Frequency (Hz)
5.0 ms
0.5 Hz
0.50 s

At 0.50 s: 25.00 ms delay · first cancellation at 20.0 Hz

D(t) = 20 ms + depth × sin(2π × rate × t); y(t) = 0.5x(t) + 0.5x(t − D(t))

Flanger

Flanging mixes a short, changing delay with the original to create moving comb notches.

The LFO moves the delay

The LFO moves the delayDelay time follows a 0.50 Hz sine wave. The dot marks the selected time. Horizontal axis: Time (s). Vertical axis: Delay (ms).024012Delay (ms)Time (s)

A frozen comb response

A frozen comb responseFrequency response for the selected 4.00 ms delay with 30% feedback. Horizontal axis: Frequency (Hz). Vertical axis: Gain (dB).-40-2002001k2kGain (dB)Frequency (Hz)
1.5 ms
30%
0.50 s

Delay: 4.00 ms · first notch: 125 Hz · notch spacing: 250 Hz

y[n] = x[n] + x[n − D] + feedback × y[n − D]

Phaser

A phaser mixes phase-shifted copies with the original to create moving notches.

All-pass magnitude and mixed magnitude

All-pass magnitude and mixed magnitudeThe all-pass branch remains at unity gain; only its mixture with the dry branch creates notches. Horizontal axis: Frequency (Hz). Vertical axis: Magnitude (×).00.5103k6kMagnitude (×)Frequency (Hz)

The all-pass chain changes phase

The all-pass chain changes phaseThe unwrapped phase of 4 first-order digital all-pass stages at a 48 kHz sample rate. Horizontal axis: Frequency (Hz). Vertical axis: Phase (degrees).-1k-500003k6kPhase (degrees)Frequency (Hz)
500 Hz
50%

4 all-pass stages · corner: 500 Hz

A(z) = (a + z⁻¹)/(1 + a z⁻¹); H(z) = (1 − mix) + mix × A(z)^stages

Time-Based Effects

Time-based effects use stored audio to create echoes and tails.

The impulse response of an echo

The impulse response of an echoA single impulse at 100 ms produces eight echoes spaced 250 ms apart. Each repeat retains 60% of the previous echo. Horizontal axis: Time (ms). Vertical axis: Impulse amplitude.00.5101.75k3.5kImpulse amplitudeTime (ms)
250 ms
60%
75%

First echo: 250 ms later at 0.75× · second echo: 0.45× · third: 0.27×

echo[n] = x[n − D] + feedback × echo[n − D]; y[n] = x[n] + wet × echo[n]

Spatial Effects

Spatial processing changes the level and timing differences between the ears.

Left and right channel waveforms

Left and right channel waveformsLeft gain is 0.71 and right gain is 0.71. The right signal arrives 0.50 ms later. Horizontal axis: Time (ms). Vertical axis: Amplitude.-0.500.5048AmplitudeTime (ms)
Center
0.5 ms
500 Hz

Left: 0.71× · right: 0.71× · right arrives 0.50 ms later

L(t) = cos(θ) × x(t); R(t) = sin(θ) × x(t − D); θ = (pan + 1)π/4

Mixing

Mixing adds weighted signals, whose phases can reinforce or cancel.

Two weighted signals and their sum

Two weighted signals and their sumTwo 200 Hz tones combine with 90 degrees of phase difference. Output peak amplitude is 0.636. Horizontal axis: Time (ms). Vertical axis: Amplitude.-2-101201020AmplitudeTime (ms)
0.75×
0.75×
90°

Sum peak: 0.636

y(t) = 0.75 × xA(t) + 0.75 × xB(t)

Signal Chain

A signal chain combines simple operations, with each output feeding the next input.

Input → gain → low-pass

Input → gain → low-passThe input contains 100 Hz and 800 Hz tones. The intermediate line shows gain alone, and the output includes filtering. Horizontal axis: Time (ms). Vertical axis: Amplitude.-1010510AmplitudeTime (ms)

The response of the whole chain

The response of the whole chainGain scales the low-pass response at every frequency. Horizontal axis: Frequency (Hz). Vertical axis: Magnitude (×).01201.2k2.4kMagnitude (×)Frequency (Hz)
1.00×
350 Hz

100 Hz leaves at 0.96× · 800 Hz leaves at 0.40×

u[n] = gain × x[n]; y[n] = (1 − a)u[n] + a·y[n − 1]; a = exp(−2π × cutoff / 48000)