AutoFilter

AutoFilter is a Tone.Filter with a Tone.LFO connected to the filter cutoff frequency. Setting the LFO rate and depth allows for control over the filter modulation rate and depth.


import { AutoFilter, Oscillator } from "tone";
// create an autofilter and start it's LFO
const autoFilter = new AutoFilter("4n").toDestination().start();
// route an oscillator through the filter and start it
const oscillator = new Oscillator().connect(autoFilter).start();

Hierarchy

Constructor

new AutoFilter (
frequency?:Frequency ,

The rate of the LFO.

baseFrequency?:Frequency ,

The lower value of the LFOs oscillation

octaves?:Positive

The number of octaves above the baseFrequency

) => AutoFilter
new AutoFilter (
options?:Partial<AutoFilterOptions >
) => AutoFilter

Properties

baseFrequency #

Frequency

The minimum value of the filter's cutoff frequency.

blockTime #

readonly Seconds

The number of seconds of 1 processing block (128 samples)

channelCount #

number

channelCount is the number of channels used when up-mixing and down-mixing connections to any inputs to the node. The default value is 2 except for specific nodes where its value is specially determined.

channelCountMode #

ChannelCountMode

channelCountMode determines how channels will be counted when up-mixing and down-mixing connections to any inputs to the node. The default value is "max". This attribute has no effect for nodes with no inputs.

  • "max" - computedNumberOfChannels is the maximum of the number of channels of all connections to an input. In this mode channelCount is ignored.
  • "clamped-max" - computedNumberOfChannels is determined as for "max" and then clamped to a maximum value of the given channelCount.
  • "explicit" - computedNumberOfChannels is the exact value as specified by the channelCount.

channelInterpretation #

ChannelInterpretation

channelInterpretation determines how individual channels will be treated when up-mixing and down-mixing connections to any inputs to the node. The default value is "speakers".

context #

BaseContext

The context belonging to the node.

debug #

boolean

Set this debug flag to log all events that happen in this class.

depth #

Param<"normalRange" >

The range of the filter modulating between the min and max frequency. 0 = no modulation. 1 = full modulation.

disposed #

readonly boolean

Indicates if the instance was disposed. 'Disposing' an instance means that all of the Web Audio nodes that were created for the instance are disconnected and freed for garbage collection.

filter #

Filter

The filter node

frequency #

Signal<"frequency" >

How fast the filter modulates between min and max.

input #

Gain

The effect input node

name #

string

numberOfInputs #

readonly number

The number of inputs feeding into the AudioNode. For source nodes, this will be 0.

numberOfOutputs #

readonly number

The number of outputs of the AudioNode.

octaves #

Positive

The maximum value of the filter's cutoff frequency.

output #

CrossFade

The effect output

sampleTime #

readonly Seconds

The duration in seconds of one sample.

type #

"sine" | "square" | "sawtooth" | "triangle" | "custom" | "sine1" | "sine2" | "sine3" | "sine4" | "sine5" | "sine6" | "sine7" | "sine8" | "sine9" | "sine10" | "sine11" | "sine12" | "sine13" | "sine14" | "sine15" | "sine16" | "sine17" | "sine18" | "sine19" | "sine20" | "sine21" | "sine22" | "sine23" | "sine24" | "sine25" | "sine26" | "sine27" | "sine28" | "sine29" | "sine30" | "sine31" | "sine32" | "square1" | "square2" | "square3" | "square4" | "square5" | "square6" | "square7" | "square8" | "square9" | "square10" | "square11" | "square12" | "square13" | "square14" | "square15" | "square16" | "square17" | "square18" | "square19" | "square20" | "square21" | "square22" | "square23" | "square24" | "square25" | "square26" | "square27" | "square28" | "square29" | "square30" | "square31" | "square32" | "triangle1" | "triangle2" | "triangle3" | "triangle4" | "triangle5" | "triangle6" | "triangle7" | "triangle8" | "triangle9" | "triangle10" | "triangle11" | "triangle12" | "triangle13" | "triangle14" | "triangle15" | "triangle16" | "triangle17" | "triangle18" | "triangle19" | "triangle20" | "triangle21" | "triangle22" | "triangle23" | "triangle24" | "triangle25" | "triangle26" | "triangle27" | "triangle28" | "triangle29" | "triangle30" | "triangle31" | "triangle32" | "sawtooth1" | "sawtooth2" | "sawtooth3" | "sawtooth4" | "sawtooth5" | "sawtooth6" | "sawtooth7" | "sawtooth8" | "sawtooth9" | "sawtooth10" | "sawtooth11" | "sawtooth12" | "sawtooth13" | "sawtooth14" | "sawtooth15" | "sawtooth16" | "sawtooth17" | "sawtooth18" | "sawtooth19" | "sawtooth20" | "sawtooth21" | "sawtooth22" | "sawtooth23" | "sawtooth24" | "sawtooth25" | "sawtooth26" | "sawtooth27" | "sawtooth28" | "sawtooth29" | "sawtooth30" | "sawtooth31" | "sawtooth32"

The type of the LFO's oscillator: See Oscillator.type


import { AutoFilter, Noise } from "tone";
const autoFilter = new AutoFilter().start().toDestination();
const noise = new Noise().start().connect(autoFilter);
autoFilter.type = "square";

static version #

string

The version number semver

wet #

Signal<"normalRange" >

The wet control is how much of the effected will pass through to the output. 1 = 100% effected signal, 0 = 100% dry signal.

Methods

chain #

Connect the output of this node to the rest of the nodes in series.


import { Destination, Filter, Oscillator, Volume } from "tone";
const osc = new Oscillator().start();
const filter = new Filter();
const volume = new Volume(-8);
// connect a node to the filter, volume and then to the master output
osc.chain(filter, volume, Destination);
chain (
...nodes:InputNode []
) => this

connect #

connect the output of a ToneAudioNode to an AudioParam, AudioNode, or ToneAudioNode

connect (
destination:InputNode ,

The output to connect to

outputNum= 0:number ,

The output to connect from

inputNum= 0:number

The input to connect to

) => this

disconnect #

disconnect the output

disconnect (
destination?:InputNode ,
outputNum= 0:number ,
inputNum= 0:number
) => this

dispose #

Dispose and disconnect

dispose ( ) => this

fan #

connect the output of this node to the rest of the nodes in parallel.

fan (
...nodes:InputNode []
) => this

get #

Get the object's attributes.


import { Oscillator } from "tone";
const osc = new Oscillator();
console.log(osc.get());
// returns {"type" : "sine", "frequency" : 440, ...etc}
get ( ) => AutoFilterOptions

static getDefaults #

Returns all of the default options belonging to the class.

getDefaults ( ) => AutoFilterOptions

immediate #

Return the current time of the Context clock without any lookAhead.

immediate ( ) => Seconds

now #

Return the current time of the Context clock plus the lookAhead.

now ( ) => Seconds

set #

Set multiple properties at once with an object.


import { Filter } from "tone";
const filter = new Filter();
// set values using an object
filter.set({
	frequency: 300,
	type: "highpass"
});
set ( ) => this

start #

Start the effect.

start (
time?:Time
) => this

stop #

Stop the lfo

stop (
time?:Time
) => this

sync #

Sync the filter to the transport. See LFO.sync

sync ( ) => this

toDestination #

Connect the output to the context's destination node.

toDestination ( ) => this

toFrequency #

Convert the input to a frequency number

toFrequency (
freq:Frequency
) => Hertz

toMaster # DEPRECATED

Connect the output to the context's destination node. See toDestination

toMaster ( ) => this

toSeconds #

Convert the incoming time to seconds

toSeconds (
time?:Time
) => Seconds

toString #

Convert the class to a string


import { Oscillator } from "tone";
const osc = new Oscillator();
console.log(osc.toString());
toString ( ) => string

toTicks #

Convert the input time into ticks

toTicks (
time?:Time | TimeClass
) => Ticks

unsync #

Unsync the filter from the transport.

unsync ( ) => this