BandpassFilter[data,{ω1,ω2}]
applies a bandpass filter with cutoff frequencies ω1 and ω2 to an array of data.
BandpassFilter[data,{{ω,q}}]
uses center frequency ω and quality factor q.
BandpassFilter[data,spec,n]
uses a filter kernel of length n.
BandpassFilter[data,spec,n,wfun]
applies a smoothing window wfun to the filter kernel.
BandpassFilter
BandpassFilter[data,{ω1,ω2}]
applies a bandpass filter with cutoff frequencies ω1 and ω2 to an array of data.
BandpassFilter[data,{{ω,q}}]
uses center frequency ω and quality factor q.
BandpassFilter[data,spec,n]
uses a filter kernel of length n.
BandpassFilter[data,spec,n,wfun]
applies a smoothing window wfun to the filter kernel.
Details and Options
- Bandpass filtering is commonly used in audio equalizers and audio receivers to attenuate low and high frequencies in a signal while leaving the mid-range frequencies unchanged.
- BandpassFilter convolves a digital signal with a finite impulse response (FIR) kernel created using the window method.
- Longer kernels result in a better frequency discrimination.
- The data can be any of the following:
-
list arbitrary-rank numerical array tseries temporal data such as TimeSeries and TemporalData image arbitrary Image or Image3D object audio an Audio or Sound object video a Video object - The range of frequencies that are attenuated is dependent on the values of the cutoff frequencies ω1 and ω2, with ω2>ω1.
- When applied to images and multidimensional arrays, filtering is applied successively to each dimension starting at level 1. BandpassFilter[data,{{ω11,ω21},…}] uses the frequencies {ω1i,ω2i} for the i
dimension. - BandpassFilter[data,{ω1,ω2}] uses a filter kernel length and smoothing window suitable for the cutoff frequencies {ω1,ω2} and the input data.
- Typical smoothing windows wfun include:
-
BlackmanWindow smoothing with a Blackman window DirichletWindow no smoothing HammingWindow smoothing with a Hamming window {v1,v2,…} use a window with values vi f create a window by sampling f between
and 
- The following options can be given:
-
Padding "Fixed" the padding value to use SampleRate Automatic sample rate assumed for the input - By default, SampleRate->1 is assumed for images as well as data. For audio signals and time series, the sample rate is either extracted or computed from the input data.
- With SampleRatesr, the cutoff frequency ωc should be between 0 and sr
.
Examples
open all close allBasic Examples (3)
Bandpass filtering of a sum of cosines:
data = Table[Cos[x] + Cos[10x] + Cos[20x], {x, 0, 2Pi, 0.04}];
filtered = BandpassFilter[data, {.2, .6}, 31];
ListLinePlot[{data, filtered}, PlotLegends -> {"original", "filtered"}]BandpassFilter[\!\(\*AudioBox[""]\), {Quantity[500, "Hertz"], Quantity[2500, "Hertz"]}]Bandpass filtering of an image:
BandpassFilter[[image], {0.5, .8}, 25]//ImageAdjustScope (14)
Data (8)
data = BoxMatrix[5, {41}];
ListLinePlot[{data, BandpassFilter[data, {.5, 1.5}, 15]}, PlotRange -> All]data = Table[UnitBox[(n/7), (m/7)], {n, -7, 7}, {m, -7, 7}];
ListPlot3D[data]BandpassFilter[data, {0.5, 1.5}]//ListPlot3DFilter a TimeSeries:
ts = TemporalData[TimeSeries, {{{0., -0.27267267057145633, -0.6672983789995302, -0.5338541947930846,
-0.6117404489279314, -0.6755527076595494, -0.02125421294486496, -0.10792797291843935,
-0.6138271235477938, -0.3248568606554575, -0.08843449054 ... 2053424, -0.49980440691873723, -0.5388679788215971,
-0.4101602764645551}}, {{0, 1., 0.01}}, 1, {"Continuous", 1}, {"Continuous", 1}, 1,
{ValueDimensions -> 1, ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, False,
10.1];
filtered = BandpassFilter[ts, {Quantity[5, "Hertz"], Quantity[10, "Hertz"]}];ListLinePlot[{ts, filtered}, PlotRange -> All, PlotLegends -> {"original data", "filtered"}]Bandpass filtering of a Sound object of a tri-tone signal:
snd = Sound[SampledSoundList[Table[Sin[2 π 697 t] + Sin[2 π 1209 t] + Sin[2π 1633 t], {t, 0., 0.3, 1 / 8000.}], 8000]]Eliminate the outer tones using a bandpass filter with a Blackman window of length 101:
BandpassFilter[snd, {Quantity[1000, "Hertz"], Quantity[1400, "Hertz"]}, 101, BlackmanWindow]Bandpass filtering of a halftone image:
BandpassFilter[[image], {0.5, 1.5}]//ImageAdjustBandpassFilter[Video["ExampleData/fish.mp4"], {.2, 1.5}]Bandpass filtering of a 3D image:
BandpassFilter[[image], {0.25, 1.25}]BandpassFilter[{0, 0, 0, 1, 1, 1, 0, 0, 0}, {Pi / 2, Pi}, 3]Parameters (6)
With an audio signal of sample rate s, a numeric frequency will be interpreted as a rad/s quantity:
a = \!\(\*AudioBox[""]\);BandpassFilter[a, {{Quantity[1000, "Hertz"], 1.}}] === BandpassFilter[a, {{Quantity[1000*2*Pi, "Radians"/"Seconds"], 1.}}] === BandpassFilter[a, {{1000 2 Pi, 1.}}]Filter a white noise signal using a bandpass filter with cutoff frequencies of 8000 Hz and 12000 Hz:
noise = AudioGenerator["White", 0.2];
Periodogram[noise]Periodogram[BandpassFilter[noise, {Quantity[8000, "Hertz"], Quantity[12000, "Hertz"]}]]Use center frequency of 9798 Hz and a quality factor q of 2:
Periodogram[BandpassFilter[noise, {{Quantity[9798, "Hertz"], 2}}]]Make the passband narrower by increasing the quality factor:
Periodogram[BandpassFilter[noise, {{Quantity[9798, "Hertz"], 5}}]]noise = AudioGenerator["White", 0.2];
Periodogram[BandpassFilter[noise, {Quantity[8000, "Hertz"], Quantity[12000, "Hertz"]}, 33]]Increase frequency discrimination by using a longer kernel:
Periodogram[BandpassFilter[noise, {Quantity[8000, "Hertz"], Quantity[12000, "Hertz"]}, 55]]Vary the amount of attenuation by using different window functions:
a = AudioGenerator[Sin[11025 2 π #^2]&];
Periodogram[BandpassFilter[a, {Quantity[5000, "Hertz"], Quantity[15000, "Hertz"]}, 33, #]& /@ {DirichletWindow, HammingWindow, BlackmanWindow}, PlotLegends -> {"Dirichlet", "Hamming", "Hann"}]Vary the amount of attenuation by using the adjustable Kaiser window:
Periodogram[Table[BandpassFilter[a, {Quantity[5000, "Hertz"], Quantity[15000, "Hertz"]}, 33, KaiserWindow[#, b]&], {b, {3, 5, 7}}], PlotLegends -> {3, 5, 7}]Specify the window function as a numeric list:
Periodogram[BandpassFilter[a, {Quantity[5000, "Hertz"], Quantity[15000, "Hertz"]}, 33, ConstantArray[1, {33}]]]Bandpass filtering using different center frequencies:
a = AudioGenerator[Sin[11025 2 π #^2]&];
Periodogram[BandpassFilter[a, {{#, QuantityMagnitude[(#/Quantity[5000, "Hertz"])]}}, 33]& /@ {Quantity[5000, "Hertz"], Quantity[10000, "Hertz"], Quantity[15000, "Hertz"]}, PlotLegends -> {Quantity[5000, "Hertz"], Quantity[10000, "Hertz"], Quantity[15000, "Hertz"]}]Use the same center frequency and different quality factors:
Periodogram[BandpassFilter[a, {{Quantity[10000, "Hertz"], #}}, 33]& /@ {2, 4}, PlotLegends -> {2, 4}]Use different center frequencies in each dimension:
BandpassFilter[[image], {{0.2, 0.45}, {0.45, 1}}]//ImageAdjustOptions (3)
Padding (1)
SampleRate (2)
Use a filter centered on the frequency π/2 assuming a sample rate of sr=1:
BandpassFilter[{0, 0, 0, 1, 1, 1, 0, 0, 0}, {{π / 2., 1}}, 5]BandpassFilter[{0, 0, 0, 1, 1, 1, 0, 0, 0}, {{3π / 2., 1}}, 5, SampleRate -> 3]Apply a bandpass filter centered on the half-band frequency to audio sampled at a rate of 44100 Hz:
noise = AudioGenerator["White", 0.2];
sr = QuantityMagnitude@AudioSampleRate[noise]BandpassFilter[noise, {{sr π / 2., 1}}]//PeriodogramApplications (1)
On a modern 88-key piano, key 55 (note C5) has a fundamental frequency of approximately 523 Hz. Use BandpassFilter to effectively remove all the harmonics of this key while retaining the fundamental in the following audio clip:
key55 = \!\(\*AudioBox[""]\);Use a narrow filter (Q=3) of length 63 centered on the fundamental frequency (523 Hz):
f = 523;
res = BandpassFilter[key55, {{2 π f, 3}}, 63]Compare the frequency spectra of the two audio clips:
Periodogram[{key55, res}, PlotRange -> All, GridLines -> All, PlotLegends -> {"original", "filtered"}, Epilog -> {Red, InfiniteLine[{{f, 0}, {f, 1}}]}]Properties & Relations (6)
Using cutoff frequencies of 0 and π returns the original sequence:
BandpassFilter[{0., 0., 0., 0., 1., 1., 1., 1.}, {0, Pi}]Create a bandpass filter using LeastSquaresFilterKernel and a Hamming window:
n = 5;
ω = {1, 1.5};
win = Array[HammingWindow, n, {-1 / 2, 1 / 2}];
ker = win LeastSquaresFilterKernel[{"Bandpass", ω}, n]ListConvolve[ker, {0, 0, 0, 0, 1, 1, 1, 1}, Ceiling[n / 2], 0]Compare with the result of BandpassFilter:
BandpassFilter[{0, 0, 0, 0, 1, 1, 1, 1}, ω, n, win, Padding -> 0]Impulse response of a bandpass filter of length 21:
h = BandpassFilter[ArrayPad[{1}, 10], {0.75, 1.5}, 21]ListPlot[h, PlotRange -> All, Filling -> 0]Magnitude spectrum of the filter:
Plot[Abs[ListFourierSequenceTransform[h, ω]], {ω, 0, π}]Impulse response of a bandpass filter of length 21 without a smoothing window:
h = BandpassFilter[ArrayPad[{1}, 10], {1., 1.5}, 21, None]ListPlot[h, PlotRange -> All, Filling -> 0]Magnitude spectrum of the filter:
Plot[Abs[ListFourierSequenceTransform[h, ω]], {ω, 0, π}]The frequency discrimination of the bandpass filter improves as the length of the filter is increased:
Manipulate[
ListLinePlot[Abs[Fourier[BandpassFilter[ArrayPad[{1.}, 128], {Pi / 4., 3 Pi / 4.}, n, None], FourierParameters -> {1, -1}]][[ ;; 129]], ...], {{n, 21}, 3, 63, 1}]The length of the impulse response increases as the filter's quality factor is increased:
Manipulate[ListPlot[x = DeleteCases[BandpassFilter[ArrayPad[{1.}, 65], {{Pi / 2, q}}, Padding -> 0], 0.], ...], {{q, 5., "𝒬"}, 1., 13.}]Possible Issues (1)
History
Introduced in 2012 (9.0) | Updated in 2015 (10.2) ▪ 2015 (10.3) ▪ 2016 (11.0) ▪ 2017 (11.1) ▪ 2025 (14.3)
Text
Wolfram Research (2012), BandpassFilter, Wolfram Language function, https://reference.wolfram.com/language/ref/BandpassFilter.html (updated 2025).
CMS
Wolfram Language. 2012. "BandpassFilter." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. https://reference.wolfram.com/language/ref/BandpassFilter.html.
APA
Wolfram Language. (2012). BandpassFilter. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/BandpassFilter.html
BibTeX
@misc{reference.wolfram_2026_bandpassfilter, author="Wolfram Research", title="{BandpassFilter}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/BandpassFilter.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_bandpassfilter, organization={Wolfram Research}, title={BandpassFilter}, year={2025}, url={https://reference.wolfram.com/language/ref/BandpassFilter.html}, note=[Accessed: 12-June-2026]}