*~

Smooth filter changes

If you want to change the coefficients of biquad~ in real time while a sound is playing, it's usually better to use MSP signals rather than individual Max messages, to avoid causing clicks. In that case, you should replace filtergraph~ with filtercoeff~ and send the frequency, gain, and Q parameters into filtercoeff~ as smooth signals (as shown in the left portion of the example).

Variable-mode filter demo

This patch allows you to try out various filter settings of the biquad~ object, via the filtergraph~ object. For adjusting the parameters you can drag on filtergraph~ with the mouse, or you can send values in its three rightmost inlets for frequency, gain, and Q. The spectroscope~ object tries to draw the spectrum of the signal.

Linear interpolation of audio

For linear interpolation of a MSP signal, the line~ object sends out a signal that progress to some new value over a certain amount of time interpolating sample-by-sample along the way. The input to line~ is a pair of numbers representing a destination value (where it should eventually arrive) and a transition time (how long it should take to get there). It can receive multiple pairs of numbers in a single message, and it will use the pairs in order, starting each new pair when the previous transition has finished.

Stop a modulating oscillator

When you want to turn off an oscillator in MSP, you don’t literally stop it or turn it off, you just turn its amplitude to 0; you multiply it by a constant value of 0 so that the resulting signal is 0. Setting an oscillator’s frequency to 0 does not turn the oscillator off, it just stops it dead in its tracks. (It is completing exactly 0 cycles per second, meaning it’s going nowhere.) It will continue to output whatever value it was at when its frequency was turned to 0, which in all likelihood will not be exactly at the value 0.