Skip to content

filter.SpecFilt.Function.filterSignal

Christian d'Heureuse edited this page Jun 7, 2026 · 2 revisions

dsp-collection / filter/SpecFilt / filterSignal

Function: filterSignal()

function filterSignal(
   inSamples, 
   filterType, 
   filterFreq1, 
   filterFreq2, 
   smoothingWidth): Float64Array;

Defined in: filter/SpecFilt.ts:123

Filters a signal using FFT and iFFT.

All frequency parameters are normalized frequencies according to the following formula: nomalizedFrequency = frequencyInHz / sampleRate = 1 / waveLengthInSamples

The input signal should ideally be windoweded to prevent artifacts. But this would distort the amplitude curve of the output signal. In practice, the input signal should at least have a fade-in/fade-out.

Parameters

inSamples

ArrayLike<number>

The input signal samples. If the length of the input array is even, the computation is faster. If it's a power of 2, it's even faster.

filterType

FilterType

The filter type (low-pass, high-pass, etc.).

filterFreq1

number

Normalized filter frequency for low-pass or high-pass. Lower filter frequecy for band-pass or band-stop.

filterFreq2

number

Normalized upper filter frequecy for band-pass or band-stop. Ignored for low-pass or high-pass.

smoothingWidth

number

Normalized frequency distance between the start of the smoothing and the -6dB point.

Returns

Float64Array

The filtered output signal samples.

Clone this wiki locally