# Anti-aliasing filter An **anti-aliasing filter** is a [[Filter_(signal_processing)|filter]] placed ahead of a sampler to remove, before [[Sampling_(signal_processing)|sampling]], the frequency components that the samples could not represent. Any component above the sampler's [[Nyquist_frequency]], half the sampling rate, produces the same samples as some lower frequency and reappears there as an alias; once sampled, the alias is indistinguishable from a genuine component and nothing downstream can remove it.[^tib111] The filter is therefore the one stage in a digitising chain that must act on the continuous signal, and it is usually the last analog stage before the [[Analog-to-digital_converter|analog-to-digital converter]]. The ideal anti-aliasing filter is a brick wall, passing everything below the Nyquist frequency unchanged and removing everything above it, which is the hypothesis under which the [[Nyquist–Shannon_sampling_theorem]] promises exact reconstruction. No physical filter has that response, and a practical filter is a compromise between three costs: some band below the Nyquist frequency is given up as a transition region in which the response falls from pass to stop, some [[Aliasing|aliasing]] is tolerated because the stopband attenuation is finite, and the filter's own amplitude and phase ripple [[Distortion|distorts]] the band it keeps. The usual escape from the compromise is to sample faster than the application needs, a practice called [[Oversampling|oversampling]], so that the images sit far from the passband and a gentle analog filter suffices, leaving a steep [[Digital_filter|digital filter]] to finish the job after conversion. The page's primary microsim, *Anti-aliasing filter*, sends a two-tone signal down two paths at once, one sampled raw and one passed through an ideal low-pass filter first, and lets the reader move the tone frequencies, the sample rate and the filter cutoff while watching the high tone fold into the unfiltered spectrum and vanish from the filtered one. ## Image processing An image [[Sensor|sensor]] samples a scene in space rather than time. A sensor with pixel pitch `p` takes `1/p` samples per unit length along each axis, so its spatial [[Nyquist_frequency|Nyquist frequency]] is `1/(2p)` cycles per unit length, and any detail finer than two pixels per cycle is recorded as coarse moiré, the spatial [[Aliasing|alias]] of a pattern the sensor cannot resolve. A [[Charge-coupled_device|CCD]] or similar sensor therefore needs an anti-aliasing filter of its own, but an optical one, acting on the light before it reaches the pixels. The common construction is a stack of birefringent plates in front of the sensor, each of which splits an incoming ray into two displaced copies about a pixel pitch apart, so that a point of light lands on a small cluster of pixels instead of one; the blur is a [[Low-pass_filter|low-pass filter]] whose cutoff sits near the sensor's Nyquist frequency.[^olpf] The filter is deliberately imperfect. It softens genuine detail near the limit of resolution to suppress patterns beyond it, the same trade the electronic filter makes, and when a lens cannot itself resolve detail at the sensor's Nyquist frequency, because the pixel pitch is finer than the lens's blur, the optical filter can be omitted, the lens having become the filter. Colour sensors are more sensitive to the problem than monochrome ones: the colour filter array samples each colour on a coarser grid than the pixel grid, so the Nyquist frequency of each colour channel is lower, and aliased fine detail appears as coloured fringes rather than as grey moiré. Aliasing also arises inside [[Digital_image_processing|digital image processing]], whenever an image already sampled is resampled more coarsely. Reducing an image to half its width discards every second pixel, which halves the Nyquist frequency, so the detail between the old and the new Nyquist frequencies must be removed by a digital low-pass filter before the pixels are dropped; scaling down without that filter produces jagged edges and moiré in exactly the way an unfiltered sampler does. The same logic runs through computer graphics, where a rendered scene is a continuous function sampled at pixel centres. Rendering at a higher resolution and averaging groups of samples down to the display grid, supersampling, is an anti-aliasing filter applied by [[Oversampling|oversampling]], and pre-filtered texture pyramids are anti-aliasing filters applied in advance, so that a distant texture is sampled from a copy already blurred to its new Nyquist frequency. In each case the rule is the one the microsim shows for a single tone: remove what lies above the new Nyquist frequency before the sampling that would fold it, never after. ## Audio processing In [[Audio_signal_processing|audio]] and in general data acquisition the anti-aliasing filter is an electronic [[Low-pass_filter|low-pass filter]] between the analog source and the [[Analog-to-digital_converter|converter]]. Its passband must reach the highest frequency the application needs, its stopband must begin low enough that whatever leaks through folds harmlessly, and the [[Sampling_(signal_processing)|sampling rate]] sets where those two edges may lie. The design condition is the sampling theorem's `fs > 2*fmax`,[^dyer48] but the filter has more room than that suggests. A component between the [[Nyquist_frequency|Nyquist frequency]] `fs/2` and `fs - fpass` folds to a frequency between `fpass` and `fs/2`, above the passband, where it does no harm and the digital side can discard it; only components above `fs - fpass` fold into the band that matters. The transition region may therefore extend from `fpass` all the way to `fs - fpass`, a width of `fs - 2*fpass`. At the 44.1 kHz rate of compact-disc audio,[^cd] which is also the rate of Downey's Think DSP examples, where a 10 ms segment holds 441 samples,[^downey70] a passband to 20 kHz leaves the filter a transition region from 20 kHz to 24.1 kHz in which to fall from pass to stop, since a component at 24.1 kHz is the one that folds onto 20 kHz. How steeply a filter falls depends on its order. A single [[Capacitor|capacitor]] and [[Resistor|resistor]] form the simplest low-pass filter, with the [[Frequency_response|response]] `H(f) = 1/(1 + j*2π*f*R*C)` and a cutoff at `1/(2π*R*C)`, above which the magnitude falls by a factor of ten for every tenfold increase in frequency, that is by 20 [[Decibel|dB]] per decade.[^john119] Johnson's worked figure runs a pulse train of period 1 ms through such a filter at cutoffs of 100 Hz, 1 kHz and 10 kHz, and the harmonics above each cutoff are progressively, never abruptly, removed.[^john119] Set against the microsim's defaults, a first-order filter with the cutoff at 5 Hz would leave the 8.5 Hz tone at about half its amplitude (derived: `1/sqrt(1 + (8.5/5)^2) = 0.51`), so its alias at 1.5 Hz would still be plainly visible in the sampled spectrum, whereas the sketch's ideal filter removes it entirely. A practical audio filter reaches the required stopband attenuation in a narrow transition region only by being of high [[Filter_design|order]], with the phase [[Distortion|distortion]] and component sensitivity that implies, which is why a genuine brick wall is treated in the laboratory texts as an unrealisable reference rather than a design.[^fons229] The mirror image of the problem occurs on the output side: a [[Digital-to-analog_converter|digital-to-analog converter]] produces a [[Zero-order_hold|stair-step]] that carries images of the signal at every multiple of the sampling rate, and Dyer and Davis follow it with a low-pass filter at `fs/2` to remove them, the reconstruction filter, whose specification is the anti-aliasing filter's read backwards.[^dyer50] ### Oversampling Sampling faster than the application requires is the standard way to relax the analog filter. If the passband ends at `fpass` and the rate is raised to many times `2*fpass`, the transition region `fs - 2*fpass` becomes wide, a low-order analog filter can span it comfortably, and the steep cut at `fpass` is made afterwards by a [[Digital_filter|digital filter]], whose response is exact and repeatable, before the sample rate is reduced to the one the application stores. The digital filter is itself an anti-aliasing filter for the rate reduction that follows it, since dropping samples lowers the Nyquist frequency just as coarsening an image does. [[Delta-sigma_modulation|Delta-sigma]] converters carry the idea to its limit, sampling at a large multiple of the final rate with very few bits per sample and pushing the [[Quantization_(signal_processing)|quantization]] noise toward the high frequencies that the digital filter then removes. The microsim shows the first half of the argument directly: with the two tones at 2 Hz and 8.5 Hz and the sample rate at its default of 10 Hz, the 8.5 Hz tone lies above the 5 Hz Nyquist frequency and folds; raising the sample rate to 20 Hz moves the Nyquist frequency to 10 Hz, both tones are represented exactly even on the unfiltered path, and the cutoff can now be placed anywhere between 8.5 Hz and 10 Hz without loss. ### Bandpass signals When the signal of interest occupies a narrow band well above zero, as a radio channel or a [[Radar|radar]] return does, the sampler can run below twice the highest frequency and deliberately fold the band down, provided the sampling rate is chosen so that no image of the band lands on itself. The anti-aliasing filter for such a sampler is a band-pass rather than a low-pass filter, and its stopband requirement is more severe, not less: every band that would fold onto the wanted one, above and below it, must be removed, and so must the wideband [[Noise_(electronics)|noise]] between them, because the sampler folds noise from every image band into the baseband and the [[Signal-to-noise_ratio|signal-to-noise ratio]] falls by the number of bands that fold. A single tone illustrates the mechanism in the microsim: the 8.5 Hz tone sampled at 10 Hz appears at 1.5 Hz, `|8.5 - 10*round(8.5/10)| = 1.5`, and a bandpass sampler would treat that image as the wanted output. The sketch cannot show the filtering half of the technique, because its filter is low-pass only; a bandpass anti-aliasing filter for that case would have to remove the 2 Hz tone and everything else outside the band around 8.5 Hz. ### Signal overload The filter protects the sampler only if nothing between them creates new frequencies. If the signal is strong enough to clip in the converter's input buffer or in any amplifier stage after the filter, the clipping generates harmonics of the signal, and those harmonics lie above the Nyquist frequency where the filter can no longer act. A clipped 2 Hz [[Sine_wave|sine]] sampled at 10 Hz acquires a third harmonic at 6 Hz, which folds to 4 Hz, and a fifth at 10 Hz, which folds to zero; a rich signal clipped after the filter produces a spray of inharmonic aliases of the same kind, which is the distinctive harshness of an overloaded digital recording as opposed to the softer clipping of an analog one. The safeguard is headroom: the gain must be set before the filter so that the filter's output stays within the converter's range, and any limiter or protection stage must sit ahead of the filter rather than behind it. The microsim does not model clipping; its two paths are linear, which is the assumption the filter's placement is meant to keep true. ## Microsims The primary microsim, *Anti-aliasing filter*, runs a two-tone signal, a unit-amplitude [[Sine_wave|tone]] at f₁ plus a tone of amplitude 0.6 at f₂, down two paths drawn side by side. The left path samples the raw signal; the right path passes it through an ideal low-pass filter first. Four sliders set the parameters: f₁ primary freq, 0.5–15 Hz, default 2.0 Hz; f₂ high freq, 0.5–15 Hz, default 8.5 Hz; fₛ sample rate, 2–30 Hz, default 10 Hz; and f_c AAF cutoff, 0.5–15 Hz, default 5.0 Hz, with the [[Nyquist_frequency|Nyquist frequency]] fₛ/2 printed above the right-hand column. Each path has three panels over a two-second window: the continuous signal with its sample points, a reconstruction drawn as straight lines between the samples, and the magnitude spectrum of the samples from zero to the Nyquist frequency, with the cutoff marked f_c on the filtered side. Below the spectra a verdict reads ALIASING or No aliasing for the raw path and Aliases suppressed or Cutoff too high, aliases leak for the filtered path, the latter appearing when the cutoff is set above the Nyquist frequency while a tone lies between them. The model is ILLUSTRATIVE: the filter is a brick wall applied to each tone separately, with no transition band, ripple or phase shift; the reconstruction is a straight-line join rather than a proper reconstruction filter; there is no noise; and the spectrum is a plain [[Discrete_Fourier_transform|DFT]] of the samples in the window, so tones at multiples of 0.5 Hz give single clean bars and other tones spread across neighbouring bins. *Try:* Leave the defaults and compare the two spectra: the raw path shows bars at 2 Hz and at 1.5 Hz, the [[Aliasing|alias]] of the 8.5 Hz tone under ALIASING, while the filtered path shows only the 2 Hz bar under Aliases suppressed; then raise f_c AAF cutoff past 8.5 Hz and watch the 1.5 Hz bar return on the filtered side with the warning that the cutoff is too high, and finally raise fₛ sample rate to 20 Hz and watch both paths report no aliasing. A three.js companion renders this concept in depth. The sketch runs live at https://editor.p5js.org/sciencenibber/full/TN3sNHqvO and can be forked at https://editor.p5js.org/sciencenibber/sketches/TN3sNHqvO . ## Wikipedia : Wikitube **Strict pair:** [Wikipedia](https://en.wikipedia.org/wiki/Anti-aliasing_filter) : [Wikitube](https://en.wikitube.io/wiki/Anti-aliasing_filter) Skeleton mirrored at revision 1372180426. Prose, emphasis and the microsims are Wikitube's own. ## Notes The sketch is ILLUSTRATIVE: its filter is an ideal brick wall applied tone by tone, its reconstruction is linear interpolation between samples, and its spectrum is a discrete Fourier transform of the samples in a two-second window. Page numbers in the references are PDF pages of the open editions. ## References [^tib111]: Tiberius, C.; Mulder, M. *Engineering Signal Analysis: From Fourier to filtering - Theory*. 2026, pp. 111-113 (PDF pages): the sampling theorem and the strictness of the inequality. Open Textbook Library: https://open.umn.edu/opentextbooks/textbooks/engineering-signal-analysis-from-fourier-to-filtering-theory . CC BY. [^dyer48]: Dyer, J.; Davis, C. *Measurement and Instrumentation: An Introduction to Concepts and Methods*. 1st ed., 2020, pp. 48-49 (PDF pages): the sampling condition fs > 2 fmax. Open Textbook Library: https://open.umn.edu/opentextbooks/textbooks/measurement-and-instrumentation-an-introduction-to-concepts-and-methods . CC BY-NC-SA. [^dyer50]: Dyer, J.; Davis, C. *Measurement and Instrumentation: An Introduction to Concepts and Methods*. 1st ed., 2020, pp. 50-51 (PDF pages): the DAC output as a stair-step followed by a low-pass filter at fs/2. Open Textbook Library: https://open.umn.edu/opentextbooks/textbooks/measurement-and-instrumentation-an-introduction-to-concepts-and-methods . CC BY-NC-SA. [^john119]: Johnson, D. *Fundamentals of Electrical Engineering I*. 2014, p. 119 (PDF page): the RC low-pass response H(f) = 1/(1 + j2πfRC) and Fig. 4.10, a 1 ms pulse train filtered at 100 Hz, 1 kHz and 10 kHz. Open Textbook Library: https://open.umn.edu/opentextbooks/textbooks/fundamentals-of-electrical-engineering-1 . CC BY. [^fons229]: Fonseca, A.; Dickerson, J. *Open Signals and Systems Laboratory Exercises*. 2nd ed., 2024, pp. 229-230 (PDF pages): a brick-wall filter is unrealisable. Open Textbook Library: https://open.umn.edu/opentextbooks/textbooks/open-signals-and-systems-laboratory-exercises . CC BY-NC. [^downey70]: Downey, A. *Think DSP: Digital Signal Processing in Python*. 2012, p. 70 (PDF page): a 0.01 s segment at 44.1 kHz holds 441 samples. Open Textbook Library: https://open.umn.edu/opentextbooks/textbooks/think-dsp-digital-signal-processing-in-python . CC BY-NC. [^cd]: Citation needed: the 44.1 kHz sampling rate of compact-disc audio is fixed by the Compact Disc Digital Audio standard (IEC 60908); a page reference to that standard, or to a Portal Book that states the rate, would settle it. [^olpf]: Citation needed: the birefringent-plate construction of optical low-pass filters in digital cameras; an imaging-sensor textbook or a sensor manufacturer's technical note on optical low-pass filters would settle it. <!-- Hubs: Signal_processing. Portals: PORTAL_Signal_Processing. Signal Processing portal wave 1 · 2026-09-17 · drafted. -->