
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
dsp-filter-library
Advanced tools
A comprehensive DSP library with 23 window functions, advanced FIR/IIR filter design, biquad combination, and interactive visualization
A comprehensive JavaScript library for digital signal processing filter design and analysis, supporting both IIR and FIR filters with interactive visualization.
npm install dsp-filter-library
import { FilterDSP } from 'dsp-filter-library';
// Design a 6th order Butterworth lowpass filter
const spec = {
family: 'butter',
kind: 'lowpass',
N: 6,
Fs: 48000,
f1: 4000
};
const filter = FilterDSP.designIIR(spec);
// Get frequency response
const response = filter.frequencyGrid(1024);
console.log(response.magdB); // Magnitude in dB
console.log(response.phaseDeg); // Phase in degrees
console.log(response.freqHz); // Frequency points in Hz
// Get impulse response
const impResp = filter.impulseResponse(256);
// Get filter coefficients
console.log(filter.sections); // Second-order sections
// Design a 101-tap Hamming window lowpass filter
const spec = {
kind: 'lowpass',
taps: 101,
Fs: 48000,
f1: 4000,
window: 'hamming'
};
const filter = FilterDSP.designFIR(spec);
// Get filter taps
console.log(filter.taps);
// Get zeros
console.log(filter.zeros());
// Kaiser window with custom β parameter
const kaiserFilter = FilterDSP.designFIR({
kind: 'lowpass',
taps: 101,
Fs: 48000,
f1: 4000,
window: 'kaiser',
beta: 8.6 // Adjustable sidelobe level
});
// Tukey window with custom α parameter
const tukeyFilter = FilterDSP.designFIR({
kind: 'bandpass',
taps: 201,
Fs: 48000,
f1: 2000,
f2: 8000,
window: 'tukey',
alpha: 0.5 // Taper ratio (0=rectangular, 1=hann)
});
// Gaussian window with custom σ parameter
const gaussianFilter = FilterDSP.designFIR({
kind: 'highpass',
taps: 151,
Fs: 48000,
f1: 6000,
window: 'gauss',
sigma: 0.4 // Width parameter
});
// Flat-top window for accurate measurements
const flatTopFilter = FilterDSP.designFIR({
kind: 'lowpass',
taps: 301,
Fs: 48000,
f1: 4000,
window: 'flatTop' // Optimized for amplitude accuracy
});
// Elliptic bandpass filter with custom ripple
const spec = {
family: 'ellip',
kind: 'bandpass',
N: 8,
Rp: 1.0, // Passband ripple (dB)
Rs: 60, // Stopband ripple (dB)
Fs: 48000,
f1: 2000, // Lower cutoff
f2: 8000 // Upper cutoff
};
const filter = FilterDSP.designIIR(spec);
Open example/index.html in your browser to see the interactive filter design tool with real-time visualization.
Designs an IIR filter based on the specification object.
Parameters:
spec.family: Filter family ('butter', 'cheby1', 'cheby2', 'ellip', 'linkwitz', 'bessel')spec.kind: Filter type ('lowpass', 'highpass', 'bandpass', 'bandstop')spec.N: Filter orderspec.Rp: Passband ripple in dB (for Chebyshev I and Elliptic)spec.Rs: Stopband ripple in dB (for Chebyshev II and Elliptic)spec.Fs: Sampling frequency in Hzspec.f1: First cutoff frequency in Hzspec.f2: Second cutoff frequency in Hz (for bandpass/bandstop)Designs an FIR filter using windowed-sinc method.
Parameters:
spec.kind: Filter type ('lowpass', 'highpass', 'bandpass', 'bandstop')spec.taps: Number of filter taps (must be odd)spec.Fs: Sampling frequency in Hzspec.f1: First cutoff frequency in Hzspec.f2: Second cutoff frequency in Hz (for bandpass/bandstop)spec.window: Window function (see supported windows below)spec.beta: Kaiser window β parameter (default: 8.6)spec.alpha: Tukey window α parameter (default: 0.5)spec.sigma: Gaussian window σ parameter (default: 0.4)spec.poissonAlpha: Poisson window α parameter (default: 2.0)Supported Window Functions:
'rect', 'hann', 'hamming', 'blackman''blackmanHarris', 'blackmanNuttall', 'nuttall', 'exactBlackman''bartlett', 'bartlettHann', 'welch', 'triangular''gauss', 'tukey', 'poisson', 'parzen', 'bohman''lanczos', 'cosine', 'flatTop', 'dolphChebyshev', 'taylor', 'kaiser'Returns frequency response data.
nPoints: Number of frequency points to computeReturns:
magdB: Magnitude response in dBphaseDeg: Phase response in degrees (unwrapped)freqHz: Frequency points in HzgdSamples: Group delay in samplespdSamples: Phase delay in samplesReturns impulse response data.
nSamples: Number of samples to computeArray of second-order sections with coefficients a and b.
Array of filter tap coefficients.
Returns array of filter zeros as complex numbers.
Array of filter poles as complex numbers.
Array of filter zeros as complex numbers.
npm install
npm run build
This will generate the library files in the lib/ directory:
dsp-filter-library.js - UMD builddsp-filter-library.min.js - Minified UMD builddsp-filter-library.esm.min.js - ES module buildThe library includes 23 different window functions for FIR filter design, each with specific characteristics:
// Design a lowpass filter for audio
const filter = FilterDSP.designIIR({
family: 'butter',
kind: 'lowpass',
N: 4,
Fs: 44100,
f1: 8000
});
// Process audio samples
const audioSamples = [/* your audio data */];
const filteredSamples = filter.process(audioSamples);
// Analyze filter characteristics
const response = filter.frequencyGrid(2048);
// Find -3dB cutoff frequency
const cutoffIndex = response.magdB.findIndex(mag => mag <= -3);
const cutoffFreq = response.freqHz[cutoffIndex];
// Check stability (poles inside unit circle)
const isStable = filter.zPoles.every(pole =>
Math.sqrt(pole.re * pole.re + pole.im * pole.im) < 1
);
MIT License - see LICENSE file for details.
FAQs
A comprehensive DSP library with 23 window functions, advanced FIR/IIR filter design, biquad combination, and interactive visualization
The npm package dsp-filter-library receives a total of 47 weekly downloads. As such, dsp-filter-library popularity was classified as not popular.
We found that dsp-filter-library demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.