| name | signal-processing-dsp-basics |
| description | Foundations of digital signal processing — sampling, aliasing, the Nyquist criterion, quantization, convolution, the discrete Fourier transform, FFT, FIR and IIR filter design, windowing, spectral leakage, and practical issues in fixed-point versus floating-point implementation. Use when designing filters, analyzing spectra, choosing sample rates, reasoning about aliasing, or implementing DSP algorithms on a microcontroller, DSP chip, or host CPU. |
| type | skill |
| category | electronics |
| status | stable |
| origin | tibsfox |
| modified | false |
| first_seen | "2026-04-12T00:00:00.000Z" |
| first_path | examples/skills/electronics/signal-processing-dsp-basics/SKILL.md |
| superseded_by | null |
Signal Processing: DSP Basics
Digital signal processing is what happens after an ADC and before a DAC — or inside the world of purely discrete-time signals like audio files, sensor logs, and computed waveforms. The core ideas of DSP are deceptively simple (sample, add, multiply, feed back) but the traps are numerous (aliasing, leakage, numerical underflow, phase distortion, quantization noise). This skill covers the fundamentals every embedded or systems engineer needs to avoid making expensive analog problems digital.
Agent affinity: shima (DSP architecture and fixed-point implementation), horowitz (intuition and practical filter examples)
Concept IDs: elec-data-conversion-dsp, elec-signal-ac-analysis
Sampling and the Nyquist Criterion
A continuous-time signal x(t) is sampled by taking its value at evenly spaced instants T_s apart, producing the discrete-time sequence x[n] = x(n * T_s). The sample rate f_s = 1 / T_s.
The Nyquist-Shannon sampling theorem. A band-limited signal whose frequency content is strictly below f_s / 2 can be perfectly reconstructed from its samples. Any frequency content above f_s / 2 gets aliased — folded back into the band from 0 to f_s / 2 — and becomes indistinguishable from legitimate signal content at the aliased frequency.
The critical corollary. The sample rate must be at least twice the highest frequency of interest. For audio at up to 20 kHz, the minimum is 40 kHz (compact disc uses 44.1 kHz, professional audio 48 or 96 kHz). For a temperature sensor whose highest frequency of interest is 1 Hz, 10 Hz is plenty.
Anti-aliasing filters. Before the ADC, an analog low-pass filter must attenuate everything above f_s / 2 below the noise floor of the ADC. No amount of post-processing can undo aliasing; once two frequencies fold onto each other, they are indistinguishable.
Technique 1 — Quantization
An ADC represents each sample as one of 2^N levels, where N is the bit depth. The rounding error at each sample is a quantization error, uniformly distributed in the interval (-q/2, q/2) where q is the step size. Its RMS value is q / sqrt(12), and the resulting signal-to-quantization-noise ratio (SQNR) is approximately 6.02 * N + 1.76 dB.
Practical numbers:
| Bits | SQNR (dB) |
|---|
| 8 | 50 |
| 10 | 62 |
| 12 | 74 |
| 16 | 98 |
| 24 | 146 |
16-bit audio provides about 98 dB of dynamic range, which is near the limit of what consumer headphones can resolve. 24-bit audio is used in professional recording for headroom, not because the last eight bits are audible.