cycle~

Tempo-relative timing for MSP LFO control

The MSP phasor~ object is frequently used as a low-frequency control signal for audio. Because it is often used to control other signals over a specific period of time, phasor~ can use tempo-relative timing, too. The frequency (rate) of a phasor~ is normally specified in Hertz, but you can alternatively give phasor~ a time interval, using tempo-relative time units, and it will use the inverse of that to determine its frequency.

Phase distortion synthesis in a poly~ subpatch

This shows an implementation of phase distortion synthesis in MSP—using the phasor~, kink~, and cycle~ objects—in a patch that is designed to be used inside the poly~ object. For an explanation of this sort of phase distortion synthesis, see “A demonstration of phase distortion synthesis.” The main point of this example, though, is to show how a synthesis patch can be designed to respond directly to MIDI input.

Constant power panning using table lookup

In "Constant power panning using square root of intensity" we used the square root of the desired intensity for each speaker to calculate the amplitude of each speaker. However, square root calculations are somewhat computationally intensive, and it would be nice if we could somehow avoid having to perform two such calculations for every single audio sample. As it happens, the sum of the squares of sine and cosine functions also equals 1.

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).

Bandpass filter swept with a LFO

This example demonstrates one of MSP's many filter objects—the resonant bandpass filter reson~—and demonstrates how a parameter of that filter—in this case its center frequency—can be easily modulated by a low-frequency control oscillator (cycle~). The range of cycle~ is between 1 and -1, but that range can be amplified by multiplication, and can be offset by addition.

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.