Designing Sound in SuperCollider/Equivalents for Pure Data Objects
The following list is based on the Pure Data (PD) Object Reference Glossary by Christopher Ariza, which is available at the following URL: http://www.flexatone.net/docs/pdg
The coefficients of the SuperCollider examples are adapted to the behavior of the pure data objects.
Sends a series of bangs at a constant rate in miliseconds.
// example: [metro 2012] // 2012 ms = 2.012 s // BPM: 60 / 2.012 = 29.821073558648 // BPS: BPM / 60 = 0.49701789264413 -> ~ 0.497 Hz Impulse.kr((2012/1000).reciprocal); // equals to Impulse.kr(60/(2012/1000)/60);
Band pass filter. Arguments initialize center frequency and Q.
// [bp~] and BPF.ar differ in their behaviour. // This example is just an approximation to [bp~]. BPF.ar(signal, centerFrequency, Q.reciprocal)
The cos~ object outputs the cosine of two pi times its signal input. So -1, 0, 1 and 2 give 1 out, 0.5 gives -1, and so on.
(signal * 2pi).cos
alternatively, use the more common phase modulation and a lookup table:
SinOsc.ar(phase: 0.5pi + (2pi * signal))
Delay a signal. Provide a signal as input to add to a delay line. One or more [delread~] or [vd~] objects can read from the delay line created with the [delwrite~] object.
1st argument: name of delay line 2nd argument: length of delay line in msec (= max. delay time)
// at first: a buffer for the UGens to use buffer = Buffer.alloc(s, s.sampleRate * seconds, 1); // or LocalBuf(s.sampleRate * seconds, 1) ... whatever suits best DelTapWr.ar(buffer, signal)
One-pole high pass filter.
(signal - OnePole.ar(signal, exp(-2pi * (freq * SampleDur.ir))))
One-pole low pass filter.
OnePole.ar(signal, exp(-2pi * (freq * SampleDur.ir)))
Return the larger of two signals.
Return the smaller of two signals.
Uniformly distributed white noise; the output is between -1 and 1.
Sawtooth oscillator. Ramps from 0 to 1; can be considered a Sawtooth waveform between 0 and 1.
LFSaw.ar(0.5, 1, 0.5, 0.5)
Pink noise generator.
Exponentiate a signal.
Delay a signal. One or more independent [vd~] objects can read a delay line from one named [delwrite~] object. The delay line must be named as a construction argument. A signal input will set the delay time in milliseconds.
// works in conjunction with DelTapWr and an allocated buffer DelTapRd.ar(buffer, outputOfDelTapWr, delTime)
The vline~ object, like line~, generates linear ramps whose levels and timing are determined by messages you send it. The messages consist of a target value, a time interval (zero if not supplied), and an initial delay (also zero if not supplied.) Ramps may start and stop between audio samples, in which case the output is interpolated accordingly.
// Equivalent in SuperCollider for the following message sent to [vline~]: [1 1000 500, 0 1000 2500] EnvGen.ar(Env.new([0, 0, 1, 1, 0], [0.5, 1, 1, 1])) // the pure data message means: // go to 1 in 1000ms but wait 500ms from the starting point, // then go to 0 in 1000ms but wait 2500 ms from the starting point: Env.new([0, 0, 1, 1, 0], [0.5, 1, 1, 1]).plot
Remainder modulo 1. The [wrap~] object gives the difference between the input and the largest integer not exceeding it (for positive numbers this is the fractional part).
or use the operator "wrap"