Skip to content
Tone.js

Filter

class Component ↳ extends ToneAudioNode<FilterOptions>

Tone.Filter is a filter which allows for all of the same native methods as the BiquadFilterNode. Tone.Filter has the added ability to set the filter rolloff at -12 (default), -24 and -48.

const filter = new Tone.Filter(1500, "highpass").toDestination();
filter.frequency.rampTo(20000, 10);
const noise = new Tone.Noise().connect(filter).start();
new Filter(frequency?: Frequency, type?: BiquadFilterType, rolloff?: FilterRollOff)

Parameters

  • frequency Frequency optional

    The cutoff frequency of the filter.

  • type BiquadFilterType optional

    The type of filter.

  • rolloff FilterRollOff optional

    The drop in decibels per octave after the cutoff frequency

new Filter(options?: Partial<FilterOptions>)

Parameters

read-only

detune: Signal<"cents">

The detune parameter

read-only

frequency: Signal<"frequency">

The cutoff frequency of the filter.

read-only

gain: Signal<"decibels">

The gain of the filter, only used in certain filter types

read-only

input: Gain<"gain">

The input node or nodes. If the object is a source, it does not have any input and this.input is undefined.

read-only

name: string

The name of the class

Default: "Filter"

read-only

output: Gain<"gain">

The output nodes. If the object is a sink, it does not have any output and this.output is undefined.

read-only

Q: Signal<"positive">

The Q or Quality of the filter

rolloff: FilterRollOff

The rolloff of the filter which is the drop in db per octave. Implemented internally by cascading filters. Only accepts the values -12, -24, -48 and -96.

type: BiquadFilterType

The type of the filter. Types: “lowpass”, “highpass”, “bandpass”, “lowshelf”, “highshelf”, “notch”, “allpass”, or “peaking”.

dispose(): this

Clean up.

Returns this

getFrequencyResponse(len?: number): Float32Array

Get the frequency response curve. This curve represents how the filter responses to frequencies between 20hz-20khz.

Parameters

  • len number optional default 128

    The number of values to return

Returns Float32Array The frequency response curve between 20-20kHz

static

getDefaults(): FilterOptions

Returns all of the default options belonging to the class.

Returns FilterOptions