lores~

ADSR filter envelope

An ADSR envelope generator is a common tool for controlling the amplitude of a note, and in fact it can be used to control any parameter of a sound. In this example, one adsr~ object controls the amplitude of a note while another adsr~ controls the cutoff frequency of a lowpass filter on the sound. Both are triggered at the same moment, but they have slightly different parameters for independent envelope shapes.

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.

Calculating Doppler shift for moving virtual sound sources

A stereo spatialization effect can be achieved using x,y coordinates to determine intensity and delay for the sound at each speaker at each moment. The hypothetical listener is placed at a point equidistant from the two speakers. The speakers are each assumed to be at some angle from the listener between 0 and pi radians, with 0 radians being straight to the right, pi/2 radians being directly in front of the listener, and pi radians being to the left.