A p5.Filter uses a Web Audio Biquad Filter to filter the frequency response of an input source. Subclasses include:
p5.LowPass
: Allows frequencies below the cutoff frequency to pass through, and attenuates frequencies above the cutoff.p5.HighPass
: The opposite of a lowpass filter.p5.BandPass
: Allows a range of frequencies to pass through and attenuates the frequencies below and above this frequency range.The .res()
method controls either width of the bandpass, or resonance of the low/highpass cutoff frequency.
This class extends p5.Effect. Methods amp(), chain(), drywet(), connect(), and disconnect() are available.
Examples
Syntax
p5.Filter([type])
Parameters
'lowpass' (default), 'highpass', 'bandpass'
Fields
The p5.Filter is built with a Web Audio BiquadFilter Node.
Methods
Filter an audio signal according to a set of filter parameters.
Set the frequency and the resonance of the filter.
Set the filter frequency, in Hz, from 10 to 22050 (the range of human hearing, although in reality most people hear in a narrower range).
Controls either width of a bandpass frequency, or the resonance of a low/highpass cutoff frequency.
Controls the gain attribute of a Biquad Filter. This is distinctly different from .amp() which is inherited from p5.Effect .amp() controls the volume via the output gain node p5.Filter.gain() controls the gain parameter of a Biquad Filter node.
Toggle function. Switches between the specified type and allpass
Set the type of a p5.Filter. Possible types include: "lowpass" (default), "highpass", "bandpass", "lowshelf", "highshelf", "peaking", "notch", "allpass".