web synth docs

filter

Filters are audio processing constructs that change the levels different frequency components of a sound. Going into the details of how filters work is out of scope of this guide, but the filters used in web-synth are mostly simple.

The filters for the [fm-synth] and [synth-designer] are both currently based off of [web-audio]'s BiquadFilterNode. The controls of the filter module consist of the standard parameters for a biquad filter and an [envelope-generator] that can be used to set how the filter's cutoff changes over time. The adsr length ms parameter controls how long the envelope is in milliseconds and the [envelope-generator] beneath it allows configuration of exactly how the frequency changes over time.

type

There are several types of filter available, most of which map directly to the built-in filter types of WebAudio's BiquadFilterNode: https://developer.mozilla.org/en-US/docs/Web/API/BiquadFilterNode/type

However, there are also some composition filter types included in web-synth that consist of multiple biquad filters chained in series. Filter types such as order 4 lowpass, order 8 highpass, order 16 lowpass etc. are created by chaining together 2, 4, and 8 biquad filters respectively with their Q factors chosen using an algorithm that preserves a flat [frequency-response] for the composite filter.

The higher the filter order, the sharper the cutoff will be. That means that the transition period between accepted frequencies and rejected frequencies is narrower and the filter sounds much more abrupt.

Image source: https://www.analog.com/en/analog-dialogue/articles/practical-filter-design-precision-adcs.html#

Archive link: https://web.archive.org/web/20210318233302/https://www.analog.com/en/analog-dialogue/articles/practical-filter-design-precision-adcs.html

cutoff frequency

The most important parameter aside from its type for a filter is its cutoff frequency.

In the [fm-synth], If the envelope is disabled, it will be controllable directly via a slider labeled frequency. If the enable envelope checkbox is checked, then an [envelope-generator] will be used to control the frequency.

filter designer

Web synth includes a [filter-designer] [module] which allows composing multiple biquad filters together and viewing the resulting [frequency-response] in a plot. It can be connected via the [patch-network] to other modules or nodes and used to process sound.

bypass

By checking the bypass checkbox, the filter will be bypassed completely and sound will pass through as if the filter doesn't exist.

filter