Polyphony Tutorial 3: Audio-Rate Control Data
This tutorial looks at using the poly~ object to generate low-frequency oscillators (LFOs) to generate control-rate data for Max objects. There are many tasks in Max (such as graphics) that don't require control updates at audio rate (44,100 per second, or higher), and simply need to receive new values regularly at a lower speed. For example, a video processing patcher running at 30 frames per second would only need new information for all of its parameters every 33 milliseconds. At the same time, MSP signal generators make excellent choices for designing periodic sources of control information. The poly~ object has a simple way to downsample the audio processing in an abstraction, so that it can be used to create control-rate data in Max without the CPU overhead of working at audio rate.
Using cosine waves of different frequencies as the X and Y inputs of a drawing surface (such as an oscilloscope) creates something called lissajous curves. These patterns visually describe complex harmonic motion, so that X and Y patterns in simple ratios will create pre-determined repeating shapes.
Notice how simple our abstraction seems, with an in object allowing use to set the frequency of a cycle~ object. A second in object provides messages to a snapshot~. The snapshot~ object allows us to capture single values of MSP signals as floating-point numbers generated as Max events. Whenever a snapshot~ receives a , it samples the current MSP signal at its inlet and outputs that one sample as a floating-point value. In our tutorial, this value then goes to an out object, and back into our main patcher.
The phasor~ object generates ramps from to , so we scale the output to go between and with the *~ and -~ objects before we sample it with the snapshot~abstraction does the same as , but generates its output as a sawtooth wave rather than a cosine wave. The
The triangle~ object. The triangle~ object wraps a phasor~ around a midpoint, essentially translating it into a triangular waveform. This object outputs values between and , so it doesn't require any scaling.object generats a triangular output by using a
When working with an abstraction inside of a poly~ object, you can decide to work at a lower or higher sampling rate than your main MSP patcher. This rate is not specified directly, but as a divisor or multiplier of the main rate. The arguments will make the poly~ run at twice the sampling rate of the main patcher. The arguments , as shown here, run the audio within the poly~ objects at one eighth the normal speed (i.e. 5.5125kHz if the main patcher runs at 44.1kHz). Since we're only sampling our oscillator values once every frame of the drawing (set by the metro speed at 50Hz or every 20ms), this is more than enough resolution for our control data.
The poly~ object can work at a different sampling rate than its host MSP patcher. The and arguments allow you to specify a multiplier or divisor for the main sampling rate. When designing LFOs (low frequency oscillators), it's often useful to use massively downsampled MSP patchers inside of poly~ objects to generate the curves efficiently. the snapshot~ object allows you to sample a single value from an MSP signal in response to a .
|snapshot~||Convert signal values to numbers|