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();
Constructor
Section titled “Constructor”new Filter(frequency?: Frequency, type?: BiquadFilterType, rolloff?: FilterRollOff)Parameters
-
frequency
FrequencyoptionalThe cutoff frequency of the filter.
-
type
BiquadFilterTypeoptionalThe type of filter.
-
rolloff
FilterRollOffoptionalThe drop in decibels per octave after the cutoff frequency
new Filter(options?: Partial<FilterOptions>)Parameters
- options
Partial<FilterOptions>optional
Properties
Section titled “Properties”frequency
Section titled “frequency”read-only
frequency: Signal<"frequency">The cutoff frequency of the filter.
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.
output
Section titled “output”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.
rolloff
Section titled “rolloff”rolloff: FilterRollOffThe 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: BiquadFilterTypeThe type of the filter. Types: “lowpass”, “highpass”, “bandpass”, “lowshelf”, “highshelf”, “notch”, “allpass”, or “peaking”.
Methods
Section titled “Methods”getFrequencyResponse()
Section titled “getFrequencyResponse()”getFrequencyResponse(len?: number): Float32ArrayGet the frequency response curve. This curve represents how the filter responses to frequencies between 20hz-20khz.
Parameters
-
len
numberoptional default128The number of values to return
Returns Float32Array The frequency response curve between 20-20kHz
getDefaults()
Section titled “getDefaults()”static
getDefaults(): FilterOptionsReturns all of the default options belonging to the class.
Returns FilterOptions
Inherited members
Section titled “Inherited members”- From
ToneWithContext: context, blockTime, sampleTime, get(), immediate(), now(), set(), toFrequency(), toSeconds(), toTicks() - From
Tone: debug, version, disposed, toString() - From
ToneAudioNode: channelCount, channelCountMode, channelInterpretation, numberOfInputs, numberOfOutputs, chain(), connect(), disconnect(), fan(), toDestination(), toMaster()