MSP

Generate a burst of audio pulses

This example shows how you can generate a pulse burst of a certain number of repeated rectangle waves. It allows you to choose how many pulses you want to produce, the rate at which you want them to occur, and the width of the pulse relative to the pulse rate, also known as the duty cycle. The patch uses a phasor~ (with its rate specified by the user) and a <~ object (with its threshold specified by the duty cycle) to generate pulse that goes briefly to 1 then back to 0.

Audio cue chooser

This examples shows a way to choose automatically from a list of preestablished sound cues, with a crossfade between cues rather than a sudden switch.

To do this we have two stereo sfplay~ objects, both of which refer to the same list of sound cues in an sflist~ object, named "cuelist". Instead of sending open and preload messages to each sfplay~ object, you can send those same messages to a single sflist~, and then the sfplay~ objects refer to that object by its name.

Amplitude and decibels

A linear fade-in or fade-out of audio is okay for quick changes that take place in a fraction of a second, but for slower fades one should generally take into account that our subjective sense of loudness more closely conforms to an exponential change in amplitude. This patch allows you to use the slider (or the mod wheel from a MIDI controller) to control the amplitude of white noise in one of three different ways: with straight linear mapping, exponentially (with an exponent of 4), or using a range of 60 decibels.

How the adsr~ object works

The adsr~ object provides a signal in the shape of an ADSR envelope (attack, decay, sustain, release) commonly used in synthesizer design. You specify an attack time in ms (time to get from 0 amplitude to peak amplitude), a decay time in ms (time to settle to the sustain level), a sustain level (an amplitude factor, not a ms time), and a release time in ms (time to return to 0). Those values can all be supplied as initializing arguments, and/or as floats or signals in the second, third, fourth, and fifth inlets.

Delay effects

The tapin~ and tapout~ objects work together to delay sound. The tapin~ creates a place in memory for storing a circular buffer of the most recently received signal. Its argument specifies how many milliseconds of audio it should store. Any connected tapout~ object accesses that memory to get the recent past of an audio signal.