filters

Rhythmic filtered noise bursts

This example demonstrates how the settings of a resonant bandpass filter can be altered in a rhythmic way for musical effect. The three table objects each contain 16 numbers, which will be used as the parameter settings for gain, center frequency, and Q in a reson~ object. The numbers in the table objects are looked up by a counter that cycles repeatedly through the table indices, 0 to 15.

Resonant bandpass filter

The reson~ object is a resonant bandpass filter; it passes frequencies in a specified region, and attenuates the other frequencies. It requires only three parameter values: input gain, center (resonated) frequency, and a resonance quality factor (Q). The Q determines the bandwidth of the passed region around the center frequency. Specifically, Q is defined as center frequency divided by bandwidth, where bandwidth is the extent, in Hertz, above and below the center frequency before the frequencies will be significantly attenuated.

Resonant lowpass filter

The lores~ object is a resonant lowpass filter. It requires only two parameter values: the cutoff frequency and a resonance factor from 0 to 1. Increasing the resonance will increase the steepness of the filter (increase the attenuation effect on frequencies above the cutoff) and also will accentuate the frequencies right around the cutoff. Experiment with different resonance values between 0 and 1 to hear the effect, and try sweeping the cutoff frequency through different registers.

The simplest lowpass filter

Almost all digital filters involve mixing a sound with one or more delayed versions of itself, usually to cause interference and thus change the amplitude at certain frequencies. The very simplest imaginable example is to delay a sound by exactly one sample, and then take the average of the current sample and the previous (delayed) sample. The result of this averaging process is that the signal is smoothed slightly, reducing the high frequencies: a lowpass filter.

Comb filter

When a sound is mixed with a delayed version of itself, each sinusoidal component of the delayed sound has a unique phase offset compared to the original, so each frequency is accentuated or attenuated differently. For example, if a 1000 Hz sinusoid is delayed by 1/1000 of a second (1 millisecond), the original and the delayed version will still be perfectly in phase, so that frequency will be increased in amplitude when the two versions are added together.