line~

Trapezoidal control signals

The trapezoid~ object outputs a trapezoidal shape, rising linearly from 0 to 1 in a certain fraction of its time, then staying at 1, then falling linearly back to 0 in a fraction of its time. Its timing is driven by a control signal at its input, one that goes in a straight line from 0 to 1; so a phasor~ or a line~ is the obvious choice for input to trapezoid~. As the input goes from 0 to 1, the output draws the designated trapezoidal shape.

Interface for a flanger

This patch shows an appropriate interface for a flanger, including dials to control delay time, flanging rate, flanging depth, and control over the mix between the dry (unaltered) and wet (altered) signal. Control over the dry/wet mix is a good thing to include in most audio effects.

MIDI mapping to amplitude

Mapping one range of values to another needed range of values is a crucial technique in computer music. In this example, we want to map MIDI data values that range from 0 to 127 into a useful range for controlling the amplitude—and thus the loudness—of a sound in MSP.

Linear control signal

The phasor~ object produces a linear control signal that goes repeatedly from 0 to 1. That's demonstrated in the upper left part of this patch. In general, a control signal that goes gradually in a straight line from one value to another is quite useful, but you don't always want it to repeat over and over the way that phasor~ does.

Using a sustain point in a function object

When you play a note with MIDI, you usually want the note to sustain as long as the key is held down, then you want it to turn off (either immediately or gradually) when the key is released (when the note-off message is received). Because MIDI is designed to function in real time, in live performance, there is no duration information contained in a note-on message. The duration can only be known once the key has been released.