This example demonstrates how to “filter” sound using the p5.Biquad class. Filters are a core component of sound synthesis and are useful for removing, isolating, or accentuating particular frequency ranges. To learn more about filters see this guide.
The sketch also introduces the p5.Noise class which can be useful for making wind and water sounds. Noise sources can also be “windowed” with the p5.Envelope class to create percussive sounds.
Try experimenting with different kinds of filters such as bandpass, highpass, and lowpass (default).
Filtering Sound: Edited and maintained by p5.js Contributors and Processing Foundation. Licensed under CC BY-NC-SA 4.0.
Related Examples

An image of sound waves rendered in p5.js.
Making a Beep
Creating tones with an Oscillator.

An image of sound waves rendered in p5.js.
Filtering Sound
Simulate the sound of waves and wind with white noise.

An image of sound waves rendered in p5.js.
Playing Melodies
Create melodic music using an array of pitch values.

An image of sound waves rendered in p5.js.
Echo Synth
Trigger a short sound with an echo effect.

An image of sound waves rendered in p5.js.
Sample Playback
Load a soundfile and change its properties.

An image of sound waves rendered in p5.js.
Measuring Amplitude (Visualization)
Analyze the amplitude of sound with p5.Amplitude.

An image of sound waves rendered in p5.js.
Visualizing Sound
Spectral analysis for audio-responsive animations.

An image of sound waves rendered in p5.js.
Connecting to ToneJS
Working with AudioContexts and cross-library synthesis.