de.sciss.synth.ugen

Type members

Classlikes

object A2K extends ProductReader[A2K]

A converter UGen that takes an audio-rate input and produces a control-rate output by means of sampling. The sample is always taken at the beginning of each control-block, while all other samples of the audio-rate input within that block are ignored.

A converter UGen that takes an audio-rate input and produces a control-rate output by means of sampling. The sample is always taken at the beginning of each control-block, while all other samples of the audio-rate input within that block are ignored.

See also
Companion
class
final case
class A2K(in: GE) extends SingleOut with ControlRated

A converter UGen that takes an audio-rate input and produces a control-rate output by means of sampling. The sample is always taken at the beginning of each control-block, while all other samples of the audio-rate input within that block are ignored.

A converter UGen that takes an audio-rate input and produces a control-rate output by means of sampling. The sample is always taken at the beginning of each control-block, while all other samples of the audio-rate input within that block are ignored.

Value Params
in

audio-rate signal to convert

See also
Companion
object
object APF extends ProductReader[APF]
Companion
class
final case
class APF(rate: MaybeRate, in: GE, freq: GE, radius: GE) extends SingleOut
Companion
object
object AllpassC extends ProductReader[AllpassC]

All pass delay line with cubic interpolation.

All pass delay line with cubic interpolation.

See also
Companion
class
final case
class AllpassC(rate: Rate, in: GE, maxDelayTime: GE, delayTime: GE, decayTime: GE) extends SingleOut

All pass delay line with cubic interpolation.

All pass delay line with cubic interpolation.

Value Params
decayTime

Time for the echoes to decay by 60 decibels. If this time is negative then the feedback coefficient will be negative, thus emphasizing only odd harmonics at an octave lower.

delayTime

Delay time in seconds.

in

The input signal.

maxDelayTime

The maximum delay time in seconds. used to initialize the delay buffer size. ''(init-time only)''

See also
Companion
object
object AllpassL extends ProductReader[AllpassL]

All pass delay line with linear interpolation.

All pass delay line with linear interpolation.

See also
Companion
class
final case
class AllpassL(rate: Rate, in: GE, maxDelayTime: GE, delayTime: GE, decayTime: GE) extends SingleOut

All pass delay line with linear interpolation.

All pass delay line with linear interpolation.

Value Params
decayTime

Time for the echoes to decay by 60 decibels. If this time is negative then the feedback coefficient will be negative, thus emphasizing only odd harmonics at an octave lower.

delayTime

Delay time in seconds.

in

The input signal.

maxDelayTime

The maximum delay time in seconds. used to initialize the delay buffer size. ''(init-time only)''

See also
Companion
object
object AllpassN extends ProductReader[AllpassN]

All pass delay line with no interpolation.

All pass delay line with no interpolation.

See also
Companion
class
final case
class AllpassN(rate: Rate, in: GE, maxDelayTime: GE, delayTime: GE, decayTime: GE) extends SingleOut

All pass delay line with no interpolation.

All pass delay line with no interpolation.

Value Params
decayTime

Time for the echoes to decay by 60 decibels. If this time is negative then the feedback coefficient will be negative, thus emphasizing only odd harmonics at an octave lower.

delayTime

Delay time in seconds.

in

The input signal.

maxDelayTime

The maximum delay time in seconds. used to initialize the delay buffer size. ''(init-time only)''

See also
Companion
object
object AmpComp extends ProductReader[AmpComp]

A UGen that produces a psychoacoustic amplitude compensation factor for a given frequency.

A UGen that produces a psychoacoustic amplitude compensation factor for a given frequency.

Implements the formula: (root / freq).pow(exp)

Higher frequencies are normally perceived as louder, therefore AmpComp outputs lower values for them. For example, with default parameters, the pitch C4 (frequency 262 Hz) produces the base factor of 1.0, whereas a pitch one octave up, C5 (or 523 Hz) produces a factor of 0.793719 (an attenuation of -2 dB).

An alternative is AmpCompA that better models the bell-shaped equal loudness contours of the hearing system. Especially note that the output of this UGen can become very high for frequencies much lower than the root parameter.

===Examples===

// activate with mouse button
play {
 val freq = MouseX.kr(300, 15000, 1)
 val mod  = freq * SinOsc.ar(MouseY.kr(3, 200, 1)).mulAdd(0.5, 1)
 val corr = AmpComp.ar(mod, 300) * 2
 val amp  = Select.ar(MouseButton.kr(lag = 0), Seq(DC.ar(1), corr))
 SinOsc.ar(mod) * 0.1 * amp
}
See also
Companion
class
final case
class AmpComp(rate: Rate, freq: GE, root: GE, expon: GE) extends SingleOut

A UGen that produces a psychoacoustic amplitude compensation factor for a given frequency.

A UGen that produces a psychoacoustic amplitude compensation factor for a given frequency.

Implements the formula: (root / freq).pow(exp)

Higher frequencies are normally perceived as louder, therefore AmpComp outputs lower values for them. For example, with default parameters, the pitch C4 (frequency 262 Hz) produces the base factor of 1.0, whereas a pitch one octave up, C5 (or 523 Hz) produces a factor of 0.793719 (an attenuation of -2 dB).

An alternative is AmpCompA that better models the bell-shaped equal loudness contours of the hearing system. Especially note that the output of this UGen can become very high for frequencies much lower than the root parameter.

Value Params
expon

the exponent determines how steep the compensation curve decreases for increasing frequencies. In general, the louder a signal is played, the shallower the equal loudness contours become.

freq

the frequency in Hertz for which to determine the compensation factor

root

the base frequency corresponding to a compensation factor of 1.0

See also
Companion
object
object AmpCompA extends ProductReader[AmpCompA]

A UGen that produces a psychoacoustic amplitude compensation factor for a given frequency. It uses the A-weighting curve that is based on the Fletcher-Munson curve for rather low volume sounds (40 phon).

A UGen that produces a psychoacoustic amplitude compensation factor for a given frequency. It uses the A-weighting curve that is based on the Fletcher-Munson curve for rather low volume sounds (40 phon).

Only the freq parameter can be modulated, the other parameters are read at initialization time only.

===Examples===

// activate with mouse button
play {
 val freq = MouseX.kr(300, 15000, 1)
 val mod  = freq * SinOsc.ar(MouseY.kr(3, 200, 1)).mulAdd(0.5, 1)
 val corr = AmpCompA.ar(mod, 300) * 2
 val amp  = Select.ar(MouseButton.kr(lag = 0), Seq(DC.ar(1), corr))
 SinOsc.ar(mod) * 0.1 * amp
}
See also
Companion
class
final case
class AmpCompA(rate: Rate, freq: GE, root: GE, minAmp: GE, rootAmp: GE) extends SingleOut

A UGen that produces a psychoacoustic amplitude compensation factor for a given frequency. It uses the A-weighting curve that is based on the Fletcher-Munson curve for rather low volume sounds (40 phon).

A UGen that produces a psychoacoustic amplitude compensation factor for a given frequency. It uses the A-weighting curve that is based on the Fletcher-Munson curve for rather low volume sounds (40 phon).

Only the freq parameter can be modulated, the other parameters are read at initialization time only.

Value Params
freq

the frequency in Hertz for which to determine the compensation factor

minAmp

amplitude at the minimum point of the curve. This is the factor output when freq is approx. 2512 Hz. ''(init-time only)''

root

the root frequency in Hertz, relative to which the curve is calculated. This is usually lowest expected frequency. ''(init-time only)''

rootAmp

amplitude at the root frequency of the curve. This is the factor output when freq == root . ''(init-time only)''

See also
Companion
object
object Amplitude extends ProductReader[Amplitude]

An amplitude follower UGen. Tracks and reports the peak amplitude of its input signal.

An amplitude follower UGen. Tracks and reports the peak amplitude of its input signal.

===Examples===

// use sound-card input to control pulse amplitude
play {
 // use headphones to prevent feedback!
 Pulse.ar(90, 0.3) * Amplitude.kr(PhysicalIn.ar(0))
}
// compare with known amplitude
play {
 val amp = MouseX.kr
 val in  = PinkNoise.ar(amp)
 val ana = Amplitude.kr(amp, attack = 2, release = 2)
 (ana - amp).poll(2, "discrepancy")
 in
}
See also
Companion
class
final case
class Amplitude(rate: MaybeRate, in: GE, attack: GE, release: GE) extends SingleOut

An amplitude follower UGen. Tracks and reports the peak amplitude of its input signal.

An amplitude follower UGen. Tracks and reports the peak amplitude of its input signal.

Value Params
attack

60 dB convergence time in for following attacks, in seconds

in

input signal to be analyzed

release

60 dB convergence time in for following decays, in seconds

See also
Companion
object
object BAllPass extends ProductReader[BAllPass]

An all pass filter UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

An all pass filter UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

Note: Biquad coefficient calculations imply certain amount of CPU overhead. These plugin UGens contain optimizations such that the coefficients get updated only when there has been a change to one of the filter's parameters. This can cause spikes in CPU performance and should be considered when using several of these units.

Companion
class
final case
class BAllPass(in: GE, freq: GE, rq: GE) extends SingleOut with AudioRated

An all pass filter UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

An all pass filter UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

Note: Biquad coefficient calculations imply certain amount of CPU overhead. These plugin UGens contain optimizations such that the coefficients get updated only when there has been a change to one of the filter's parameters. This can cause spikes in CPU performance and should be considered when using several of these units.

Value Params
freq

cutoff frequency.

in

input signal to be processed.

rq

the reciprocal of Q, hence bandwidth / cutoffFreq.

Companion
object
object BBandPass extends ProductReader[BBandPass]

An band pass filter UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

An band pass filter UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

Note: Biquad coefficient calculations imply certain amount of CPU overhead. These plugin UGens contain optimizations such that the coefficients get updated only when there has been a change to one of the filter's parameters. This can cause spikes in CPU performance and should be considered when using several of these units.

Companion
class
final case
class BBandPass(in: GE, freq: GE, bw: GE) extends SingleOut with AudioRated

An band pass filter UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

An band pass filter UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

Note: Biquad coefficient calculations imply certain amount of CPU overhead. These plugin UGens contain optimizations such that the coefficients get updated only when there has been a change to one of the filter's parameters. This can cause spikes in CPU performance and should be considered when using several of these units.

Value Params
bw

the bandwidth '''in octaves''' between -3 dB frequencies

freq

center frequency.

in

input signal to be processed.

Companion
object
object BBandStop extends ProductReader[BBandStop]

An band stop (reject) filter UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

An band stop (reject) filter UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

Note: Biquad coefficient calculations imply certain amount of CPU overhead. These plugin UGens contain optimizations such that the coefficients get updated only when there has been a change to one of the filter's parameters. This can cause spikes in CPU performance and should be considered when using several of these units.

Companion
class
final case
class BBandStop(in: GE, freq: GE, bw: GE) extends SingleOut with AudioRated

An band stop (reject) filter UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

An band stop (reject) filter UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

Note: Biquad coefficient calculations imply certain amount of CPU overhead. These plugin UGens contain optimizations such that the coefficients get updated only when there has been a change to one of the filter's parameters. This can cause spikes in CPU performance and should be considered when using several of these units.

Value Params
bw

the bandwidth '''in octaves''' between -3 dB frequencies

freq

center frequency.

in

input signal to be processed.

Companion
object
object BHiPass extends ProductReader[BHiPass]

A 2nd order (12db per oct roll-off) resonant high pass filter UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

A 2nd order (12db per oct roll-off) resonant high pass filter UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

Note: Biquad coefficient calculations imply certain amount of CPU overhead. These plugin UGens contain optimizations such that the coefficients get updated only when there has been a change to one of the filter's parameters. This can cause spikes in CPU performance and should be considered when using several of these units.

Companion
class
final case
class BHiPass(in: GE, freq: GE, rq: GE) extends SingleOut with AudioRated

A 2nd order (12db per oct roll-off) resonant high pass filter UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

A 2nd order (12db per oct roll-off) resonant high pass filter UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

Note: Biquad coefficient calculations imply certain amount of CPU overhead. These plugin UGens contain optimizations such that the coefficients get updated only when there has been a change to one of the filter's parameters. This can cause spikes in CPU performance and should be considered when using several of these units.

Value Params
freq

cutoff frequency.

in

input signal to be processed.

rq

the reciprocal of Q, hence bandwidth / cutoffFreq.

Companion
object
object BHiShelf extends ProductReader[BHiShelf]

A high shelf equalizer UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

A high shelf equalizer UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

Note: Biquad coefficient calculations imply certain amount of CPU overhead. These plugin UGens contain optimizations such that the coefficients get updated only when there has been a change to one of the filter's parameters. This can cause spikes in CPU performance and should be considered when using several of these units.

Companion
class
final case
class BHiShelf(in: GE, freq: GE, rs: GE, gain: GE) extends SingleOut with AudioRated

A high shelf equalizer UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

A high shelf equalizer UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

Note: Biquad coefficient calculations imply certain amount of CPU overhead. These plugin UGens contain optimizations such that the coefficients get updated only when there has been a change to one of the filter's parameters. This can cause spikes in CPU performance and should be considered when using several of these units.

Value Params
freq

cutoff frequency.

gain

boost/cut at the cutoff frequency (in decibels).

in

input signal to be processed.

rs

the reciprocal of the slope S (Shell boost/cut slope). When S = 1 , the shelf slope is as steep as it can be and remain monotonically increasing or decreasing gain with frequency. The shelf slope, in dB/octave, remains proportional to S for all other values for a fixed freq/sample-rate and gain .

Companion
object
object BLowPass extends ProductReader[BLowPass]

A 2nd order (12db per oct roll-off) resonant low pass filter UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

A 2nd order (12db per oct roll-off) resonant low pass filter UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

Note: Biquad coefficient calculations imply certain amount of CPU overhead. These plugin UGens contain optimizations such that the coefficients get updated only when there has been a change to one of the filter's parameters. This can cause spikes in CPU performance and should be considered when using several of these units.

Companion
class
final case
class BLowPass(in: GE, freq: GE, rq: GE) extends SingleOut with AudioRated

A 2nd order (12db per oct roll-off) resonant low pass filter UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

A 2nd order (12db per oct roll-off) resonant low pass filter UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

Note: Biquad coefficient calculations imply certain amount of CPU overhead. These plugin UGens contain optimizations such that the coefficients get updated only when there has been a change to one of the filter's parameters. This can cause spikes in CPU performance and should be considered when using several of these units.

Value Params
freq

cutoff frequency.

in

input signal to be processed.

rq

the reciprocal of Q, hence bandwidth / cutoffFreq.

Companion
object
object BLowShelf extends ProductReader[BLowShelf]

A low shelf equalizer UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

A low shelf equalizer UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

Note: Biquad coefficient calculations imply certain amount of CPU overhead. These plugin UGens contain optimizations such that the coefficients get updated only when there has been a change to one of the filter's parameters. This can cause spikes in CPU performance and should be considered when using several of these units.

Companion
class
final case
class BLowShelf(in: GE, freq: GE, rs: GE, gain: GE) extends SingleOut with AudioRated

A low shelf equalizer UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

A low shelf equalizer UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

Note: Biquad coefficient calculations imply certain amount of CPU overhead. These plugin UGens contain optimizations such that the coefficients get updated only when there has been a change to one of the filter's parameters. This can cause spikes in CPU performance and should be considered when using several of these units.

Value Params
freq

cutoff frequency.

gain

boost/cut at the cutoff frequency (in decibels).

in

input signal to be processed.

rs

the reciprocal of the slope S (Shell boost/cut slope). When S = 1 , the shelf slope is as steep as it can be and remain monotonically increasing or decreasing gain with frequency. The shelf slope, in dB/octave, remains proportional to S for all other values for a fixed freq/sample-rate and gain .

Companion
object
object BPF extends ProductReader[BPF]

A second order band pass filter UGen.

A second order band pass filter UGen.

===Examples===

// modulated frequency
play {
 val in   = Saw.ar(200) * 0.5
 val freq = SinOsc.ar(XLine.ar(0.3, 100, 20)).mulAdd(3600, 4000)
 BPF.ar(in, freq)
}
// mouse controlled frequency and Q
play {
 val in   = WhiteNoise.ar(0.5)
 val freq = MouseX.kr(200, 10000, 1)
 val q    = MouseY.kr(1, 100, 1) // bottom to top
 val flt  = BPF.ar(in, freq, q.reciprocal)
 flt * q.sqrt // compensate for energy loss
}
See also
Companion
class
final case
class BPF(rate: MaybeRate, in: GE, freq: GE, rq: GE) extends SingleOut

A second order band pass filter UGen.

A second order band pass filter UGen.

Value Params
freq

center frequency in Hertz

in

input signal to be filtered

rq

reciprocal of Q. The Q (or quality) is conventionally defined as center-frequency / bandwidth, meaning that rq  = bandwidth / center-frequency. A higher Q or lower rq produces a steeper filter.

See also
Companion
object
object BPZ2 extends ProductReader[BPZ2]

a special fixed band-pass filter UGen. Implements the formula :

a special fixed band-pass filter UGen. Implements the formula :

out(i) = 0.5 * (in(i) - in(i-2))

This filter cuts out frequencies around zero Hertz and Nyquist.

===Examples===

// engage with mouse button
play {
 val sig = WhiteNoise.ar(0.5)
 val flt = BPZ2.ar(sig)
 LinXFade2.ar(sig, flt, MouseButton.kr(-1, 1))
}
See also
Companion
class
final case
class BPZ2(rate: MaybeRate, in: GE) extends SingleOut

a special fixed band-pass filter UGen. Implements the formula :

a special fixed band-pass filter UGen. Implements the formula :

out(i) = 0.5 * (in(i) - in(i-2))

This filter cuts out frequencies around zero Hertz and Nyquist.

Value Params
in

input signal to be filtered

See also
Companion
object
object BPeakEQ extends ProductReader[BPeakEQ]

An parametric equalizer UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

An parametric equalizer UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

Note: Biquad coefficient calculations imply certain amount of CPU overhead. These plugin UGens contain optimizations such that the coefficients get updated only when there has been a change to one of the filter's parameters. This can cause spikes in CPU performance and should be considered when using several of these units.

Companion
class
final case
class BPeakEQ(in: GE, freq: GE, rq: GE, gain: GE) extends SingleOut with AudioRated

An parametric equalizer UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

An parametric equalizer UGen. The B equalization suite is based on the Second Order Section (SOS) biquad UGen.

Note: Biquad coefficient calculations imply certain amount of CPU overhead. These plugin UGens contain optimizations such that the coefficients get updated only when there has been a change to one of the filter's parameters. This can cause spikes in CPU performance and should be considered when using several of these units.

Value Params
freq

center frequency.

gain

boost/cut at the center frequency (in decibels).

in

input signal to be processed.

rq

the reciprocal of Q, hence bandwidth / cutoffFreq.

Companion
object
object BRF extends ProductReader[BRF]

A second order band reject (notch) filter UGen.

A second order band reject (notch) filter UGen.

===Examples===

// modulated frequency
play {
 val in   = Saw.ar(200) * 0.5
 val freq = SinOsc.ar(XLine.ar(0.3, 100, 20)).mulAdd(3600, 4000)
 BRF.ar(in, freq)
}
// mouse controlled frequency and Q
play {
 val in   = WhiteNoise.ar(0.5)
 val freq = MouseX.kr(200, 10000, 1)
 val q    = MouseY.kr(0.5, 10, 1) // bottom to top
 BRF.ar(in, freq, q.reciprocal)
}
See also
Companion
class
final case
class BRF(rate: MaybeRate, in: GE, freq: GE, rq: GE) extends SingleOut

A second order band reject (notch) filter UGen.

A second order band reject (notch) filter UGen.

Value Params
freq

center frequency in Hertz

in

input signal to be filtered

rq

reciprocal of Q. The Q (or quality) is conventionally defined as center-frequency / bandwidth, meaning that rq  = bandwidth / center-frequency. A higher Q or lower rq produces a steeper filter. Too high values for rq may blow the filter up!

See also
Companion
object
object BRZ2 extends ProductReader[BRZ2]

a special fixed band-reject filter UGen. Implements the formula :

a special fixed band-reject filter UGen. Implements the formula :

out(i) = 0.5 * (in(i) + in(i-2))

This filter cuts out frequencies around half of the Nyquist frequency.

===Examples===

// engage with mouse button
play {
 val sig = WhiteNoise.ar(0.5)
 val flt = BRZ2.ar(sig)
 LinXFade2.ar(sig, flt, MouseButton.kr(-1, 1))
}
See also
Companion
class
final case
class BRZ2(rate: MaybeRate, in: GE) extends SingleOut

a special fixed band-reject filter UGen. Implements the formula :

a special fixed band-reject filter UGen. Implements the formula :

out(i) = 0.5 * (in(i) + in(i-2))

This filter cuts out frequencies around half of the Nyquist frequency.

Value Params
in

input signal to be filtered

See also
Companion
object
object Balance2 extends ProductReader[Balance2]

An equal power two channel balancing UGen. It takes a left and right input signal and attenuates them according to the pos value, producing again a stereophonic output.

An equal power two channel balancing UGen. It takes a left and right input signal and attenuates them according to the pos value, producing again a stereophonic output.

See also
Companion
class
final case
class Balance2(rate: Rate, inL: GE, inR: GE, pos: GE, level: GE) extends MultiOut

An equal power two channel balancing UGen. It takes a left and right input signal and attenuates them according to the pos value, producing again a stereophonic output.

An equal power two channel balancing UGen. It takes a left and right input signal and attenuates them according to the pos value, producing again a stereophonic output.

Value Params
inL

The left input signal

inR

The right input signal

pos

The balance position from -1 (left only, right muted) to +1 (right only, left muted). The curve follows an equal power law, such that left.squared + right.squared == 1 , e.g. at the middle position 0 , both channels are multiplied with factor sqrt(0.5) = 0.707 = -3 dB .

See also
Companion
object
object Ball extends ProductReader[Ball]
Companion
class
final case
class Ball(rate: MaybeRate, in: GE, g: GE, damp: GE, friction: GE) extends SingleOut
Companion
object
object BeatTrack extends ProductReader[BeatTrack]

An autocorrelation based beat tracker UGen.

An autocorrelation based beat tracker UGen.

The underlying model assumes 4/4, but it should work on any isochronous beat structure, though there are biases to 100-120 bpm; a fast 7/8 may not be tracked in that sense. There are '''four''' control-rate outputs, being ticks at quarter, eighth and sixteenth level from the determined beat, and the current detected tempo. Note that the sixteenth note output won't necessarily make much sense if the music being tracked has swing; it is provided just as a convenience.

This beat tracker determines the beat, biased to the mid-tempo range by weighting functions. It does not determine the measure level, only a tactus. It is also slow reacting, using a 6 second temporal window for its autocorrelation maneuvres. Don't expect human musician level predictive tracking.

On the other hand, it is tireless, relatively general (though obviously best at transient 4/4 heavy material without much expressive tempo variation), and can form the basis of computer processing that is decidedly faster than human.

'''Warning''': This UGen only works properly at 44.1 or 48.0 kHz.

Companion
class
final case
class BeatTrack(chain: GE, lock: GE) extends SingleOut with ControlRated with IsIndividual

An autocorrelation based beat tracker UGen.

An autocorrelation based beat tracker UGen.

The underlying model assumes 4/4, but it should work on any isochronous beat structure, though there are biases to 100-120 bpm; a fast 7/8 may not be tracked in that sense. There are '''four''' control-rate outputs, being ticks at quarter, eighth and sixteenth level from the determined beat, and the current detected tempo. Note that the sixteenth note output won't necessarily make much sense if the music being tracked has swing; it is provided just as a convenience.

This beat tracker determines the beat, biased to the mid-tempo range by weighting functions. It does not determine the measure level, only a tactus. It is also slow reacting, using a 6 second temporal window for its autocorrelation maneuvres. Don't expect human musician level predictive tracking.

On the other hand, it is tireless, relatively general (though obviously best at transient 4/4 heavy material without much expressive tempo variation), and can form the basis of computer processing that is decidedly faster than human.

'''Warning''': This UGen only works properly at 44.1 or 48.0 kHz.

Value Params
chain

the output (buffer) of an FFT UGen which transforms the audio input to track. The expected size of FFT is 1024 for 44100 and 48000 sampling rate, and 2048 for double those. No other sampling rates are supported.

lock

If this argument is greater than 0.5, the tracker will lock at its current periodicity and continue from the current phase. Whilst it updates the model's phase and period, this is not reflected in the output until lock goes back below 0.5. Can be control-rate modulated.

Companion
object
object BeatTrack2 extends ProductReader[BeatTrack2]

A template matching beat tracker UGen. This beat tracker is based on exhaustively testing particular template patterns against feature streams; the testing takes place every 0.5 seconds. The two basic templates are a straight (groove=0) and a swung triplet (groove=1) pattern of 16th notes; this pattern is tried out at scaling factors corresponding to the tempi from 60 to 180 bpm. This is the cross-correlation method of beat tracking. A majority vote is taken on the best tempo detected, but this must be confirmed by a consistency check after a phase estimate. Such a consistency check helps to avoid wild fluctuating estimates, but is at the expense of an additional half second delay. The latency of the beat tracker with default settings is thus at least 2.5 seconds; because of block-based amortisation of calculation, it is actually around 2.8 seconds latency for a 2.0 second temporal window.

A template matching beat tracker UGen. This beat tracker is based on exhaustively testing particular template patterns against feature streams; the testing takes place every 0.5 seconds. The two basic templates are a straight (groove=0) and a swung triplet (groove=1) pattern of 16th notes; this pattern is tried out at scaling factors corresponding to the tempi from 60 to 180 bpm. This is the cross-correlation method of beat tracking. A majority vote is taken on the best tempo detected, but this must be confirmed by a consistency check after a phase estimate. Such a consistency check helps to avoid wild fluctuating estimates, but is at the expense of an additional half second delay. The latency of the beat tracker with default settings is thus at least 2.5 seconds; because of block-based amortisation of calculation, it is actually around 2.8 seconds latency for a 2.0 second temporal window.

This beat tracker is designed to be flexible for user needs; you can try out different window sizes, tempo weights and combinations of features. However, there are no guarantees on stability and effectiveness, and you will need to explore such parameters for a particular situation.

The UGen has '''six outputs''' corresponding to beat-tick, eighth-tick, groove-tick, tempo, phase, and groove. '''Warning''': it reads from input control bus instead of taking a regular control input signal as its first argument!

Companion
class
final case
class BeatTrack2(bus: GE, numChannels: GE, winSize: GE, phaseSpacing: GE, lock: GE, weighting: GE) extends MultiOut with ControlRated with IsIndividual

A template matching beat tracker UGen. This beat tracker is based on exhaustively testing particular template patterns against feature streams; the testing takes place every 0.5 seconds. The two basic templates are a straight (groove=0) and a swung triplet (groove=1) pattern of 16th notes; this pattern is tried out at scaling factors corresponding to the tempi from 60 to 180 bpm. This is the cross-correlation method of beat tracking. A majority vote is taken on the best tempo detected, but this must be confirmed by a consistency check after a phase estimate. Such a consistency check helps to avoid wild fluctuating estimates, but is at the expense of an additional half second delay. The latency of the beat tracker with default settings is thus at least 2.5 seconds; because of block-based amortisation of calculation, it is actually around 2.8 seconds latency for a 2.0 second temporal window.

A template matching beat tracker UGen. This beat tracker is based on exhaustively testing particular template patterns against feature streams; the testing takes place every 0.5 seconds. The two basic templates are a straight (groove=0) and a swung triplet (groove=1) pattern of 16th notes; this pattern is tried out at scaling factors corresponding to the tempi from 60 to 180 bpm. This is the cross-correlation method of beat tracking. A majority vote is taken on the best tempo detected, but this must be confirmed by a consistency check after a phase estimate. Such a consistency check helps to avoid wild fluctuating estimates, but is at the expense of an additional half second delay. The latency of the beat tracker with default settings is thus at least 2.5 seconds; because of block-based amortisation of calculation, it is actually around 2.8 seconds latency for a 2.0 second temporal window.

This beat tracker is designed to be flexible for user needs; you can try out different window sizes, tempo weights and combinations of features. However, there are no guarantees on stability and effectiveness, and you will need to explore such parameters for a particular situation.

The UGen has '''six outputs''' corresponding to beat-tick, eighth-tick, groove-tick, tempo, phase, and groove. '''Warning''': it reads from input control bus instead of taking a regular control input signal as its first argument!

Value Params
bus

index of a control bus to read from. the number of channels of that bus are expected to match the numChannels argument. To track a particular audio signal, analyse it first into numChannels features, that is onset-detection-triggers, as generated by Onsets , and write the trigger-output to this control bus.

lock

If this argument is greater than 0.5, the tracker will lock at its current periodicity and continue from the current phase. Whilst it updates the model's phase and period, this is not reflected in the output until lock goes back below 0.5. Can be control-rate modulated.

numChannels

(scalar) How many features (ie how many control bus channels) are provided ''(init-time only)''

phaseSpacing

(scalar) Relates to how many different phases to test. At the default of 0.02 seconds, 50 different phases spaced by those 0.02 seconds would be tried out for 60bpm; 16 would be trialed for 180 bpm. Larger phaseSpacing means more tests and more CPU cost.

weighting

(scalar) Use (-2.5) for flat weighting of tempi, (-1.5) for compensation weighting based on the number of events tested (because different periods allow different numbers of events within the temporal window). If an integer from 0 upwards is given, this is specifying the id of a buffer containing 120 frames which represent individual tempo weights; tempi go from 60 to 179 bpm in steps of one bpm, so you make sure the buffer has 120 frames.

winSize

(scalar) Size of the temporal window desired (2.0 to 3.0 seconds models the human temporal window). You might use longer values for stability of estimate at the expense of reactiveness.

Companion
object
object BiPanB2 extends ProductReader[BiPanB2]

A two dimensional Ambisonics B-format encoder UGen for a two-channel input signal. ambisonic B-format. It places the two input channels at opposite poles of the 2D (W, X, Y) Ambisonics field. It is equivalent to:

A two dimensional Ambisonics B-format encoder UGen for a two-channel input signal. ambisonic B-format. It places the two input channels at opposite poles of the 2D (W, X, Y) Ambisonics field. It is equivalent to:

PanB2(_, inA, azimuth, level) + PanB2(_, inB, azimuth + 1, level)

===Examples===

// 4-channel rotation of opposite sounds
play {
 val p = WhiteNoise.ar(0.05)                     // first source
 val q = Mix(LFSaw.ar(Seq(200, 200.37))) * 0.03  // second source
 // B-format encode 2 signals at opposite sides of the circle
 val enc = BiPanB2.ar(p, q, MouseX.kr(-1, +1))
 // B-format decode to quad (front-left, front-right, rear-left, rear-right)
 DecodeB2.ar(4, enc.w, enc.x, enc.y)
}
See also
Companion
class
final case
class BiPanB2(rate: Rate, inA: GE, inB: GE, azimuth: GE, level: GE) extends MultiOut

A two dimensional Ambisonics B-format encoder UGen for a two-channel input signal. ambisonic B-format. It places the two input channels at opposite poles of the 2D (W, X, Y) Ambisonics field. It is equivalent to:

A two dimensional Ambisonics B-format encoder UGen for a two-channel input signal. ambisonic B-format. It places the two input channels at opposite poles of the 2D (W, X, Y) Ambisonics field. It is equivalent to:

PanB2(_, inA, azimuth, level) + PanB2(_, inB, azimuth + 1, level)
Value Params
inA

the first (monophonic) input signal, which will appear opposite to the first second signal

inB

the second (monophonic) input signal, which will appear opposite to the first input signal

See also
Companion
object
object Blip extends ProductReader[Blip]

Band Limited ImPulse generator UGen. All harmonics have equal amplitude. This is the equivalent of 'buzz' in Music-N languages. It is capable of cross-fading during a control period block if the number of harmonics changes, avoiding audible pops.

Band Limited ImPulse generator UGen. All harmonics have equal amplitude. This is the equivalent of 'buzz' in Music-N languages. It is capable of cross-fading during a control period block if the number of harmonics changes, avoiding audible pops.

===Examples===

// modulate fundamental frequency
play { Blip.ar(XLine.kr(20000, 200, 6), 100) * 0.2 }
// modulate number of harmonics
play { Blip.ar(200, Line.kr(1, 100, 20)) * 0.2 }
See also
Companion
class
final case
class Blip(rate: Rate, freq: GE, numHarm: GE) extends SingleOut

Band Limited ImPulse generator UGen. All harmonics have equal amplitude. This is the equivalent of 'buzz' in Music-N languages. It is capable of cross-fading during a control period block if the number of harmonics changes, avoiding audible pops.

Band Limited ImPulse generator UGen. All harmonics have equal amplitude. This is the equivalent of 'buzz' in Music-N languages. It is capable of cross-fading during a control period block if the number of harmonics changes, avoiding audible pops.

Value Params
freq

Fundamental frequency in Hertz

numHarm

Number of harmonics. This will be automatically limited to avoid aliasing.

See also
Companion
object
object BrownNoise extends ProductReader[BrownNoise]

A noise generator UGen whose spectrum falls off in power by 6 dB per octave. The values produced by this UGen lie between -1 and +1 , the RMS is approx. -4.8 dB (the same as white noise).

A noise generator UGen whose spectrum falls off in power by 6 dB per octave. The values produced by this UGen lie between -1 and +1 , the RMS is approx. -4.8 dB (the same as white noise).

===Examples===

// plain noise
play { BrownNoise.ar(Seq(0.2, 0.2)) }
See also
Companion
class
final case
class BrownNoise(rate: Rate, mul: GE) extends SingleOut with IsIndividual

A noise generator UGen whose spectrum falls off in power by 6 dB per octave. The values produced by this UGen lie between -1 and +1 , the RMS is approx. -4.8 dB (the same as white noise).

A noise generator UGen whose spectrum falls off in power by 6 dB per octave. The values produced by this UGen lie between -1 and +1 , the RMS is approx. -4.8 dB (the same as white noise).

Value Params
mul

Not actually a UGen input, this argument produces a multiplication of the output by this factor. A multi-channel mul argument will cause the generation of multiple independent noise generators.

See also
Companion
object
object BufAllpassC extends ProductReader[BufAllpassC]

All pass delay line with cubic interpolation which uses a buffer for its internal memory.

All pass delay line with cubic interpolation which uses a buffer for its internal memory.

'''Warning''': For reasons of efficiency, the effective buffer size is the allocated size rounded down to the next power of two. For example, if 44100 samples are allocated, the maximum delay would be 32768 samples. Also note that the buffer must be monophonic.

===Examples===

// Compare interpolation types
// allocate buffer
val b = Buffer.alloc(s, (0.2 * s.sampleRate).toInt.nextPowerOfTwo)

// Since the allpass delay has no audible effect as a resonator on
// steady state sound ...
play { BufAllpassC.ar(b.id, WhiteNoise.ar(0.1), XLine.kr(0.0001, 0.01, 20), 0.2) }

// ...these examples add the input to the effected sound and compare variants so that you can hear
// the effect of the phase comb:
play {
 val z = WhiteNoise.ar(0.2)
 z + BufAllpassN.ar(b.id, z, XLine.kr(0.0001, 0.01, 20), 0.2)
}

play {
 val z = WhiteNoise.ar(0.2)
 z + BufAllpassL.ar(b.id, z, XLine.kr(0.0001, 0.01, 20), 0.2)
}

play {
 val z = WhiteNoise.ar(0.2)
 z + BufAllpassC.ar(b.id, z, XLine.kr(0.0001, 0.01, 20), 0.2)
}

b.free()  // after synths have been stopped
See also
Companion
class
final case
class BufAllpassC(rate: Rate, buf: GE, in: GE, delayTime: GE, decayTime: GE) extends SingleOut with HasSideEffect with IsIndividual

All pass delay line with cubic interpolation which uses a buffer for its internal memory.

All pass delay line with cubic interpolation which uses a buffer for its internal memory.

'''Warning''': For reasons of efficiency, the effective buffer size is the allocated size rounded down to the next power of two. For example, if 44100 samples are allocated, the maximum delay would be 32768 samples. Also note that the buffer must be monophonic.

Value Params
buf

Buffer id.

decayTime

Time for the echoes to decay by 60 decibels. If this time is negative then the feedback coefficient will be negative, thus emphasizing only odd harmonics at an octave lower.

delayTime

Delay time in seconds.

in

The input signal.

See also
Companion
object
object BufAllpassL extends ProductReader[BufAllpassL]

All pass delay line with linear interpolation which uses a buffer for its internal memory.

All pass delay line with linear interpolation which uses a buffer for its internal memory.

'''Warning''': For reasons of efficiency, the effective buffer size is the allocated size rounded down to the next power of two. For example, if 44100 samples are allocated, the maximum delay would be 32768 samples. Also note that the buffer must be monophonic.

===Examples===

// Compare interpolation types
// allocate buffer
val b = Buffer.alloc(s, (0.2 * s.sampleRate).toInt.nextPowerOfTwo)

// Since the allpass delay has no audible effect as a resonator on
// steady state sound ...
play { BufAllpassC.ar(b.id, WhiteNoise.ar(0.1), XLine.kr(0.0001, 0.01, 20), 0.2) }

// ...these examples add the input to the effected sound and compare variants so that you can hear
// the effect of the phase comb:
play {
 val z = WhiteNoise.ar(0.2)
 z + BufAllpassN.ar(b.id, z, XLine.kr(0.0001, 0.01, 20), 0.2)
}

play {
 val z = WhiteNoise.ar(0.2)
 z + BufAllpassL.ar(b.id, z, XLine.kr(0.0001, 0.01, 20), 0.2)
}

play {
 val z = WhiteNoise.ar(0.2)
 z + BufAllpassC.ar(b.id, z, XLine.kr(0.0001, 0.01, 20), 0.2)
}

b.free()  // after synths have been stopped
See also
Companion
class
final case
class BufAllpassL(rate: Rate, buf: GE, in: GE, delayTime: GE, decayTime: GE) extends SingleOut with HasSideEffect with IsIndividual

All pass delay line with linear interpolation which uses a buffer for its internal memory.

All pass delay line with linear interpolation which uses a buffer for its internal memory.

'''Warning''': For reasons of efficiency, the effective buffer size is the allocated size rounded down to the next power of two. For example, if 44100 samples are allocated, the maximum delay would be 32768 samples. Also note that the buffer must be monophonic.

Value Params
buf

Buffer id.

decayTime

Time for the echoes to decay by 60 decibels. If this time is negative then the feedback coefficient will be negative, thus emphasizing only odd harmonics at an octave lower.

delayTime

Delay time in seconds.

in

The input signal.

See also
Companion
object
object BufAllpassN extends ProductReader[BufAllpassN]

All pass delay line with no interpolation which uses a buffer for its internal memory.

All pass delay line with no interpolation which uses a buffer for its internal memory.

'''Warning''': For reasons of efficiency, the effective buffer size is the allocated size rounded down to the next power of two. For example, if 44100 samples are allocated, the maximum delay would be 32768 samples. Also note that the buffer must be monophonic.

===Examples===

// Compare interpolation types
// allocate buffer
val b = Buffer.alloc(s, (0.2 * s.sampleRate).toInt.nextPowerOfTwo)

// Since the allpass delay has no audible effect as a resonator on
// steady state sound ...
play { BufAllpassC.ar(b.id, WhiteNoise.ar(0.1), XLine.kr(0.0001, 0.01, 20), 0.2) }

// ...these examples add the input to the effected sound and compare variants so that you can hear
// the effect of the phase comb:
play {
 val z = WhiteNoise.ar(0.2)
 z + BufAllpassN.ar(b.id, z, XLine.kr(0.0001, 0.01, 20), 0.2)
}

play {
 val z = WhiteNoise.ar(0.2)
 z + BufAllpassL.ar(b.id, z, XLine.kr(0.0001, 0.01, 20), 0.2)
}

play {
 val z = WhiteNoise.ar(0.2)
 z + BufAllpassC.ar(b.id, z, XLine.kr(0.0001, 0.01, 20), 0.2)
}

b.free()  // after synths have been stopped
// Used as echo
val b = Buffer.alloc(s, (0.2 * s.sampleRate).toInt.nextPowerOfTwo)

// doesn't really sound different than Comb,
// but it outputs the input signal immediately (inverted) and the echoes
// are lower in amplitude.
play { BufAllpassN.ar(b.id, Decay.ar(Dust.ar(1) * 0.5, 0.2) * WhiteNoise.ar, 0.2, 3) }

b.free()
See also
Companion
class
final case
class BufAllpassN(rate: Rate, buf: GE, in: GE, delayTime: GE, decayTime: GE) extends SingleOut with HasSideEffect with IsIndividual

All pass delay line with no interpolation which uses a buffer for its internal memory.

All pass delay line with no interpolation which uses a buffer for its internal memory.

'''Warning''': For reasons of efficiency, the effective buffer size is the allocated size rounded down to the next power of two. For example, if 44100 samples are allocated, the maximum delay would be 32768 samples. Also note that the buffer must be monophonic.

Value Params
buf

Buffer id.

decayTime

Time for the echoes to decay by 60 decibels. If this time is negative then the feedback coefficient will be negative, thus emphasizing only odd harmonics at an octave lower.

delayTime

Delay time in seconds.

in

The input signal.

See also
Companion
object
object BufChannels extends ProductReader[BufChannels]

Returns the current number of channels of the buffer at the provided index.

Returns the current number of channels of the buffer at the provided index.

===Examples===

// channels of local buffer
play {
 val buf = LocalBuf(1024, 2)
 BufChannels.ir(buf).poll(0) // reports 2
}
See also
Companion
class
final case
class BufChannels(rate: Rate, buf: GE) extends SingleOut

Returns the current number of channels of the buffer at the provided index.

Returns the current number of channels of the buffer at the provided index.

Value Params
buf

Buffer id.

See also
Companion
object
object BufCombC extends ProductReader[BufCombC]

Comb delay line with cubic interpolation which uses a buffer for its internal memory.

Comb delay line with cubic interpolation which uses a buffer for its internal memory.

===Examples===

// Compare interpolation
// These examples compare the variants, so that you can hear the difference in interpolation

// allocate buffer
val b = Buffer.alloc(s, (0.01 * s.sampleRate).toInt.nextPowerOfTwo)

// Comb used as a resonator. The resonant fundamental is equal to
// reciprocal of the delay time.
play { BufCombN.ar(b.id, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }

play { BufCombL.ar(b.id, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }

play { BufCombC.ar(b.id, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }

// with negative feedback
play { BufCombN.ar(b.id, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }

play { BufCombL.ar(b.id, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }

play { BufCombC.ar(b.id, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }

b.free()   // do this after the synths have ended
See also
Companion
class
final case
class BufCombC(rate: Rate, buf: GE, in: GE, delayTime: GE, decayTime: GE) extends SingleOut with HasSideEffect with IsIndividual

Comb delay line with cubic interpolation which uses a buffer for its internal memory.

Comb delay line with cubic interpolation which uses a buffer for its internal memory.

Value Params
buf

Buffer id.

decayTime

Time for the echoes to decay by 60 decibels. If this time is negative then the feedback coefficient will be negative, thus emphasizing only odd harmonics at an octave lower. '''Warning''': For reasons of efficiency, the effective buffer size is the allocated size rounded down to the next power of two. For example, if 44100 samples are allocated, the maximum delay would be 32768 samples. Also note that the buffer must be monophonic.

delayTime

Delay time in seconds.

in

The input signal.

See also
Companion
object
object BufCombL extends ProductReader[BufCombL]

Comb delay line with linear interpolation which uses a buffer for its internal memory.

Comb delay line with linear interpolation which uses a buffer for its internal memory.

===Examples===

// Compare interpolation
// These examples compare the variants, so that you can hear the difference in interpolation

// allocate buffer
val b = Buffer.alloc(s, (0.01 * s.sampleRate).toInt.nextPowerOfTwo)

// Comb used as a resonator. The resonant fundamental is equal to
// reciprocal of the delay time.
play { BufCombN.ar(b.id, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }

play { BufCombL.ar(b.id, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }

play { BufCombC.ar(b.id, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }

// with negative feedback
play { BufCombN.ar(b.id, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }

play { BufCombL.ar(b.id, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }

play { BufCombC.ar(b.id, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }

b.free()   // do this after the synths have ended
See also
Companion
class
final case
class BufCombL(rate: Rate, buf: GE, in: GE, delayTime: GE, decayTime: GE) extends SingleOut with HasSideEffect with IsIndividual

Comb delay line with linear interpolation which uses a buffer for its internal memory.

Comb delay line with linear interpolation which uses a buffer for its internal memory.

Value Params
buf

Buffer id.

decayTime

Time for the echoes to decay by 60 decibels. If this time is negative then the feedback coefficient will be negative, thus emphasizing only odd harmonics at an octave lower. '''Warning''': For reasons of efficiency, the effective buffer size is the allocated size rounded down to the next power of two. For example, if 44100 samples are allocated, the maximum delay would be 32768 samples. Also note that the buffer must be monophonic.

delayTime

Delay time in seconds.

in

The input signal.

See also
Companion
object
object BufCombN extends ProductReader[BufCombN]

Comb delay line with no interpolation which uses a buffer for its internal memory.

Comb delay line with no interpolation which uses a buffer for its internal memory.

'''Warning''': For reasons of efficiency, the effective buffer size is the allocated size rounded down to the next power of two. For example, if 44100 samples are allocated, the maximum delay would be 32768 samples. Also note that the buffer must be monophonic.

===Examples===

// Compare interpolation
// These examples compare the variants, so that you can hear the difference in interpolation

// allocate buffer
val b = Buffer.alloc(s, (0.01 * s.sampleRate).toInt.nextPowerOfTwo)

// Comb used as a resonator. The resonant fundamental is equal to
// reciprocal of the delay time.
play { BufCombN.ar(b.id, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }

play { BufCombL.ar(b.id, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }

play { BufCombC.ar(b.id, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }

// with negative feedback
play { BufCombN.ar(b.id, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }

play { BufCombL.ar(b.id, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }

play { BufCombC.ar(b.id, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }

b.free()   // do this after the synths have ended
// Used as an echo
val b = Buffer.alloc(s, (0.2 * s.sampleRate).toInt.nextPowerOfTwo)

play { BufCombN.ar(b.id, Decay.ar(Dust.ar(1) * 0.5, 0.2) * WhiteNoise.ar, 0.2, 3) }

b.free()   // do this after the synth has ended
See also
Companion
class
final case
class BufCombN(rate: Rate, buf: GE, in: GE, delayTime: GE, decayTime: GE) extends SingleOut with HasSideEffect with IsIndividual

Comb delay line with no interpolation which uses a buffer for its internal memory.

Comb delay line with no interpolation which uses a buffer for its internal memory.

'''Warning''': For reasons of efficiency, the effective buffer size is the allocated size rounded down to the next power of two. For example, if 44100 samples are allocated, the maximum delay would be 32768 samples. Also note that the buffer must be monophonic.

Value Params
buf

Buffer id.

decayTime

Time for the echoes to decay by 60 decibels. If this time is negative then the feedback coefficient will be negative, thus emphasizing only odd harmonics at an octave lower.

delayTime

Delay time in seconds.

in

The input signal.

See also
Companion
object
object BufDelayC extends ProductReader[BufDelayC]

Simple delay line with cubic interpolation which uses a buffer for its internal memory.

Simple delay line with cubic interpolation which uses a buffer for its internal memory.

'''Warning''': For reasons of efficiency, the effective buffer size is the allocated size rounded down to the next power of two. For example, if 44100 samples are allocated, the maximum delay would be 32768 samples. Also note that the buffer must be monophonic.

See also
Companion
class
final case
class BufDelayC(rate: Rate, buf: GE, in: GE, delayTime: GE) extends SingleOut with HasSideEffect with IsIndividual

Simple delay line with cubic interpolation which uses a buffer for its internal memory.

Simple delay line with cubic interpolation which uses a buffer for its internal memory.

'''Warning''': For reasons of efficiency, the effective buffer size is the allocated size rounded down to the next power of two. For example, if 44100 samples are allocated, the maximum delay would be 32768 samples. Also note that the buffer must be monophonic.

Value Params
buf

Buffer id.

delayTime

Delay time in seconds.

in

The input signal.

See also
Companion
object
object BufDelayL extends ProductReader[BufDelayL]

Simple delay line with linear interpolation which uses a buffer for its internal memory.

Simple delay line with linear interpolation which uses a buffer for its internal memory.

'''Warning''': For reasons of efficiency, the effective buffer size is the allocated size rounded down to the next power of two. For example, if 44100 samples are allocated, the maximum delay would be 32768 samples. Also note that the buffer must be monophonic.

See also
Companion
class
final case
class BufDelayL(rate: Rate, buf: GE, in: GE, delayTime: GE) extends SingleOut with HasSideEffect with IsIndividual

Simple delay line with linear interpolation which uses a buffer for its internal memory.

Simple delay line with linear interpolation which uses a buffer for its internal memory.

'''Warning''': For reasons of efficiency, the effective buffer size is the allocated size rounded down to the next power of two. For example, if 44100 samples are allocated, the maximum delay would be 32768 samples. Also note that the buffer must be monophonic.

Value Params
buf

Buffer id.

delayTime

Delay time in seconds.

in

The input signal.

See also
Companion
object
object BufDelayN extends ProductReader[BufDelayN]

Simple delay line with no interpolation which uses a buffer for its internal memory.

Simple delay line with no interpolation which uses a buffer for its internal memory.

'''Warning''': For reasons of efficiency, the effective buffer size is the allocated size rounded down to the next power of two. For example, if 44100 samples are allocated, the maximum delay would be 32768 samples. Also note that the buffer must be monophonic.

===Examples===

// Random white-noise decay
// allocate buffer
val b = Buffer.alloc(s, (0.2 * s.sampleRate).toInt.nextPowerOfTwo, 1)

// Dust randomly triggers Decay to create an exponential
// decay envelope for the WhiteNoise input source.
// We apply a slight filter to the delayed signal
// so it is easier to distinguish
play {
 val z = Decay.ar(Dust.ar(1) * 0.5, 0.3) * WhiteNoise.ar
 LPF.ar(BufDelayN.ar(b.id, z, 0.2), 8000) + z  // input is mixed with delay
}

b.free()  // do this after the synth has ended
See also
Companion
class
final case
class BufDelayN(rate: Rate, buf: GE, in: GE, delayTime: GE) extends SingleOut with HasSideEffect with IsIndividual

Simple delay line with no interpolation which uses a buffer for its internal memory.

Simple delay line with no interpolation which uses a buffer for its internal memory.

'''Warning''': For reasons of efficiency, the effective buffer size is the allocated size rounded down to the next power of two. For example, if 44100 samples are allocated, the maximum delay would be 32768 samples. Also note that the buffer must be monophonic.

Value Params
buf

Buffer id.

delayTime

Delay time in seconds.

in

The input signal.

See also
Companion
object
object BufDur extends ProductReader[BufDur]

Returns the current duration of the buffer at the provided index.

Returns the current duration of the buffer at the provided index.

===Examples===

// duration of local buffer
play {
 val buf = LocalBuf(SampleRate.ir * 1.5, 2)
 BufDur.ir(buf).poll(0) // reports 1.5
}
See also
Companion
class
final case
class BufDur(rate: Rate, buf: GE) extends SingleOut

Returns the current duration of the buffer at the provided index.

Returns the current duration of the buffer at the provided index.

Value Params
buf

Buffer id.

See also
Companion
object
object BufFrames extends ProductReader[BufFrames]

Returns the number of allocated frames of the buffer at the provided index.

Returns the number of allocated frames of the buffer at the provided index.

===Examples===

// frames of local buffer
play {
 val buf = LocalBuf(1024, 2)
 BufFrames.ir(buf).poll(0) // reports 1024
}
See also
Companion
class
final case
class BufFrames(rate: Rate, buf: GE) extends SingleOut

Returns the number of allocated frames of the buffer at the provided index.

Returns the number of allocated frames of the buffer at the provided index.

Value Params
buf

Buffer id.

See also
Companion
object
object BufRateScale extends ProductReader[BufRateScale]

Returns a ratio by which the playback of the buffer at the provided index is to be scaled relative to the current sample rate of the server.

Returns a ratio by which the playback of the buffer at the provided index is to be scaled relative to the current sample rate of the server.

buffer sample rate / server sample rate

===Examples===

// rate scale of local buffer
play {
 val buf = LocalBuf(1024)
 BufRateScale.ir(buf).poll(0) // reports 1.0 because buffer rate matches server rate
}
See also
Companion
class
final case
class BufRateScale(rate: Rate, buf: GE) extends SingleOut

Returns a ratio by which the playback of the buffer at the provided index is to be scaled relative to the current sample rate of the server.

Returns a ratio by which the playback of the buffer at the provided index is to be scaled relative to the current sample rate of the server.

buffer sample rate / server sample rate
Value Params
buf

Buffer id.

See also
Companion
object
object BufRd extends ProductReader[BufRd]

A UGen which reads the content of a buffer, using an index pointer.

A UGen which reads the content of a buffer, using an index pointer.

Warning: if the supplied buf refers to a buffer whose number of channels differs from numChannels , the UGen will fail silently.

An alternative to BufRd is PlayBuf . While PlayBuf plays through the buffer by itself, BufRd only moves its read point by the index input and therefore has no pitch input. PlayBuf uses cubic interpolation, while BufRd has variable interpolation. PlayBuf can determine the end of the buffer and issue a done-action.

===Examples===

// Write and read
val b = Buffer.alloc(s, numFrames = 32768, numChannels = 1)

// write into the buffer with a BufWr
val y = play {
 val in = SinOsc.ar(LFNoise1.kr(2).mulAdd(300, 400)) * 0.1
 val rate = "rate" kr 1
 BufWr.ar(in, b.id, Phasor.ar(0, BufRateScale.kr(b.id) * rate, 0, BufFrames.kr(b.id)))
 0.0 // quiet
}

// read it with a BufRd
val x = play {
 val rate = "rate" kr 1
 BufRd.ar(1, b.id, Phasor.ar(0, BufRateScale.kr(b.id) * rate, 0, BufFrames.kr(b.id)))
}

y.set("rate" -> 0.5) // notice the clicks when the play head overtakes the write head!
x.set("rate" -> 0.5)
y.set("rate" -> 1.0)
See also
Companion
class
final case
class BufRd(rate: Rate, numChannels: Int, buf: GE, index: GE, loop: GE, interp: GE) extends MultiOut with IsIndividual with HasDoneFlag

A UGen which reads the content of a buffer, using an index pointer.

A UGen which reads the content of a buffer, using an index pointer.

Warning: if the supplied buf refers to a buffer whose number of channels differs from numChannels , the UGen will fail silently.

An alternative to BufRd is PlayBuf . While PlayBuf plays through the buffer by itself, BufRd only moves its read point by the index input and therefore has no pitch input. PlayBuf uses cubic interpolation, while BufRd has variable interpolation. PlayBuf can determine the end of the buffer and issue a done-action.

Value Params
buf

the identifier of the buffer to use

index

audio rate frame-index into the buffer. Can be fractional.

interp

1 for no interpolation, 2 for linear, and 4 for cubic interpolation. ''(init-time only)''

loop

1 to enable looping, 0 to disable looping. this can be modulated.

numChannels

number of channels that the buffer will be. Since this is an integer constant, a change in the number of channels must be reflected by creating different SynthDefs.

See also
Companion
object
object BufSampleRate extends ProductReader[BufSampleRate]

Returns the buffer's current sample rate.

Returns the buffer's current sample rate.

===Examples===

// rate of local buffer
play {
 val buf = LocalBuf(1024)
 BufSampleRate.ir(buf).poll(0) // matches server sample rate
}
See also
Companion
class
final case
class BufSampleRate(rate: Rate, buf: GE) extends SingleOut

Returns the buffer's current sample rate.

Returns the buffer's current sample rate.

Value Params
buf

Buffer id.

See also
Companion
object
object BufSamples extends ProductReader[BufSamples]

Returns the current number of allocated samples in the Buffer at the provided index. A sample is not the same as a frame (compare with BufFrames ); a frame includes the samples in each channel of the buffer. Only for a mono buffer are samples the same as frames.

Returns the current number of allocated samples in the Buffer at the provided index. A sample is not the same as a frame (compare with BufFrames ); a frame includes the samples in each channel of the buffer. Only for a mono buffer are samples the same as frames.

samples = frames * numChannels

===Examples===

// samples of local buffer
play {
 val buf = LocalBuf(1024, 2)
 BufSamples.ir(buf).poll(0) // 2 * 1024 = 2048
}
See also
Companion
class
final case
class BufSamples(rate: Rate, buf: GE) extends SingleOut

Returns the current number of allocated samples in the Buffer at the provided index. A sample is not the same as a frame (compare with BufFrames ); a frame includes the samples in each channel of the buffer. Only for a mono buffer are samples the same as frames.

Returns the current number of allocated samples in the Buffer at the provided index. A sample is not the same as a frame (compare with BufFrames ); a frame includes the samples in each channel of the buffer. Only for a mono buffer are samples the same as frames.

samples = frames * numChannels
Value Params
buf

Buffer id.

See also
Companion
object
object BufWr extends ProductReader[BufWr]

A UGen that writes a signal to a buffer, using an index pointer.

A UGen that writes a signal to a buffer, using an index pointer.

Warning: if the supplied buf refers to a buffer whose number of channels differs from those of the input signal, the UGen will fail silently.

An alternative to BufWr is RecordBuf . While RecordBuf advances the index into the buffer by itself, BufWr only moves its write point by the index input, making it possible to adjust the writing speed or to access the buffer in a non-linear way. RecordBuf can determine the end of the buffer and issue a done-action.

===Examples===

// record and playback
// a two second mono buffer
val b = Buffer.alloc(s, numFrames = s.sampleRate.toInt * 2)

val y = play {
 val sig  = SinOsc.ar(LFNoise1.kr(2).mulAdd(300, 400)) * 0.1
 val rate = "rate" kr 1
 BufWr.ar(in = sig, buf = b.id, index =
   Phasor.ar(speed = BufRateScale.kr(b.id) * rate, lo = 0, hi = BufFrames.kr(b.id)))
 0.0 // quiet
}

// read it with a BufRd
val x = play {
 val rate = "rate" kr 1
 BufRd.ar(1, buf = b.id, index =
   Phasor.ar(speed = BufRateScale.kr(b.id) * rate, lo = 0, hi = BufFrames.kr(b.id)))
}

x.set("rate" -> 5)
y.set("rate" -> 3)
x.set("rate" -> 2)
See also
Companion
class
final case
class BufWr(rate: Rate, in: GE, buf: GE, index: GE, loop: GE) extends SingleOut with HasSideEffect with IsIndividual with HasDoneFlag

A UGen that writes a signal to a buffer, using an index pointer.

A UGen that writes a signal to a buffer, using an index pointer.

Warning: if the supplied buf refers to a buffer whose number of channels differs from those of the input signal, the UGen will fail silently.

An alternative to BufWr is RecordBuf . While RecordBuf advances the index into the buffer by itself, BufWr only moves its write point by the index input, making it possible to adjust the writing speed or to access the buffer in a non-linear way. RecordBuf can determine the end of the buffer and issue a done-action.

Value Params
buf

the identifier of the buffer to use

in

input signal to record

index

audio rate frame-index into the buffer.

loop

1 to enable looping, 0 to disable looping. this can be modulated.

See also
Companion
object
object COsc extends ProductReader[COsc]
Companion
class
final case
class COsc(rate: Rate, buf: GE, freq: GE, beats: GE) extends SingleOut with IsIndividual
Companion
object
object ChannelIndices extends ProductReader[ChannelIndices]
Companion
class
final case
class ChannelIndices(in: GE) extends SingleOut with ScalarRated

A graph element that produces an integer sequence from zero until the number-of-channels of the input element.

A graph element that produces an integer sequence from zero until the number-of-channels of the input element.

===Examples===

// cross-faded select
play {
 val sines: GE = Seq.fill(4)(SinOsc.ar(ExpRand(200, 2000)))
 val index   = MouseX.kr(lo = 0, hi = NumChannels(sines) - 1)
 val indices = ChannelIndices(sines)
 indices.poll(0, "indices")
 val select  = 1 - (indices absdif index).min(1)
 val sig     = Mix(sines * select)
 sig * 0.2
}
Value Params
in

the element whose indices to produce

See also
Companion
object
object ChannelRangeProxy extends ProductReader[ChannelRangeProxy]
Companion
class
final case
class ChannelRangeProxy(elem: GE, from: Int, until: Int, step: Int) extends Lazy

A helper graph element that selects a particular range of output channel of another element. The range is specified with integers and thus cannot be determined at graph expansion time. If this is desired, the Select UGen can be used.

A helper graph element that selects a particular range of output channel of another element. The range is specified with integers and thus cannot be determined at graph expansion time. If this is desired, the Select UGen can be used.

Usually the graph element operator out along with a standard Scala Range argument can be used instead of explicitly writing ChannelRangeProxy. Thus elem out (0 until 4) selects the first four channels and is equivalent to ChannelRangeProxy(elem, from = 0, until = 4, step = 1).

Behind the scene, ChannelProxy instances are created, thus ChannelRangeProxy(x, a, b) is the same as (a until b).map(ChannelProxy(x, _)): GE.

Because ScalaCollider allows late-expanding graph elements, we have no direct way to get some array of a UGen's outputs.

Value Params
elem

a multi-channel element from which to select channels.

from

the first index (inclusive) of the channel range, counting from zero.

step

the increment from index to index in the range. A value of one means all channels from from until until will be selected. A value of two means, every second channel will be skipped. A negative value can be used to count down from high to low indices.

until

the end index (exclusive) of the channel range, counting from zero.

See also
Companion
object
object CheckBadValues extends ProductReader[CheckBadValues]

A UGen to test for infinity, not-a-number (NaN), and denormal numbers. Its output is as follows: 0 = a normal float, 1 = NaN, 2 = infinity, and 3 = a denormal. According to the post settings it will print the information to the console along with a given identifier.

A UGen to test for infinity, not-a-number (NaN), and denormal numbers. Its output is as follows: 0 = a normal float, 1 = NaN, 2 = infinity, and 3 = a denormal. According to the post settings it will print the information to the console along with a given identifier.

Companion
class
final case
class CheckBadValues(rate: Rate, in: GE, id: GE, post: GE) extends SingleOut with HasSideEffect

A UGen to test for infinity, not-a-number (NaN), and denormal numbers. Its output is as follows: 0 = a normal float, 1 = NaN, 2 = infinity, and 3 = a denormal. According to the post settings it will print the information to the console along with a given identifier.

A UGen to test for infinity, not-a-number (NaN), and denormal numbers. Its output is as follows: 0 = a normal float, 1 = NaN, 2 = infinity, and 3 = a denormal. According to the post settings it will print the information to the console along with a given identifier.

Value Params
id

an identifier showing up with the values in the console

in

the signal to be tested

post

One of three post modes: 0 = no posting; 1 = post a line for every bad value; 2 = post a line only when the floating-point classification changes (e.g., normal -> NaN and vice versa)

Companion
object
object ClearBuf extends ProductReader[ClearBuf]

A scalar (init-time) UGen that fills the contents of a buffer with zeroes.

A scalar (init-time) UGen that fills the contents of a buffer with zeroes.

See also
Companion
class
final case
class ClearBuf(buf: GE) extends SingleOut with ScalarRated with HasSideEffect with IsIndividual

A scalar (init-time) UGen that fills the contents of a buffer with zeroes.

A scalar (init-time) UGen that fills the contents of a buffer with zeroes.

Value Params
buf

the buffer to clear

See also
Companion
object
object Clip extends ProductReader[Clip]

A UGen that constrains a signal to a given range, by limiting values outside the range to the range margins. This is similar to the clip2 binary operator but permits both a lower range value lo and an upper range value hi .

A UGen that constrains a signal to a given range, by limiting values outside the range to the range margins. This is similar to the clip2 binary operator but permits both a lower range value lo and an upper range value hi .

Mathematically, this is equivalent to in.max(lo).min(hi).

Be aware that there seems to be an initialization bug. The following crashes, indicating that Clip.ar outputs a zero initially:

{{ play { val bar = Integrator.ar(DC.ar(0), coeff = 0.999) val foo = Clip.ar(bar, lo = 1.0, hi = 44100.0) // .max(1.0) val sum = RunningSum.ar(DC.ar(0), length = foo) sum.poll(1, "sum") () } }}

===Examples===

// clip sine wave to modulate timbre
play {
 val hi = SinOsc.ar(0.1).linExp(-1, 1, 0.01, 1.0)
 Clip.ar(SinOsc.ar(300), 0, hi) * 0.2 / hi
}
See also
Companion
class
final case
class Clip(rate: Rate, in: GE, lo: GE, hi: GE) extends SingleOut

A UGen that constrains a signal to a given range, by limiting values outside the range to the range margins. This is similar to the clip2 binary operator but permits both a lower range value lo and an upper range value hi .

A UGen that constrains a signal to a given range, by limiting values outside the range to the range margins. This is similar to the clip2 binary operator but permits both a lower range value lo and an upper range value hi .

Mathematically, this is equivalent to in.max(lo).min(hi).

Be aware that there seems to be an initialization bug. The following crashes, indicating that Clip.ar outputs a zero initially:

{{ play { val bar = Integrator.ar(DC.ar(0), coeff = 0.999) val foo = Clip.ar(bar, lo = 1.0, hi = 44100.0) // .max(1.0) val sum = RunningSum.ar(DC.ar(0), length = foo) sum.poll(1, "sum") () } }}

Value Params
hi

upper margin of clipping

in

input signal to constrain

lo

lower margin of clipping

See also
Companion
object
object ClipNoise extends ProductReader[ClipNoise]

A noise generator UGen whose values are either -1 or +1 (before being multiplied by mul ). This produces the maximum energy (an RMS of 0 dB) for the least peak to peak amplitude.

A noise generator UGen whose values are either -1 or +1 (before being multiplied by mul ). This produces the maximum energy (an RMS of 0 dB) for the least peak to peak amplitude.

===Examples===

// plain noise
play { ClipNoise.ar(Seq(0.2, 0.2)) }
See also
Companion
class
final case
class ClipNoise(rate: Rate, mul: GE) extends SingleOut with IsIndividual

A noise generator UGen whose values are either -1 or +1 (before being multiplied by mul ). This produces the maximum energy (an RMS of 0 dB) for the least peak to peak amplitude.

A noise generator UGen whose values are either -1 or +1 (before being multiplied by mul ). This produces the maximum energy (an RMS of 0 dB) for the least peak to peak amplitude.

Value Params
mul

Not actually a UGen input, this argument produces a multiplication of the output by this factor. A multi-channel mul argument will cause the generation of multiple independent noise generators.

See also
Companion
object
object CoinGate extends ProductReader[CoinGate]

A UGen that randomly filters an input trigger signal. When a trigger arrives, it may pass with a probability given by the prob argument.

A UGen that randomly filters an input trigger signal. When a trigger arrives, it may pass with a probability given by the prob argument.

===Examples===

// filter dust, probability controlled by mouse
play {
 val p = MouseX.kr
 CoinGate.ar(Dust.ar(400), p)
}
See also
Note

The argument order is different from its sclang counterpart.

Companion
class
final case
class CoinGate(rate: MaybeRate, in: GE, prob: GE) extends SingleOut with IsIndividual

A UGen that randomly filters an input trigger signal. When a trigger arrives, it may pass with a probability given by the prob argument.

A UGen that randomly filters an input trigger signal. When a trigger arrives, it may pass with a probability given by the prob argument.

Value Params
in

the input triggers to filter

prob

the probability between zero (no trigger passed) and 1 (all triggers passed)

See also
Note

The argument order is different from its sclang counterpart.

Companion
object
object CombC extends ProductReader[CombC]

Comb delay line with cubic interpolation.

Comb delay line with cubic interpolation.

See also
Companion
class
final case
class CombC(rate: Rate, in: GE, maxDelayTime: GE, delayTime: GE, decayTime: GE) extends SingleOut

Comb delay line with cubic interpolation.

Comb delay line with cubic interpolation.

Value Params
decayTime

Time for the echoes to decay by 60 decibels. If this time is negative then the feedback coefficient will be negative, thus emphasizing only odd harmonics at an octave lower.

delayTime

Delay time in seconds.

in

The input signal.

maxDelayTime

The maximum delay time in seconds. used to initialize the delay buffer size. ''(init-time only)''

See also
Companion
object
object CombL extends ProductReader[CombL]

Comb delay line with linear interpolation.

Comb delay line with linear interpolation.

See also
Companion
class
final case
class CombL(rate: Rate, in: GE, maxDelayTime: GE, delayTime: GE, decayTime: GE) extends SingleOut

Comb delay line with linear interpolation.

Comb delay line with linear interpolation.

Value Params
decayTime

Time for the echoes to decay by 60 decibels. If this time is negative then the feedback coefficient will be negative, thus emphasizing only odd harmonics at an octave lower.

delayTime

Delay time in seconds.

in

The input signal.

maxDelayTime

The maximum delay time in seconds. used to initialize the delay buffer size. ''(init-time only)''

See also
Companion
object
object CombN extends ProductReader[CombN]

Comb delay line with no interpolation.

Comb delay line with no interpolation.

See also
Companion
class
final case
class CombN(rate: Rate, in: GE, maxDelayTime: GE, delayTime: GE, decayTime: GE) extends SingleOut

Comb delay line with no interpolation.

Comb delay line with no interpolation.

Value Params
decayTime

Time for the echoes to decay by 60 decibels. If this time is negative then the feedback coefficient will be negative, thus emphasizing only odd harmonics at an octave lower.

delayTime

Delay time in seconds.

in

The input signal.

maxDelayTime

The maximum delay time in seconds. used to initialize the delay buffer size. ''(init-time only)''

See also
Companion
object
object Compander extends ProductReader[Compander]

A compressor, expander, limiter, gate and ducking UGen. This dynamic processor uses a hard-knee characteristic. All of the thresholds and ratios are given as direct values, not in decibels!

A compressor, expander, limiter, gate and ducking UGen. This dynamic processor uses a hard-knee characteristic. All of the thresholds and ratios are given as direct values, not in decibels!

See also
Companion
class
final case
class Compander(rate: Rate, in: GE, ctrl: GE, thresh: GE, ratioBelow: GE, ratioAbove: GE, attack: GE, release: GE) extends SingleOut

A compressor, expander, limiter, gate and ducking UGen. This dynamic processor uses a hard-knee characteristic. All of the thresholds and ratios are given as direct values, not in decibels!

A compressor, expander, limiter, gate and ducking UGen. This dynamic processor uses a hard-knee characteristic. All of the thresholds and ratios are given as direct values, not in decibels!

Value Params
attack

The amount of time it takes for the amplitude adjustment to kick in fully. This is usually pretty small, not much more than 10 milliseconds (the default value). I often set it as low as 2 milliseconds (0.002).

ctrl

The signal whose amplitude controls the processor. Often the same as in, but one may wish to apply equalization or delay to it to change the compressor character (side-chaining), or even feed a completely different signal, for instance in a ducking application.

in

The signal to be compressed / expanded / gated.

ratioAbove

Slope of the amplitude curve above the threshold. Values < 1.0 achieve compression (louder signals are attenuated); > 1.0, you get expansion (louder signals are made even louder). For 3:1 compression, you would use a value of 1/3 here.

ratioBelow

Slope of the amplitude curve below the threshold. If this slope > 1.0, the amplitude will drop off more quickly the softer the control signal gets; when the control signal is close to 0 amplitude, the output should be exactly zero -- hence, noise gating. Values < 1.0 are possible, but it means that a very low-level control signal will cause the input signal to be amplified, which would raise the noise floor.

release

The amount of time for the amplitude adjustment to be released. Usually a bit longer than attack; if both times are too short, you can get some (possibly unwanted) artifacts.

thresh

Control signal amplitude threshold, which determines the break point between slopeBelow and slopeAbove. Usually 0..1. The control signal amplitude is calculated using RMS.

See also
Companion
object
object ControlDur extends ProductReader[ControlDur]

A UGen that reports the server's current control period in seconds. This is equivalent to the reciprocal of ControlRate

A UGen that reports the server's current control period in seconds. This is equivalent to the reciprocal of ControlRate

===Examples===

// print the control period
play { ControlDur.ir.poll(0) }
See also
Companion
class
final case
class ControlDur() extends SingleOut with ScalarRated

A UGen that reports the server's current control period in seconds. This is equivalent to the reciprocal of ControlRate

A UGen that reports the server's current control period in seconds. This is equivalent to the reciprocal of ControlRate

See also
Companion
object
object ControlRate extends ProductReader[ControlRate]

A UGen that reports the server's current control rate. This is equivalent to the reciprocal of ControlDur

A UGen that reports the server's current control rate. This is equivalent to the reciprocal of ControlDur

===Examples===

// print the control rate
play { ControlRate.ir.poll(0) }
// play a sine tone at control rate
play { SinOsc.ar(ControlRate.ir) * 0.1 }
See also
Companion
class
final case
class ControlRate() extends SingleOut with ScalarRated

A UGen that reports the server's current control rate. This is equivalent to the reciprocal of ControlDur

A UGen that reports the server's current control rate. This is equivalent to the reciprocal of ControlDur

See also
Companion
object
object Convolution extends ProductReader[Convolution]

A UGen that performs a convolution with an continuously changing kernel. If the kernel is static or must only change occasionally, Convolution2 will be a more CPU friendly alternative. The process introduces a delay of frameSize - blockSize .

A UGen that performs a convolution with an continuously changing kernel. If the kernel is static or must only change occasionally, Convolution2 will be a more CPU friendly alternative. The process introduces a delay of frameSize - blockSize .

===Examples===

// sine filter
play {
 val a = WhiteNoise.ar
 val b = SinOsc.ar(MouseY.kr(20, 2000, 1))
 Convolution.ar(a, b, 512) * 0.01
}
See also
Companion
class
final case
class Convolution(rate: Rate, in: GE, kernel: GE, frameSize: GE) extends SingleOut with IsIndividual

A UGen that performs a convolution with an continuously changing kernel. If the kernel is static or must only change occasionally, Convolution2 will be a more CPU friendly alternative. The process introduces a delay of frameSize - blockSize .

A UGen that performs a convolution with an continuously changing kernel. If the kernel is static or must only change occasionally, Convolution2 will be a more CPU friendly alternative. The process introduces a delay of frameSize - blockSize .

Value Params
frameSize

convolution size in sample frames, which is half of the FFT size. Must be a power of two. There is maximum frame-size of 16384 (if exceeded, the server may crash). ''(init-time only)''

in

first operand of the convolution

kernel

second operand of the convolution

See also
Companion
object
object Convolution2 extends ProductReader[Convolution2]

A frequency-domain convolution UGen using a fixed kernel which can be updated by a trigger signal. The delay caused by the convolution when the kernel is a dirac impulse is equal to frameSize - controlBlockSize , so for a frameSize of 2048 and a control-block size of 64, this is 1984 sample frames.

A frequency-domain convolution UGen using a fixed kernel which can be updated by a trigger signal. The delay caused by the convolution when the kernel is a dirac impulse is equal to frameSize - controlBlockSize , so for a frameSize of 2048 and a control-block size of 64, this is 1984 sample frames.

===Examples===

// three example kernels
// creates a buffer with `n` set values
def mkBuf(n: Int, amp: => Double): Buffer = {
 val v = Vector.tabulate[FillValue](n) { i =>
   (i.linLin(0, n, 0, 2048).toInt, amp)
 }
 val b = Buffer(s)
 b.alloc(2048, completion = b.zeroMsg(b.setMsg(v: _*)))
 b
}

val b = mkBuf(3, 1)
val c = mkBuf(50, math.random)
val d = mkBuf(20, 1)

val x = play {
 val z   = Impulse.ar(1)
 val buf = "kernel".kr(b.id)
 val tr  = "trig"  .tr
 Convolution2.ar(z, buf, tr, 2048) * 0.5
}

// set buffer and trigger kernel actualization
x.set("kernel" -> b.id, "trig" -> 1)
x.set("kernel" -> c.id, "trig" -> 1)
x.set("kernel" -> d.id, "trig" -> 1)

x.free(); b.free(); c.free(); d.free()
See also
Companion
class
final case
class Convolution2(rate: Rate, in: GE, kernel: GE, trig: GE, frameSize: GE) extends SingleOut with IsIndividual

A frequency-domain convolution UGen using a fixed kernel which can be updated by a trigger signal. The delay caused by the convolution when the kernel is a dirac impulse is equal to frameSize - controlBlockSize , so for a frameSize of 2048 and a control-block size of 64, this is 1984 sample frames.

A frequency-domain convolution UGen using a fixed kernel which can be updated by a trigger signal. The delay caused by the convolution when the kernel is a dirac impulse is equal to frameSize - controlBlockSize , so for a frameSize of 2048 and a control-block size of 64, this is 1984 sample frames.

Value Params
frameSize

size of the kernel. this must be a power of two. the FFT calculated internally by the UGen has a size of twice this value. The maximum allowed frameSize is 16384. ''(init-time only)''

in

the realtime input to be convolved

kernel

buffer identifier for the fixed kernel, which may be modulated in combination with the trigger. Even a trigger input of zero is used, upon UGen initialization the kernel must point to a valid buffer, otherwise the UGen aborts.

trig

updates the kernel on a change from non-positive to positive (<= 0 to >0)

See also
Companion
object
object Convolution2L extends ProductReader[Convolution2L]

A frequency-domain convolution UGen using two linearly interpolated fixed kernels. When a trigger is received, a linear fade will be performed from the previously used kernel (internally stored by the UGen) towards the snapshot of the current kernel content upon receiving the trigger.

A frequency-domain convolution UGen using two linearly interpolated fixed kernels. When a trigger is received, a linear fade will be performed from the previously used kernel (internally stored by the UGen) towards the snapshot of the current kernel content upon receiving the trigger.

The delay caused by the convolution when the kernel is a dirac impulse is equal to frameSize - controlBlockSize , so for a frameSize of 2048 and a control-block size of 64, this is 1984 sample frames.

'''Note''': If a trigger is received before the previous fade is complete, the interpolation is broken and the kernel instead jumps straight to one of the two buffers.

===Examples===

// three example kernels
def mkBuf(n: Int, amp: => Double): Buffer = {
 val v = Vector.tabulate[FillValue](n) { i =>
   (i.linLin(0, n, 0, 2048).toInt, amp)
 }
 val b = Buffer(s)
 b.alloc(2048, completion = b.zeroMsg(b.setMsg(v: _*)))
 b
}

val b = mkBuf(3, 1)
val c = mkBuf(50, math.random)
val d = mkBuf(20, 1)

val x = play {
 val z     = Impulse.ar(16)
 val buf   = "kernel".kr(b.id)
 val tr    = "trig"  .tr
 val dur   = 4.0          // fade-time in seconds
 val n     = 2048
 val block = SampleRate.ir / n
 val p     = dur * block  // ... in periods
 Convolution2L.ar(z, buf, tr, 2048, p) * 0.5
}

x.set("kernel" -> b.id, "trig" -> 1)
x.set("kernel" -> c.id, "trig" -> 1)
x.set("kernel" -> d.id, "trig" -> 1)

x.free(); b.free(); c.free(); d.free()
See also
Companion
class
final case
class Convolution2L(rate: Rate, in: GE, kernel: GE, trig: GE, frameSize: GE, fadePeriods: GE) extends SingleOut with IsIndividual

A frequency-domain convolution UGen using two linearly interpolated fixed kernels. When a trigger is received, a linear fade will be performed from the previously used kernel (internally stored by the UGen) towards the snapshot of the current kernel content upon receiving the trigger.

A frequency-domain convolution UGen using two linearly interpolated fixed kernels. When a trigger is received, a linear fade will be performed from the previously used kernel (internally stored by the UGen) towards the snapshot of the current kernel content upon receiving the trigger.

The delay caused by the convolution when the kernel is a dirac impulse is equal to frameSize - controlBlockSize , so for a frameSize of 2048 and a control-block size of 64, this is 1984 sample frames.

'''Note''': If a trigger is received before the previous fade is complete, the interpolation is broken and the kernel instead jumps straight to one of the two buffers.

Value Params
fadePeriods

fade duration expressed as number of convolved blocks. If the desired duration in seconds is dur , then the number of periods can be calculated as fadePeriods = dur * SampleRate.ir / frameSize . ''(init-time only)''

frameSize

size of the kernel. this must be a power of two. the FFT calculated internally by the UGen has a size of twice this value. The maximum allowed frameSize is 16384. ''(init-time only)''

in

the realtime input to be convolved

kernel

buffer identifier for the fixed kernel, which may be modulated in combination with the trigger. Even if the trigger input is initially zero, upon UGen initialization the kernel must point to a valid buffer, otherwise the UGen aborts.

trig

begins a fade to update the kernel on a change from non-positive to positive (<= 0 to >0).

See also
Companion
object
object Convolution3 extends ProductReader[Convolution3]

A UGen for triggered convolution in the time domain.

A UGen for triggered convolution in the time domain.

'''Warning: This UGen seems currently broken (SC 3.6.3)'''

See also
Companion
class
final case
class Convolution3(rate: Rate, in: GE, kernel: GE, trig: GE, frameSize: GE) extends SingleOut with IsIndividual

A UGen for triggered convolution in the time domain.

A UGen for triggered convolution in the time domain.

'''Warning: This UGen seems currently broken (SC 3.6.3)'''

Value Params
frameSize

''(init-time only)''

in

the realtime input to be convolved

kernel

buffer identifier for the fixed kernel, which may be modulated in combination with the trigger. Even a trigger input of zero is used, upon UGen initialization the kernel must point to a valid buffer, otherwise the UGen aborts.

See also
Companion
object
object Crackle extends ProductReader[Crackle]

A noise generator UGen based on a chaotic function. Output values lie between zero and one. Although this is a deterministic process, it is randomly seeded.

A noise generator UGen based on a chaotic function. Output values lie between zero and one. Although this is a deterministic process, it is randomly seeded.

===Examples===

// increasing parameter
play {
 val chaos = Line.kr(1.0, 2.01, 15)
 chaos.poll(2, "chaos")
 Crackle.ar(Seq(chaos, chaos)) * 0.5
}
See also
Companion
class
final case
class Crackle(rate: Rate, chaos: GE) extends SingleOut with IsIndividual

A noise generator UGen based on a chaotic function. Output values lie between zero and one. Although this is a deterministic process, it is randomly seeded.

A noise generator UGen based on a chaotic function. Output values lie between zero and one. Although this is a deterministic process, it is randomly seeded.

Value Params
chaos

A parameter of the chaotic function with useful values from just below 1.0 to just above 2.0. Towards 2.0 the sound crackles. Values greater than 2.01 are not safe, as the UGen can switch to outputting NaNs. A early more crackling sound appears with a value of 1.33 .

See also
Companion
object
object CuspL extends ProductReader[CuspL]

A linear-interpolating sound generator based on the difference equation:

A linear-interpolating sound generator based on the difference equation:

x[n+1] = a - b * sqrt(abs(x[n]))

===Examples===

// vary frequency
play { CuspL.ar(MouseX.kr(20, SampleRate.ir), 1.0, 1.99) * 0.3 }
// mouse-controlled parameters
play { CuspL.ar(SampleRate.ir/4, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2,1)) * 0.3 }
// as a frequency control
play { SinOsc.ar(CuspL.ar(40, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1)) * 800 + 900) * 0.4 }
See also
Companion
class
final case
class CuspL(rate: Rate, freq: GE, a: GE, b: GE, xi: GE) extends SingleOut

A linear-interpolating sound generator based on the difference equation:

A linear-interpolating sound generator based on the difference equation:

x[n+1] = a - b * sqrt(abs(x[n]))
Value Params
a

Equation variable

b

Equation variable

freq

Iteration frequency in Hertz

xi

Initial value of x

See also
Companion
object
object CuspN extends ProductReader[CuspN]

A non-interpolating sound generator based on the difference equation:

A non-interpolating sound generator based on the difference equation:

x[n+1] = a - b * sqrt(abs(x[n]))

===Examples===

// vary frequency
play { CuspN.ar(MouseX.kr(20, SampleRate.ir), 1.0, 1.99) * 0.3 }
// mouse-controlled parameters
play { CuspN.ar(SampleRate.ir/4, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1)) * 0.3 }
// as a frequency control
play { SinOsc.ar(CuspN.ar(40, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2,1)) * 800 + 900) * 0.4 }
See also
Companion
class
final case
class CuspN(rate: Rate, freq: GE, a: GE, b: GE, xi: GE) extends SingleOut

A non-interpolating sound generator based on the difference equation:

A non-interpolating sound generator based on the difference equation:

x[n+1] = a - b * sqrt(abs(x[n]))
Value Params
a

Equation variable

b

Equation variable

freq

Iteration frequency in Hertz

xi

Initial value of x

See also
Companion
object
object DC extends ProductReader[DC]

A UGen that creates a constant signal at a given calculation rate.

A UGen that creates a constant signal at a given calculation rate.

===Examples===

// create a silent audio signal
play {
 // Note: Select.ar requires audio-rate input.
 // Therefore, DC can be used to wrap the otherwise
 // incompatible constant zero. In future versions of
 // ScalaCollider, this wrapping will be done
 // automatically, however.
 Select.ar(MouseButton.kr(lag = 0), Seq(DC.ar(0), SinOsc.ar * 0.2))
}
See also
Companion
class
final case
class DC(rate: Rate, in: GE) extends SingleOut

A UGen that creates a constant signal at a given calculation rate.

A UGen that creates a constant signal at a given calculation rate.

Value Params
in

constant value to output, fixed at initialisation time. ''(init-time only)''

See also
Companion
object
object Dbrown extends ProductReader[Dbrown]

A demand-rate UGen that produces random decimal numbers, analogous to a Brownian motion.

A demand-rate UGen that produces random decimal numbers, analogous to a Brownian motion.

===Examples===

// random frequency
play {
 val in = Dbrown(lo = 0, hi = 15, step = 1)
 val tr = Impulse.kr(5)
 val v  = Demand.kr(tr, in)
 v.poll(tr)
 val f  = v * 30 + 300
 SinOsc.ar(f) * 0.1
}
See also
Companion
class
final case
class Dbrown(lo: GE, hi: GE, step: GE, length: GE) extends SingleOut with DemandRated with IsIndividual

A demand-rate UGen that produces random decimal numbers, analogous to a Brownian motion.

A demand-rate UGen that produces random decimal numbers, analogous to a Brownian motion.

Value Params
hi

minimum value (inclusive)

length

length of the sequence or inf

lo

minimum value (inclusive)

step

the maximum step a value can take from the previous value

See also
Companion
object
object Dbufrd extends ProductReader[Dbufrd]

A demand-rate UGen that reads out a buffer. All inputs can be either demand UGens or any other UGens.

A demand-rate UGen that reads out a buffer. All inputs can be either demand UGens or any other UGens.

See also
Companion
class
final case
class Dbufrd(buf: GE, index: GE, loop: GE) extends SingleOut with DemandRated with IsIndividual with HasDoneFlag

A demand-rate UGen that reads out a buffer. All inputs can be either demand UGens or any other UGens.

A demand-rate UGen that reads out a buffer. All inputs can be either demand UGens or any other UGens.

Value Params
buf

the identifier of the buffer to read out

index

the frame index into the buffer

loop

whether to wrap an exceeding phase around the buffer length (1) or not (0)

See also
Companion
object
object Dbufwr extends ProductReader[Dbufwr]
Companion
class
final case
class Dbufwr(in: GE, buf: GE, index: GE, loop: GE) extends SingleOut with DemandRated with HasSideEffect with IsIndividual with HasDoneFlag
Companion
object
object Dconst extends ProductReader[Dconst]

A demand-rate UGen that outputs values from the child demand stream until the sum of those values reaches or exceeds a given total. The last value will be truncated so that the sum of Dconst 's output values will match the total exactly.

A demand-rate UGen that outputs values from the child demand stream until the sum of those values reaches or exceeds a given total. The last value will be truncated so that the sum of Dconst 's output values will match the total exactly.

Companion
class
final case
class Dconst(sum: GE, in: GE, tolerance: GE) extends SingleOut with DemandRated with IsIndividual

A demand-rate UGen that outputs values from the child demand stream until the sum of those values reaches or exceeds a given total. The last value will be truncated so that the sum of Dconst 's output values will match the total exactly.

A demand-rate UGen that outputs values from the child demand stream until the sum of those values reaches or exceeds a given total. The last value will be truncated so that the sum of Dconst 's output values will match the total exactly.

Value Params
in

a demand-rate stream, providing the output values

sum

the sum to reach. This may be a number, demand UGen or any other UGen. When a Dconst instance resets, one value will be taken for the sum, and it can't be modulated until the next reset.

tolerance

how close the running sum can get to stop the output: abs(running-sum - sum) <= tolerance. This is to avoid the problem of floating point rounding error preventing reaching the exact target sum.

Companion
object
object Decay extends ProductReader[Decay]

An integrator UGen with exponential decay of past values. This is essentially the same as Integrator except that instead of supplying the coefficient directly, it is calculated from a 60 dB decay time. This is the time required for the integrator to lose 99.9 % of its value or -60dB.

An integrator UGen with exponential decay of past values. This is essentially the same as Integrator except that instead of supplying the coefficient directly, it is calculated from a 60 dB decay time. This is the time required for the integrator to lose 99.9 % of its value or -60dB.

Note: This should not be confused with Lag which does not overshoot due to integration, but asymptotically follows the input signal.

See also
Companion
class
final case
class Decay(rate: MaybeRate, in: GE, time: GE) extends SingleOut

An integrator UGen with exponential decay of past values. This is essentially the same as Integrator except that instead of supplying the coefficient directly, it is calculated from a 60 dB decay time. This is the time required for the integrator to lose 99.9 % of its value or -60dB.

An integrator UGen with exponential decay of past values. This is essentially the same as Integrator except that instead of supplying the coefficient directly, it is calculated from a 60 dB decay time. This is the time required for the integrator to lose 99.9 % of its value or -60dB.

Note: This should not be confused with Lag which does not overshoot due to integration, but asymptotically follows the input signal.

Value Params
in

input signal to be processed

See also
Companion
object
object Decay2 extends ProductReader[Decay2]

A integrator UGen with controllable attack and release times. While Decay has a very sharp attack and can produce clicks, Decay2 rounds off the attack by subtracting one Decay from another. It can be seen as equivalent to

A integrator UGen with controllable attack and release times. While Decay has a very sharp attack and can produce clicks, Decay2 rounds off the attack by subtracting one Decay from another. It can be seen as equivalent to

Decay.ar(in, release) - Decay.ar(in, attack)

Note: This should not be confused with LagUD which does not overshoot due to integration, but asymptotically follows the input signal.

See also
Companion
class
final case
class Decay2(rate: MaybeRate, in: GE, attack: GE, release: GE) extends SingleOut

A integrator UGen with controllable attack and release times. While Decay has a very sharp attack and can produce clicks, Decay2 rounds off the attack by subtracting one Decay from another. It can be seen as equivalent to

A integrator UGen with controllable attack and release times. While Decay has a very sharp attack and can produce clicks, Decay2 rounds off the attack by subtracting one Decay from another. It can be seen as equivalent to

Decay.ar(in, release) - Decay.ar(in, attack)

Note: This should not be confused with LagUD which does not overshoot due to integration, but asymptotically follows the input signal.

Value Params
in

input signal to be processed

See also
Companion
object
object DecodeB2 extends ProductReader[DecodeB2]

A two dimensional Ambisonics B-format decoding UGen. It assumes a set of speakers in a regular polygon. The output channels are in clockwise order. The position of the first speaker is specified by the orient argument.

A two dimensional Ambisonics B-format decoding UGen. It assumes a set of speakers in a regular polygon. The output channels are in clockwise order. The position of the first speaker is specified by the orient argument.

===Examples===

// 4-channel rotation of opposite sounds
play {
 val p = WhiteNoise.ar(0.05)                     // first source
 val q = Mix(LFSaw.ar(Seq(200, 200.37))) * 0.03  // second source
 // B-format encode 2 signals at opposite sides of the circle
 val enc = PanB2.ar(p, -0.5) + PanB2.ar(q, +0.5)
 val Seq(w, x, y) = (0 to 2).map(enc out _)
 val rot = Rotate2.ar(x, y, MouseX.kr(-1, +1))
 // B-format decode to quad (front-left, front-right, rear-left, rear-right)
 DecodeB2.ar(4, w, rot.xr, rot.yr)
}
See also
Companion
class
final case
class DecodeB2(rate: Rate, numChannels: Int, w: GE, x: GE, y: GE, orient: GE) extends MultiOut

A two dimensional Ambisonics B-format decoding UGen. It assumes a set of speakers in a regular polygon. The output channels are in clockwise order. The position of the first speaker is specified by the orient argument.

A two dimensional Ambisonics B-format decoding UGen. It assumes a set of speakers in a regular polygon. The output channels are in clockwise order. The position of the first speaker is specified by the orient argument.

Value Params
numChannels

the number of output channels to produce

orient

orientation of the first channel. If zero, the first channel corresponds to the front vertex of the polygon. If the polygon does not have an edge at the front but a vertex, then an orient of 0.5 indicates that the first channel corresponds to the speaker left of the center.

w

W (first) channel of B-format input signal

x

X (second) channel of B-format input signal

y

Y (third) channel of B-format input signal

See also
Companion
object
object DegreeToKey extends ProductReader[DegreeToKey]

A UGen that uses an input signal as an index into an octave repeating table of pitch classes. The input is truncated to an integer, and indices wrap around the table and shift octaves as they do.

A UGen that uses an input signal as an index into an octave repeating table of pitch classes. The input is truncated to an integer, and indices wrap around the table and shift octaves as they do.

===Examples===

// modal space where mouse x controls pitch step
play {
 // initialize the scale buffer (Dorian)
 val scale = Vector(0, 2, 3.2, 5, 7, 9, 10)
 val buf   = LocalBuf(scale.size)
 SetBuf(buf, scale)

 // base MIDI pitch
 val base  = DegreeToKey.kr(buf, in = MouseX.kr(0, 15), octave = 12) + 72
 val noise = LFNoise1.kr(Seq(3, 3)) * 0.04  // low freq stereo detuning
 // lead tone
 val lead  = SinOsc.ar((base + noise).midiCps)
 // drone 5ths
 val drone = RLPF.ar(LFPulse.ar(Seq(48.midiCps, 55.midiCps), 0.15),
                     SinOsc.kr(0.1).mulAdd(10, 72).midiCps, 0.1)
 val mix = (lead + drone) * 0.1
 // add some 70's euro-space-rock echo
 CombN.ar(mix, 0.31, 0.31, 2) + mix
}
See also
Companion
class
final case
class DegreeToKey(rate: Rate, buf: GE, in: GE, octave: GE) extends SingleOut with IsIndividual

A UGen that uses an input signal as an index into an octave repeating table of pitch classes. The input is truncated to an integer, and indices wrap around the table and shift octaves as they do.

A UGen that uses an input signal as an index into an octave repeating table of pitch classes. The input is truncated to an integer, and indices wrap around the table and shift octaves as they do.

Value Params
buf

buffer which contains the steps for each scale degree.

in

input index signal

octave

number of steps per octave in the scale.

See also
Companion
object
object DelTapRd extends ProductReader[DelTapRd]

Tap a delay line from a DelTapWr UGen.

Tap a delay line from a DelTapWr UGen.

See also
Companion
class
final case
class DelTapRd(rate: Rate, buf: GE, phase: GE, delayTime: GE, interp: GE) extends SingleOut with IsIndividual

Tap a delay line from a DelTapWr UGen.

Tap a delay line from a DelTapWr UGen.

Value Params
buf

Buffer where DelTapWr has written signal. Max delay time is based on buffer size.

delayTime

Delay time in seconds.

interp

The kind of interpolation to be used. 1 is none, 2 is linear, 4 is cubic..

phase

the current phase of the DelTapWr UGen. This is the output of DelTapWr.

See also
Companion
object
object DelTapWr extends ProductReader[DelTapWr]

Write to a buffer for a DelTapRd UGen

Write to a buffer for a DelTapRd UGen

See also
Companion
class
final case
class DelTapWr(rate: Rate, buf: GE, in: GE) extends SingleOut with HasSideEffect with IsIndividual

Write to a buffer for a DelTapRd UGen

Write to a buffer for a DelTapRd UGen

Value Params
buf

The buffer to write signal into. Max delay time is based on buffer size. DelTapWr outputs its current sample value for use in the phase argument of DelTapRd .

in

The input signal.

See also
Companion
object
object Delay1 extends ProductReader[Delay1]

A UGen that delays the input by 1 audio frame or control period.

A UGen that delays the input by 1 audio frame or control period.

For audio-rate signals the delay is 1 audio frame, and for control-rate signals the delay is 1 control period.

''Note:'' The first value output is not zero but the same as the first input value! In this respect the UGen behaves different than DelayN .

===Examples===

// analog to HPZ1
play {
 val z = PinkNoise.ar
 val x = z - Delay1.ar(z)
 // mouse button to compare dry/wet
 LinXFade2.ar(z, x, MouseButton.kr(-1, 1))
}
See also
Companion
class
final case
class Delay1(rate: MaybeRate, in: GE) extends SingleOut

A UGen that delays the input by 1 audio frame or control period.

A UGen that delays the input by 1 audio frame or control period.

For audio-rate signals the delay is 1 audio frame, and for control-rate signals the delay is 1 control period.

''Note:'' The first value output is not zero but the same as the first input value! In this respect the UGen behaves different than DelayN .

Value Params
in

input to be delayed

See also
Companion
object
object Delay2 extends ProductReader[Delay2]

A UGen that delays the input by 2 audio frames or control periods.

A UGen that delays the input by 2 audio frames or control periods.

For audio-rate signals the delay is 2 audio frames, and for control-rate signals the delay is 2 control periods.

''Warning:'' the The first value output is zero, while both the second and the third value output equal the first input value! In this respect the UGen behaves different than DelayN .

===Examples===

// high-frequency comb filter
play {
 val z = PinkNoise.ar
 val x = z - Delay2.ar(z)
 // mouse button to compare dry/wet
 LinXFade2.ar(z, x, MouseButton.kr(-1, 1))
}
See also
Companion
class
final case
class Delay2(rate: MaybeRate, in: GE) extends SingleOut

A UGen that delays the input by 2 audio frames or control periods.

A UGen that delays the input by 2 audio frames or control periods.

For audio-rate signals the delay is 2 audio frames, and for control-rate signals the delay is 2 control periods.

''Warning:'' the The first value output is zero, while both the second and the third value output equal the first input value! In this respect the UGen behaves different than DelayN .

Value Params
in

input to be delayed

See also
Companion
object
object DelayC extends ProductReader[DelayC]

Simple delay line with cubic interpolation.

Simple delay line with cubic interpolation.

See also
Companion
class
final case
class DelayC(rate: Rate, in: GE, maxDelayTime: GE, delayTime: GE) extends SingleOut

Simple delay line with cubic interpolation.

Simple delay line with cubic interpolation.

Value Params
delayTime

Delay time in seconds.

in

The input signal.

maxDelayTime

The maximum delay time in seconds. used to initialize the delay buffer size. ''(init-time only)''

See also
Companion
object
object DelayL extends ProductReader[DelayL]

Simple delay line with linear interpolation.

Simple delay line with linear interpolation.

See also
Companion
class
final case
class DelayL(rate: Rate, in: GE, maxDelayTime: GE, delayTime: GE) extends SingleOut

Simple delay line with linear interpolation.

Simple delay line with linear interpolation.

Value Params
delayTime

Delay time in seconds.

in

The input signal.

maxDelayTime

The maximum delay time in seconds. used to initialize the delay buffer size. ''(init-time only)''

See also
Companion
object
object DelayN extends ProductReader[DelayN]

Simple delay line with no interpolation. The initial buffer contents is zero.

Simple delay line with no interpolation. The initial buffer contents is zero.

===Examples===

// Delayed random pulses
play {
 // Dust randomly triggers Decay to create an exponential
 // decay envelope for the WhiteNoise input source
 val z = Decay.ar(Dust.ar(2) * 0.5, 0.3) * WhiteNoise.ar
 DelayN.ar(z, 0.2, 0.2) + z  // input is mixed with delay via the add input
}
// Recursive application
play {
 val z = Decay2.ar(Dust.ar(1) * 0.5, 0.01, 0.1) * Saw.ar(Seq(100, 101)) * 0.5
 (z /: (0 until 5)) { (zi, i) =>
   DelayN.ar(RLPF.ar(zi, Rand(100, 3000), 0.03), 1, 1.0 / (2 << i)) + zi * 0.5
 }
}
See also
Companion
class
final case
class DelayN(rate: Rate, in: GE, maxDelayTime: GE, delayTime: GE) extends SingleOut

Simple delay line with no interpolation. The initial buffer contents is zero.

Simple delay line with no interpolation. The initial buffer contents is zero.

Value Params
delayTime

Delay time in seconds.

in

The input signal.

maxDelayTime

The maximum delay time in seconds. used to initialize the delay buffer size. ''(init-time only)''

See also
Companion
object
object Demand extends ProductReader[Demand]

A UGen which polls results from demand-rate ugens when receiving a trigger. When there is a trigger at the trig input, a value is demanded from each ugen in the in input and output. The unit generators in the list should be demand-rate. When there is a trigger at the reset input, the demand rate ugens in the list are reset.

A UGen which polls results from demand-rate ugens when receiving a trigger. When there is a trigger at the trig input, a value is demanded from each ugen in the in input and output. The unit generators in the list should be demand-rate. When there is a trigger at the reset input, the demand rate ugens in the list are reset.

Note: By design, a reset trigger only resets the demand ugens; it does not reset the value at Demand's output. Demand continues to hold its value until the next value is demanded, at which point its output value will be the first expected item in the in argument.

Note: One demand-rate ugen represents a single stream of values, so that embedding the same ugen twice calls this stream twice per demand, possibly yielding different values. To embed the same sequence twice, either make sure the ugen is demanded only once, or create two instances of the ugen.

'''Warning''': Demand currently seems to have problems with infinite sequences. As a workaround use a very large length instead. E.g. instead of Dbrown(0, 1, inf) use Dbrown(0, 1, 0xFFFFFFFF) !

'''Warning''': Demand seems to have a problem with initial triggers. For example Demand.kr(Impulse.kr(0), 1) will have a spurious zero value output first.

See also
Note

The argument order is different from its sclang counterpart.

Companion
class
final case
class Demand(rate: MaybeRate, trig: GE, in: GE, reset: GE) extends MultiOut with HasDoneFlag

A UGen which polls results from demand-rate ugens when receiving a trigger. When there is a trigger at the trig input, a value is demanded from each ugen in the in input and output. The unit generators in the list should be demand-rate. When there is a trigger at the reset input, the demand rate ugens in the list are reset.

A UGen which polls results from demand-rate ugens when receiving a trigger. When there is a trigger at the trig input, a value is demanded from each ugen in the in input and output. The unit generators in the list should be demand-rate. When there is a trigger at the reset input, the demand rate ugens in the list are reset.

Note: By design, a reset trigger only resets the demand ugens; it does not reset the value at Demand's output. Demand continues to hold its value until the next value is demanded, at which point its output value will be the first expected item in the in argument.

Note: One demand-rate ugen represents a single stream of values, so that embedding the same ugen twice calls this stream twice per demand, possibly yielding different values. To embed the same sequence twice, either make sure the ugen is demanded only once, or create two instances of the ugen.

'''Warning''': Demand currently seems to have problems with infinite sequences. As a workaround use a very large length instead. E.g. instead of Dbrown(0, 1, inf) use Dbrown(0, 1, 0xFFFFFFFF) !

'''Warning''': Demand seems to have a problem with initial triggers. For example Demand.kr(Impulse.kr(0), 1) will have a spurious zero value output first.

Value Params
in

a demand-rate signal (possibly multi-channel) which is read at each trigger

reset

trigger. Resets the list of ugens (in) when triggered.

trig

trigger. Can be any signal. A trigger happens when the signal changes from non-positive to positive.

See also
Note

The argument order is different from its sclang counterpart.

Companion
object
object DemandEnvGen extends ProductReader[DemandEnvGen]

An envelope generator UGen using demand-rate inputs for the envelope segments. For each parameter of the envelope (levels, durations and shapes), values are polled every time a new segment starts.

An envelope generator UGen using demand-rate inputs for the envelope segments. For each parameter of the envelope (levels, durations and shapes), values are polled every time a new segment starts.

See also

DoneAction

Companion
class
final case
class DemandEnvGen(rate: Rate, levels: GE, durs: GE, shapes: GE, curvatures: GE, gate: GE, reset: GE, levelScale: GE, levelBias: GE, timeScale: GE, doneAction: GE) extends SingleOut with HasSideEffect

An envelope generator UGen using demand-rate inputs for the envelope segments. For each parameter of the envelope (levels, durations and shapes), values are polled every time a new segment starts.

An envelope generator UGen using demand-rate inputs for the envelope segments. For each parameter of the envelope (levels, durations and shapes), values are polled every time a new segment starts.

Value Params
curvatures

demand-rate ugen (or other ugen) returning curvature values. these are used for curveShape segments (shape number 5) and should be zero for other shapes.

doneAction

a done action performed when one of the demand-rated series ends

durs

demand-rate ugen (or other ugen) returning duration values

gate

a control rate gate: if gate is x >= 1, the ugen runs. if gate is 0 > x > 1, the ugen is released at the next level (according to doneAction). if gate is x <= 0, the ugen is sampled and held.

levelBias

demand-rate ugen returning level offset values

levelScale

demand-rate ugen returning level scaling values

levels

demand-rate ugen (or other ugen) returning level values

reset

a trigger signal. a trigger occurs when passing from non-positive to positive. when the trigger amplitude is < 1, the input ugens (those that are demand-rated) are reset when the current segment ends. if the trigger amplitude is > 1, the reset is performed immediately.

shapes

demand-rate ugen (or other ugen) returning shape number for the envelope segment.

timeScale

demand-rate ugen returning time scaling values

See also

DoneAction

Companion
object
object DetectIndex extends ProductReader[DetectIndex]

A UGen which determines the index in a buffer at which the value matches a given input signal. If the input value is not found, it outputs -1.

A UGen which determines the index in a buffer at which the value matches a given input signal. If the input value is not found, it outputs -1.

For example, if the buffer contains values 5, 3, 2, 8, and the input signal is 3, the output will be 1. If the input is 3.001, the output will be -1. Unlike IndexInBetween , this UGen always searches through the entire buffer until the value is found or the end has been reached (returning -1).

See also
Companion
class
final case
class DetectIndex(rate: Rate, buf: GE, in: GE) extends SingleOut with IsIndividual

A UGen which determines the index in a buffer at which the value matches a given input signal. If the input value is not found, it outputs -1.

A UGen which determines the index in a buffer at which the value matches a given input signal. If the input value is not found, it outputs -1.

For example, if the buffer contains values 5, 3, 2, 8, and the input signal is 3, the output will be 1. If the input is 3.001, the output will be -1. Unlike IndexInBetween , this UGen always searches through the entire buffer until the value is found or the end has been reached (returning -1).

See also
Companion
object
object DetectSilence extends ProductReader[DetectSilence]

A UGen which detects whether its input signal falls below a given amplitude for a given amount of time (becoming "silent"). A silence is detected if the absolute sample values of the input remain less than or equal to the amp threshold for a consecutive amount of time given by the dur argument.

A UGen which detects whether its input signal falls below a given amplitude for a given amount of time (becoming "silent"). A silence is detected if the absolute sample values of the input remain less than or equal to the amp threshold for a consecutive amount of time given by the dur argument.

A value of 1 is output when this condition is met, and a value of 0 is output when the condition is not met (i.e. at least one sample occurs in the input whose absolute value is greater than amp ). Besides, when the output changes from zero to one, the doneAction is executed (unless it is doNothing ).

A special case is the initial condition of the UGen: It will begin with an output value of 0 (no silence detected), even if the input signal is below the amplitude threshold. It is only after the first input sample rising above the threshold that the actual monitoring begins and a trigger of 1 or the firing of the done-action may occur.

See also
Companion
class
final case
class DetectSilence(rate: MaybeRate, in: GE, amp: GE, dur: GE, doneAction: GE) extends SingleOut with HasSideEffect

A UGen which detects whether its input signal falls below a given amplitude for a given amount of time (becoming "silent"). A silence is detected if the absolute sample values of the input remain less than or equal to the amp threshold for a consecutive amount of time given by the dur argument.

A UGen which detects whether its input signal falls below a given amplitude for a given amount of time (becoming "silent"). A silence is detected if the absolute sample values of the input remain less than or equal to the amp threshold for a consecutive amount of time given by the dur argument.

A value of 1 is output when this condition is met, and a value of 0 is output when the condition is not met (i.e. at least one sample occurs in the input whose absolute value is greater than amp ). Besides, when the output changes from zero to one, the doneAction is executed (unless it is doNothing ).

A special case is the initial condition of the UGen: It will begin with an output value of 0 (no silence detected), even if the input signal is below the amplitude threshold. It is only after the first input sample rising above the threshold that the actual monitoring begins and a trigger of 1 or the firing of the done-action may occur.

Value Params
amp

minimum amplitude threshold which must be exceeded for the input signal to be considered non-silent. ''(init-time only)''

doneAction

an action to be performed when the output changes from zero to one (silence detected).

dur

The duration in seconds for which the input signal must be continuously smaller than or equal to the threshold to be considered silent. ''(init-time only)''

in

input signal to be measured.

See also
Companion
object
object Dgeom extends ProductReader[Dgeom]

A demand-rate UGen that produces a geometric series. Each value is calculated as

A demand-rate UGen that produces a geometric series. Each value is calculated as

x[t] = x[t-1] * grow

With x[0] given as argument start.

===Examples===

// increasing frequency
play {
 val in = Dgeom(1, 1.2, 15)
 val tr = Impulse.kr(5)
 val v  = Demand.kr(tr, in)
 v.poll(tr)
 val f  = v * 30 + 300
 SinOsc.ar(f) * 0.1
}
See also
Companion
class
final case
class Dgeom(start: GE, grow: GE, length: GE) extends SingleOut with DemandRated with IsIndividual

A demand-rate UGen that produces a geometric series. Each value is calculated as

A demand-rate UGen that produces a geometric series. Each value is calculated as

x[t] = x[t-1] * grow

With x[0] given as argument start.

Value Params
grow

factor (multiplier) by which values grow

length

length of the sequence or inf

start

initial value

See also
Companion
object
object Dibrown extends ProductReader[Dibrown]

A demand-rate UGen that produces random integer numbers, analogous to a Brownian motion, or the drunk object in Max.

A demand-rate UGen that produces random integer numbers, analogous to a Brownian motion, or the drunk object in Max.

'''Note''': The length parameter seems currently broken.

===Examples===

// random frequency
play {
 val in = Dibrown(lo = 0, hi = 15, step = 2)
 val tr = Impulse.kr(5)
 val v  = Demand.kr(tr, in)
 v.poll(tr)
 val f  = (v + 62).midiCps
 SinOsc.ar(f) * 0.1
}
See also
Companion
class
final case
class Dibrown(lo: GE, hi: GE, step: GE, length: GE) extends SingleOut with DemandRated with IsIndividual

A demand-rate UGen that produces random integer numbers, analogous to a Brownian motion, or the drunk object in Max.

A demand-rate UGen that produces random integer numbers, analogous to a Brownian motion, or the drunk object in Max.

'''Note''': The length parameter seems currently broken.

Value Params
hi

maximum value (inclusive)

length

length of the sequence or inf . This is currently (SuperCollider 3.7.2) broken, and the sequence always has infinite length.

lo

minimum value (inclusive)

step

the maximum step a value can take from the previous value

See also
Companion
object
object DiskIn extends ProductReader[DiskIn]

A UGen to stream in a signal from an audio file. Continuously plays a longer audio file from disk. This requires a buffer to be preloaded with one buffer size of sound. If loop is set to 1, the file will loop.

A UGen to stream in a signal from an audio file. Continuously plays a longer audio file from disk. This requires a buffer to be preloaded with one buffer size of sound. If loop is set to 1, the file will loop.

'''Note''': The buffer size must be a multiple of (2 * the server's block size). See Buffer#cue for details.

See also

Buffer#cue

Companion
class
final case
class DiskIn(rate: Rate, numChannels: Int, buf: GE, loop: GE) extends MultiOut with HasSideEffect with IsIndividual with HasDoneFlag

A UGen to stream in a signal from an audio file. Continuously plays a longer audio file from disk. This requires a buffer to be preloaded with one buffer size of sound. If loop is set to 1, the file will loop.

A UGen to stream in a signal from an audio file. Continuously plays a longer audio file from disk. This requires a buffer to be preloaded with one buffer size of sound. If loop is set to 1, the file will loop.

'''Note''': The buffer size must be a multiple of (2 * the server's block size). See Buffer#cue for details.

Value Params
buf

the id of the buffer with the correct number of channels and frames

loop

whether the file should loop when its end is reached

numChannels

the amount of channels the file and the buffer will have. This is an Int and hence must be pre-determined. Different SynthDefs must be created for different numbers of channels.

See also

Buffer#cue

Companion
object
object DiskOut extends ProductReader[DiskOut]

A UGen which writes a signal to a sound file on disk. To achieve this efficiently, a buffer is needs to be provides which is used to buffer the incoming signal.

A UGen which writes a signal to a sound file on disk. To achieve this efficiently, a buffer is needs to be provides which is used to buffer the incoming signal.

'''Note''': It might be that the buffer size must be a multiple of (2 * the server's block size). We haven't currently verified this, but to be safe, you should make sure this property is met.

The signal output by the UGen represents the number of frames written.

See also

Buffer#write

Companion
class
final case
class DiskOut(rate: Rate, buf: GE, in: GE) extends SingleOut with HasSideEffect with IsIndividual

A UGen which writes a signal to a sound file on disk. To achieve this efficiently, a buffer is needs to be provides which is used to buffer the incoming signal.

A UGen which writes a signal to a sound file on disk. To achieve this efficiently, a buffer is needs to be provides which is used to buffer the incoming signal.

'''Note''': It might be that the buffer size must be a multiple of (2 * the server's block size). We haven't currently verified this, but to be safe, you should make sure this property is met.

The signal output by the UGen represents the number of frames written.

Value Params
buf

the buffer used internally by the UGen. this number of frames in the buffer must be a power of two (this is currently not checked!). The buffer must have been initialized with a write command whose leaveOpen argument is true. Note that the number of channels of the buffer and of the input signal must be the same, otherwise DiskOut will fail silently (and not write anything to the file). '''Warning''': Crashes the server if the number of channels exceeds 32.

in

the signal to be recorded

See also

Buffer#write

Companion
object
object Diwhite extends ProductReader[Diwhite]

A demand-rate UGen that produces equally distributed random integer numbers.

A demand-rate UGen that produces equally distributed random integer numbers.

===Examples===

// random pitch
play {
 val in = Diwhite(lo = 0, hi = 15)
 val tr = Impulse.kr(5)
 val v  = Demand.kr(tr, in)
 v.poll(tr)
 val f  = (v + 62).midiCps
 SinOsc.ar(f) * 0.1
}
See also
Companion
class
final case
class Diwhite(lo: GE, hi: GE, length: GE) extends SingleOut with DemandRated with IsIndividual

A demand-rate UGen that produces equally distributed random integer numbers.

A demand-rate UGen that produces equally distributed random integer numbers.

Value Params
hi

maximum value (inclusive)

length

length of the sequence or inf

lo

minimum value (inclusive)

See also
Companion
object
object Donce extends ProductReader[Donce]
Companion
class
final case
class Donce(in: GE) extends SingleOut with DemandRated with IsIndividual
Companion
object
object Done extends ProductReader[Done]

A UGen which monitors another UGen to see when it is finished. Some UGens, such as PlayBuf , RecordBuf , Line , XLine , EnvGen , Linen , BufRd , BufWr , DbufRd , and the Buffer delay UGens set a 'done' flag when they are finished playing. This UGen echoes that flag as an explicit output signal when it is set to track a particular UGen. When the tracked UGen changes to done, the output signal changes from zero to one.

A UGen which monitors another UGen to see when it is finished. Some UGens, such as PlayBuf , RecordBuf , Line , XLine , EnvGen , Linen , BufRd , BufWr , DbufRd , and the Buffer delay UGens set a 'done' flag when they are finished playing. This UGen echoes that flag as an explicit output signal when it is set to track a particular UGen. When the tracked UGen changes to done, the output signal changes from zero to one.

See also
Companion
class
final case
class Done(src: GE & HasDoneFlag) extends SingleOut with ControlRated with HasSideEffect

A UGen which monitors another UGen to see when it is finished. Some UGens, such as PlayBuf , RecordBuf , Line , XLine , EnvGen , Linen , BufRd , BufWr , DbufRd , and the Buffer delay UGens set a 'done' flag when they are finished playing. This UGen echoes that flag as an explicit output signal when it is set to track a particular UGen. When the tracked UGen changes to done, the output signal changes from zero to one.

A UGen which monitors another UGen to see when it is finished. Some UGens, such as PlayBuf , RecordBuf , Line , XLine , EnvGen , Linen , BufRd , BufWr , DbufRd , and the Buffer delay UGens set a 'done' flag when they are finished playing. This UGen echoes that flag as an explicit output signal when it is set to track a particular UGen. When the tracked UGen changes to done, the output signal changes from zero to one.

Value Params
src

the UGen to track

See also
Companion
object
object Dpoll extends ProductReader[Dpoll]

A demand rate UGen printing the current output value of its input to the console when polled.

A demand rate UGen printing the current output value of its input to the console when polled.

See also
Companion
class
final case
class Dpoll(in: GE, label: String, run: GE, trigId: GE) extends SingleOut with DemandRated with HasSideEffect with IsIndividual

A demand rate UGen printing the current output value of its input to the console when polled.

A demand rate UGen printing the current output value of its input to the console when polled.

Value Params
in

the signal you want to poll

label

a string or symbol to be printed with the polled value ''(init-time only)''

run

if 1 the polling is active, if 0 it is inactive.

trigId

if greater then 0, a "/tr" OSC message is sent back to the client (similar to SendTrig )

See also
Companion
object
object Drand extends ProductReader[Drand]

A demand-rate UGen which outputs random elements from a sequence. Drand allows duplicate elements to appear, whereas Dxrand forbids repetitions.

A demand-rate UGen which outputs random elements from a sequence. Drand allows duplicate elements to appear, whereas Dxrand forbids repetitions.

===Examples===

// sequence of constants
play {
 val in = Drand(Seq(3, 5, 7, 8, 11), inf)
 val tr = Impulse.kr(5)
 val v  = Demand.kr(tr, in)
 v.poll(tr)
 val f  = (v + 62).midiCps
 SinOsc.ar(f) * 0.1
}
See also
Companion
class
final case
class Drand(seq: GE, length: GE) extends SingleOut with DemandRated with IsIndividual

A demand-rate UGen which outputs random elements from a sequence. Drand allows duplicate elements to appear, whereas Dxrand forbids repetitions.

A demand-rate UGen which outputs random elements from a sequence. Drand allows duplicate elements to appear, whereas Dxrand forbids repetitions.

Value Params
length

The number of items polled from the sequence

seq

A multi-channel signal providing the values at each step of the sequence. Typically (but not necessarily) a sequence of constant values.

See also
Companion
object
object Dreset extends ProductReader[Dreset]

A demand-rate UGen that, when triggered, resets the state of its in argument.

A demand-rate UGen that, when triggered, resets the state of its in argument.

===Examples===

// reset on mouse-click
play {
 val in = Dreset(Dseries(0, 2, inf), MouseButton.kr)
 val tr = Impulse.kr(5)
 val v  = Demand.kr(tr, in)
 v.poll(tr)
 val f  = v * 30 + 340
 SinOsc.ar(f) * 0.1
}
See also
Companion
class
final case
class Dreset(in: GE, reset: GE) extends SingleOut with DemandRated with IsIndividual

A demand-rate UGen that, when triggered, resets the state of its in argument.

A demand-rate UGen that, when triggered, resets the state of its in argument.

Value Params
in

a demand-rate UGen, producing values which are passed through, and which will be reset by this UGen

reset

a demand-rate or any other UGen. When crossing from non-positive to positive, Dreset resets its in argument.

See also
Companion
object
object Dseq extends ProductReader[Dseq]

A demand-rate UGen which reproduces and repeats a sequence of values.

A demand-rate UGen which reproduces and repeats a sequence of values.

The arguments can be constant or any other ugens, where demand rate UGens are normally polled, proceeding to the next value when the sub-sequence ends.

===Examples===

// sequence of constants
play {
 val in = Dseq(Seq(3, 5, 7, 8, 11), inf)
 val tr = Impulse.kr(5)
 val v  = Demand.kr(tr, in)
 v.poll(tr)
 val f  = (v + 62).midiCps
 SinOsc.ar(f) * 0.1
}
// constants alternating with white noise samples
play {
 val in = Dseq(Seq[GE](3, 5, 7, 8, 11, WhiteNoise.kr * 2), inf)
 val tr = Impulse.kr(5)
 val v  = Demand.kr(tr, in)
 v.poll(tr)
 val f  = (v + 62).midiCps
 SinOsc.ar(f) * 0.1
}
// constants alternating with two brownian values
play {
 val br = Dbrown(lo = -3, hi = 3, step = 1, length = 2)
 val c7 = Dseq(7, repeats = inf)
 val in = Dseq(Seq[GE](3, 5, 7, 8, 11, br), inf)
 val tr = Impulse.kr(5)
 val v  = Demand.kr(tr, in)
 v.poll(tr)
 val f  = (v + 62).midiCps
 SinOsc.ar(f) * 0.1
}
See also
Companion
class
final case
class Dseq(seq: GE, repeats: GE) extends SingleOut with DemandRated with IsIndividual

A demand-rate UGen which reproduces and repeats a sequence of values.

A demand-rate UGen which reproduces and repeats a sequence of values.

The arguments can be constant or any other ugens, where demand rate UGens are normally polled, proceeding to the next value when the sub-sequence ends.

Value Params
repeats

The number of repetitions of the entire sequence

seq

A multi-channel signal providing the values at each step of the sequence. Typically (but not necessarily) a sequence of constant values.

See also
Companion
object
object Dser extends ProductReader[Dser]

A demand-rate UGen which reproduces and repeats values of a sequence. It is very similar to Dseq , the difference being that the length parameter specifies the length of output sequence, not the number of repetitions of the input sequence. The input sequence is repeated if length is greater than the length of the input sequence.

A demand-rate UGen which reproduces and repeats values of a sequence. It is very similar to Dseq , the difference being that the length parameter specifies the length of output sequence, not the number of repetitions of the input sequence. The input sequence is repeated if length is greater than the length of the input sequence.

The arguments can be constant or any other ugens, where demand rate UGens are normally polled, proceeding to the next value when the sub-sequence ends.

===Examples===

// sequence of constants
play {
 val in = Dseq(Seq(3, 5, 7, 8, 11), 8)
 val tr = Impulse.kr(5)
 val v  = Demand.kr(tr, in)
 v.poll(tr)
 val f  = (v + 62).midiCps
 SinOsc.ar(f) * 0.1
}
See also
Companion
class
final case
class Dser(seq: GE, length: GE) extends SingleOut with DemandRated with IsIndividual

A demand-rate UGen which reproduces and repeats values of a sequence. It is very similar to Dseq , the difference being that the length parameter specifies the length of output sequence, not the number of repetitions of the input sequence. The input sequence is repeated if length is greater than the length of the input sequence.

A demand-rate UGen which reproduces and repeats values of a sequence. It is very similar to Dseq , the difference being that the length parameter specifies the length of output sequence, not the number of repetitions of the input sequence. The input sequence is repeated if length is greater than the length of the input sequence.

The arguments can be constant or any other ugens, where demand rate UGens are normally polled, proceeding to the next value when the sub-sequence ends.

Value Params
length

The number of items polled from the sequence

seq

A multi-channel signal providing the values at each step of the sequence. Typically (but not necessarily) a sequence of constant values.

See also
Companion
object
object Dseries extends ProductReader[Dseries]

A demand-rate UGen which produces an arithmetic (linear) series.

A demand-rate UGen which produces an arithmetic (linear) series.

The arguments can be constant or any other ugens.

See also
Companion
class
final case
class Dseries(start: GE, step: GE, length: GE) extends SingleOut with DemandRated with IsIndividual

A demand-rate UGen which produces an arithmetic (linear) series.

A demand-rate UGen which produces an arithmetic (linear) series.

The arguments can be constant or any other ugens.

Value Params
length

the number of elements to produces (maybe be infinite)

start

the start value of the series

step

the incremental step by which the series changes. the step is added to the previous value on each demand.

See also
Companion
object
object Dshuf extends ProductReader[Dshuf]

A demand-rate UGen which outputs a randomly shuffled version of an input sequence. The sequence is only shuffled once, thus when repeats is greater than one, the same randomized sequence will be repeated, until the UGen is reset. This happens for example, when it is nested inside a Dseq , as shown in the example "reshuffle".

A demand-rate UGen which outputs a randomly shuffled version of an input sequence. The sequence is only shuffled once, thus when repeats is greater than one, the same randomized sequence will be repeated, until the UGen is reset. This happens for example, when it is nested inside a Dseq , as shown in the example "reshuffle".

===Examples===

// sequence of constants
play {
 val in = Dshuf(Seq(3, 5, 7, 8, 11), inf)
 val tr = Impulse.kr(5)
 val v  = Demand.kr(tr, in)
 v.poll(tr)
 val f  = (v + 62).midiCps
 SinOsc.ar(f) * 0.1
}
// reshuffle
play {
 val in = Dseq(Seq[GE](Dshuf(Seq(3, 5, 7, 8, 11), 4), 24), inf)
 val tr = Impulse.kr(5)
 val v  = Demand.kr(tr, in)
 v.poll(tr)
 val f  = (v + 62).midiCps
 SinOsc.ar(f) * 0.1
}
// audio rate
play {
 val in = Dseq(Seq(Dshuf(Seq.fill(81)(util.Random.nextInt(10)), 5)), inf)
 val tr = Impulse.ar(500)
 val f  = Demand.ar(tr, in) * 30 + 340
 SinOsc.ar(f) * 0.1
}
// embedded structures
play {
 val in = Dseq(repeats = inf, seq =
   Dshuf(repeats = 8, seq = Seq[GE](
     Drand(Seq(1, 2, 3), 1),
     3,
     Drand(Seq(20, 23, 56), 1),
     7, 8.5)))
 val tr = Impulse.kr(MouseX.kr(1, 40, 1))
 val f  = Demand.kr(tr, in) * 30 + 340
 SinOsc.ar(f) * 0.1
}
See also
Companion
class
final case
class Dshuf(seq: GE, repeats: GE) extends SingleOut with DemandRated with IsIndividual

A demand-rate UGen which outputs a randomly shuffled version of an input sequence. The sequence is only shuffled once, thus when repeats is greater than one, the same randomized sequence will be repeated, until the UGen is reset. This happens for example, when it is nested inside a Dseq , as shown in the example "reshuffle".

A demand-rate UGen which outputs a randomly shuffled version of an input sequence. The sequence is only shuffled once, thus when repeats is greater than one, the same randomized sequence will be repeated, until the UGen is reset. This happens for example, when it is nested inside a Dseq , as shown in the example "reshuffle".

Value Params
repeats

The number of repetitions of the entire sequence

seq

A multi-channel signal providing the values at each step of the sequence. Typically (but not necessarily) a sequence of constant values.

See also
Companion
object
object Dstutter extends ProductReader[Dstutter]
Companion
class
final case
class Dstutter(n: GE, in: GE) extends SingleOut with DemandRated with IsIndividual
Companion
object
object Dswitch extends ProductReader[Dswitch]
Companion
class
final case
class Dswitch(seq: GE, index: GE) extends SingleOut with DemandRated with IsIndividual
Companion
object
object Dswitch1 extends ProductReader[Dswitch1]
Companion
class
final case
class Dswitch1(seq: GE, index: GE) extends SingleOut with DemandRated with IsIndividual
Companion
object
object Dust extends ProductReader[Dust]

A UGen generating random impulses with values ranging from 0 to +1 . The pulse duration is one sample for audio-rate and one block for control-rate operation.

A UGen generating random impulses with values ranging from 0 to +1 . The pulse duration is one sample for audio-rate and one block for control-rate operation.

The approximate RMS energy is (density/sr).log2 * 3 - 4.8 where sr is the sample-rate. For example, at 44.1 kHz, a density of 1000 Hz yields an RMS of approx. -21.2 dB.

===Examples===

// decreasing density
play { Dust.ar(XLine.kr(20000, 2, Seq(20, 20))) * 0.5 }
See also
Companion
class
final case
class Dust(rate: Rate, density: GE) extends SingleOut with IsIndividual

A UGen generating random impulses with values ranging from 0 to +1 . The pulse duration is one sample for audio-rate and one block for control-rate operation.

A UGen generating random impulses with values ranging from 0 to +1 . The pulse duration is one sample for audio-rate and one block for control-rate operation.

The approximate RMS energy is (density/sr).log2 * 3 - 4.8 where sr is the sample-rate. For example, at 44.1 kHz, a density of 1000 Hz yields an RMS of approx. -21.2 dB.

Value Params
density

the average number of impulses per second

See also
Companion
object
object Dust2 extends ProductReader[Dust2]

A UGen generating random impulses with values ranging from -1 to +1 . The pulse duration is one sample for audio-rate and one block for control-rate operation.

A UGen generating random impulses with values ranging from -1 to +1 . The pulse duration is one sample for audio-rate and one block for control-rate operation.

===Examples===

// decreasing density
play { Dust2.ar(XLine.kr(20000, 2, Seq(20, 20))) * 0.5 }
See also
Companion
class
final case
class Dust2(rate: Rate, density: GE) extends SingleOut with IsIndividual

A UGen generating random impulses with values ranging from -1 to +1 . The pulse duration is one sample for audio-rate and one block for control-rate operation.

A UGen generating random impulses with values ranging from -1 to +1 . The pulse duration is one sample for audio-rate and one block for control-rate operation.

Value Params
density

the average number of impulses per second

See also
Companion
object
object Duty extends ProductReader[Duty]

A UGen which polls results from demand-rate ugens in intervals specified by a duration input. A value from the level ugen is demanded and output according to a stream of duration values. When there is a trigger at the reset input, the level and the dur input are reset.

A UGen which polls results from demand-rate ugens in intervals specified by a duration input. A value from the level ugen is demanded and output according to a stream of duration values. When there is a trigger at the reset input, the level and the dur input are reset.

See also

DoneAction

Note

The argument order is different from its sclang counterpart.

Companion
class
final case
class Duty(rate: Rate, dur: GE, level: GE, reset: GE, doneAction: GE) extends SingleOut with HasSideEffect

A UGen which polls results from demand-rate ugens in intervals specified by a duration input. A value from the level ugen is demanded and output according to a stream of duration values. When there is a trigger at the reset input, the level and the dur input are reset.

A UGen which polls results from demand-rate ugens in intervals specified by a duration input. A value from the level ugen is demanded and output according to a stream of duration values. When there is a trigger at the reset input, the level and the dur input are reset.

Value Params
doneAction

a doneAction that is evaluated when the duration stream ends.

dur

the provider of time values. Can be a demand-rate ugen or any signal. The next poll is acquired after the previous duration.

level

a demand-rate ugen providing the output values.

reset

a trigger which resets the dur input (if demand-rated) and the the level input ugen. The reset input may also be a demand-rate ugen, in this case providing a stream of reset times.

See also

DoneAction

Note

The argument order is different from its sclang counterpart.

Companion
object
object Dwhite extends ProductReader[Dwhite]

A demand-rate UGen that produces random decimal numbers with a constant spectral density, equivalent to WhiteNoise for audio- or control-rate.

A demand-rate UGen that produces random decimal numbers with a constant spectral density, equivalent to WhiteNoise for audio- or control-rate.

===Examples===

// random frequency
play {
 val in = Dwhite(lo = 0, hi = 15)
 val tr = Impulse.kr(5)
 val v  = Demand.kr(tr, in)
 v.poll(tr)
 val f  = v * 30 + 300
 SinOsc.ar(f) * 0.1
}
See also
Companion
class
final case
class Dwhite(lo: GE, hi: GE, length: GE) extends SingleOut with DemandRated with IsIndividual

A demand-rate UGen that produces random decimal numbers with a constant spectral density, equivalent to WhiteNoise for audio- or control-rate.

A demand-rate UGen that produces random decimal numbers with a constant spectral density, equivalent to WhiteNoise for audio- or control-rate.

Value Params
hi

maximum value (inclusive)

length

length of the sequence or inf

lo

minimum value (inclusive)

See also
Companion
object
object Dxrand extends ProductReader[Dxrand]

A demand-rate UGen which outputs random elements from a sequence. Dxrand forbid repetitions, whereas Drand allows duplicate elements to appear.

A demand-rate UGen which outputs random elements from a sequence. Dxrand forbid repetitions, whereas Drand allows duplicate elements to appear.

===Examples===

// sequence of constants
play {
 val in = Dxrand(Seq(3, 5, 7, 8, 11), inf)
 val tr = Impulse.kr(5)
 val v  = Demand.kr(tr, in)
 v.poll(tr)
 val f  = (v + 62).midiCps
 SinOsc.ar(f) * 0.1
}
See also
Companion
class
final case
class Dxrand(seq: GE, length: GE) extends SingleOut with DemandRated with IsIndividual

A demand-rate UGen which outputs random elements from a sequence. Dxrand forbid repetitions, whereas Drand allows duplicate elements to appear.

A demand-rate UGen which outputs random elements from a sequence. Dxrand forbid repetitions, whereas Drand allows duplicate elements to appear.

Value Params
length

The number of items polled from the sequence

seq

A multi-channel signal providing the values at each step of the sequence. Typically (but not necessarily) a sequence of constant values.

See also
Companion
object
object Env extends EnvFactory[Env]
Companion
class
final case
class Env(startLevel: GE, segments: Seq[Segment], releaseNode: GE, loopNode: GE) extends EnvLike
Companion
object
sealed
trait EnvFactory[V] extends ProductReader[V]
object EnvGen extends ProductReader[EnvGen]

An envelope generator UGen. It uses a break point description in its envelope input, typically coming from an Env object. The envelope may be re-triggered using the gate input. Upon start and upon re-triggering, the envelope , levelScale , levelBias and timeScale parameters are polled and remain constant for the duration of the envelope.

An envelope generator UGen. It uses a break point description in its envelope input, typically coming from an Env object. The envelope may be re-triggered using the gate input. Upon start and upon re-triggering, the envelope , levelScale , levelBias and timeScale parameters are polled and remain constant for the duration of the envelope.

To construct a manual envelope without the use of the Env class, the format should be as follows:

val env = Seq[GE](startLevel, numSegments, releaseNode, loopNode,
targetLevel1, duration1, curveType1, curvature1,
targetLevel2, duration2, curveType2, curvature2,
...)

Where the curve-type is one of Curve.step.id , Curve.lin.id , Curve.exp.id , etc. The curvature values are only relevant for the parametric curve type. The releaseNode and loopNode parameters are segment indices or the special value -99 indicating that there are no release or loop segments.

'''Note''': The actual minimum duration of a segment is not zero, but one sample step for audio rate and one block for control rate. This may result in asynchronicity when in two envelopes of different number of levels, the envelope times add up to the same total duration. Similarly, when modulating times, the new time is only updated at the end of the current segment; this may lead to asynchronicity of two envelopes with modulated times.

===Examples===

// percussive one-shot
play { PinkNoise.ar(EnvGen.kr(Env.perc, doneAction = freeSelf)) }
// fixed duration amplitude envelope
play {
 val env = Env(0, Seq(0.01 -> 1, 0.5 -> 0.5, 0.02 -> 1, 0.5 -> 0))
 SinOsc.ar(470) * EnvGen.kr(env, doneAction = freeSelf)
}
// amplitude and frequency modulation
play {
 val env  = Env(0, Seq(0.01 -> 1, 0.5 -> 0.5, 0.02 -> 0.8, 0.5 -> 0, 0.2 -> 1.2, 0.5 -> 0))
 val gate = Impulse.kr(MouseX.kr(0.2, 3), 0.5)
 val gen  = EnvGen.kr(env, gate)
 SinOsc.ar(270, SinOsc.ar(gen * 473)) * gen * 0.2
}
// Dust-triggered envelope
play {
 val c   = Curve.parametric(-4)
 val env = Env(0, Seq((0.05,0.5,c), (0.1,0.0,c), (0.01,1.0,c), (1.0,0.9,c), (1.5,0.0,c)))
 val gen = EnvGen.ar(env, Dust.ar(1))
 SinOsc.ar(gen * 1000 + 440) * gen * 0.1
}
// two channels
play {
 val p = Curve.parametric(-4)

 def mkEnv(a: Double, b: Double) = {
   val env = Env(0.0, Seq((0.05,a,p), (0.1,0.0,p), (0.01,1.0,p), (1.0,b,p), (1.5,0.0,p)))
   EnvGen.ar(env, Dust.ar(1))
 }

 val gen: GE = Seq(mkEnv(-0.2, -0.4), mkEnv(0.5, 0.9))
 SinOsc.ar(gen * 440 + 550) * gen * 0.1
}
// control gate and done-action
val x = play {
 var gen = EnvGen.kr(Env.adsr(), "gate".kr(0), doneAction = "done".kr(0))
 SinOsc.ar(440) * gen * 0.1
}

x.set("gate" -> 1)  // turn on
x.set("gate" -> 0)  // turn off
x.set("gate" -> 1)  // turn on
x.set("done" -> freeSelf.id, "gate" -> 0) // turn off and free
// fast triggering
play {
 val freq = MouseX.kr(1, 100, 1)
 val gate = Impulse.ar(freq)
 val env  = Env.perc(0.1, 0.9)
 val gen  = EnvGen.ar(env, gate = gate, timeScale = freq.reciprocal)
 SinOsc.ar(440) * gen * 0.1
}
See also
Companion
class
final case
class EnvGen(rate: Rate, envelope: GE, gate: GE, levelScale: GE, levelBias: GE, timeScale: GE, doneAction: GE) extends SingleOut with HasSideEffect with HasDoneFlag

An envelope generator UGen. It uses a break point description in its envelope input, typically coming from an Env object. The envelope may be re-triggered using the gate input. Upon start and upon re-triggering, the envelope , levelScale , levelBias and timeScale parameters are polled and remain constant for the duration of the envelope.

An envelope generator UGen. It uses a break point description in its envelope input, typically coming from an Env object. The envelope may be re-triggered using the gate input. Upon start and upon re-triggering, the envelope , levelScale , levelBias and timeScale parameters are polled and remain constant for the duration of the envelope.

To construct a manual envelope without the use of the Env class, the format should be as follows:

val env = Seq[GE](startLevel, numSegments, releaseNode, loopNode,
targetLevel1, duration1, curveType1, curvature1,
targetLevel2, duration2, curveType2, curvature2,
...)

Where the curve-type is one of Curve.step.id , Curve.lin.id , Curve.exp.id , etc. The curvature values are only relevant for the parametric curve type. The releaseNode and loopNode parameters are segment indices or the special value -99 indicating that there are no release or loop segments.

'''Note''': The actual minimum duration of a segment is not zero, but one sample step for audio rate and one block for control rate. This may result in asynchronicity when in two envelopes of different number of levels, the envelope times add up to the same total duration. Similarly, when modulating times, the new time is only updated at the end of the current segment; this may lead to asynchronicity of two envelopes with modulated times.

Value Params
doneAction

action to be performed when the envelope reaches its end point.

envelope

the description of the envelope break-points. Typically you pass an instance of Env which will then automatically expand to the correct format.

gate

triggers the envelope and holds it open while greater than zero. If the envelope is of fixed duration (e.g. Env.linen , Env.perc ), the gate argument is used as a simple trigger. If it contains a sustained segment (e.g. Env.adsr , Env.asr ), the envelope is held open until the gate becomes 0, at which point is released. If gate is less than zero, a release is enforced with duration -1.0 - gate .

levelBias

amplitude offset which is added to the nominal envelope.

levelScale

amplitude factor with which the nominal envelope is multiplied.

timeScale

time scale factor with which the envelope segment durations are multiplied.

See also
Companion
object
sealed
trait EnvLike extends GE
object ExpRand extends ProductReader[ExpRand]

A scalar UGen that generates a single random decimal value, using an exponential distribution from lo to hi . Values lo and hi must both have the same sign and be non-zero.

A scalar UGen that generates a single random decimal value, using an exponential distribution from lo to hi . Values lo and hi must both have the same sign and be non-zero.

===Examples===

// random sine frequencies
play {
 val m = Mix.fill(10)(FSinOsc.ar(ExpRand(200.0, 800.0)))
 m * Line.kr(0.025, 0, 4, doneAction = freeSelf)
}
See also
Companion
class
final case
class ExpRand(lo: GE, hi: GE) extends SingleOut with ScalarRated with IsIndividual

A scalar UGen that generates a single random decimal value, using an exponential distribution from lo to hi . Values lo and hi must both have the same sign and be non-zero.

A scalar UGen that generates a single random decimal value, using an exponential distribution from lo to hi . Values lo and hi must both have the same sign and be non-zero.

Value Params
hi

upper limit of the output range

lo

lower limit of the output range

See also
Companion
object
object FBSineC extends ProductReader[FBSineC]

A non-interpolating sound generator based on the difference equations:

A non-interpolating sound generator based on the difference equations:

x[n+1] = sin(im * y[n] + fb * x[n])
y[n+1] = (a * y[n] + c) % 2pi

This uses a linear congruential function to drive the phase indexing of a sine wave. For im = 1, fb = 0 , and a = 1 a normal sine wave results.

===Examples===

// default initial parameters
play { FBSineC.ar(SampleRate.ir/4) * 0.2 }
// increase feedback
play { FBSineC.ar(SampleRate.ir, 1, Line.kr(0.01, 4, 10), 1, 0.1) * 0.2 }
// increase phase multiplier
play { FBSineC.ar(SampleRate.ir, 1, 0, XLine.kr(1, 2, 10), 0.1) * 0.2 }
// modulate frequency and index multiplier
play { FBSineC.ar(LFNoise2.kr(1).mulAdd(1e4, 1e4), LFNoise2.kr(1).mulAdd(16, 17), 1, 1.005, 0.7) * 0.2 }
// randomly modulate parameters
play {
 FBSineC.ar(
   LFNoise2.kr(1).mulAdd(1e4, 1e4),
   LFNoise2.kr(1).mulAdd(32, 33),
   LFNoise2.kr(1) * 0.5,
   LFNoise2.kr(1).mulAdd(0.05, 1.05),
   LFNoise2.kr(1).mulAdd(0.3, 0.3)
 ) * 0.2
}
See also
Companion
class
final case
class FBSineC(rate: Rate, freq: GE, im: GE, fb: GE, a: GE, c: GE, xi: GE, yi: GE) extends SingleOut

A non-interpolating sound generator based on the difference equations:

A non-interpolating sound generator based on the difference equations:

x[n+1] = sin(im * y[n] + fb * x[n])
y[n+1] = (a * y[n] + c) % 2pi

This uses a linear congruential function to drive the phase indexing of a sine wave. For im = 1, fb = 0 , and a = 1 a normal sine wave results.

Value Params
a

Phase multiplier amount

c

Phase increment amount

fb

Feedback amount

freq

Iteration frequency in Hertz

im

Index multiplier amount

xi

Initial value of x

yi

Initial value of y

See also
Companion
object
object FBSineL extends ProductReader[FBSineL]

A non-interpolating sound generator based on the difference equations:

A non-interpolating sound generator based on the difference equations:

x[n+1] = sin(im * y[n] + fb * x[n])
y[n+1] = (a * y[n] + c) % 2pi

This uses a linear congruential function to drive the phase indexing of a sine wave. For im = 1, fb = 0, and a = 1 a normal sine wave results.

===Examples===

// default initial parameters
play { FBSineL.ar(SampleRate.ir/4) * 0.2 }
// increase feedback
play { FBSineL.ar(SampleRate.ir, 1, Line.kr(0.01, 4, 10), 1, 0.1) * 0.2 }
// increase phase multiplier
play { FBSineL.ar(SampleRate.ir, 1, 0, XLine.kr(1, 2, 10), 0.1) * 0.2 }
// modulate frequency and index multiplier
play { FBSineL.ar(LFNoise2.kr(1).mulAdd(1e4, 1e4), LFNoise2.kr(1).mulAdd(16, 17), 1, 1.005, 0.7) * 0.2 }
// randomly modulate parameters
play {
 FBSineL.ar(
   LFNoise2.kr(1).mulAdd(1e4, 1e4),
   LFNoise2.kr(1).mulAdd(32, 33),
   LFNoise2.kr(1) * 0.5,
   LFNoise2.kr(1).mulAdd(0.05, 1.05),
   LFNoise2.kr(1).mulAdd(0.3, 0.3)
 ) * 0.2
}
See also
Companion
class
final case
class FBSineL(rate: Rate, freq: GE, im: GE, fb: GE, a: GE, c: GE, xi: GE, yi: GE) extends SingleOut

A non-interpolating sound generator based on the difference equations:

A non-interpolating sound generator based on the difference equations:

x[n+1] = sin(im * y[n] + fb * x[n])
y[n+1] = (a * y[n] + c) % 2pi

This uses a linear congruential function to drive the phase indexing of a sine wave. For im = 1, fb = 0, and a = 1 a normal sine wave results.

Value Params
a

Phase multiplier amount

c

Phase increment amount

fb

Feedback amount

freq

Iteration frequency in Hertz

im

Index multiplier amount

xi

Initial value of x

yi

Initial value of y

See also
Companion
object
object FBSineN extends ProductReader[FBSineN]

A non-interpolating sound generator based on the difference equations:

A non-interpolating sound generator based on the difference equations:

x[n+1] = sin(im * y[n] + fb * x[n])
y[n+1] = (a * y[n] + c) % 2pi

This uses a linear congruential function to drive the phase indexing of a sine wave. For im = 1, fb = 0, and a = 1 a normal sine wave results.

===Examples===

// default initial parameters
play { FBSineN.ar(SampleRate.ir/4) * 0.2 }
// increase feedback
play { FBSineN.ar(SampleRate.ir, 1, Line.kr(0.01, 4, 10), 1, 0.1) * 0.2 }
// increase phase multiplier
play { FBSineN.ar(SampleRate.ir, 1, 0, XLine.kr(1, 2, 10), 0.1) * 0.2 }
// modulate frequency and index multiplier
play { FBSineN.ar(LFNoise2.kr(1).mulAdd(1e4, 1e4), LFNoise2.kr(1).mulAdd(16, 17), 1, 1.005, 0.7) * 0.2 }
// randomly modulate parameters
play {
 FBSineN.ar(
   LFNoise2.kr(1).mulAdd(1e4, 1e4),
   LFNoise2.kr(1).mulAdd(32, 33),
   LFNoise2.kr(1) * 0.5,
   LFNoise2.kr(1).mulAdd(0.05, 1.05),
   LFNoise2.kr(1).mulAdd(0.3, 0.3)
 ) * 0.2
}
See also
Companion
class
final case
class FBSineN(rate: Rate, freq: GE, im: GE, fb: GE, a: GE, c: GE, xi: GE, yi: GE) extends SingleOut

A non-interpolating sound generator based on the difference equations:

A non-interpolating sound generator based on the difference equations:

x[n+1] = sin(im * y[n] + fb * x[n])
y[n+1] = (a * y[n] + c) % 2pi

This uses a linear congruential function to drive the phase indexing of a sine wave. For im = 1, fb = 0, and a = 1 a normal sine wave results.

Value Params
a

Phase multiplier amount

c

Phase increment amount

fb

Feedback amount

freq

Iteration frequency in Hertz

im

Index multiplier amount

xi

Initial value of x

yi

Initial value of y

See also
Companion
object
object FFT extends ProductReader[FFT]

A UGen performing short-time forward fourier transformations. In order to properly link the spectral ugens ( PV_... ), you should begin by using the output of each UGen (which is just the fft buffer identifier), and use that as buffer input of the next UGen. That way, the UGen graph is correctly sorted. E.g. IFFT(PV_...(FFT(buf, in))) .

A UGen performing short-time forward fourier transformations. In order to properly link the spectral ugens ( PV_... ), you should begin by using the output of each UGen (which is just the fft buffer identifier), and use that as buffer input of the next UGen. That way, the UGen graph is correctly sorted. E.g. IFFT(PV_...(FFT(buf, in))) .

The UGen will initially output zero until the first FFT can be performed. This is the case after hop * fftSize . Thus for a default fft buffer size of 1024 and a hop of 0.5, and for a default control block size of 64, for the first 1024*0.5/64 = 8 control blocks the UGen will output zero. This also implies that the first FFT in this case if performed on the first 512 samples of the in signal (prepended by 512 zeros). In other words, the first 'full' FFT of the input happens after fftSize/controlBlockSize cycles, no matter what hop size was chosen.

If you use FFT for performing signal analysis and not phase vocoder effects, make sure you change the window type accordingly.

===Examples===

// perfect reconstruction
play {
 // with a hop of 0.5 and forward Hann window,
 // we get a perfect reconstruction delayed
 // by the fftSize minus one control-block.
 // (alternatively, you can use a hop of 1.0,
 //  and winType of 1 for both FFT and IFFT)
 val n     = 1024
 val hop   = 0.5
 val buf   = LocalBuf(n)
 val in    = PinkNoise.ar(0.5)
 val fft   = FFT(buf, in, hop = hop, winType = 1)
 val out   = IFFT.ar(fft, winType = -1)
 val dur   = (2 * n * hop) / SampleRate.ir - ControlDur.ir
 val dly   = DelayN.ar(in, dur, dur)
 out - dly
}
See also
Companion
class
final case
class FFT(buf: GE, in: GE, hop: GE, winType: GE, active: GE, winSize: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A UGen performing short-time forward fourier transformations. In order to properly link the spectral ugens ( PV_... ), you should begin by using the output of each UGen (which is just the fft buffer identifier), and use that as buffer input of the next UGen. That way, the UGen graph is correctly sorted. E.g. IFFT(PV_...(FFT(buf, in))) .

A UGen performing short-time forward fourier transformations. In order to properly link the spectral ugens ( PV_... ), you should begin by using the output of each UGen (which is just the fft buffer identifier), and use that as buffer input of the next UGen. That way, the UGen graph is correctly sorted. E.g. IFFT(PV_...(FFT(buf, in))) .

The UGen will initially output zero until the first FFT can be performed. This is the case after hop * fftSize . Thus for a default fft buffer size of 1024 and a hop of 0.5, and for a default control block size of 64, for the first 1024*0.5/64 = 8 control blocks the UGen will output zero. This also implies that the first FFT in this case if performed on the first 512 samples of the in signal (prepended by 512 zeros). In other words, the first 'full' FFT of the input happens after fftSize/controlBlockSize cycles, no matter what hop size was chosen.

If you use FFT for performing signal analysis and not phase vocoder effects, make sure you change the window type accordingly.

Value Params
active

This parameter can be temporarily set to <= 0 to pause the FFT operation.

buf

The buffer to use for writing the FFT to. The size must be a power of two. Since FFT operates at control rate (also being a power of two), the buffer should probably be at least as long as the control block size. ''(init-time only)''

hop

A factor determining the step size between successive FFTs. That is, FFTs are performed every fftSize * hop sample frames. The default of 0.5 means thus a 50% overlap, while a hope of 1.0 means no overlapping. Choosing 0.0 will most likely crash the server! ''(init-time only)''

in

The time domain signal to be transformed into the spectral domain.

winSize

With the default value of zero, the window size equals the fft size. If you wish to perform zero padding, an explicit window size can be specified. ''(init-time only)''

winType

The window function applied before each FFT is taken. The default of 0 is a sine window which is good for phase vocoder applications (using the PV_... UGens). For analysis applications, you may want to use -1 which is a rectangle window (effectively no windowing) or 1 which is a Hann window. A Hann window gives perfect overlap-add reconstruction for a hope size of 0.5 (or 0.25 etc.) ''(init-time only)''

See also
Companion
object
object FFTTrigger extends ProductReader[FFTTrigger]

A phase vocoder UGen that takes a buffer and prepares it to be used in FFT chains, without doing an actual FFT on a signal. This is useful if you want to provide a buffer whose content had already been transformed into the Fourier domain.

A phase vocoder UGen that takes a buffer and prepares it to be used in FFT chains, without doing an actual FFT on a signal. This is useful if you want to provide a buffer whose content had already been transformed into the Fourier domain.

Companion
class
final case
class FFTTrigger(buf: GE, hop: GE, polar: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that takes a buffer and prepares it to be used in FFT chains, without doing an actual FFT on a signal. This is useful if you want to provide a buffer whose content had already been transformed into the Fourier domain.

A phase vocoder UGen that takes a buffer and prepares it to be used in FFT chains, without doing an actual FFT on a signal. This is useful if you want to provide a buffer whose content had already been transformed into the Fourier domain.

Value Params
buf

the identifier of the buffer to use ''(init-time only)''

hop

the hop size for timing triggers ''(init-time only)''

polar

whether the complex buffer content is given in cartesian coordinates (0) or in polar coordinates (1) ''(init-time only)''

Companion
object
object FOS extends ProductReader[FOS]

A first order filter section UGen. Filter coefficients are given directly rather than calculated for you. The formula is equivalent to:

A first order filter section UGen. Filter coefficients are given directly rather than calculated for you. The formula is equivalent to:

out(i) = a0 * in(i) + a1 * in(i-1) + b1 * out(i-1)

'''Warning:''' there are bugs when the coefficients are modulated

===Examples===

// same as OnePole
play {
 val x = LFTri.ar(0.4) * 0.99
 FOS.ar(LFSaw.ar(200) * 0.1, 1 - x.abs, 0.0, x)
}
// same as OneZero
play {
 val x = LFTri.ar(0.4) * 0.99
 FOS.ar(LFSaw.ar(200) * 0.1, 1 - x.abs, x, 0.0)
}
See also
Companion
class
final case
class FOS(rate: MaybeRate, in: GE, a0: GE, a1: GE, b1: GE) extends SingleOut

A first order filter section UGen. Filter coefficients are given directly rather than calculated for you. The formula is equivalent to:

A first order filter section UGen. Filter coefficients are given directly rather than calculated for you. The formula is equivalent to:

out(i) = a0 * in(i) + a1 * in(i-1) + b1 * out(i-1)

'''Warning:''' there are bugs when the coefficients are modulated

Value Params
in

input signal to be filtered

See also
Companion
object
object FSinOsc extends ProductReader[FSinOsc]

A sine oscillator UGen using a fast approximation. It uses a ringing filter and is less CPU expensive than SinOsc . However, the amplitude of the wave will vary with frequency. Generally the amplitude will go down when the frequency rises and it will go up as if the frequency is lowered.

A sine oscillator UGen using a fast approximation. It uses a ringing filter and is less CPU expensive than SinOsc . However, the amplitude of the wave will vary with frequency. Generally the amplitude will go down when the frequency rises and it will go up as if the frequency is lowered.

'''Warning''': In the current implementation, the amplitude can blow up if the frequency is modulated by certain alternating signals (e.g. abruptly by TRand ).

===Examples===

// plain oscillator
play { FSinOsc.ar(441) * 0.2 }
See also
Companion
class
final case
class FSinOsc(rate: Rate, freq: GE, iphase: GE) extends SingleOut

A sine oscillator UGen using a fast approximation. It uses a ringing filter and is less CPU expensive than SinOsc . However, the amplitude of the wave will vary with frequency. Generally the amplitude will go down when the frequency rises and it will go up as if the frequency is lowered.

A sine oscillator UGen using a fast approximation. It uses a ringing filter and is less CPU expensive than SinOsc . However, the amplitude of the wave will vary with frequency. Generally the amplitude will go down when the frequency rises and it will go up as if the frequency is lowered.

'''Warning''': In the current implementation, the amplitude can blow up if the frequency is modulated by certain alternating signals (e.g. abruptly by TRand ).

Value Params
freq

frequency in Hertz

iphase

initial phase of the oscillator in radians. This cannot be modulated. A value of 0.5 Pi means the output starts at +1. A value of 1.5 Pi means the output starts at -1, ''(init-time only)''

See also
Companion
object
object Flatten extends ProductReader[Flatten]
Companion
class
final case
class Flatten(elem: GE) extends Lazy

A graph element that flattens the channels from a nested multi-channel structure.

A graph element that flattens the channels from a nested multi-channel structure.

Value Params
elem

the element to flatten

Companion
object
object Fold extends ProductReader[Fold]

A UGen that constrains a signal to a given range, by "folding" values outside the range. This is similar to the fold2 binary operator but permits both a lower range value lo and an upper range value hi .

A UGen that constrains a signal to a given range, by "folding" values outside the range. This is similar to the fold2 binary operator but permits both a lower range value lo and an upper range value hi .

Folding can be understood as "reflecting" around the boundaries. For example, if the upper margin is 3, then if an input value exceeds 3, the excess is negatively reflected; 3.1 becomes 2.9, 3.2 becomes 2.8, etc. until the lower margin is reached again where another reflection occurs. Likewise, if the lower margin is 1, then if an input value falls below 1, the undershoot is reflected; 0.9 becomes 1.1, 0.8 becomes 1.2, etc. until the upper margin is reached again where another reflection occurs.

===Examples===

// fold sawtooth wave to modulate timbre
play {
 val hi = SinOsc.ar(0.1).linExp(-1, 1, 0.01, 1.0)
 Fold.ar(Saw.ar(300), 0, hi) * 0.2 / hi
}
See also
Companion
class
final case
class Fold(rate: Rate, in: GE, lo: GE, hi: GE) extends SingleOut

A UGen that constrains a signal to a given range, by "folding" values outside the range. This is similar to the fold2 binary operator but permits both a lower range value lo and an upper range value hi .

A UGen that constrains a signal to a given range, by "folding" values outside the range. This is similar to the fold2 binary operator but permits both a lower range value lo and an upper range value hi .

Folding can be understood as "reflecting" around the boundaries. For example, if the upper margin is 3, then if an input value exceeds 3, the excess is negatively reflected; 3.1 becomes 2.9, 3.2 becomes 2.8, etc. until the lower margin is reached again where another reflection occurs. Likewise, if the lower margin is 1, then if an input value falls below 1, the undershoot is reflected; 0.9 becomes 1.1, 0.8 becomes 1.2, etc. until the upper margin is reached again where another reflection occurs.

Value Params
hi

upper margin of folding

in

input signal to constrain

lo

lower margin of folding

See also
Companion
object
object FoldIndex extends ProductReader[FoldIndex]

A UGen which reads a single sample value from a buffer at a given index.

A UGen which reads a single sample value from a buffer at a given index.

It uses the in argument as index into the buffer, truncating that argument to an integer. Out-of-range index values are "folded" inside the valid range. Folding means reflecting the excess at the valid range's boundaries.

For example, if the buffer has four samples, index 4 is wrapped to index 2 (the excess beyond the maximum index of 3 is 4 - 3 = 1, and the excess is folded so that and 3 - 1 = 2), index 5 is folded to index 1, index -1 is folded to index 1, index -2 is folded to index 2, etc.

While designed for monophonic buffers, it works with multi-channel buffers by treating them as de-interleaved. See the Index UGen for details.

See also
Companion
class
final case
class FoldIndex(rate: Rate, buf: GE, in: GE) extends SingleOut with IsIndividual

A UGen which reads a single sample value from a buffer at a given index.

A UGen which reads a single sample value from a buffer at a given index.

It uses the in argument as index into the buffer, truncating that argument to an integer. Out-of-range index values are "folded" inside the valid range. Folding means reflecting the excess at the valid range's boundaries.

For example, if the buffer has four samples, index 4 is wrapped to index 2 (the excess beyond the maximum index of 3 is 4 - 3 = 1, and the excess is folded so that and 3 - 1 = 2), index 5 is folded to index 1, index -1 is folded to index 1, index -2 is folded to index 2, etc.

While designed for monophonic buffers, it works with multi-channel buffers by treating them as de-interleaved. See the Index UGen for details.

Value Params
buf

The buffer to read from.

in

The sample index into the buffer. This is truncated to an integer automatically.

See also
Companion
object
object Formant extends ProductReader[Formant]

A UGen that generates a set of harmonics around a formant frequency at a given fundamental frequency.

A UGen that generates a set of harmonics around a formant frequency at a given fundamental frequency.

===Examples===

// modulate fundamental frequency
play { Formant.ar(XLine.kr(400, 1000, 8), 2000, 800) * 0.2 }
// modulate formant frequency
play { Formant.ar(200, XLine.kr(400, 4000, 8), 200) * 0.2 }
// modulate the bandwidth
play { Formant.ar(400, 2000, XLine.kr(800, 8000, 8)) * 0.2 }
Companion
class
final case
class Formant(rate: Rate, fundFreq: GE, formFreq: GE, bw: GE) extends SingleOut

A UGen that generates a set of harmonics around a formant frequency at a given fundamental frequency.

A UGen that generates a set of harmonics around a formant frequency at a given fundamental frequency.

Value Params
bw

Pulse width frequency in Hertz. Controls the bandwidth of the formant. Must be greater than or equal to fundFreq . Read at control-rate, so if input is audio-rate, it will be sub-sampled.

formFreq

Formant frequency in Hertz. This determines the overtone(s) most prominently perceived. Read at control-rate, so if input is audio-rate, it will be sub-sampled.

fundFreq

Fundamental frequency in Hertz. Read at control-rate, so if input is audio-rate, it will be sub-sampled.

Companion
object
object Formlet extends ProductReader[Formlet]

A FOF-like resonant filter UGen. Its impulse response is like that of a sine wave with a Decay2 envelope over it. It is possible to control the attack and decay times.

A FOF-like resonant filter UGen. Its impulse response is like that of a sine wave with a Decay2 envelope over it. It is possible to control the attack and decay times.

Formlet is equivalent to:

Ringz(in, freq, decay) - Ringz(in, freq, attack)

The great advantage to this filter over FOF (Fonction d'onde formantique) is that there is no limit to the number of overlapping grains since the grain is just the impulse response of the filter.

''Note'': Ringz and derived UGens Klank and Formlet produce output RMS depending on the server's sampling rate. This is to achieve the same amplitude for single-sample impulse inputs.

===Examples===

// modulated formant frequency
play {
 val in = Blip.ar(SinOsc.kr(5,0).mulAdd(20, 300), 1000) * 0.1
 Formlet.ar(in, XLine.kr(1500, 700, 8), 0.005, 0.04)
}
// mouse control of frequency and decay time
play {
 val in    = Blip.ar(SinOsc.kr(5,0).mulAdd(20, 300), 1000) * 0.1
 val freq  = MouseY.kr(700, 2000, 1)
 val decay = MouseX.kr(0.01, 0.2, 1)
 Formlet.ar(in, freq, attack = 0.005, decay = decay)
}
See also
Companion
class
final case
class Formlet(rate: MaybeRate, in: GE, freq: GE, attack: GE, decay: GE) extends SingleOut

A FOF-like resonant filter UGen. Its impulse response is like that of a sine wave with a Decay2 envelope over it. It is possible to control the attack and decay times.

A FOF-like resonant filter UGen. Its impulse response is like that of a sine wave with a Decay2 envelope over it. It is possible to control the attack and decay times.

Formlet is equivalent to:

Ringz(in, freq, decay) - Ringz(in, freq, attack)

The great advantage to this filter over FOF (Fonction d'onde formantique) is that there is no limit to the number of overlapping grains since the grain is just the impulse response of the filter.

''Note'': Ringz and derived UGens Klank and Formlet produce output RMS depending on the server's sampling rate. This is to achieve the same amplitude for single-sample impulse inputs.

Value Params
attack

the 60 dB attack time in seconds

decay

the 60 dB decay time in seconds

freq

resonant frequency in Hertz

in

input signal to be filtered

See also
Companion
object
object Free extends ProductReader[Free]

A UGen that, when triggered, frees a given node.

A UGen that, when triggered, frees a given node.

This UGen outputs its trig input signal for convenience.

See also
Companion
class
final case
class Free(trig: GE, node: GE) extends SingleOut with ControlRated with HasSideEffect

A UGen that, when triggered, frees a given node.

A UGen that, when triggered, frees a given node.

This UGen outputs its trig input signal for convenience.

Value Params
node

the id of the target node to free upon receiving the trigger

trig

the trigger to cause the action

See also
Companion
object
object FreeSelf extends ProductReader[FreeSelf]

A UGen that, when triggered, frees enclosing synth. It frees the enclosing synth when the input signal crosses from non-positive to positive.

A UGen that, when triggered, frees enclosing synth. It frees the enclosing synth when the input signal crosses from non-positive to positive.

''Note'' that if the trigger is initially high the UGen will not react. For example, FreeSelf.kr("foo".kr) will not work if the control is initially 1 . A work-around is to wrap the input in this case in a Trig object: FreeSelf.kr(Trig.kr("foo".kr)) . This is most likely a bug.

This UGen outputs its input signal for convenience.

See also
Companion
class
final case
class FreeSelf(trig: GE) extends SingleOut with ControlRated with HasSideEffect

A UGen that, when triggered, frees enclosing synth. It frees the enclosing synth when the input signal crosses from non-positive to positive.

A UGen that, when triggered, frees enclosing synth. It frees the enclosing synth when the input signal crosses from non-positive to positive.

''Note'' that if the trigger is initially high the UGen will not react. For example, FreeSelf.kr("foo".kr) will not work if the control is initially 1 . A work-around is to wrap the input in this case in a Trig object: FreeSelf.kr(Trig.kr("foo".kr)) . This is most likely a bug.

This UGen outputs its input signal for convenience.

Value Params
trig

the input signal which will trigger the action.

See also
Companion
object
object FreeSelfWhenDone extends ProductReader[FreeSelfWhenDone]

A UGen that, when its input UGen is finished, frees enclosing synth. This is essentially a shortcut for FreeSelf.kr(Done.kr(src)) , so instead of providing a trigger signal it reads directly the done flag of an appropriate ugen (such as Line or PlayBuf ).

A UGen that, when its input UGen is finished, frees enclosing synth. This is essentially a shortcut for FreeSelf.kr(Done.kr(src)) , so instead of providing a trigger signal it reads directly the done flag of an appropriate ugen (such as Line or PlayBuf ).

This UGen outputs its input signal for convenience.

See also
Companion
class
final case
class FreeSelfWhenDone(src: GE & HasDoneFlag) extends SingleOut with ControlRated with HasSideEffect

A UGen that, when its input UGen is finished, frees enclosing synth. This is essentially a shortcut for FreeSelf.kr(Done.kr(src)) , so instead of providing a trigger signal it reads directly the done flag of an appropriate ugen (such as Line or PlayBuf ).

A UGen that, when its input UGen is finished, frees enclosing synth. This is essentially a shortcut for FreeSelf.kr(Done.kr(src)) , so instead of providing a trigger signal it reads directly the done flag of an appropriate ugen (such as Line or PlayBuf ).

This UGen outputs its input signal for convenience.

Value Params
src

the input UGen which when finished will trigger the action.

See also
Companion
object
object FreeVerb extends ProductReader[FreeVerb]

A monophonic reverb UGen. All parameters are specified in and automatically clipped to the range 0 to 1. The UGen is stateless insofar it does not use a random number generator.

A monophonic reverb UGen. All parameters are specified in and automatically clipped to the range 0 to 1. The UGen is stateless insofar it does not use a random number generator.

===Examples===

// mouse control for mix and room
play {
 val in   = Decay.ar(Impulse.ar(1), 0.25) * LFCub.ar(1200) * 0.1
 val mix  = MouseX.kr
 val room = MouseY.kr
 val verb = FreeVerb.ar(in, mix, room, "damp".kr(0.5))
 Pan2.ar(verb)
}
See also
Companion
class
final case
class FreeVerb(in: GE, mix: GE, room: GE, damp: GE) extends SingleOut with AudioRated

A monophonic reverb UGen. All parameters are specified in and automatically clipped to the range 0 to 1. The UGen is stateless insofar it does not use a random number generator.

A monophonic reverb UGen. All parameters are specified in and automatically clipped to the range 0 to 1. The UGen is stateless insofar it does not use a random number generator.

Value Params
damp

high frequency attenuation (1 is maximum attenuation)

in

input signal to reverberate

mix

dry/wet balance from zero (only dry) to one (only wet)

room

room size

See also
Companion
object
object FreeVerb2 extends ProductReader[FreeVerb2]

A stereophonic reverb UGen. All parameters are specified in and automatically clipped to the range 0 to 1. The UGen is stateless insofar it does not use a random number generator. However, if the same input is used for left and right channel, the output channels are different and uncorrelated. There is also some cross-feed between the two channels.

A stereophonic reverb UGen. All parameters are specified in and automatically clipped to the range 0 to 1. The UGen is stateless insofar it does not use a random number generator. However, if the same input is used for left and right channel, the output channels are different and uncorrelated. There is also some cross-feed between the two channels.

===Examples===

// mouse control for mix and room, random input pan
play {
 val tr   = Impulse.ar(1)
 val in   = Decay.ar(tr, 0.25) * LFCub.ar(1200) * 0.1
 val in2  = Pan2.ar(in, TRand.ar(-1, 1, tr))
 val mix  = MouseX.kr
 val room = MouseY.kr
 FreeVerb2.ar(in2 out 0, in2 out 1, mix, room, "damp".kr(0.5))
}
See also
Companion
class
final case
class FreeVerb2(inL: GE, inR: GE, mix: GE, room: GE, damp: GE) extends MultiOut with AudioRated

A stereophonic reverb UGen. All parameters are specified in and automatically clipped to the range 0 to 1. The UGen is stateless insofar it does not use a random number generator. However, if the same input is used for left and right channel, the output channels are different and uncorrelated. There is also some cross-feed between the two channels.

A stereophonic reverb UGen. All parameters are specified in and automatically clipped to the range 0 to 1. The UGen is stateless insofar it does not use a random number generator. However, if the same input is used for left and right channel, the output channels are different and uncorrelated. There is also some cross-feed between the two channels.

Value Params
damp

high frequency attenuation (1 is maximum attenuation)

inL

left channel of input signal to reverberate

inR

right channel of input signal to reverberate

mix

dry/wet balance from zero (only dry) to one (only wet)

room

room size

See also
Companion
object
object FreqShift extends ProductReader[FreqShift]

A frequency shifting UGen. It implements single sideband (SSB) amplitude modulation, also known as frequency shifting, but not to be confused with pitch shifting. Frequency shifting moves all the components of a signal by a fixed amount but does not preserve the original harmonic relationships.

A frequency shifting UGen. It implements single sideband (SSB) amplitude modulation, also known as frequency shifting, but not to be confused with pitch shifting. Frequency shifting moves all the components of a signal by a fixed amount but does not preserve the original harmonic relationships.

===Examples===

// shift a sine frequency from 200 to 700 Hz
play {
 val freq = Line.ar(0, 500, 5)
 FreqShift.ar(SinOsc.ar(200) * 0.25, freq)
}
// negative frequency to shift downwards
play {
 val freq = Line.ar(0, -500, 5)
 FreqShift.ar(SinOsc.ar(700) * 0.25, freq)
}
See also
Companion
class
final case
class FreqShift(rate: Rate, in: GE, freq: GE, phase: GE) extends SingleOut

A frequency shifting UGen. It implements single sideband (SSB) amplitude modulation, also known as frequency shifting, but not to be confused with pitch shifting. Frequency shifting moves all the components of a signal by a fixed amount but does not preserve the original harmonic relationships.

A frequency shifting UGen. It implements single sideband (SSB) amplitude modulation, also known as frequency shifting, but not to be confused with pitch shifting. Frequency shifting moves all the components of a signal by a fixed amount but does not preserve the original harmonic relationships.

Value Params
freq

the shift amount in Hertz. Positive values shift upwards, negative values shift downwards.

phase

a phase parameter in radians (0 to 2 Pi).

See also
Companion
object
object GVerb extends ProductReader[GVerb]

A stereophonic reverb UGen. It is based on the GVerb LADSPA effect by Juhana Sadeharju.

A stereophonic reverb UGen. It is based on the GVerb LADSPA effect by Juhana Sadeharju.

'''Note:''' A CPU spike may occur when the synth is instantiated. '''Warning:''' The UGen has a bug which results in loud noise if the room size is increased during playback. It seems safe to start with a large room size and ''decrease'' the value during playing. '''Warning:''' The UGen may crash the server if roomSize becomes larger than maxRoomSize .

===Examples===

// mouse control for time and damping
play {
 val tr   = Impulse.ar(1)
 val in   = Decay.ar(tr, 0.25) * LFCub.ar(1200) * 0.1
 val damp = MouseX.kr
 val tail = MouseY.kr(1, 100, 1)
 GVerb.ar(in, roomSize = 20, revTime = tail, damping = damp, maxRoomSize = 20)
}
See also
Companion
class
final case
class GVerb(in: GE, roomSize: GE, revTime: GE, damping: GE, inputBW: GE, spread: GE, dryLevel: GE, earlyRefLevel: GE, tailLevel: GE, maxRoomSize: GE) extends MultiOut with AudioRated

A stereophonic reverb UGen. It is based on the GVerb LADSPA effect by Juhana Sadeharju.

A stereophonic reverb UGen. It is based on the GVerb LADSPA effect by Juhana Sadeharju.

'''Note:''' A CPU spike may occur when the synth is instantiated. '''Warning:''' The UGen has a bug which results in loud noise if the room size is increased during playback. It seems safe to start with a large room size and ''decrease'' the value during playing. '''Warning:''' The UGen may crash the server if roomSize becomes larger than maxRoomSize .

Value Params
damping

high frequency attenuation (1 is maximum attenuation)

dryLevel

amount of dry signal

earlyRefLevel

amount of early reflections

inputBW

high frequency attenuation of the input signal (0 to 1)

maxRoomSize

maximum value that roomSize can take. This is used for the early reflection delay lines and is only read at initialization time. ''(init-time only)''

revTime

reverberation time in seconds.

roomSize

Size of the virtual room in meters. It must not be greater than maxRoomSize . Note that quick changes in roomSize may result in zipper noise and an audible Doppler effect.

spread

stereo spread of the reverb signal. Units?

tailLevel

amount of late reverberation

See also
Companion
object
object Gate extends ProductReader[Gate]

A gate or hold UGen. It allows the input signal value to pass when the gate argument is positive, otherwise it holds last value.

A gate or hold UGen. It allows the input signal value to pass when the gate argument is positive, otherwise it holds last value.

Before the first high gate value is registered, this UGen outputs zero.

See also
Companion
class
final case
class Gate(rate: MaybeRate, in: GE, gate: GE) extends SingleOut

A gate or hold UGen. It allows the input signal value to pass when the gate argument is positive, otherwise it holds last value.

A gate or hold UGen. It allows the input signal value to pass when the gate argument is positive, otherwise it holds last value.

Before the first high gate value is registered, this UGen outputs zero.

Value Params
gate

the signal specifying whether to pass the input signal (when greater than zero) or whether to close the gate and hold the last value (when less than or equal to zero)

in

the input signal to gate

See also
Companion
object
object GbmanL extends ProductReader[GbmanL]
Companion
class
final case
class GbmanL(rate: Rate, freq: GE, xi: GE, yi: GE) extends SingleOut
Value Params
freq

Iteration frequency in Hertz

yi

Initial value of y

Companion
object
object GbmanN extends ProductReader[GbmanN]

A non-interpolating sound generator based on the difference equations:

A non-interpolating sound generator based on the difference equations:

x[n+1] = 1 - y[n] + abs(x[n])
y[n+1] = x[n]

The behavior of the system is only dependent on its initial conditions. Reference: Devaney, R. L. "The Gingerbreadman." Algorithm 3, 15-16, Jan. 1992.

===Examples===

// default initial parameters
play { GbmanN.ar(MouseX.kr(20, SampleRate.ir)) * 0.1 }
// change initial parameters
play { GbmanN.ar(MouseX.kr(20, SampleRate.ir), -0.7, -2.7) * 0.1 }
// wait for it...
play { GbmanN.ar(MouseX.kr(20, SampleRate.ir), 1.2, 2.0002) * 0.1 }
// as a frequency control
play { SinOsc.ar(GbmanN.ar(40) * 400 + 500) * 0.4 }
See also
Companion
class
final case
class GbmanN(rate: Rate, freq: GE, xi: GE, yi: GE) extends SingleOut

A non-interpolating sound generator based on the difference equations:

A non-interpolating sound generator based on the difference equations:

x[n+1] = 1 - y[n] + abs(x[n])
y[n+1] = x[n]

The behavior of the system is only dependent on its initial conditions. Reference: Devaney, R. L. "The Gingerbreadman." Algorithm 3, 15-16, Jan. 1992.

Value Params
freq

Iteration frequency in Hertz

yi

Initial value of y

See also
Companion
object
object Gendy1 extends ProductReader[Gendy1]
Companion
class
final case
class Gendy1(rate: Rate, ampDist: GE, durDist: GE, adParam: GE, ddParam: GE, minFreq: GE, maxFreq: GE, ampScale: GE, durScale: GE, initCPs: GE, kNum: GE) extends SingleOut with IsIndividual
Companion
object
object Gendy2 extends ProductReader[Gendy2]
Companion
class
final case
class Gendy2(rate: Rate, ampDist: GE, durDist: GE, adParam: GE, ddParam: GE, minFreq: GE, maxFreq: GE, ampScale: GE, durScale: GE, initCPs: GE, kNum: GE, a: GE, c: GE) extends SingleOut with IsIndividual
Companion
object
object Gendy3 extends ProductReader[Gendy3]
Companion
class
final case
class Gendy3(rate: Rate, ampDist: GE, durDist: GE, adParam: GE, ddParam: GE, freq: GE, ampScale: GE, durScale: GE, initCPs: GE, kNum: GE) extends SingleOut with IsIndividual
Companion
object
object GrainBuf extends ProductReader[GrainBuf]

A granular synthesis UGen taking sound stored in a buffer. Another buffer can be used to provide an amplitude envelope. The input sound buffer must be monophonic, but output may be multi-channel, using a panorama control.

A granular synthesis UGen taking sound stored in a buffer. Another buffer can be used to provide an amplitude envelope. The input sound buffer must be monophonic, but output may be multi-channel, using a panorama control.

All arguments except numChannels and maxGrain are polled at grain creation (trigger) time.

See also
Companion
class
final case
class GrainBuf(numChannels: Int, trig: GE, dur: GE, buf: GE, speed: GE, pos: GE, interp: GE, pan: GE, envBuf: GE, maxGrains: GE) extends MultiOut with AudioRated with IsIndividual

A granular synthesis UGen taking sound stored in a buffer. Another buffer can be used to provide an amplitude envelope. The input sound buffer must be monophonic, but output may be multi-channel, using a panorama control.

A granular synthesis UGen taking sound stored in a buffer. Another buffer can be used to provide an amplitude envelope. The input sound buffer must be monophonic, but output may be multi-channel, using a panorama control.

All arguments except numChannels and maxGrain are polled at grain creation (trigger) time.

Value Params
buf

buffer holding a mono audio signal portions of which are read as grains

dur

grain duration in seconds

envBuf

identifier of a buffer containing a signal to use for the grain envelope. The default value of -1 means that a built-in Hann envelope is used.

interp

interpolation type when using pitch-shifting via speed . 1 for no interpolation (nearest sample), 2 for linear interpolation, and 4 for cubic interpolation.

maxGrains

maximum number of overlapping grains that can be used at a given time. This value is set at the UGens init time and cannot be modified later. Lower value mean that less memory is used.

numChannels

the number of channels to output. If 1 , a monophonic signal is returned and the pan argument is ignored.

pan

panning position when numChannels is greater than one. Equivalent to the pan position of Pan2 (for stereo output) or PanAz (for more than two channels)

pos

grain start position, where 0 is beginning and 1 is the end of the input buffer

speed

playback speed of the grain, where 1.0 is original rate, 0.5 is half speed etc.

trig

a control- or audio-rate trigger to start a new grain. For audio-rate, timing is sample frame accurate.

See also
Companion
object
object GrainFM extends ProductReader[GrainFM]
Companion
class
final case
class GrainFM(numChannels: Int, trig: GE, dur: GE, carFreq: GE, modFreq: GE, index: GE, pan: GE, envBuf: GE, maxGrains: GE) extends MultiOut with AudioRated with IsIndividual
Companion
object
object GrainIn extends ProductReader[GrainIn]
Companion
class
final case
class GrainIn(numChannels: Int, trig: GE, dur: GE, in: GE, pan: GE, envBuf: GE, maxGrains: GE) extends MultiOut with AudioRated with IsIndividual
Companion
object
object GrainSin extends ProductReader[GrainSin]
Companion
class
final case
class GrainSin(numChannels: Int, trig: GE, dur: GE, freq: GE, pan: GE, envBuf: GE, maxGrains: GE) extends MultiOut with AudioRated with IsIndividual
Companion
object
object GrayNoise extends ProductReader[GrayNoise]

A noise generator UGen which results from flipping random bits in a word. The resulting waveform looks like a sample-and-hold function with values between -1 and +1 (before being multiplied by mul ).

A noise generator UGen which results from flipping random bits in a word. The resulting waveform looks like a sample-and-hold function with values between -1 and +1 (before being multiplied by mul ).

This type of noise has a high RMS level relative to its peak to peak level. With approx. -4.8 dB, the RMS is the same as white noise, but the spectrum is emphasized towards lower frequencies.

===Examples===

// plain noise
play { GrayNoise.ar(Seq(0.2, 0.2)) }
See also
Companion
class
final case
class GrayNoise(rate: Rate, mul: GE) extends SingleOut with IsIndividual

A noise generator UGen which results from flipping random bits in a word. The resulting waveform looks like a sample-and-hold function with values between -1 and +1 (before being multiplied by mul ).

A noise generator UGen which results from flipping random bits in a word. The resulting waveform looks like a sample-and-hold function with values between -1 and +1 (before being multiplied by mul ).

This type of noise has a high RMS level relative to its peak to peak level. With approx. -4.8 dB, the RMS is the same as white noise, but the spectrum is emphasized towards lower frequencies.

Value Params
mul

Not actually a UGen input, this argument produces a multiplication of the output by this factor. A multi-channel mul argument will cause the generation of multiple independent noise generators.

See also
Companion
object
object HPF extends ProductReader[HPF]

A second order high pass filter UGen.

A second order high pass filter UGen.

===Examples===

// modulated frequency
play {
 val in   = Saw.ar(200) * 0.5
 val freq = SinOsc.ar(XLine.ar(0.3, 100, 20)).mulAdd(3600, 4000)
 HPF.ar(in, freq)
}
// mouse controlled frequency
play {
 val in   = WhiteNoise.ar(0.5)
 val freq = MouseX.kr(200, 10000, 1)
 HPF.ar(in, freq)
}
See also
Companion
class
final case
class HPF(rate: MaybeRate, in: GE, freq: GE) extends SingleOut

A second order high pass filter UGen.

A second order high pass filter UGen.

Value Params
freq

cutoff frequency in Hertz

in

input signal to be filtered

See also
Companion
object
object HPZ1 extends ProductReader[HPZ1]

A two point difference filter UGen. Implements the formula :

A two point difference filter UGen. Implements the formula :

out(i) = 0.5 * (in(i) - in(i-1))

Note: the filter's memory is initialized with the first input sample, so for HPZ1.ar(DC.ar(x)) the output will be zero, even at the beginning.

===Examples===

// engage with mouse button
play {
 val sig = PinkNoise.ar
 val flt = HPZ1.ar(sig)
 LinXFade2.ar(sig, flt, MouseButton.kr(-1, 1))
}
// detect changes
play {
 val z  = LFNoise0.ar(2)
 val f  = HPZ1.ar(z)
 val ch = f sig_!= 0 // input increased or decreased
 z.poll(ch, "now")
 0
}
See also
Companion
class
final case
class HPZ1(rate: MaybeRate, in: GE) extends SingleOut

A two point difference filter UGen. Implements the formula :

A two point difference filter UGen. Implements the formula :

out(i) = 0.5 * (in(i) - in(i-1))

Note: the filter's memory is initialized with the first input sample, so for HPZ1.ar(DC.ar(x)) the output will be zero, even at the beginning.

Value Params
in

input signal to be filtered

See also
Companion
object
object HPZ2 extends ProductReader[HPZ2]

three point difference filter UGen. Implements the formula :

three point difference filter UGen. Implements the formula :

out(i) = 0.25 * (in(i) - 2 * in(i-1) + in(i-2))

===Examples===

// engage with mouse button
play {
 val sig = WhiteNoise.ar(0.5)
 val flt = HPZ2.ar(sig)
 LinXFade2.ar(sig, flt, MouseButton.kr(-1, 1))
}
See also
Companion
class
final case
class HPZ2(rate: MaybeRate, in: GE) extends SingleOut

three point difference filter UGen. Implements the formula :

three point difference filter UGen. Implements the formula :

out(i) = 0.25 * (in(i) - 2 * in(i-1) + in(i-2))
Value Params
in

input signal to be filtered

See also
Companion
object
object Hasher extends ProductReader[Hasher]

A UGen that returns a unique output value from -1 to +1 for each input value according to a hash function. The same input value will always produce the same output value. The input values can have any range.

A UGen that returns a unique output value from -1 to +1 for each input value according to a hash function. The same input value will always produce the same output value. The input values can have any range.

===Examples===

// scramble mouse motion
play {
 SinOsc.ar(
   Hasher.kr(MouseX.kr(0,10)).mulAdd(300, 500)
 ) * 0.2
}
// distort pulse wave
play {
 val lag  = MouseY.kr(0.001, 0.1, 1)
 val freq = MouseX.kr(1, 500, 1)
 Hasher.ar(Lag.ar(LFPulse.ar(freq), lag)) * 0.2
}
Companion
class
final case
class Hasher(rate: MaybeRate, in: GE) extends SingleOut

A UGen that returns a unique output value from -1 to +1 for each input value according to a hash function. The same input value will always produce the same output value. The input values can have any range.

A UGen that returns a unique output value from -1 to +1 for each input value according to a hash function. The same input value will always produce the same output value. The input values can have any range.

Value Params
in

input to calculate the hash function for

Companion
object
object HenonC extends ProductReader[HenonC]

A cubic-interpolating sound generator based on the difference equation:

A cubic-interpolating sound generator based on the difference equation:

x[n+2] = 1 - a * pow(x[n+1], 2) + b * x[n]

This equation was discovered by French astronomer Michel Hénon while studying the orbits of stars in globular clusters.

===Examples===

// default initial parameters
play { HenonC.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }
// mouse-control of parameters
play { HenonC.ar(SampleRate.ir/4, MouseX.kr(1,1.4), MouseY.kr(0,0.3)) * 0.2 }
// randomly modulate parameters
play {
 HenonC.ar(
   SampleRate.ir/8,
   LFNoise2.kr(1).mulAdd(0.2, 1.2),
   LFNoise2.kr(1).mulAdd(0.15, 0.15)
 ) * 0.2
}
// as a frequency control
play { SinOsc.ar(HenonC.ar(40, MouseX.kr(1, 1.4), MouseY.kr(0, 0.3)) * 800 + 900) * 0.4 }
See also
Companion
class
final case
class HenonC(rate: Rate, freq: GE, a: GE, b: GE, x0: GE, x1: GE) extends SingleOut

A cubic-interpolating sound generator based on the difference equation:

A cubic-interpolating sound generator based on the difference equation:

x[n+2] = 1 - a * pow(x[n+1], 2) + b * x[n]

This equation was discovered by French astronomer Michel Hénon while studying the orbits of stars in globular clusters.

Value Params
a

Equation variable

b

Equation variable

freq

Iteration frequency in Hertz

x0

Initial value of x

x1

Second value of x

See also
Companion
object
object HenonL extends ProductReader[HenonL]

A linear-interpolating sound generator based on the difference equation:

A linear-interpolating sound generator based on the difference equation:

x[n+2] = 1 - a * pow(x[n+1], 2) + b * x[n]

This equation was discovered by French astronomer Michel Hénon while studying the orbits of stars in globular clusters.

===Examples===

// default initial parameters
play { HenonL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }
// mouse-control of parameters
play { HenonL.ar(SampleRate.ir/4, MouseX.kr(1,1.4), MouseY.kr(0,0.3)) * 0.2 }
// randomly modulate parameters
play {
 HenonL.ar(
   SampleRate.ir/8,
   LFNoise2.kr(1).mulAdd(0.2, 1.2),
   LFNoise2.kr(1).mulAdd(0.15, 0.15)
 ) * 0.2
}
// as a frequency control
play { SinOsc.ar(HenonL.ar(40, MouseX.kr(1, 1.4), MouseY.kr(0, 0.3)) * 800 + 900) * 0.4 }
See also
Companion
class
final case
class HenonL(rate: Rate, freq: GE, a: GE, b: GE, x0: GE, x1: GE) extends SingleOut

A linear-interpolating sound generator based on the difference equation:

A linear-interpolating sound generator based on the difference equation:

x[n+2] = 1 - a * pow(x[n+1], 2) + b * x[n]

This equation was discovered by French astronomer Michel Hénon while studying the orbits of stars in globular clusters.

Value Params
a

Equation variable

b

Equation variable

freq

Iteration frequency in Hertz

x0

Initial value of x

x1

Second value of x

See also
Companion
object
object HenonN extends ProductReader[HenonN]

A non-interpolating sound generator based on the difference equation:

A non-interpolating sound generator based on the difference equation:

x[n+2] = 1 - a * pow(x[n+1], 2) + b * x[n]

This equation was discovered by French astronomer Michel Hénon while studying the orbits of stars in globular clusters.

===Examples===

// default initial parameters
play { HenonN.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }
// mouse-control of parameters
play { HenonN.ar(SampleRate.ir/4, MouseX.kr(1,1.4), MouseY.kr(0,0.3)) * 0.2 }
// randomly modulate parameters
play {
 HenonN.ar(
   SampleRate.ir/8,
   LFNoise2.kr(1).mulAdd(0.2, 1.2),
   LFNoise2.kr(1).mulAdd(0.15, 0.15)
 ) * 0.2
}
// as a frequency control
play { SinOsc.ar(HenonN.ar(40, MouseX.kr(1, 1.4), MouseY.kr(0, 0.3)) * 800 + 900) * 0.4 }
See also
Companion
class
final case
class HenonN(rate: Rate, freq: GE, a: GE, b: GE, x0: GE, x1: GE) extends SingleOut

A non-interpolating sound generator based on the difference equation:

A non-interpolating sound generator based on the difference equation:

x[n+2] = 1 - a * pow(x[n+1], 2) + b * x[n]

This equation was discovered by French astronomer Michel Hénon while studying the orbits of stars in globular clusters.

Value Params
a

Equation variable

b

Equation variable

freq

Iteration frequency in Hertz

x0

Initial value of x

x1

Second value of x

See also
Companion
object
object Hilbert extends ProductReader[Hilbert]

A Hilbert transform UGen. This transformation produces two signals from a given input with identical frequency content, but with their respective phases shifted to be 90 degrees apart (0.5 pi radians).

A Hilbert transform UGen. This transformation produces two signals from a given input with identical frequency content, but with their respective phases shifted to be 90 degrees apart (0.5 pi radians).

The two signals output by Hilbert correspond to the real and imaginary part of the complex transformed signal. Due to the method used (an IIR filter), distortion occurs in the upper octave of the frequency spectrum.

The transform can be used to implemented single-side-band (SSB) modulation, but a dedicated UGen FreqShift is already provided for this case.

===Examples===

// a form of envelope tracking
play {
 val in = SinOsc.ar(440)
 val h  = Hilbert.ar(in)
 val x  = h.real.squared + h.imag.squared
 x.poll(1)  // cos(x)^2 + sin(x)^2 == 1 (ideally)
 0
}
See also
Companion
class
final case
class Hilbert(rate: Rate, in: GE) extends MultiOut

A Hilbert transform UGen. This transformation produces two signals from a given input with identical frequency content, but with their respective phases shifted to be 90 degrees apart (0.5 pi radians).

A Hilbert transform UGen. This transformation produces two signals from a given input with identical frequency content, but with their respective phases shifted to be 90 degrees apart (0.5 pi radians).

The two signals output by Hilbert correspond to the real and imaginary part of the complex transformed signal. Due to the method used (an IIR filter), distortion occurs in the upper octave of the frequency spectrum.

The transform can be used to implemented single-side-band (SSB) modulation, but a dedicated UGen FreqShift is already provided for this case.

Value Params
in

input signal to be processed

See also
Companion
object
object IEnv extends EnvFactory[IEnv]
Companion
class
final case
class IEnv(startLevel: GE, segments: Seq[Segment], offset: GE) extends EnvLike
Companion
object
object IEnvGen extends ProductReader[IEnvGen]

Envelope generator UGen with random access index pointer into the break-point function.

Envelope generator UGen with random access index pointer into the break-point function.

'''Warning''': The envelope must be generated using IEnv not Env . IEnv has a completely different format. Using the wrong format ( Env ) may crash the server.

To construct a manual envelope without the use of the IEnv class, the format should be as follows:

val env = Seq[GE](offset, startLevel, numSegments, totalDuration,
duration1, curveType1, curvature1, targetLevel1,
duration2, curveType2, curvature2, targetLevel2
...)

===Examples===

// mouse controls index
play {
 import Curve._
 val env = IEnv(0, Seq(
   (0.10, 0.6, lin),
   (0.02, 0.3, exp),
   (0.40, 1.0, parametric(-6)),
   (1.10, 0.0, sine)))
 val dur = Mix(env.segments.map(_.dur))
 val gen = IEnvGen.kr(env, MouseX.kr(0, dur))
 SinOsc.ar(gen * 500 + 440) * 0.2
}
See also
Companion
class
final case
class IEnvGen(rate: Rate, envelope: GE, index: GE) extends SingleOut

Envelope generator UGen with random access index pointer into the break-point function.

Envelope generator UGen with random access index pointer into the break-point function.

'''Warning''': The envelope must be generated using IEnv not Env . IEnv has a completely different format. Using the wrong format ( Env ) may crash the server.

To construct a manual envelope without the use of the IEnv class, the format should be as follows:

val env = Seq[GE](offset, startLevel, numSegments, totalDuration,
duration1, curveType1, curvature1, targetLevel1,
duration2, curveType2, curvature2, targetLevel2
...)
Value Params
envelope

the description of the envelope break-points. Typically you pass an instance of IEnv which will then automatically expand to the correct format.

index

index point into the envelope, given as time in seconds

See also
Companion
object
object IFFT extends ProductReader[IFFT]

A UGen performing an inverse FFT, transforming a buffer containing a spectral domain signal back into the time domain.

A UGen performing an inverse FFT, transforming a buffer containing a spectral domain signal back into the time domain.

===Examples===

// perfect reconstruction
play {
 // with a hop of 0.5 and forward Hann window,
 // we get a perfect reconstruction delayed
 // by the fftSize minus one control-block.
 // (alternatively, you can use a hop of 1.0,
 //  and winType of 1 for both FFT and IFFT)
 val n     = 1024
 val hop   = 0.5
 val buf   = LocalBuf(n)
 val in    = PinkNoise.ar(0.5)
 val fft   = FFT(buf, in, hop = hop, winType = 1)
 val out   = IFFT.ar(fft, winType = -1)
 val dur   = (2 * n * hop) / SampleRate.ir - ControlDur.ir
 val dly   = DelayN.ar(in, dur, dur)
 out - dly
}
See also
Companion
class
final case
class IFFT(rate: Rate, chain: GE, winType: GE, winSize: GE) extends SingleOut with IsIndividual

A UGen performing an inverse FFT, transforming a buffer containing a spectral domain signal back into the time domain.

A UGen performing an inverse FFT, transforming a buffer containing a spectral domain signal back into the time domain.

Value Params
chain

reference to the spectral signal, returned as a buffer-identifier from FFT or the PV_... UGens.

winSize

With the default value of zero, the window size equals the fft size. If you wish to perform zero padding, an explicit window size can be specified. ''(init-time only)''

winType

The window function applied after each IFFT is taken. The default of 0 is a sine window, -1 is a rectangle window, and 1 is a Hann window. ''(init-time only)''

See also
Companion
object
object IRand extends ProductReader[IRand]

A scalar UGen that generates a single random integer value, using a uniform distribution from lo to hi .

A scalar UGen that generates a single random integer value, using a uniform distribution from lo to hi .

===Examples===

// random sine frequencies
play {
 val m = Mix.fill(10)(FSinOsc.ar(IRand(40, 100).midiCps))
 m * Line.kr(0.025, 0, 4, doneAction = freeSelf)
}
See also
Companion
class
final case
class IRand(lo: GE, hi: GE) extends SingleOut with ScalarRated with IsIndividual

A scalar UGen that generates a single random integer value, using a uniform distribution from lo to hi .

A scalar UGen that generates a single random integer value, using a uniform distribution from lo to hi .

Value Params
hi

upper limit of the output range (inclusive)

lo

lower limit of the output range

See also
Companion
object
object Impulse extends ProductReader[Impulse]

A non-band-limited generator UGen for single sample impulses.

A non-band-limited generator UGen for single sample impulses.

===Examples===

// modulating frequency
play { Impulse.ar(XLine.kr(100, 20000, 10)) * 0.3 }
// modulating amplitude
play { Impulse.kr(XLine.kr(1, 200, 10)) * SinOsc.ar(440) * 0.3 }
// modulating phase
play { Impulse.ar(4, Seq(DC.kr(0), MouseX.kr(0, 1))) * 0.3 }
See also
Companion
class
final case
class Impulse(rate: Rate, freq: GE, phase: GE) extends SingleOut

A non-band-limited generator UGen for single sample impulses.

A non-band-limited generator UGen for single sample impulses.

Value Params
freq

frequency in Hertz. A value of zero can be used to generate a singular impulse.

phase

phase offset in cycles (0 to 1)

See also
Companion
object
object In extends ProductReader[In]

A UGen that reads a signal from a bus. Whether an audio- or control-bus is used depends on the rate of the UGen.

A UGen that reads a signal from a bus. Whether an audio- or control-bus is used depends on the rate of the UGen.

In.ar and In.kr behave differently with respect to signals left on the bus in the previous calculation cycle (control block): In.ar can access audio signals that were generated in the current calculation cycle by synths appearing earlier in the node tree. It does not read signals produced by nodes in the previous calculation cycle (i.e. synths appearing later in the node tree), the input would instead be zero. To allow such "feedback", InFeedback can be used.

In contrast, In.kr does not distinguish between "new" and "old" data: It will always read the most recent value found on the bus, whether it was generated earlier in this calculation cycle, left over from the last one, or set before by the client.

'''Note''': The server uses the first NumOutputBuses channels to write to the sound card, followed by another NumInputBuses to read from the sound card. For convenience, the pseudo-UGens PhysicalOut and PhysicalIn can be used.

===Examples===

// cross-synth routing
// allocate an internal stereo audio-bus
val bus = Bus.audio(s, 2)

// writes to internal bus (initially inaudible)
val x = play {
 Out.ar(bus.index, Dust.ar(Seq(345, 345)))
}

// reads internal bus and makes it audible.
// must be after `x` to be able to read the bus signal
val y = play(target = x, addAction = addAfter) {
 val in = In.ar(bus.index, 2)
 Resonz.ar(in, 555, 0.1) * 10
}

// when done, do not forget to free the bus
y.free(); x.free(); bus.free()
See also
Companion
class
final case
class In(rate: Rate, bus: GE, numChannels: Int) extends MultiOut with IsIndividual

A UGen that reads a signal from a bus. Whether an audio- or control-bus is used depends on the rate of the UGen.

A UGen that reads a signal from a bus. Whether an audio- or control-bus is used depends on the rate of the UGen.

In.ar and In.kr behave differently with respect to signals left on the bus in the previous calculation cycle (control block): In.ar can access audio signals that were generated in the current calculation cycle by synths appearing earlier in the node tree. It does not read signals produced by nodes in the previous calculation cycle (i.e. synths appearing later in the node tree), the input would instead be zero. To allow such "feedback", InFeedback can be used.

In contrast, In.kr does not distinguish between "new" and "old" data: It will always read the most recent value found on the bus, whether it was generated earlier in this calculation cycle, left over from the last one, or set before by the client.

'''Note''': The server uses the first NumOutputBuses channels to write to the sound card, followed by another NumInputBuses to read from the sound card. For convenience, the pseudo-UGens PhysicalOut and PhysicalIn can be used.

Value Params
bus

index of the bus to read from. When numChannels is greater than one, the other channels or read from the adjacent indices.

numChannels

number of channels to read

See also
Companion
object
object InFeedback extends ProductReader[InFeedback]

A UGen which reads a signal from an audio bus with a current or one cycle old timestamp.

A UGen which reads a signal from an audio bus with a current or one cycle old timestamp.

Audio buses adhere to the concept of a cycle timestamp, which increases for each audio block calculated. When the various output ugens ( Out , OffsetOut , XOut ) write data to a bus, they mix it with any data from the current cycle, but overwrite any data from the previous cycle. ( ReplaceOut overwrites all data regardless.) Thus depending on node order and what synths are writing to the bus, the data on a given bus may be from the current cycle or be one cycle old at the time of reading.

In.ar checks the timestamp of any data it reads in and zeros any data from the previous cycle (for use within that node; the data remains on the bus). This is fine for audio data, as it avoids feedback, but for control data it is useful to be able to read data from any place in the node order. For this reason In.kr also reads data that is older than the current cycle.

In some cases one might also want to read audio from a node later in the current node order. This can be achieved with InFeedback . It reads from the previous cycle, and hence introduces a '''delay''' of one block size, which by default is 64 sample frames (equal to about 1.45 ms at 44.1 kHz sample rate).

'''Note''' that no delay occurs when the bus contains a signal which has been written already in the current cycle. The delay is only introduced when no present signal exists.

===Examples===

// feedback frequency modulation
play {
 val in = InFeedback.ar(0) // read output
 SinOsc.ar(in * 1300 + 300) * 0.4
}
// resonator
val bus = Bus.audio(s) // internal feedback bus

val x = play {
 val imp  = Impulse.ar(1)
 val in   = InFeedback.ar(bus.index)
 val feed = imp + in * 0.995
 // must subtract block-size for correct tuning
 // (try removing the ControlDur to here the pitch change)
 val time = 440.reciprocal - ControlDur.ir
 val dly  = DelayC.ar(feed, time, time)
 Out.ar(bus.index, dly)

 // alternate between feedback and reference pitch
 val comp = Seq(dly, SinOsc.ar(440) * 0.2): GE
 comp * LFPulse.kr(1, Seq(0.0, 0.5))
}

x.free(); bus.free()  // do not forget to free the bus eventually
See also
Companion
class
final case
class InFeedback(bus: GE, numChannels: Int) extends MultiOut with AudioRated with IsIndividual

A UGen which reads a signal from an audio bus with a current or one cycle old timestamp.

A UGen which reads a signal from an audio bus with a current or one cycle old timestamp.

Audio buses adhere to the concept of a cycle timestamp, which increases for each audio block calculated. When the various output ugens ( Out , OffsetOut , XOut ) write data to a bus, they mix it with any data from the current cycle, but overwrite any data from the previous cycle. ( ReplaceOut overwrites all data regardless.) Thus depending on node order and what synths are writing to the bus, the data on a given bus may be from the current cycle or be one cycle old at the time of reading.

In.ar checks the timestamp of any data it reads in and zeros any data from the previous cycle (for use within that node; the data remains on the bus). This is fine for audio data, as it avoids feedback, but for control data it is useful to be able to read data from any place in the node order. For this reason In.kr also reads data that is older than the current cycle.

In some cases one might also want to read audio from a node later in the current node order. This can be achieved with InFeedback . It reads from the previous cycle, and hence introduces a '''delay''' of one block size, which by default is 64 sample frames (equal to about 1.45 ms at 44.1 kHz sample rate).

'''Note''' that no delay occurs when the bus contains a signal which has been written already in the current cycle. The delay is only introduced when no present signal exists.

Value Params
bus

the index of the audio bus to read in from.

numChannels

the number of channels (i.e. adjacent buses) to read in. Since this is a constant, a change in number of channels of the underlying bus must be reflected by creating different SynthDefs.

See also
Companion
object
object InRange extends ProductReader[InRange]

A UGen that tests if a signal is within a given range. If in >= lo and in <= hi , outputs 1.0, otherwise outputs 0.0.

A UGen that tests if a signal is within a given range. If in >= lo and in <= hi , outputs 1.0, otherwise outputs 0.0.

===Examples===

// detect whether mouse is in specific horizontal range
play {
 val x = MouseX.kr
 InRange.kr(x, 0.4, 0.6) * PinkNoise.ar(0.3)
}
See also
Companion
class
final case
class InRange(rate: Rate, in: GE, lo: GE, hi: GE) extends SingleOut

A UGen that tests if a signal is within a given range. If in >= lo and in <= hi , outputs 1.0, otherwise outputs 0.0.

A UGen that tests if a signal is within a given range. If in >= lo and in <= hi , outputs 1.0, otherwise outputs 0.0.

Value Params
hi

upper margin of test range (inclusive)

in

input signal to test

lo

lower margin of test range (inclusive)

See also
Companion
object
object InRect extends ProductReader[InRect]

A UGen that tests if two signals lie both within a given ranges. The two input signals can be understood as horizontal and vertical coordinates, therefore the test become one that determines whether the input is within a given "rectangle".

A UGen that tests if two signals lie both within a given ranges. The two input signals can be understood as horizontal and vertical coordinates, therefore the test become one that determines whether the input is within a given "rectangle".

If x >= left and x <= right and y > top and y <= bottom , outputs 1.0, otherwise outputs 0.0.

===Examples===

// detect whether mouse is in specific horizontal and vertical range
play {
 val x  = MouseX.kr; val y = MouseY.kr(1, 0)
 val in = InRect.kr(x = x, y = y, left = 0.4, top = 0.2, right = 0.6, bottom = 0.4)
 in * PinkNoise.ar(0.3)
}
See also
Companion
class
final case
class InRect(rate: Rate, x: GE, y: GE, left: GE, top: GE, right: GE, bottom: GE) extends SingleOut

A UGen that tests if two signals lie both within a given ranges. The two input signals can be understood as horizontal and vertical coordinates, therefore the test become one that determines whether the input is within a given "rectangle".

A UGen that tests if two signals lie both within a given ranges. The two input signals can be understood as horizontal and vertical coordinates, therefore the test become one that determines whether the input is within a given "rectangle".

If x >= left and x <= right and y > top and y <= bottom , outputs 1.0, otherwise outputs 0.0.

Value Params
bottom

upper margin of vertical test range (inclusive)

left

lower margin of horizontal test range (inclusive)

right

upper margin of horizontal test range (inclusive)

top

lower margin of vertical test range (inclusive)

x

"horizontal" signal to test

y

"vertical" signal to test

See also
Companion
object
object InTrig extends ProductReader[InTrig]

A UGen which generates a trigger anytime a control bus is set.

A UGen which generates a trigger anytime a control bus is set.

Any time the bus is "touched" i.e. has its value set (using "/c_set" etc.), a single impulse trigger will be generated. Its amplitude is the value that the bus was set to. Note that if a signal is continuously written to that bus, for instance using Out.kr , only one initial trigger is generated once that ugen starts writing, but no successive triggers are generated.

===Examples===

// envelope trigger
val c = Bus.control(s)

val x = play {
 val tr = InTrig.kr(c.index)
 SinOsc.ar * EnvGen.kr(Env.perc, gate = tr, levelScale = tr)
}

c.set(1.0)
c.set(0.2)
c.set(0.1)

x.free(); c.free()
See also

TrigControl

Companion
class
final case
class InTrig(bus: GE, numChannels: Int) extends MultiOut with ControlRated with IsIndividual

A UGen which generates a trigger anytime a control bus is set.

A UGen which generates a trigger anytime a control bus is set.

Any time the bus is "touched" i.e. has its value set (using "/c_set" etc.), a single impulse trigger will be generated. Its amplitude is the value that the bus was set to. Note that if a signal is continuously written to that bus, for instance using Out.kr , only one initial trigger is generated once that ugen starts writing, but no successive triggers are generated.

Value Params
bus

the index of the control bus to read in from.

numChannels

the number of channels (i.e. adjacent buses) to read in. Since this is a constant, a change in number of channels of the underlying bus must be reflected by creating different SynthDefs.

See also

TrigControl

Companion
object
object Index extends ProductReader[Index]

A UGen which reads a single sample value from a buffer at a given index.

A UGen which reads a single sample value from a buffer at a given index.

It uses the in argument as index into the buffer, truncating that argument to an integer. Out-of-range index values are clipped to the valid range.

While designed for monophonic buffers, it works with multi-channel buffers by treating them as de-interleaved. For example, if the buffer has two frames and two channels, index 0 corresponds to frame 0, channel 0, index 1 correspond to frame 0, channel 1, index 2 corresponds to frame 1, channel 0, and index 3 corresponds to frame 1, channel 1.

See also
Companion
class
final case
class Index(rate: Rate, buf: GE, in: GE) extends SingleOut with IsIndividual

A UGen which reads a single sample value from a buffer at a given index.

A UGen which reads a single sample value from a buffer at a given index.

It uses the in argument as index into the buffer, truncating that argument to an integer. Out-of-range index values are clipped to the valid range.

While designed for monophonic buffers, it works with multi-channel buffers by treating them as de-interleaved. For example, if the buffer has two frames and two channels, index 0 corresponds to frame 0, channel 0, index 1 correspond to frame 0, channel 1, index 2 corresponds to frame 1, channel 0, and index 3 corresponds to frame 1, channel 1.

Value Params
buf

The buffer to read from.

in

The sample index into the buffer. This is truncated to an integer automatically.

See also
Companion
object
object IndexInBetween extends ProductReader[IndexInBetween]

A UGen which determines the (lowest) index in a buffer at which the two neighboring values contain a given input signal. The output index is a decimal whose fractional part is suitable for linearly interpolating between the buffer slot values.

A UGen which determines the (lowest) index in a buffer at which the two neighboring values contain a given input signal. The output index is a decimal whose fractional part is suitable for linearly interpolating between the buffer slot values.

For example, if the Buffer contains values 3, 21, 25, 26 and the input signal has the value 22, then the output will be 1.25, because the value 22 is in-between the values stored at indices 1 and 2 and the linear location of 22 is one-quarter of the way along the interval between them: 21 * (1 - 0.25) + 25 * (1 - 0.75) = 22.

If the input value is smaller than the first sample, the output will be zero. If the input value is larger than any sample in the buffer, the output will be the buffer size minus one.

While designed for monophonic buffers, it works with multi-channel buffers by treating them as de-interleaved. For example, if the buffer has two frames and two channels, and the algorithm finds the frame 1 in channel 0, the reported index is 2 (frame * numChannels + channel).

IndexInBetween is the complement of the IndexL UGen.

See also
Companion
class
final case
class IndexInBetween(rate: Rate, buf: GE, in: GE) extends SingleOut with IsIndividual

A UGen which determines the (lowest) index in a buffer at which the two neighboring values contain a given input signal. The output index is a decimal whose fractional part is suitable for linearly interpolating between the buffer slot values.

A UGen which determines the (lowest) index in a buffer at which the two neighboring values contain a given input signal. The output index is a decimal whose fractional part is suitable for linearly interpolating between the buffer slot values.

For example, if the Buffer contains values 3, 21, 25, 26 and the input signal has the value 22, then the output will be 1.25, because the value 22 is in-between the values stored at indices 1 and 2 and the linear location of 22 is one-quarter of the way along the interval between them: 21 * (1 - 0.25) + 25 * (1 - 0.75) = 22.

If the input value is smaller than the first sample, the output will be zero. If the input value is larger than any sample in the buffer, the output will be the buffer size minus one.

While designed for monophonic buffers, it works with multi-channel buffers by treating them as de-interleaved. For example, if the buffer has two frames and two channels, and the algorithm finds the frame 1 in channel 0, the reported index is 2 (frame * numChannels + channel).

IndexInBetween is the complement of the IndexL UGen.

Value Params
buf

The buffer to search in.

in

The input signal whose value is looked up in the buffer.

See also
Companion
object
object IndexL extends ProductReader[IndexL]

A UGen which reads from a buffer at a given index, linearly interpolating between neighboring points.

A UGen which reads from a buffer at a given index, linearly interpolating between neighboring points.

It uses the in argument as index into the buffer. Out-of-range index values are clipped to the valid range. If the index has a fractional part, it is used to interpolate between the buffer index at the floor and the buffer index at the ceiling of the index argument.

While designed for monophonic buffers, it works with multi-channel buffers by treating them as de-interleaved. See the Index UGen for details.

See also
Companion
class
final case
class IndexL(rate: Rate, buf: GE, in: GE) extends SingleOut with IsIndividual

A UGen which reads from a buffer at a given index, linearly interpolating between neighboring points.

A UGen which reads from a buffer at a given index, linearly interpolating between neighboring points.

It uses the in argument as index into the buffer. Out-of-range index values are clipped to the valid range. If the index has a fractional part, it is used to interpolate between the buffer index at the floor and the buffer index at the ceiling of the index argument.

While designed for monophonic buffers, it works with multi-channel buffers by treating them as de-interleaved. See the Index UGen for details.

Value Params
buf

The buffer to read from.

in

The sample index into the buffer. This can have a fractional part.

See also
Companion
object
object Integrator extends ProductReader[Integrator]

A filter UGen to integrate an input signal with a leak. Implements the formula :

A filter UGen to integrate an input signal with a leak. Implements the formula :

out(i) = in(i) + (coef * out(i-1))

'''Warning:''' there are bugs when the coefficient is modulated

See also
Companion
class
final case
class Integrator(rate: MaybeRate, in: GE, coeff: GE) extends SingleOut

A filter UGen to integrate an input signal with a leak. Implements the formula :

A filter UGen to integrate an input signal with a leak. Implements the formula :

out(i) = in(i) + (coef * out(i-1))

'''Warning:''' there are bugs when the coefficient is modulated

Value Params
coeff

the leak coefficient. Should be between -1 and +1

in

input signal to be processed

See also
Companion
object
object K2A extends ProductReader[K2A]

A converter UGen that takes a control-rate input and produces an audio-rate output by means of linear interpolation. The current control input value is always reached in at the beginning of the subsequent control block. A special case is the initialization which begins directly at the first control input value (therefore, the first control block of the audio-rate output is is always constant.)

A converter UGen that takes a control-rate input and produces an audio-rate output by means of linear interpolation. The current control input value is always reached in at the beginning of the subsequent control block. A special case is the initialization which begins directly at the first control input value (therefore, the first control block of the audio-rate output is is always constant.)

For example, if the block size is 64, and the first three input values are -0.5, 0.6, 0.3, then the output signal will be 65 samples of value -0.5, followed by a linear ramp of 64 samples towards 0.6, followed by a linear ramp of 64 samples to towards 0.3.

===Examples===

// compare control and audio rate
play {
 val a = K2A.ar(WhiteNoise.kr(0.3))
 val b =        WhiteNoise.ar(0.3)
 val c = LFPulse.ar(1, Seq(0, 0.5))
 c * Seq(a, b)
}
See also
Companion
class
final case
class K2A(in: GE) extends SingleOut with AudioRated

A converter UGen that takes a control-rate input and produces an audio-rate output by means of linear interpolation. The current control input value is always reached in at the beginning of the subsequent control block. A special case is the initialization which begins directly at the first control input value (therefore, the first control block of the audio-rate output is is always constant.)

A converter UGen that takes a control-rate input and produces an audio-rate output by means of linear interpolation. The current control input value is always reached in at the beginning of the subsequent control block. A special case is the initialization which begins directly at the first control input value (therefore, the first control block of the audio-rate output is is always constant.)

For example, if the block size is 64, and the first three input values are -0.5, 0.6, 0.3, then the output signal will be 65 samples of value -0.5, followed by a linear ramp of 64 samples towards 0.6, followed by a linear ramp of 64 samples to towards 0.3.

Value Params
in

control-rate signal to convert

See also
Companion
object
object KeyState extends ProductReader[KeyState]

A UGen that detects a specific keyboard stroke. When the given key is not pressed, the lo value is output, while the key is pressed the hi value is output. If lag is greater than zero, a Lag -type operation is applied for a smoother transition between lo and hi .

A UGen that detects a specific keyboard stroke. When the given key is not pressed, the lo value is output, while the key is pressed the hi value is output. If lag is greater than zero, a Lag -type operation is applied for a smoother transition between lo and hi .

===Examples===

// determine codes
play {
 val code = Phasor.kr(lo = 0, hi = 127)
 val k    = KeyState.kr(code, lag = 0)
 val x    = Gate.kr(code, k)
 val ch   = x sig_!= Delay1.kr(x)
 // when a code change is detected, print it
 x.poll(ch, "code")
 ()
}
// gate sound using the 'A' key
play {
 // on Linux, key-code 38 denotes the 'A' key
 SinOsc.ar(800) * KeyState.kr(38, 0, 0.1)
}
See also
Companion
class
final case
class KeyState(keyCode: GE, lo: GE, hi: GE, lag: GE) extends SingleOut with ControlRated

A UGen that detects a specific keyboard stroke. When the given key is not pressed, the lo value is output, while the key is pressed the hi value is output. If lag is greater than zero, a Lag -type operation is applied for a smoother transition between lo and hi .

A UGen that detects a specific keyboard stroke. When the given key is not pressed, the lo value is output, while the key is pressed the hi value is output. If lag is greater than zero, a Lag -type operation is applied for a smoother transition between lo and hi .

Value Params
hi

value output when the currently pressed does match the code

keyCode

hardware code for the key to monitor. This is likely platform dependent. For example, on Linux, key-codes 24 to 29 correspond to 'Q', 'W', 'E', 'R', 'T', 'Y'.

lag

60 dB lag time in seconds.

lo

value output when the currently pressed does not match the code

See also
Companion
object
object KeyTrack extends ProductReader[KeyTrack]

A (12TET major/minor) key tracker UGen. It is based on a pitch class profile of energy across FFT bins and matching this to templates for major and minor scales in all transpositions. It assumes a 440 Hz concert A reference. Output is 0-11 C major to B major, 12-23 C minor to B minor.

A (12TET major/minor) key tracker UGen. It is based on a pitch class profile of energy across FFT bins and matching this to templates for major and minor scales in all transpositions. It assumes a 440 Hz concert A reference. Output is 0-11 C major to B major, 12-23 C minor to B minor.

Companion
class
final case
class KeyTrack(chain: GE, keyDecay: GE, chromaLeak: GE) extends SingleOut with ControlRated with IsIndividual

A (12TET major/minor) key tracker UGen. It is based on a pitch class profile of energy across FFT bins and matching this to templates for major and minor scales in all transpositions. It assumes a 440 Hz concert A reference. Output is 0-11 C major to B major, 12-23 C minor to B minor.

A (12TET major/minor) key tracker UGen. It is based on a pitch class profile of energy across FFT bins and matching this to templates for major and minor scales in all transpositions. It assumes a 440 Hz concert A reference. Output is 0-11 C major to B major, 12-23 C minor to B minor.

Value Params
chain

the output (buffer) of an FFT UGen which transforms the audio input to track. For the FFT chain, with a standard hop of half FFT size, the FFT size should be 4096 at 44.1 or 48 kHz and 8192 at 88.2 or 96 kHz sampling rate.

chromaLeak

Each frame, the chroma values are set to the previous value multiplied by this chroma decay. 0.0 will start each frame afresh with no memory. Can be control-rate modulated.

keyDecay

Number of seconds for the influence of a window on the final key decision to decay by 40dB (to 0.01 its original value). Can be control-rate modulated.

Companion
object
object Klang extends ProductReader[Klang]
Companion
class
final case
class Klang(specs: GE, freqScale: GE, freqOffset: GE) extends SingleOut with AudioRated
Companion
object
object KlangSpec extends ProductReader[KlangSpec]
Companion
class
final case
class KlangSpec(freq: GE, amp: GE, decay: GE) extends GE
Companion
object
object Klank extends ProductReader[Klank]

Klank is a UGen of a bank of fixed frequency resonators which can be used to simulate the resonant modes of an object. Each mode is given a ring time, which is the time for the mode to decay by 60 dB.

Klank is a UGen of a bank of fixed frequency resonators which can be used to simulate the resonant modes of an object. Each mode is given a ring time, which is the time for the mode to decay by 60 dB.

''Note'': Ringz and derived UGens Klank and Formlet produce output RMS depending on the server's sampling rate. This is to achieve the same amplitude for single-sample impulse inputs.

See also
Companion
class
final case
class Klank(specs: GE, in: GE, freqScale: GE, freqOffset: GE, decayScale: GE) extends SingleOut with AudioRated

Klank is a UGen of a bank of fixed frequency resonators which can be used to simulate the resonant modes of an object. Each mode is given a ring time, which is the time for the mode to decay by 60 dB.

Klank is a UGen of a bank of fixed frequency resonators which can be used to simulate the resonant modes of an object. Each mode is given a ring time, which is the time for the mode to decay by 60 dB.

''Note'': Ringz and derived UGens Klank and Formlet produce output RMS depending on the server's sampling rate. This is to achieve the same amplitude for single-sample impulse inputs.

Value Params
decayScale

''(init-time only)''

freqOffset

''(init-time only)''

freqScale

''(init-time only)''

specs

''(init-time only)''

See also
Companion
object
object LFClipNoise extends ProductReader[LFClipNoise]

A UGen that randomly generates the values -1 or +1 at a rate given by the nearest integer division of the sample rate by the frequency argument. The difference to LFClipNoise is that this UGen quantizes time to the nearest integer division of the sample-rate, and the frequency input is only polled at the moment a new output value is scheduled.

A UGen that randomly generates the values -1 or +1 at a rate given by the nearest integer division of the sample rate by the frequency argument. The difference to LFClipNoise is that this UGen quantizes time to the nearest integer division of the sample-rate, and the frequency input is only polled at the moment a new output value is scheduled.

===Examples===

// generator
play { LFClipNoise.ar(500) * 0.2 }
// random panning
play {
 val pos = LFClipNoise.ar(4)
 Pan2.ar(PinkNoise.ar, pos)
}
// modulate frequency
play { LFClipNoise.ar(XLine.kr(100, 10000, 20)) * 0.2 }
See also
Companion
class
final case
class LFClipNoise(rate: Rate, freq: GE) extends SingleOut with IsIndividual

A UGen that randomly generates the values -1 or +1 at a rate given by the nearest integer division of the sample rate by the frequency argument. The difference to LFClipNoise is that this UGen quantizes time to the nearest integer division of the sample-rate, and the frequency input is only polled at the moment a new output value is scheduled.

A UGen that randomly generates the values -1 or +1 at a rate given by the nearest integer division of the sample rate by the frequency argument. The difference to LFClipNoise is that this UGen quantizes time to the nearest integer division of the sample-rate, and the frequency input is only polled at the moment a new output value is scheduled.

Value Params
freq

rate at which to generate random values.

See also
Companion
object
object LFCub extends ProductReader[LFCub]

A sine-like oscillator UGen with a shape made of two cubic pieces. It is smoother than LFPar .

A sine-like oscillator UGen with a shape made of two cubic pieces. It is smoother than LFPar .

===Examples===

// modulating frequency
play { LFPar.ar(XLine.kr(100, 20000, 10)) * 0.1 }
// modulating amplitude
play { LFPar.kr(XLine.kr(1, 200, 10)) * SinOsc.ar(440) * 0.1 }
// used as both oscillator and LFO
play { LFPar.ar(LFPar.kr(LFPar.kr(0.2).mulAdd(8,10)).mulAdd(400,800)) * 0.1 }
See also
Companion
class
final case
class LFCub(rate: Rate, freq: GE, iphase: GE) extends SingleOut

A sine-like oscillator UGen with a shape made of two cubic pieces. It is smoother than LFPar .

A sine-like oscillator UGen with a shape made of two cubic pieces. It is smoother than LFPar .

Value Params
freq

oscillator frequency in Hertz

iphase

initial phase in cycle (0 to 1) ''(init-time only)''

See also
Companion
object
object LFDClipNoise extends ProductReader[LFDClipNoise]

A UGen that randomly generates the values -1 or +1 at a rate given by the nearest integer division of the sample rate by the frequency argument. The difference to LFClipNoise is that this UGen does not quantize time and recovers fast from frequency input changes.

A UGen that randomly generates the values -1 or +1 at a rate given by the nearest integer division of the sample rate by the frequency argument. The difference to LFClipNoise is that this UGen does not quantize time and recovers fast from frequency input changes.

===Examples===

// generator
play { LFDClipNoise.ar(500) * 0.2 }
// random panning
play {
 val pos = LFDClipNoise.ar(4)
 Pan2.ar(PinkNoise.ar, pos)
}
// modulate frequency
play { LFDClipNoise.ar(XLine.kr(100, 10000, 20)) * 0.2 }
See also
Companion
class
final case
class LFDClipNoise(rate: Rate, freq: GE) extends SingleOut with IsIndividual

A UGen that randomly generates the values -1 or +1 at a rate given by the nearest integer division of the sample rate by the frequency argument. The difference to LFClipNoise is that this UGen does not quantize time and recovers fast from frequency input changes.

A UGen that randomly generates the values -1 or +1 at a rate given by the nearest integer division of the sample rate by the frequency argument. The difference to LFClipNoise is that this UGen does not quantize time and recovers fast from frequency input changes.

Value Params
freq

rate at which to generate random values.

See also
Companion
object
object LFDNoise0 extends ProductReader[LFDNoise0]

A dynamic step noise UGen. Like LFNoise0 , it generates abruptly changing random values between -1 and +1 at a rate given by the freq argument, with two differences: There is no time quantization, and it there is fast recovery from low freq values.

A dynamic step noise UGen. Like LFNoise0 , it generates abruptly changing random values between -1 and +1 at a rate given by the freq argument, with two differences: There is no time quantization, and it there is fast recovery from low freq values.

In contrast, LFNoise0 , LFNoise1 , and LFNoise2 quantize to the nearest integer division of the sample rate, and they poll the freq argument only when scheduled, and thus seem to hang when the frequencies get very low.

If very high or very low frequencies are not needed, or fixed frequencies are used, LFNoise0 is more efficient.

See also
Companion
class
final case
class LFDNoise0(rate: Rate, freq: GE) extends SingleOut with IsIndividual

A dynamic step noise UGen. Like LFNoise0 , it generates abruptly changing random values between -1 and +1 at a rate given by the freq argument, with two differences: There is no time quantization, and it there is fast recovery from low freq values.

A dynamic step noise UGen. Like LFNoise0 , it generates abruptly changing random values between -1 and +1 at a rate given by the freq argument, with two differences: There is no time quantization, and it there is fast recovery from low freq values.

In contrast, LFNoise0 , LFNoise1 , and LFNoise2 quantize to the nearest integer division of the sample rate, and they poll the freq argument only when scheduled, and thus seem to hang when the frequencies get very low.

If very high or very low frequencies are not needed, or fixed frequencies are used, LFNoise0 is more efficient.

Value Params
freq

rate at which to generate random values.

See also
Companion
object
object LFDNoise1 extends ProductReader[LFDNoise1]

A dynamic ramp noise UGen. Like LFNoise1 , it generates linearly interpolated random values between -1 and +1 at a rate given by the freq argument, with two differences: There is no time quantization, and it there is fast recovery from low freq values.

A dynamic ramp noise UGen. Like LFNoise1 , it generates linearly interpolated random values between -1 and +1 at a rate given by the freq argument, with two differences: There is no time quantization, and it there is fast recovery from low freq values.

In contrast, LFNoise0 , LFNoise1 , and LFNoise2 quantize to the nearest integer division of the sample rate, and they poll the freq argument only when scheduled, and thus seem to hang when the frequencies get very low.

If very high or very low frequencies are not needed, or fixed frequencies are used, LFNoise1 is more efficient.

See also
Companion
class
final case
class LFDNoise1(rate: Rate, freq: GE) extends SingleOut with IsIndividual

A dynamic ramp noise UGen. Like LFNoise1 , it generates linearly interpolated random values between -1 and +1 at a rate given by the freq argument, with two differences: There is no time quantization, and it there is fast recovery from low freq values.

A dynamic ramp noise UGen. Like LFNoise1 , it generates linearly interpolated random values between -1 and +1 at a rate given by the freq argument, with two differences: There is no time quantization, and it there is fast recovery from low freq values.

In contrast, LFNoise0 , LFNoise1 , and LFNoise2 quantize to the nearest integer division of the sample rate, and they poll the freq argument only when scheduled, and thus seem to hang when the frequencies get very low.

If very high or very low frequencies are not needed, or fixed frequencies are used, LFNoise1 is more efficient.

Value Params
freq

rate at which to generate random values.

See also
Companion
object
object LFDNoise3 extends ProductReader[LFDNoise3]

A dynamic ramp noise UGen. It is similar to LFNoise2 , with three differences: It uses cubic instead of quadratic interpolation for the random values between -1 and +1 at a rate given by the freq argument. There is no time quantization, and it there is fast recovery from low freq values.

A dynamic ramp noise UGen. It is similar to LFNoise2 , with three differences: It uses cubic instead of quadratic interpolation for the random values between -1 and +1 at a rate given by the freq argument. There is no time quantization, and it there is fast recovery from low freq values.

In contrast, LFNoise0 , LFNoise1 , and LFNoise2 quantize to the nearest integer division of the sample rate, and they poll the freq argument only when scheduled, and thus seem to hang when the frequencies get very low.

===Examples===

// compare dynamic and non-dynamic
play {
 val r    = MouseX.kr(0.1, 1000, 1)
 val a    = LFNoise2 .ar(r)
 val b    = LFDNoise3.ar(r)
 val freq = Select.ar(MouseButton.kr(lag = 0), Seq(a, b))
 SinOsc.ar(freq.mulAdd(200, 500)) * 0.2
}
See also
Companion
class
final case
class LFDNoise3(rate: Rate, freq: GE) extends SingleOut with IsIndividual

A dynamic ramp noise UGen. It is similar to LFNoise2 , with three differences: It uses cubic instead of quadratic interpolation for the random values between -1 and +1 at a rate given by the freq argument. There is no time quantization, and it there is fast recovery from low freq values.

A dynamic ramp noise UGen. It is similar to LFNoise2 , with three differences: It uses cubic instead of quadratic interpolation for the random values between -1 and +1 at a rate given by the freq argument. There is no time quantization, and it there is fast recovery from low freq values.

In contrast, LFNoise0 , LFNoise1 , and LFNoise2 quantize to the nearest integer division of the sample rate, and they poll the freq argument only when scheduled, and thus seem to hang when the frequencies get very low.

Value Params
freq

rate at which to generate random values.

See also
Companion
object
object LFGauss extends ProductReader[LFGauss]

A non-band-limited gaussian function oscillator UGen. Output ranges from minVal to 1. It implements the formula:

A non-band-limited gaussian function oscillator UGen. Output ranges from minVal to 1. It implements the formula:

f(x) = exp((x - phase).squared / (-2 * width.squared))

where x is to vary in the range -1 to 1 over the period dur . minVal is the initial value at -1. E.g. for default parameters, it is exp(-50) or roughly zero.

===Examples===

// dur and width can be modulated at audio rate
play {
 val dur = SinOsc.ar(MouseX.kr(2, 1000, 1) * Seq(1.0, 1.1)).linLin(-1, 1, 0.0006, 0.01)
 val width = SinOsc.ar(Seq(0.5, 0.55)).linLin(-1, 1, 0.01, 0.3)
 LFGauss.ar(dur, width) * 0.2
}
// several frequencies and widths combined
play {
 val x    = MouseX.kr(1, 0.07, 1)
 val y    = MouseY.kr(1, 3)
 val mod  = LFGauss.ar(x, (-1 to -6 by -1).map(i => y.pow(i)))
 val carr = SinOsc.ar((0 to 5).map(i => 200 * 1.3.pow(i)))
 Mix(carr * mod) * 0.1
}
// test spectrum
play {
 val son = LeakDC.ar(LFGauss.ar(0.005, 0.2))
 BPF.ar(son * 3, MouseX.kr(60, 2000, 1), 0.05)
}
Companion
class
final case
class LFGauss(rate: Rate, dur: GE, width: GE, phase: GE, loop: GE, doneAction: GE) extends SingleOut

A non-band-limited gaussian function oscillator UGen. Output ranges from minVal to 1. It implements the formula:

A non-band-limited gaussian function oscillator UGen. Output ranges from minVal to 1. It implements the formula:

f(x) = exp((x - phase).squared / (-2 * width.squared))

where x is to vary in the range -1 to 1 over the period dur . minVal is the initial value at -1. E.g. for default parameters, it is exp(-50) or roughly zero.

Value Params
doneAction

evaluated after cycle completes

dur

duration in seconds of a full -1 <= x <= 1 cycle, or the reciprocal of the frequency

loop

if greater than zero, the UGen oscillates. Otherwise it calls doneAction after one cycle.

phase

phase offset

width

relative width of the bell. Best to keep below 0.25 when used as envelope.

Companion
object
object LFNoise0 extends ProductReader[LFNoise0]

A step noise UGen. It generates abruptly changing random values between -1 and +1 at a rate given by the freq argument.

A step noise UGen. It generates abruptly changing random values between -1 and +1 at a rate given by the freq argument.

The frequency is quantized to the nearest integer division of the sample rate, and changes in frequency are only picked up at the next trigger. In contrast, variant LFDNoise0 has precise frequency and reacts to frequency changes instantly.

===Examples===

// plain noise
play { LFNoise0.ar(1000) * 0.25 }
See also
Companion
class
final case
class LFNoise0(rate: Rate, freq: GE) extends SingleOut with IsIndividual

A step noise UGen. It generates abruptly changing random values between -1 and +1 at a rate given by the freq argument.

A step noise UGen. It generates abruptly changing random values between -1 and +1 at a rate given by the freq argument.

The frequency is quantized to the nearest integer division of the sample rate, and changes in frequency are only picked up at the next trigger. In contrast, variant LFDNoise0 has precise frequency and reacts to frequency changes instantly.

Value Params
freq

rate at which to generate random values.

See also
Companion
object
object LFNoise1 extends ProductReader[LFNoise1]

A ramp noise UGen. It generates line segments whose start and end points are chosen randomly between -1 and +1 . New breakpoints are generated at a specified frequency.

A ramp noise UGen. It generates line segments whose start and end points are chosen randomly between -1 and +1 . New breakpoints are generated at a specified frequency.

The frequency is quantized to the nearest integer division of the sample rate, and changes in frequency are only picked up at the next trigger. In contrast, variant LFDNoise1 has precise frequency and reacts to frequency changes instantly.

===Examples===

// plain noise
play { LFNoise1.ar(1000) * 0.25 }
See also
Companion
class
final case
class LFNoise1(rate: Rate, freq: GE) extends SingleOut with IsIndividual

A ramp noise UGen. It generates line segments whose start and end points are chosen randomly between -1 and +1 . New breakpoints are generated at a specified frequency.

A ramp noise UGen. It generates line segments whose start and end points are chosen randomly between -1 and +1 . New breakpoints are generated at a specified frequency.

The frequency is quantized to the nearest integer division of the sample rate, and changes in frequency are only picked up at the next trigger. In contrast, variant LFDNoise1 has precise frequency and reacts to frequency changes instantly.

Value Params
freq

rate at which to generate new breakpoints.

See also
Companion
object
object LFNoise2 extends ProductReader[LFNoise2]

A quadratically interpolating noise UGen. This interpolation happens between breakpoints chosen randomly between -1 and +1 at a specified frequency.

A quadratically interpolating noise UGen. This interpolation happens between breakpoints chosen randomly between -1 and +1 at a specified frequency.

The frequency is quantized to the nearest integer division of the sample rate, and changes in frequency are only picked up at the next trigger. In contrast, variant LFDNoise3 has precise frequency and reacts to frequency changes instantly.

'''Note:''' Due to the interpolation, the output values can occasionally extend beyond the normal range of -1 to +1, if the frequency varies in certain ways.

===Examples===

// plain noise
play { LFNoise2.ar(1000) * 0.25 }
See also
Companion
class
final case
class LFNoise2(rate: Rate, freq: GE) extends SingleOut with IsIndividual

A quadratically interpolating noise UGen. This interpolation happens between breakpoints chosen randomly between -1 and +1 at a specified frequency.

A quadratically interpolating noise UGen. This interpolation happens between breakpoints chosen randomly between -1 and +1 at a specified frequency.

The frequency is quantized to the nearest integer division of the sample rate, and changes in frequency are only picked up at the next trigger. In contrast, variant LFDNoise3 has precise frequency and reacts to frequency changes instantly.

'''Note:''' Due to the interpolation, the output values can occasionally extend beyond the normal range of -1 to +1, if the frequency varies in certain ways.

Value Params
freq

rate at which to generate new breakpoints.

See also
Companion
object
object LFPar extends ProductReader[LFPar]

A sine-like oscillator UGen with a shape made of two parabolas. It has audible odd harmonics and is non-band-limited. Its output ranges from -1 to +1.

A sine-like oscillator UGen with a shape made of two parabolas. It has audible odd harmonics and is non-band-limited. Its output ranges from -1 to +1.

===Examples===

// modulating frequency
play { LFPar.ar(XLine.kr(100, 20000, 10)) * 0.1 }
// modulating amplitude
play { LFPar.kr(XLine.kr(1, 200, 10)) * SinOsc.ar(440) * 0.1 }
// used as both oscillator and LFO
play { LFPar.ar(LFPar.kr(LFPar.kr(0.2).mulAdd(8,10)).mulAdd(400,800)) * 0.1 }
See also
Companion
class
final case
class LFPar(rate: Rate, freq: GE, iphase: GE) extends SingleOut

A sine-like oscillator UGen with a shape made of two parabolas. It has audible odd harmonics and is non-band-limited. Its output ranges from -1 to +1.

A sine-like oscillator UGen with a shape made of two parabolas. It has audible odd harmonics and is non-band-limited. Its output ranges from -1 to +1.

Value Params
freq

oscillator frequency in Hertz

iphase

initial phase in cycle (0 to 1) ''(init-time only)''

See also
Companion
object
object LFPulse extends ProductReader[LFPulse]

A non-band-limited pulse oscillator UGen. Outputs a high value of one and a low value of zero.

A non-band-limited pulse oscillator UGen. Outputs a high value of one and a low value of zero.

===Examples===

// modulating frequency
play { LFPulse.ar(XLine.kr(1, 200, 10), 0, 0.2) * 0.1 }
// modulating amplitude
play { LFPulse.kr(XLine.kr(1, 200, 10), 0, 0.2) * SinOsc.ar(440) * 0.1 }
// used as both oscillator and LFO
play { LFPulse.ar(LFPulse.kr(3, 0, 0.3).mulAdd(200, 200), 0, 0.2) * 0.1 }
See also
Companion
class
final case
class LFPulse(rate: Rate, freq: GE, iphase: GE, width: GE) extends SingleOut

A non-band-limited pulse oscillator UGen. Outputs a high value of one and a low value of zero.

A non-band-limited pulse oscillator UGen. Outputs a high value of one and a low value of zero.

Value Params
freq

oscillator frequency in Hertz

iphase

initial phase offset in cycles ( 0..1 ). If you think of a buffer of one cycle of the waveform, this is the starting offset into this buffer. Hence, an iphase of 0.25 means that you will hear the first impulse after 0.75 periods! If you prefer to specify the perceived delay instead, you could use an iphase of -0.25 + 1 which is more intuitive. Note that the phase is not automatically wrapped into the range of 0..1 , so putting an iphase of -0.25 currently results in a strange initial signal which only stabilizes to the correct behaviour after one period! ''(init-time only)''

width

pulse width duty cycle from zero to one. If you want to specify the width rather in seconds, you can use the formula width = freq * dur , e.g. for a single sample impulse use width = freq * SampleDur.ir .

See also
Companion
object
object LFSaw extends ProductReader[LFSaw]

A sawtooth oscillator UGen. The oscillator is creating an aliased sawtooth, that is it does not use band-limiting. For a band-limited version use Saw instead. The signal range is -1 to +1.

A sawtooth oscillator UGen. The oscillator is creating an aliased sawtooth, that is it does not use band-limiting. For a band-limited version use Saw instead. The signal range is -1 to +1.

===Examples===

// modulating frequency
play { LFSaw.ar(XLine.kr(1, 200, 10)) * 0.1 }
// modulating amplitude
play { LFSaw.kr(XLine.kr(1, 200, 10)) * SinOsc.ar(440) * 0.1 }
// neuer deutscher Sägezahn
play { LFSaw.ar(LFSaw.kr(3).mulAdd(200, 200)) * 0.1 }
See also
Companion
class
final case
class LFSaw(rate: Rate, freq: GE, iphase: GE) extends SingleOut

A sawtooth oscillator UGen. The oscillator is creating an aliased sawtooth, that is it does not use band-limiting. For a band-limited version use Saw instead. The signal range is -1 to +1.

A sawtooth oscillator UGen. The oscillator is creating an aliased sawtooth, that is it does not use band-limiting. For a band-limited version use Saw instead. The signal range is -1 to +1.

Value Params
freq

oscillator frequency in Hertz

iphase

initial phase offset. For efficiency reasons this is a value ranging from -1 to 1 (thus equal to the initial output value). Note that a phase of zero (default) means the wave starts at 0 and rises to +1 before jumping down to -1. Use a phase of 1 to have the wave start at -1. ''(init-time only)''

See also
Companion
object
object LFTri extends ProductReader[LFTri]

A triangle oscillator UGen designed for low frequency control signals (being non-band-limited). The output varies from -1 to 1.

A triangle oscillator UGen designed for low frequency control signals (being non-band-limited). The output varies from -1 to 1.

With an initial phase of zero, the oscillator begins at 0, rises to 1, then falls to -1 and goes back to zero after one complete phase. With an initial phase of 1 (corresponding to 90 degrees), the oscillator begins at 1 and then falls to -1. With an initial phase of 3 (or 270 degrees), the oscillator begins at -1 and then rises to 1.

===Examples===

// modulating frequency
play { LFTri.ar(XLine.kr(100, 20000, 10)) * 0.1 }
// modulating amplitude
play { LFTri.kr(XLine.kr(1, 200, 10)) * SinOsc.ar(440) * 0.1 }
// used as both oscillator and LFO
play { LFTri.ar(LFTri.kr(LFTri.kr(0.2).mulAdd(8,10)).mulAdd(400,800)) * 0.1 }
Companion
class
final case
class LFTri(rate: Rate, freq: GE, iphase: GE) extends SingleOut

A triangle oscillator UGen designed for low frequency control signals (being non-band-limited). The output varies from -1 to 1.

A triangle oscillator UGen designed for low frequency control signals (being non-band-limited). The output varies from -1 to 1.

With an initial phase of zero, the oscillator begins at 0, rises to 1, then falls to -1 and goes back to zero after one complete phase. With an initial phase of 1 (corresponding to 90 degrees), the oscillator begins at 1 and then falls to -1. With an initial phase of 3 (or 270 degrees), the oscillator begins at -1 and then rises to 1.

Value Params
freq

frequency in Hertz

iphase

initial phase of the oscillator. A full phase (2 Pi or 360 degrees) is represented by an iphase value of 4. The initial phase cannot be modulated. ''(init-time only)''

Companion
object
object LPF extends ProductReader[LPF]

A second order low pass filter UGen.

A second order low pass filter UGen.

===Examples===

// modulated frequency
play {
 val in   = Saw.ar(200) * 0.5
 val freq = SinOsc.ar(XLine.ar(0.3, 100, 20)).mulAdd(3600, 4000)
 LPF.ar(in, freq)
}
// mouse controlled frequency
play {
 val in   = WhiteNoise.ar(0.5)
 val freq = MouseX.kr(200, 10000, 1)
 LPF.ar(in, freq)
}
See also
Companion
class
final case
class LPF(rate: MaybeRate, in: GE, freq: GE) extends SingleOut

A second order low pass filter UGen.

A second order low pass filter UGen.

Value Params
freq

cutoff frequency in Hertz

in

input signal to be filtered

See also
Companion
object
object LPZ1 extends ProductReader[LPZ1]

two point average filter UGen. Implements the formula :

two point average filter UGen. Implements the formula :

out(i) = 0.5 * (in(i) + in(i-1))

===Examples===

// engage with mouse button
play {
 val sig = WhiteNoise.ar(0.5)
 val flt = LPZ1.ar(sig)
 LinXFade2.ar(sig, flt, MouseButton.kr(-1, 1))
}
See also
Companion
class
final case
class LPZ1(rate: MaybeRate, in: GE) extends SingleOut

two point average filter UGen. Implements the formula :

two point average filter UGen. Implements the formula :

out(i) = 0.5 * (in(i) + in(i-1))
Value Params
in

input signal to be filtered

See also
Companion
object
object LPZ2 extends ProductReader[LPZ2]

three point average filter UGen. Implements the formula :

three point average filter UGen. Implements the formula :

out(i) = 0.25 * (in(i) + 2 * in(i-1) + in(i-2))

===Examples===

// engage with mouse button
play {
 val sig = WhiteNoise.ar(0.5)
 val flt = LPZ2.ar(sig)
 LinXFade2.ar(sig, flt, MouseButton.kr(-1, 1))
}
See also
Companion
class
final case
class LPZ2(rate: MaybeRate, in: GE) extends SingleOut

three point average filter UGen. Implements the formula :

three point average filter UGen. Implements the formula :

out(i) = 0.25 * (in(i) + 2 * in(i-1) + in(i-2))
Value Params
in

input signal to be filtered

See also
Companion
object
object Lag extends ProductReader[Lag]

An exponential lag UGen. This is essentially the same as OnePole except that instead of supplying the coefficient directly, it is calculated from a 60 dB lag time. This is the time required for the filter to converge to within 0.01 % of a value. This is useful for smoothing out control signals.

An exponential lag UGen. This is essentially the same as OnePole except that instead of supplying the coefficient directly, it is calculated from a 60 dB lag time. This is the time required for the filter to converge to within 0.01 % of a value. This is useful for smoothing out control signals.

See also
Companion
class
final case
class Lag(rate: MaybeRate, in: GE, time: GE) extends SingleOut

An exponential lag UGen. This is essentially the same as OnePole except that instead of supplying the coefficient directly, it is calculated from a 60 dB lag time. This is the time required for the filter to converge to within 0.01 % of a value. This is useful for smoothing out control signals.

An exponential lag UGen. This is essentially the same as OnePole except that instead of supplying the coefficient directly, it is calculated from a 60 dB lag time. This is the time required for the filter to converge to within 0.01 % of a value. This is useful for smoothing out control signals.

Value Params
in

input signal.

time

60 dB lag time in seconds.

See also
Companion
object
object Lag2 extends ProductReader[Lag2]

A cascaded exponential lag UGen. Lag2.kr(in, time) is equivalent to Lag.kr(Lag.kr(in, time), time) , thus resulting in a smoother transition. This saves on CPU as you only have to calculate the decay factor once instead of twice.

A cascaded exponential lag UGen. Lag2.kr(in, time) is equivalent to Lag.kr(Lag.kr(in, time), time) , thus resulting in a smoother transition. This saves on CPU as you only have to calculate the decay factor once instead of twice.

See also
Companion
class
final case
class Lag2(rate: MaybeRate, in: GE, time: GE) extends SingleOut

A cascaded exponential lag UGen. Lag2.kr(in, time) is equivalent to Lag.kr(Lag.kr(in, time), time) , thus resulting in a smoother transition. This saves on CPU as you only have to calculate the decay factor once instead of twice.

A cascaded exponential lag UGen. Lag2.kr(in, time) is equivalent to Lag.kr(Lag.kr(in, time), time) , thus resulting in a smoother transition. This saves on CPU as you only have to calculate the decay factor once instead of twice.

Value Params
in

input signal.

time

60 dB lag time in seconds.

See also
Companion
object
object Lag2UD extends ProductReader[Lag2UD]

A cascaded exponential lag UGen with separate inputs for up and down slope. Lag2UD.kr(in, up, down) is equivalent to LagUD.kr(LagUD.kr(in, up, down), up, down) , thus resulting in a smoother transition. This saves on CPU as you only have to calculate the decay factors once instead of twice.

A cascaded exponential lag UGen with separate inputs for up and down slope. Lag2UD.kr(in, up, down) is equivalent to LagUD.kr(LagUD.kr(in, up, down), up, down) , thus resulting in a smoother transition. This saves on CPU as you only have to calculate the decay factors once instead of twice.

See also
Companion
class
final case
class Lag2UD(rate: MaybeRate, in: GE, timeUp: GE, timeDown: GE) extends SingleOut

A cascaded exponential lag UGen with separate inputs for up and down slope. Lag2UD.kr(in, up, down) is equivalent to LagUD.kr(LagUD.kr(in, up, down), up, down) , thus resulting in a smoother transition. This saves on CPU as you only have to calculate the decay factors once instead of twice.

A cascaded exponential lag UGen with separate inputs for up and down slope. Lag2UD.kr(in, up, down) is equivalent to LagUD.kr(LagUD.kr(in, up, down), up, down) , thus resulting in a smoother transition. This saves on CPU as you only have to calculate the decay factors once instead of twice.

Value Params
in

input signal.

timeDown

60 dB lag time in seconds effective during a falling slope in the input signal

timeUp

60 dB lag time in seconds effective during a rising slope in the input signal

See also
Companion
object
object Lag3 extends ProductReader[Lag3]

A cascaded exponential lag UGen. Lag3.kr(in, time) is equivalent to Lag.kr(Lag.kr(Lag.kr(Lag.kr(in, time), time), time) , thus resulting in a smoother transition. This saves on CPU as you only have to calculate the decay factor once instead of three times.

A cascaded exponential lag UGen. Lag3.kr(in, time) is equivalent to Lag.kr(Lag.kr(Lag.kr(Lag.kr(in, time), time), time) , thus resulting in a smoother transition. This saves on CPU as you only have to calculate the decay factor once instead of three times.

See also
Companion
class
final case
class Lag3(rate: MaybeRate, in: GE, time: GE) extends SingleOut

A cascaded exponential lag UGen. Lag3.kr(in, time) is equivalent to Lag.kr(Lag.kr(Lag.kr(Lag.kr(in, time), time), time) , thus resulting in a smoother transition. This saves on CPU as you only have to calculate the decay factor once instead of three times.

A cascaded exponential lag UGen. Lag3.kr(in, time) is equivalent to Lag.kr(Lag.kr(Lag.kr(Lag.kr(in, time), time), time) , thus resulting in a smoother transition. This saves on CPU as you only have to calculate the decay factor once instead of three times.

Value Params
in

input signal.

time

60 dB lag time in seconds.

See also
Companion
object
object Lag3UD extends ProductReader[Lag3UD]

A cascaded exponential lag UGen with separate inputs for up and down slope. Lag3UD.kr(in, up, down) is equivalent to LagUD.kr(LagUD.kr(LagUD.kr(in, up, down), up, down), up, down) , thus resulting in a smoother transition. This saves on CPU as you only have to calculate the decay factors once instead of three times.

A cascaded exponential lag UGen with separate inputs for up and down slope. Lag3UD.kr(in, up, down) is equivalent to LagUD.kr(LagUD.kr(LagUD.kr(in, up, down), up, down), up, down) , thus resulting in a smoother transition. This saves on CPU as you only have to calculate the decay factors once instead of three times.

See also
Companion
class
final case
class Lag3UD(rate: MaybeRate, in: GE, timeUp: GE, timeDown: GE) extends SingleOut

A cascaded exponential lag UGen with separate inputs for up and down slope. Lag3UD.kr(in, up, down) is equivalent to LagUD.kr(LagUD.kr(LagUD.kr(in, up, down), up, down), up, down) , thus resulting in a smoother transition. This saves on CPU as you only have to calculate the decay factors once instead of three times.

A cascaded exponential lag UGen with separate inputs for up and down slope. Lag3UD.kr(in, up, down) is equivalent to LagUD.kr(LagUD.kr(LagUD.kr(in, up, down), up, down), up, down) , thus resulting in a smoother transition. This saves on CPU as you only have to calculate the decay factors once instead of three times.

Value Params
in

input signal.

timeDown

60 dB lag time in seconds effective during a falling slope in the input signal

timeUp

60 dB lag time in seconds effective during a rising slope in the input signal

See also
Companion
object
object LagIn extends ProductReader[LagIn]

A UGen that reads a signal from a control bus and applies a lag filter to it. This is essentially the same as Lag.kr(In.kr(...), time) .

A UGen that reads a signal from a control bus and applies a lag filter to it. This is essentially the same as Lag.kr(In.kr(...), time) .

===Examples===

// portamento
play {
 val c = Bus.control(s)
 c.set(30)   // initial midi-pitch

 play {
   val freq = LagIn.kr(c.index, time = 1).midiCps
   SinOsc.ar(freq) * AmpComp.kr(freq) * 0.1
 }

 c.set(70)
 c.set(100)
}
See also
Companion
class
final case
class LagIn(rate: Rate, bus: GE, numChannels: Int, time: GE) extends MultiOut with IsIndividual

A UGen that reads a signal from a control bus and applies a lag filter to it. This is essentially the same as Lag.kr(In.kr(...), time) .

A UGen that reads a signal from a control bus and applies a lag filter to it. This is essentially the same as Lag.kr(In.kr(...), time) .

Value Params
bus

index of the bus to read from. When numChannels is greater than one, the other channels or read from the adjacent indices.

numChannels

number of channels to read

time

60 dB lag time in seconds.

See also
Companion
object
object LagUD extends ProductReader[LagUD]

An exponential lag UGen with separate inputs for up and down slope. This is essentially the same as Lag except that you can supply a different 60 dB time for when the signal goes up, from when the signal goes down.

An exponential lag UGen with separate inputs for up and down slope. This is essentially the same as Lag except that you can supply a different 60 dB time for when the signal goes up, from when the signal goes down.

See also
Companion
class
final case
class LagUD(rate: MaybeRate, in: GE, timeUp: GE, timeDown: GE) extends SingleOut

An exponential lag UGen with separate inputs for up and down slope. This is essentially the same as Lag except that you can supply a different 60 dB time for when the signal goes up, from when the signal goes down.

An exponential lag UGen with separate inputs for up and down slope. This is essentially the same as Lag except that you can supply a different 60 dB time for when the signal goes up, from when the signal goes down.

Value Params
in

input signal.

timeDown

60 dB lag time in seconds effective during a falling slope in the input signal

timeUp

60 dB lag time in seconds effective during a rising slope in the input signal

See also
Companion
object
object LastValue extends ProductReader[LastValue]

A sample-and-hold UGen that outputs the last value before the input changed more than a threshold. Change is based on the absolute of the differentiation of input signal.

A sample-and-hold UGen that outputs the last value before the input changed more than a threshold. Change is based on the absolute of the differentiation of input signal.

===Examples===

// distortion
play {
 val in     = SinOsc.ar(262)
 val thresh = MouseX.kr(1.0e-3, 2.0, 1, lag = 1)
 thresh.poll(5, "thresh")
 LeakDC.ar(LastValue.ar(in, thresh)) * 0.1
}
See also
Companion
class
final case
class LastValue(rate: Rate, in: GE, thresh: GE) extends SingleOut

A sample-and-hold UGen that outputs the last value before the input changed more than a threshold. Change is based on the absolute of the differentiation of input signal.

A sample-and-hold UGen that outputs the last value before the input changed more than a threshold. Change is based on the absolute of the differentiation of input signal.

Value Params
in

input signal to analyze and filter

thresh

threshold below which the input sign

See also
Companion
object
object Latch extends ProductReader[Latch]

A sample-and-hold UGen. When triggered, a new value is taken from the input and hold until the next trigger occurs.

A sample-and-hold UGen. When triggered, a new value is taken from the input and hold until the next trigger occurs.

Before the first trigger is registered, this UGen outputs zero.

See also
Companion
class
final case
class Latch(rate: Rate, in: GE, trig: GE) extends SingleOut

A sample-and-hold UGen. When triggered, a new value is taken from the input and hold until the next trigger occurs.

A sample-and-hold UGen. When triggered, a new value is taken from the input and hold until the next trigger occurs.

Before the first trigger is registered, this UGen outputs zero.

Value Params
in

the input signal

trig

the trigger. The can be any signal. A trigger happens when the signal changes from non-positive to positive.

See also
Companion
object
object LatoocarfianC extends ProductReader[LatoocarfianC]

A cubic-interpolating sound generator based on a function given in Clifford Pickover's book Chaos In Wonderland, pg 26. The function is:

A cubic-interpolating sound generator based on a function given in Clifford Pickover's book Chaos In Wonderland, pg 26. The function is:

x[n+1] = sin(b * y[n]) + c * sin(b * x[n])
y[n+1] = sin(a * y[n]) + d * sin(a * x[n])

According to Pickover, parameters a and b should be in the range from -3 to +3, and parameters c and d should be in the range from 0.5 to 1.5. The function can, depending on the parameters given, give continuous chaotic output, converge to a single value (silence) or oscillate in a cycle (tone). NOTE: This UGen is experimental and not optimized currently, so is rather hoggish of CPU.

===Examples===

// default initial parameters
play { LatoocarfianC.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }
// randomly modulate all parameters
play {
 LatoocarfianC.ar(
   SampleRate.ir/4,
   LFNoise2.kr(2).mulAdd(1.5, 1.5),
   LFNoise2.kr(2).mulAdd(1.5, 1.5),
   LFNoise2.kr(2).mulAdd(0.5, 1.5),
   LFNoise2.kr(2).mulAdd(0.5, 1.5)
 ) * 0.2
}
See also
Companion
class
final case
class LatoocarfianC(rate: Rate, freq: GE, a: GE, b: GE, c: GE, d: GE, xi: GE, yi: GE) extends SingleOut

A cubic-interpolating sound generator based on a function given in Clifford Pickover's book Chaos In Wonderland, pg 26. The function is:

A cubic-interpolating sound generator based on a function given in Clifford Pickover's book Chaos In Wonderland, pg 26. The function is:

x[n+1] = sin(b * y[n]) + c * sin(b * x[n])
y[n+1] = sin(a * y[n]) + d * sin(a * x[n])

According to Pickover, parameters a and b should be in the range from -3 to +3, and parameters c and d should be in the range from 0.5 to 1.5. The function can, depending on the parameters given, give continuous chaotic output, converge to a single value (silence) or oscillate in a cycle (tone). NOTE: This UGen is experimental and not optimized currently, so is rather hoggish of CPU.

Value Params
a

Equation variable

b

Equation variable

c

Equation variable

d

Equation variable

freq

Iteration frequency in Hertz.

xi

Initial value of x

yi

Initial value of y

See also
Companion
object
object LatoocarfianL extends ProductReader[LatoocarfianL]

A linear-interpolating sound generator based on a function given in Clifford Pickover's book Chaos In Wonderland, pg 26. The function is:

A linear-interpolating sound generator based on a function given in Clifford Pickover's book Chaos In Wonderland, pg 26. The function is:

x[n+1] = sin(b * y[n]) + c * sin(b * x[n])
y[n+1] = sin(a * y[n]) + d * sin(a * x[n])

According to Pickover, parameters a and b should be in the range from -3 to +3, and parameters c and d should be in the range from 0.5 to 1.5. The function can, depending on the parameters given, give continuous chaotic output, converge to a single value (silence) or oscillate in a cycle (tone). NOTE: This UGen is experimental and not optimized currently, so is rather hoggish of CPU.

===Examples===

// default initial parameters
play { LatoocarfianL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }
// randomly modulate all parameters
play {
 LatoocarfianL.ar(
   SampleRate.ir/4,
   LFNoise2.kr(2).mulAdd(1.5, 1.5),
   LFNoise2.kr(2).mulAdd(1.5, 1.5),
   LFNoise2.kr(2).mulAdd(0.5, 1.5),
   LFNoise2.kr(2).mulAdd(0.5, 1.5)
 ) * 0.2
}
See also
Companion
class
final case
class LatoocarfianL(rate: Rate, freq: GE, a: GE, b: GE, c: GE, d: GE, xi: GE, yi: GE) extends SingleOut

A linear-interpolating sound generator based on a function given in Clifford Pickover's book Chaos In Wonderland, pg 26. The function is:

A linear-interpolating sound generator based on a function given in Clifford Pickover's book Chaos In Wonderland, pg 26. The function is:

x[n+1] = sin(b * y[n]) + c * sin(b * x[n])
y[n+1] = sin(a * y[n]) + d * sin(a * x[n])

According to Pickover, parameters a and b should be in the range from -3 to +3, and parameters c and d should be in the range from 0.5 to 1.5. The function can, depending on the parameters given, give continuous chaotic output, converge to a single value (silence) or oscillate in a cycle (tone). NOTE: This UGen is experimental and not optimized currently, so is rather hoggish of CPU.

Value Params
a

Equation variable

b

Equation variable

c

Equation variable

d

Equation variable

freq

Iteration frequency in Hertz

xi

Initial value of x

yi

Initial value of y

See also
Companion
object
object LatoocarfianN extends ProductReader[LatoocarfianN]

A non-interpolating sound generator based on a function given in Clifford Pickover's book Chaos In Wonderland, pg 26. The function is:

A non-interpolating sound generator based on a function given in Clifford Pickover's book Chaos In Wonderland, pg 26. The function is:

x[n+1] = sin(b * y[n]) + c * sin(b * x[n])
y[n+1] = sin(a * y[n]) + d * sin(a * x[n])

According to Pickover, parameters a and b should be in the range from -3 to +3, and parameters c and d should be in the range from 0.5 to 1.5. The function can, depending on the parameters given, give continuous chaotic output, converge to a single value (silence) or oscillate in a cycle (tone). NOTE: This UGen is experimental and not optimized currently, so is rather hoggish of CPU.

===Examples===

// default initial parameters
play { LatoocarfianN.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }
// randomly modulate all parameters
play {
 LatoocarfianN.ar(
   SampleRate.ir/4,
   LFNoise2.kr(2).mulAdd(1.5, 1.5),
   LFNoise2.kr(2).mulAdd(1.5, 1.5),
   LFNoise2.kr(2).mulAdd(0.5, 1.5),
   LFNoise2.kr(2).mulAdd(0.5, 1.5)
 ) * 0.2
}
See also
Companion
class
final case
class LatoocarfianN(rate: Rate, freq: GE, a: GE, b: GE, c: GE, d: GE, xi: GE, yi: GE) extends SingleOut

A non-interpolating sound generator based on a function given in Clifford Pickover's book Chaos In Wonderland, pg 26. The function is:

A non-interpolating sound generator based on a function given in Clifford Pickover's book Chaos In Wonderland, pg 26. The function is:

x[n+1] = sin(b * y[n]) + c * sin(b * x[n])
y[n+1] = sin(a * y[n]) + d * sin(a * x[n])

According to Pickover, parameters a and b should be in the range from -3 to +3, and parameters c and d should be in the range from 0.5 to 1.5. The function can, depending on the parameters given, give continuous chaotic output, converge to a single value (silence) or oscillate in a cycle (tone). NOTE: This UGen is experimental and not optimized currently, so is rather hoggish of CPU.

Value Params
a

Equation variable

b

Equation variable

c

Equation variable

d

Equation variable

freq

Iteration frequency in Hertz.

xi

Initial value of x

yi

Initial value of y

See also
Companion
object
object LeakDC extends ProductReader[LeakDC]

A filter UGen to remove very low frequency content DC offset.

A filter UGen to remove very low frequency content DC offset.

This is a one-pole highpass filter implementing the formula

y[n] = x[n] - x[n-1] + coeff * y[n-1]

===Examples===

// show DC with mouse-controlled coefficient
play {
 val freq = 800
 val in   = LFPulse.ar(freq).mulAdd(0.5, 0.5)
 val coef = MouseX.kr(0.9, 0.999)
 val flt  = LeakDC.ar(in, coef)
 val dc   = RunningSum.ar(flt, SampleRate.ir/freq)
 coef.poll(2)
 dc  .poll(2)
 0
}
See also
Companion
class
final case
class LeakDC(rate: MaybeRate, in: GE, coeff: GE) extends SingleOut

A filter UGen to remove very low frequency content DC offset.

A filter UGen to remove very low frequency content DC offset.

This is a one-pole highpass filter implementing the formula

y[n] = x[n] - x[n-1] + coeff * y[n-1]
Value Params
coeff

the leak coefficient determines the filter strength. the value must be between zero and one (exclusive) for the filter to remain stable. values closer to one produce less bass attenuation.

in

input signal to be filtered

See also
Companion
object
object LeastChange extends ProductReader[LeastChange]

A UGen that switches between two input signal depending on which is changing less. Change is based on the absolute of the differentiation of the respective signals.

A UGen that switches between two input signal depending on which is changing less. Change is based on the absolute of the differentiation of the respective signals.

===Examples===

// mouse-x versus mouse-y
play {
 val x   = MouseX.kr(lag = 1)
 val y   = MouseY.kr(lag = 1)
 val c   = LeastChange.kr(x, y)
 val isX = c sig_== x
 val isY = 1 - isX
 // if X change weaker, modulate pan position
 val p   = LFTri.ar(c * 10 * isX)
 // if Y change weaker, modulate sine frequency
 val f   = LFTri.ar(c * 10 * isY).linExp(-1, 1, 100, 4000)
 // report current state
 c.poll(5, "c")
 x.poll(isX, "now X")
 y.poll(isY, "now Y")
 Pan2.ar(SinOsc.ar(f) * 0.1, p)
}
See also
Companion
class
final case
class LeastChange(rate: MaybeRate, a: GE, b: GE) extends SingleOut

A UGen that switches between two input signal depending on which is changing less. Change is based on the absolute of the differentiation of the respective signals.

A UGen that switches between two input signal depending on which is changing less. Change is based on the absolute of the differentiation of the respective signals.

Value Params
a

first input signal to select from

b

second input signal to select from

See also
Companion
object
object Limiter extends ProductReader[Limiter]

Limits the input amplitude to the given level. Unlike Compander , this UGen will never overshoot, but it needs to look ahead in the input signal, introducing a delay in its output. The delay time is equal to twice the value of the dur parameter (the buffer internally used).

Limits the input amplitude to the given level. Unlike Compander , this UGen will never overshoot, but it needs to look ahead in the input signal, introducing a delay in its output. The delay time is equal to twice the value of the dur parameter (the buffer internally used).

===Examples===

// compare dry and wet
play {
 val in = Decay2.ar(
   Impulse.ar(8, phase = LFSaw.kr(0.25) * 0.7),
   attack = 0.001, release = 0.3) * FSinOsc.ar(500)
 val flt = Limiter.ar(in, level = 0.4)
 LinXFade2.ar(in, flt, MouseButton.kr(-1, 1))
}
See also
Companion
class
final case
class Limiter(rate: Rate, in: GE, level: GE, dur: GE) extends SingleOut

Limits the input amplitude to the given level. Unlike Compander , this UGen will never overshoot, but it needs to look ahead in the input signal, introducing a delay in its output. The delay time is equal to twice the value of the dur parameter (the buffer internally used).

Limits the input amplitude to the given level. Unlike Compander , this UGen will never overshoot, but it needs to look ahead in the input signal, introducing a delay in its output. The delay time is equal to twice the value of the dur parameter (the buffer internally used).

Value Params
dur

look-ahead time in seconds ''(init-time only)''

in

input signal to be limited

level

maximum amplitude to which the signal is limited. The limiter will kick in when the input signal exceeds +level or falls below -level .

See also
Companion
object
object LinCongC extends ProductReader[LinCongC]

A cubic-interpolating sound generator based on the difference equation:

A cubic-interpolating sound generator based on the difference equation:

x[n+1] = (a * x[n] + c) % m

The output signal is automatically scaled to a range of [-1, 1].

===Examples===

// default initial parameters
play { LinCongC.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }
// randomly modulate parameters
play {
 LinCongC.ar(
   LFNoise2.kr(1.0).mulAdd(1e4, 1e4),
   LFNoise2.kr(0.1).mulAdd(0.5, 1.4),
   LFNoise2.kr(0.1).mulAdd(0.1, 0.1),
   LFNoise2.kr(0.1)
 ) * 0.2
}
// as frequency control
play {
 SinOsc.ar(
   LinCongC.ar(
     40,
     LFNoise2.kr(0.1).mulAdd(0.1, 1),
     LFNoise2.kr(0.1).mulAdd(0.1, 0.1),
     LFNoise2.kr(0.1)
   ).mulAdd(500, 600)
 ) * 0.4
}
See also
Companion
class
final case
class LinCongC(rate: Rate, freq: GE, a: GE, c: GE, m: GE, xi: GE) extends SingleOut

A cubic-interpolating sound generator based on the difference equation:

A cubic-interpolating sound generator based on the difference equation:

x[n+1] = (a * x[n] + c) % m

The output signal is automatically scaled to a range of [-1, 1].

Value Params
a

Multiplier amount

c

Increment amount

freq

Iteration frequency in Hertz

m

Modulus amount

xi

Initial value of x

See also
Companion
object
object LinCongL extends ProductReader[LinCongL]

A linear-interpolating sound generator based on the difference equation:

A linear-interpolating sound generator based on the difference equation:

x[n+1] = (a * x[n] + c) % m

The output signal is automatically scaled to a range of [-1, 1].

===Examples===

// default initial parameters
play { LinCongL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }
// randomly modulate parameters
play {
 LinCongL.ar(
   LFNoise2.kr(1.0).mulAdd(1e4, 1e4),
   LFNoise2.kr(0.1).mulAdd(0.5, 1.4),
   LFNoise2.kr(0.1).mulAdd(0.1, 0.1),
   LFNoise2.kr(0.1)
 ) * 0.2
}
// as frequency control
play {
 SinOsc.ar(
   LinCongL.ar(
     40,
     LFNoise2.kr(0.1).mulAdd(0.1, 1),
     LFNoise2.kr(0.1).mulAdd(0.1, 0.1),
     LFNoise2.kr(0.1)
   ).mulAdd(500, 600)
 ) * 0.4
}
See also
Companion
class
final case
class LinCongL(rate: Rate, freq: GE, a: GE, c: GE, m: GE, xi: GE) extends SingleOut

A linear-interpolating sound generator based on the difference equation:

A linear-interpolating sound generator based on the difference equation:

x[n+1] = (a * x[n] + c) % m

The output signal is automatically scaled to a range of [-1, 1].

Value Params
a

Multiplier amount

c

Increment amount

freq

Iteration frequency in Hertz

m

Modulus amount

xi

Initial value of x

See also
Companion
object
object LinCongN extends ProductReader[LinCongN]

A non-interpolating sound generator based on the difference equation:

A non-interpolating sound generator based on the difference equation:

x[n+1] = (a * x[n] + c) % m

The output signal is automatically scaled to a range of [-1, 1].

===Examples===

// default initial parameters
play { LinCongN.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }
// randomly modulate parameters
play {
 LinCongN.ar(
   LFNoise2.kr(1.0).mulAdd(1e4, 1e4),
   LFNoise2.kr(0.1).mulAdd(0.5, 1.4),
   LFNoise2.kr(0.1).mulAdd(0.1, 0.1),
   LFNoise2.kr(0.1)
 ) * 0.2
}
// as frequency control
play {
 SinOsc.ar(
   LinCongN.ar(
     40,
     LFNoise2.kr(0.1).mulAdd(0.1, 1),
     LFNoise2.kr(0.1).mulAdd(0.1, 0.1),
     LFNoise2.kr(0.1)
   ).mulAdd(500, 600)
 ) * 0.4
}
See also
Companion
class
final case
class LinCongN(rate: Rate, freq: GE, a: GE, c: GE, m: GE, xi: GE) extends SingleOut

A non-interpolating sound generator based on the difference equation:

A non-interpolating sound generator based on the difference equation:

x[n+1] = (a * x[n] + c) % m

The output signal is automatically scaled to a range of [-1, 1].

Value Params
a

Multiplier amount

c

Increment amount

freq

Iteration frequency in Hertz

m

Modulus amount

xi

Initial value of x

See also
Companion
object
object LinExp extends ProductReader[LinExp]

A UGen which maps a linear range to an exponential range. The equivalent formula is (dstHi / dstLo).pow((in - srcLo) / (srcHi - srcLo)) * dstLo .

A UGen which maps a linear range to an exponential range. The equivalent formula is (dstHi / dstLo).pow((in - srcLo) / (srcHi - srcLo)) * dstLo .

'''Note''': No clipping is performed. If the input signal exceeds the input range, the output will also exceed its range.

===Examples===

// translate linear noise into exponential frequencies
play {
 val mod = LFNoise2.ar(10)
 val lo  = MouseX.kr(200, 8000, 1)
 val hi  = MouseY.kr(200, 8000, 1)
 SinOsc.ar(LinExp.ar(mod, -1, 1, lo, hi)) * 0.1
}
See also
Companion
class
final case
class LinExp(rate: MaybeRate, in: GE, srcLo: GE, srcHi: GE, dstLo: GE, dstHi: GE) extends SingleOut

A UGen which maps a linear range to an exponential range. The equivalent formula is (dstHi / dstLo).pow((in - srcLo) / (srcHi - srcLo)) * dstLo .

A UGen which maps a linear range to an exponential range. The equivalent formula is (dstHi / dstLo).pow((in - srcLo) / (srcHi - srcLo)) * dstLo .

'''Note''': No clipping is performed. If the input signal exceeds the input range, the output will also exceed its range.

Value Params
dstHi

upper limit of output range

dstLo

lower limit of output range

in

input signal to convert

srcHi

upper limit of input range

srcLo

lower limit of input range

See also
Companion
object
object LinLin extends ProductReader[LinLin]
Companion
class
final case
class LinLin(in: GE, srcLo: GE, srcHi: GE, dstLo: GE, dstHi: GE) extends Lazy

A graph element which maps a linear range to another linear range. The equivalent formula is (in - srcLo) / (srcHi - srcLo) * (dstHi - dstLo) + dstLo.

A graph element which maps a linear range to another linear range. The equivalent formula is (in - srcLo) / (srcHi - srcLo) * (dstHi - dstLo) + dstLo.

'''Note''': No clipping is performed. If the input signal exceeds the input range, the output will also exceed its range.

===Examples===

// oscillator to frequency range
play {
 val mod = SinOsc.kr(Line.kr(1, 10, 10))
 SinOsc.ar(LinLin(mod, -1, 1, 100, 900)) * 0.1
}
Value Params
dstHi

The upper limit of output range.

dstLo

The lower limit of output range.

in

The input signal to convert.

srcHi

The upper limit of input range.

srcLo

The lower limit of input range.

See also

MulAdd

Companion
object
object LinPan2 extends ProductReader[LinPan2]

A stereo panorama UGen based on linear amplitude control. When in center position ( pos = 0 ), the signal is attenuated by 0.5 or approx. -6 dB.

A stereo panorama UGen based on linear amplitude control. When in center position ( pos = 0 ), the signal is attenuated by 0.5 or approx. -6 dB.

===Examples===

// periodic left-right oscillation
play { LinPan2.ar(PinkNoise.ar(0.4), SinOsc.kr(0.25), 0.3) }
See also
Companion
class
final case
class LinPan2(rate: Rate, in: GE, pos: GE, level: GE) extends MultiOut

A stereo panorama UGen based on linear amplitude control. When in center position ( pos = 0 ), the signal is attenuated by 0.5 or approx. -6 dB.

A stereo panorama UGen based on linear amplitude control. When in center position ( pos = 0 ), the signal is attenuated by 0.5 or approx. -6 dB.

Value Params
in

(monophonic) input signal to be panned

level

additional gain control

pos

panorama position between -1 (hard left) via 0 (center) to +1 (hard right)

See also
Companion
object
object LinRand extends ProductReader[LinRand]

A scalar UGen that generates a single random decimal value between lo and hi with a selectable skew towards either end.

A scalar UGen that generates a single random decimal value between lo and hi with a selectable skew towards either end.

The minMax <= 0 behaves rather odd: If minMax is less than 1, the distribution is skewed towards lo (with lo = 0 and hi = 1 , the mean is approx. 0.33). If minMax is greater than or equal to 1, the distribution is skewed towards hi (with lo = 0 and hi = 1 , the mean is approx 0.66).

===Examples===

// two clusters with opposite skew
play {
 val z: GE = 0 to 1 map { n =>
   Mix.fill(10)(FSinOsc.ar(LinRand(200, 800, n))) * SinOsc.ar(0.4, n * math.Pi).max(0)
 }
 z * 0.025
}
See also
Companion
class
final case
class LinRand(lo: GE, hi: GE, minMax: GE) extends SingleOut with ScalarRated with IsIndividual

A scalar UGen that generates a single random decimal value between lo and hi with a selectable skew towards either end.

A scalar UGen that generates a single random decimal value between lo and hi with a selectable skew towards either end.

The minMax <= 0 behaves rather odd: If minMax is less than 1, the distribution is skewed towards lo (with lo = 0 and hi = 1 , the mean is approx. 0.33). If minMax is greater than or equal to 1, the distribution is skewed towards hi (with lo = 0 and hi = 1 , the mean is approx 0.66).

Value Params
hi

upper limit of the output range

lo

lower limit of the output range

minMax

if 0 , the output is skewed towards lo , if 1 , the output is skewed towards hi .

See also
Companion
object
object LinXFade2 extends ProductReader[LinXFade2]

An linear two channel cross fading UGen. In center position ( pan = 0 ), both input signals are attenuated by 0.5 or approx. -6 dB.

An linear two channel cross fading UGen. In center position ( pan = 0 ), both input signals are attenuated by 0.5 or approx. -6 dB.

See also
Companion
class
final case
class LinXFade2(rate: Rate, inA: GE, inB: GE, pan: GE, level: GE) extends SingleOut

An linear two channel cross fading UGen. In center position ( pan = 0 ), both input signals are attenuated by 0.5 or approx. -6 dB.

An linear two channel cross fading UGen. In center position ( pan = 0 ), both input signals are attenuated by 0.5 or approx. -6 dB.

Value Params
inA

The first input signal

inB

The second input signal

level

An overall amplitude multiplier that is applied to the output signal

pan

the cross-fade position from -1 (only input A audible) to +1 (only input B audible)

See also
Companion
object
object Line extends ProductReader[Line]

A line generator UGen that moves from a start value to the end value in a given duration.

A line generator UGen that moves from a start value to the end value in a given duration.

===Examples===

// pan from left to right
play { Pan2.ar(PinkNoise.ar(0.3), Line.kr(-1, 1, 10, freeSelf)) }
See also
Companion
class
final case
class Line(rate: Rate, start: GE, end: GE, dur: GE, doneAction: GE) extends SingleOut with HasSideEffect with HasDoneFlag

A line generator UGen that moves from a start value to the end value in a given duration.

A line generator UGen that moves from a start value to the end value in a given duration.

Value Params
doneAction

A done-action that is evaluated when the Line has reached the end value after the given duration

dur

Duration in seconds ''(init-time only)''

end

Ending value ''(init-time only)''

start

Starting value ''(init-time only)''

See also
Companion
object
object Linen extends ProductReader[Linen]

A linear ASR-type envelope generator UGen.

A linear ASR-type envelope generator UGen.

===Examples===

// repeated trigger
play {
 val gen = Linen.kr(Impulse.kr(2), 0.01, 0.6, 1.0)
 SinOsc.ar(440) * gen * 0.1
}
// play once and end the synth
play {
 val gen = Linen.kr(Impulse.kr(0), 0.01, 0.6, 1.0, doneAction = freeSelf)
 SinOsc.ar(440) * gen * 0.1
}
// play once and sustain
val x = play {
 val gen = Linen.kr("gate".kr(1), 0.01, 0.6, 1.0, doneAction = freeSelf)
 SinOsc.ar(440) * gen * 0.1
}

x.release(4)    // release envelope with given duration
// longer gate to sustain for a given duration
play {
 val gate = Trig.kr(1, dur = 2)
 val gen = Linen.kr(gate, 0.01, 0.6, 1.0, doneAction = freeSelf)
 SinOsc.ar(440) * gen * 0.1
}
See also
Companion
class
final case
class Linen(rate: Rate, gate: GE, attack: GE, sustain: GE, release: GE, doneAction: GE) extends SingleOut with HasSideEffect with HasDoneFlag

A linear ASR-type envelope generator UGen.

A linear ASR-type envelope generator UGen.

Value Params
attack

duration (seconds) of the attack segment

doneAction

action to be performed when the envelope reaches its end point.

gate

triggers the envelope and holds it open while greater than zero. A value of less than zero enforces a release with duration -1.0 - gate .

release

duration (seconds) of the release segment

sustain

level of the sustain segment

See also
Companion
object
object LocalBuf extends ProductReader[LocalBuf]

A UGen that allocates a buffer local to the synth. This is convenient for example when using an FFT chain.

A UGen that allocates a buffer local to the synth. This is convenient for example when using an FFT chain.

See also
Companion
class
final case
class LocalBuf(numFrames: GE, numChannels: GE) extends SingleOut with ScalarRated with IsIndividual

A UGen that allocates a buffer local to the synth. This is convenient for example when using an FFT chain.

A UGen that allocates a buffer local to the synth. This is convenient for example when using an FFT chain.

Value Params
numChannels

number of channels for the buffer

numFrames

number of sample frames for the buffer

See also
Companion
object
object LocalIn extends ProductReader[LocalIn]

A UGen that reads buses that are local to the enclosing synth. These buses should be written using a LocalOut ugen. They behave like regular buses, but are more convenient for the implementation of a self contained effect that uses a feedback processing loop.

A UGen that reads buses that are local to the enclosing synth. These buses should be written using a LocalOut ugen. They behave like regular buses, but are more convenient for the implementation of a self contained effect that uses a feedback processing loop.

In a synth, there can be only each one control-rate and audio-rate LocalIn / LocalOut pair. The signal written to a LocalOut will not be read by the LocalIn until the next control block cycle, introducing a delay of ControlDur .

'''Warning''': The argument has been changed numChannels: Int in version 1.15.3 to init: GE in version 1.16.0. The previous version was incompatible with SuperCollider 3.6.x. A previous usage such as LocalIn.ar(2) to create two channels must now be expressed as LocalIn.ar(Seq(0, 0)) !

===Examples===

// ping-pong delay with feedback
play {
 val src = Decay.ar(Impulse.ar(0.3), 0.1) * WhiteNoise.ar(0.2)
 val in  = LocalIn.ar(Seq(0, 0)) + Seq[GE](src, 0) // read feedback, add source to left chan
 val dly = DelayN.ar(in, 0.2, 0.2)         // delay sound
 val att = dly * 0.8                       // apply decay factor

 // reverse channels to give ping pong effect
 LocalOut.ar(Seq(att.out(1), dly.out(0)))
 dly
}
// tank
play {
 val tones = Mix.fill(12) {
   Pan2.ar(
     Decay2.ar(Dust.ar(0.05), 0.1, 0.5) * 0.1 *
       FSinOsc.ar(IRand(36,84).midiCps).cubed.max(0),
     Rand(-1,1))
 }
 val gen = tones + Pan2.ar(Decay2.ar(Dust.ar(0.03), 0.04, 0.3) * BrownNoise.ar, 0)

 val verb = Mix.fold(gen, 4) { z =>
   AllpassN.ar(z, 0.03, Seq.fill(2)(Rand(0.005,0.02)), 1)
 }

 val in  = LocalIn.ar(Seq(0, 0)) * 0.98
 val flt = OnePole.ar(in, 0.5)

 val pan = Rotate2.ar(flt.out(0), flt.out(1), 0.23)
 val v1  = AllpassN.ar(pan, 0.05, Seq.fill(2)(Rand(0.01,0.05)), 2)
 val v2  = DelayN.ar(v1, 0.3, Seq(0.19,0.26))
 val v3  = AllpassN.ar(v2 , 0.05, Seq.fill(2)(Rand(0.03,0.15)), 2)
 val out = LeakDC.ar(v3)
 val sig = gen + out

 LocalOut.ar(sig)
 sig
}
// resonator
play {
 val imp  = Impulse.ar
 val in   = LocalIn.ar
 val feed = imp + in * 0.995
 // must subtract block-size for correct tuning
 // (try removing the ControlDur to here the pitch change)
 val time = 440.reciprocal - ControlDur.ir
 val dly  = DelayC.ar(feed, time, time)
 LocalOut.ar(dly)

 // alternate between feedback and reference pitch
 val comp = Seq(dly, SinOsc.ar(440) * 0.2): GE
 comp * LFPulse.kr(1, Seq(0.0, 0.5))
}
See also
Companion
class
final case
class LocalIn(rate: Rate, init: GE) extends MultiOut

A UGen that reads buses that are local to the enclosing synth. These buses should be written using a LocalOut ugen. They behave like regular buses, but are more convenient for the implementation of a self contained effect that uses a feedback processing loop.

A UGen that reads buses that are local to the enclosing synth. These buses should be written using a LocalOut ugen. They behave like regular buses, but are more convenient for the implementation of a self contained effect that uses a feedback processing loop.

In a synth, there can be only each one control-rate and audio-rate LocalIn / LocalOut pair. The signal written to a LocalOut will not be read by the LocalIn until the next control block cycle, introducing a delay of ControlDur .

'''Warning''': The argument has been changed numChannels: Int in version 1.15.3 to init: GE in version 1.16.0. The previous version was incompatible with SuperCollider 3.6.x. A previous usage such as LocalIn.ar(2) to create two channels must now be expressed as LocalIn.ar(Seq(0, 0)) !

Value Params
init

the initial state of the UGen. The number of channels of this signal should match with the number of channels written via LocalOut .

See also
Companion
object
object LocalOut extends ProductReader[LocalOut]

A UGen that writes to buses that are local to the enclosing synth. These buses should have been defined by a LocalIn ugen. These behave like regular buses, but are more convenient for the implementation of a self contained effect that uses a feedback processing loop.

A UGen that writes to buses that are local to the enclosing synth. These buses should have been defined by a LocalIn ugen. These behave like regular buses, but are more convenient for the implementation of a self contained effect that uses a feedback processing loop.

In a synth, there can be only each one control-rate and audio-rate LocalIn / LocalOut pair. The signal written to a LocalOut will not be read by the LocalIn until the next control block cycle, introducing a delay of ControlDur .

For more examples, see LocalIn.

===Examples===

// ping-pong delay with feedback
play {
 val src = Decay.ar(Impulse.ar(0.3), 0.1) * WhiteNoise.ar(0.2)
 val in  = LocalIn.ar(Seq(0, 0)) + Seq[GE](src, 0) // read feedback, add source to left chan
 val dly = DelayN.ar(in, 0.2, 0.2)         // delay sound
 val att = dly * 0.8                       // apply decay factor

 // reverse channels to give ping pong effect
 LocalOut.ar(Seq(att.out(1), dly.out(0)))
 dly
}
See also
Companion
class
final case
class LocalOut(rate: Rate, in: GE) extends ZeroOut

A UGen that writes to buses that are local to the enclosing synth. These buses should have been defined by a LocalIn ugen. These behave like regular buses, but are more convenient for the implementation of a self contained effect that uses a feedback processing loop.

A UGen that writes to buses that are local to the enclosing synth. These buses should have been defined by a LocalIn ugen. These behave like regular buses, but are more convenient for the implementation of a self contained effect that uses a feedback processing loop.

In a synth, there can be only each one control-rate and audio-rate LocalIn / LocalOut pair. The signal written to a LocalOut will not be read by the LocalIn until the next control block cycle, introducing a delay of ControlDur .

For more examples, see LocalIn.

Value Params
in

signal to be written to the synth-local bus. The signal's number of channels must be the same number of channels as were declared in the corresponding LocalIn .

See also
Companion
object
object Logistic extends ProductReader[Logistic]

A noise generator UGen based on the logistic map. Its formula is

A noise generator UGen based on the logistic map. Its formula is

y[n+1] = chaos * y[n] * (1.0 - y[n])

===Examples===

// increasing parameter
play { Logistic.ar(Line.kr(3.55, 4.0, 15), 1000) * 0.5 }
See also
Companion
class
final case
class Logistic(rate: Rate, chaos: GE, freq: GE, init: GE) extends SingleOut

A noise generator UGen based on the logistic map. Its formula is

A noise generator UGen based on the logistic map. Its formula is

y[n+1] = chaos * y[n] * (1.0 - y[n])
Value Params
chaos

a parameter of the chaotic function with useful values from 0.0 to 4.0. Chaotic behavior occurs from 3.57 up. Using values outside this range can make the UGen blow up, resulting in NaNs.

freq

Frequency of calculation in Hertz. The value is limited by the sampling rate.

init

Initial value of the recursive function

See also
Companion
object
object LorenzL extends ProductReader[LorenzL]

A strange attractor discovered by Edward N. Lorenz while studying mathematical models of the atmosphere. The system is composed of three ordinary differential equations:

A strange attractor discovered by Edward N. Lorenz while studying mathematical models of the atmosphere. The system is composed of three ordinary differential equations:

x' = s * (y - x)
y' = x * (r - z) - y
z' = x * y - b * z

The time step amount h determines the rate at which the ODE is evaluated. Higher values will increase the rate, but cause more instability. A safe choice is the default amount of 0.05.

===Examples===

// vary frequency
play { LorenzL.ar(MouseX.kr(20, SampleRate.ir)) * 0.3 }
// randomly modulate parameters
play {
 LorenzL.ar(
   SampleRate.ir,
   LFNoise0.kr(1).mulAdd(2, 10),
   LFNoise0.kr(1).mulAdd(20, 38),
   LFNoise0.kr(1).mulAdd(1.5, 2)
 ) * 0.2
}
// as a frequency control
play { SinOsc.ar(Lag.ar(LorenzL.ar(MouseX.kr(1, 200)), 3e-3) * 800 + 900) * 0.4 }
Companion
class
final case
class LorenzL(rate: Rate, freq: GE, s: GE, r: GE, b: GE, h: GE, xi: GE, yi: GE, zi: GE) extends SingleOut

A strange attractor discovered by Edward N. Lorenz while studying mathematical models of the atmosphere. The system is composed of three ordinary differential equations:

A strange attractor discovered by Edward N. Lorenz while studying mathematical models of the atmosphere. The system is composed of three ordinary differential equations:

x' = s * (y - x)
y' = x * (r - z) - y
z' = x * y - b * z

The time step amount h determines the rate at which the ODE is evaluated. Higher values will increase the rate, but cause more instability. A safe choice is the default amount of 0.05.

Value Params
b

Equation variable

freq

Iteration frequency in Hertz

h

Integration time step

r

Equation variable

s

Equation variable

xi

Initial value of x

yi

Initial value of y

zi

Initial value of z

Companion
object
object Loudness extends ProductReader[Loudness]

A UGen for the extraction of instantaneous loudness. A perceptual loudness function which outputs loudness in sones; this is a variant of an MP3 perceptual model, summing excitation in ERB bands. It models simple spectral and temporal masking, with equal loudness contour correction in ERB bands to obtain phons (relative dB), then a phon to sone transform. The final output is typically in the range of 0 to 64 sones, though higher values can occur with specific synthesised stimuli.

A UGen for the extraction of instantaneous loudness. A perceptual loudness function which outputs loudness in sones; this is a variant of an MP3 perceptual model, summing excitation in ERB bands. It models simple spectral and temporal masking, with equal loudness contour correction in ERB bands to obtain phons (relative dB), then a phon to sone transform. The final output is typically in the range of 0 to 64 sones, though higher values can occur with specific synthesised stimuli.

Note that despite running at control-rate, the output remains constant for each FFT frame. E.g. with an FFT size of 1024 and 50% overlap, a new measure is generated every 512 audio frames, or (at control block size 64) every 8 control blocks.

'''Warning:''' the UGen is broken if FFT sizes other than the ones specified for chain are used.

Companion
class
final case
class Loudness(chain: GE, smask: GE, tmask: GE) extends SingleOut with ControlRated with IsIndividual

A UGen for the extraction of instantaneous loudness. A perceptual loudness function which outputs loudness in sones; this is a variant of an MP3 perceptual model, summing excitation in ERB bands. It models simple spectral and temporal masking, with equal loudness contour correction in ERB bands to obtain phons (relative dB), then a phon to sone transform. The final output is typically in the range of 0 to 64 sones, though higher values can occur with specific synthesised stimuli.

A UGen for the extraction of instantaneous loudness. A perceptual loudness function which outputs loudness in sones; this is a variant of an MP3 perceptual model, summing excitation in ERB bands. It models simple spectral and temporal masking, with equal loudness contour correction in ERB bands to obtain phons (relative dB), then a phon to sone transform. The final output is typically in the range of 0 to 64 sones, though higher values can occur with specific synthesised stimuli.

Note that despite running at control-rate, the output remains constant for each FFT frame. E.g. with an FFT size of 1024 and 50% overlap, a new measure is generated every 512 audio frames, or (at control block size 64) every 8 control blocks.

'''Warning:''' the UGen is broken if FFT sizes other than the ones specified for chain are used.

Value Params
chain

the output (buffer) of an FFT UGen which transforms the audio input to track. The FFT size should be 1024 for 44.1 and 48 kHz sampling rate, and 2048 for 88.2 and 96 kHz sampling rate.

smask

Spectral masking parameter: lower bins mask higher bin power within ERB bands, with a power falloff (leaky integration multiplier) of smask per bin. Can be control-rate modulated.

tmask

Temporal masking parameter: the phon level let through in an ERB band is the maximum of the new measurement, and the previous minus tmask phons. Can be control-rate modulated.

Companion
object
object MFCC extends ProductReader[MFCC]

A UGen for extracting mel frequency cepstral coefficients. It generates a set of MFCCs; these are obtained from a band-based frequency representation (using the Mel scale by default), and then a discrete cosine transform (DCT). The DCT is an efficient approximation for principal components analysis, so that it allows a compression, or reduction of dimensionality, of the data, in this case reducing 42 band readings to a smaller set of MFCCs. A small number of features (the coefficients) end up describing the spectrum. The MFCCs are commonly used as timbral descriptors.

A UGen for extracting mel frequency cepstral coefficients. It generates a set of MFCCs; these are obtained from a band-based frequency representation (using the Mel scale by default), and then a discrete cosine transform (DCT). The DCT is an efficient approximation for principal components analysis, so that it allows a compression, or reduction of dimensionality, of the data, in this case reducing 42 band readings to a smaller set of MFCCs. A small number of features (the coefficients) end up describing the spectrum. The MFCCs are commonly used as timbral descriptors.

The output values are somewhat normalised for the range 0.0 to 1.0, but there are no guarantees on exact conformance to this. Commonly, the first coefficient will be the highest value. The number of output channels corresponds to the number of coefficients specified. Technical note: The 0th coefficient is not generated as it consists of multiplying all bands by 1 and summing

Note that despite running at control-rate, the output remains constant for each FFT frame. E.g. with an FFT size of 1024 and 50% overlap, a new measure is generated every 512 audio frames, or (at control block size 64) every 8 control blocks.

Companion
class
final case
class MFCC(chain: GE, numCoeffs: Int) extends MultiOut with ControlRated with IsIndividual

A UGen for extracting mel frequency cepstral coefficients. It generates a set of MFCCs; these are obtained from a band-based frequency representation (using the Mel scale by default), and then a discrete cosine transform (DCT). The DCT is an efficient approximation for principal components analysis, so that it allows a compression, or reduction of dimensionality, of the data, in this case reducing 42 band readings to a smaller set of MFCCs. A small number of features (the coefficients) end up describing the spectrum. The MFCCs are commonly used as timbral descriptors.

A UGen for extracting mel frequency cepstral coefficients. It generates a set of MFCCs; these are obtained from a band-based frequency representation (using the Mel scale by default), and then a discrete cosine transform (DCT). The DCT is an efficient approximation for principal components analysis, so that it allows a compression, or reduction of dimensionality, of the data, in this case reducing 42 band readings to a smaller set of MFCCs. A small number of features (the coefficients) end up describing the spectrum. The MFCCs are commonly used as timbral descriptors.

The output values are somewhat normalised for the range 0.0 to 1.0, but there are no guarantees on exact conformance to this. Commonly, the first coefficient will be the highest value. The number of output channels corresponds to the number of coefficients specified. Technical note: The 0th coefficient is not generated as it consists of multiplying all bands by 1 and summing

Note that despite running at control-rate, the output remains constant for each FFT frame. E.g. with an FFT size of 1024 and 50% overlap, a new measure is generated every 512 audio frames, or (at control block size 64) every 8 control blocks.

Value Params
chain

the output (buffer) of an FFT UGen which transforms the audio input to track. For the FFT chain, with a standard hop of half FFT size, the FFT size should be 1024 at 44.1 or 48 kHz and 2048 at 88.2 or 96 kHz sampling rate.

numCoeffs

the number of coefficients, defaults to 13, maximum of 42; more efficient to use less of course! Since this number determines the number of output channels of the UGen, it has to be an Int .

Companion
object
object MantissaMask extends ProductReader[MantissaMask]

A UGen that masks off bits in the mantissa of the floating point sample value. This introduces a quantization noise, but is less severe than linearly quantizing the signal.

A UGen that masks off bits in the mantissa of the floating point sample value. This introduces a quantization noise, but is less severe than linearly quantizing the signal.

===Examples===

// mouse-x controls resolution
play {
 val bits = MouseX.kr(0, 12)
 MantissaMask.ar(SinOsc.ar(SinOsc.kr(0.2).mulAdd(400, 500)) * 0.4, bits)
}
Companion
class
final case
class MantissaMask(rate: MaybeRate, in: GE, bits: GE) extends SingleOut

A UGen that masks off bits in the mantissa of the floating point sample value. This introduces a quantization noise, but is less severe than linearly quantizing the signal.

A UGen that masks off bits in the mantissa of the floating point sample value. This introduces a quantization noise, but is less severe than linearly quantizing the signal.

Value Params
bits

The number of mantissa bits to preserve, from 0 to 23.

in

input signal to quantize

Companion
object
object Median extends ProductReader[Median]

A filter UGen that calculates the median of a running window over its input signal. This non-linear filter can be used to reduce impulse noise from a signal.

A filter UGen that calculates the median of a running window over its input signal. This non-linear filter can be used to reduce impulse noise from a signal.

===Examples===

// engage with mouse button
play {
 val in  = Saw.ar(500) * 0.1 + Dust2.ar(100) * 0.9 // signal plus noise
 val flt = Median.ar(in, 3)
 LinXFade2.ar(in, flt, MouseButton.kr(-1, 1))
}
// long filter distorts by chopping off peaks in input
play { Median.ar(SinOsc.ar(1000) * 0.2, 31) }
See also
Note

The argument order is different from its sclang counterpart.

Companion
class
final case
class Median(rate: Rate, in: GE, length: GE) extends SingleOut

A filter UGen that calculates the median of a running window over its input signal. This non-linear filter can be used to reduce impulse noise from a signal.

A filter UGen that calculates the median of a running window over its input signal. This non-linear filter can be used to reduce impulse noise from a signal.

Value Params
length

window size. I.e., the number of input samples in which to find the median. Must be an odd number from 1 to 31. A value of 1 has no effect. ''Warning'': This parameter is only read an initialization time and cannot be modulated while the UGen is running. ''(init-time only)''

See also
Note

The argument order is different from its sclang counterpart.

Companion
object
object MidEQ extends ProductReader[MidEQ]

A single band parametric equalizer UGen. It attenuates or boosts a frequency band.

A single band parametric equalizer UGen. It attenuates or boosts a frequency band.

===Examples===

// mouse controlled frequency and boost
play {
 val in   = WhiteNoise.ar(0.25)
 val freq = MouseX.kr(200, 10000, 1)
 val gain = MouseY.kr(-12, 12) // bottom to top
 MidEQ.ar(in, freq, rq = 0.5, gain = gain)
}
See also
Companion
class
final case
class MidEQ(rate: MaybeRate, in: GE, freq: GE, rq: GE, gain: GE) extends SingleOut

A single band parametric equalizer UGen. It attenuates or boosts a frequency band.

A single band parametric equalizer UGen. It attenuates or boosts a frequency band.

Value Params
freq

center frequency in Hertz

gain

The amount of boost (when positive) or attenuation (when negative) applied to the frequency band, in decibels.

in

input signal to be filtered

rq

reciprocal of Q. The Q (or quality) is conventionally defined as center-frequency / bandwidth, meaning that rq  = bandwidth / center-frequency. A higher Q or lower rq produces a steeper filter. Too high values for rq may blow the filter up!

See also
Companion
object
object Mix extends ProductReader[Mix]

A graph element that mixes the channels of a signal together. It works like the sclang counterpart.

A graph element that mixes the channels of a signal together. It works like the sclang counterpart.

The Mix companion object contains various useful mixing idioms:

  • Mix.tabulate(n: Int)(fun: Int => GE): corresponds to Seq.tabulate and to Array.fill in sclang.
  • Mix.fill(n: Int)(thunk: => GE): corresponds to Seq.fill.
  • Mix.seq(elems: GE*): A shortcut for Mix(GESeq(elems: _*)).

A separate graph element is Mix.mono. Mix.mono(elem: GE) flattens all channels of the input element before summing them, guaranteeing that the result is monophonic.

Finally, Mix.fold is an idiom that not actually adds elements, but recursively folds them. Thus, Mix.fold(elem: GE, n: Int)(fun: GE => GE) is equivalent to

(1 to n).foldLeft(elem) { (res, _) => fun(res) }

Mix.fold is often used in the SuperCollider examples to apply a filtering process such as reverberation several times. For cases where the iteration index is needed, the full form as shown above can be used instead.

===Examples===

// non-nested multi-channel signal reduced to mono (1)
play {
 Mix(SinOsc.ar(440 :: 660 :: Nil)) * 0.2 // --> SinOsc.ar(440) + SinOsc.ar(660)
}
// non-nested multi-channel signal reduced to mono (2)
play {
 Mix(Pan2.ar(SinOsc.ar)) * 0.2 // --> left + right
}
// mix inner channels
play {
 // --> [left(440) + left(660), right(440) + right(660)]
 Mix(Pan2.ar(SinOsc.ar(440 :: 660 :: Nil))) * 0.2
}
// enforce monophonic mix
play {
 // --> left(440) + left(660) + right(440) + right(660)
 Mix.mono(Pan2.ar(SinOsc.ar(440 :: 660 :: Nil))) * 0.2
}
// combine Mix(), Mix.fill(), Mix.fold()
// from original SC examples: reverberated sine percussion
play {
 val d = 6    // number of percolators
 val c = 5    // number of comb delays
 val a = 4    // number of allpass delays

 // sine percolation sound :
 val s = Mix.fill(d) { Resonz.ar(Dust.ar(2.0 / d) * 50, Rand(200, 3200), 0.003) }

 // reverb pre-delay time :
 val z = DelayN.ar(s, 0.048)

 // 'c' length modulated comb delays in parallel :
 val y = Mix(CombL.ar(z, 0.1, LFNoise1.kr(Seq.fill(c)(Rand(0, 0.1))).madd(0.04, 0.05), 15))

 // chain of 'a' allpass delays on each of two channels (2 times 'a' total) :
 val x = Mix.fold(y, a) { in =>
   AllpassN.ar(in, 0.050, Seq(Rand(0, 0.050), Rand(0, 0.050)), 1)
 }

 // add original sound to reverb and play it :
 s + 0.2 * x
}
// Mix.tabulate usage
// from original SC examples: harmonic swimming
play {
 val f = 50       // fundamental frequency
 val p = 20       // number of partials per channel
 val offset = Line.kr(0, -0.02, 60, doneAction = freeSelf) // causes sound to separate and fade
 Mix.tabulate(p) { i =>
   FSinOsc.ar(f * (i+1)) * // freq of partial
     LFNoise1.kr(Seq(Rand(2, 10), Rand(2, 10)))  // amplitude rate
     .madd(
       0.02,     // amplitude scale
       offset    // amplitude offset
     ).max(0)    // clip negative amplitudes to zero
 }
}
See also

BinaryOpUGen

Companion
class
final case
class Mix(elem: GE) extends SingleOut

A graph element that mixes the channels of a signal together. It works like the sclang counterpart.

A graph element that mixes the channels of a signal together. It works like the sclang counterpart.

The Mix companion object contains various useful mixing idioms:

  • Mix.tabulate(n: Int)(fun: Int => GE): corresponds to Seq.tabulate and to Array.fill in sclang.
  • Mix.fill(n: Int)(thunk: => GE): corresponds to Seq.fill.
  • Mix.seq(elems: GE*): A shortcut for Mix(GESeq(elems: _*)).

A separate graph element is Mix.mono. Mix.mono(elem: GE) flattens all channels of the input element before summing them, guaranteeing that the result is monophonic.

Finally, Mix.fold is an idiom that not actually adds elements, but recursively folds them. Thus, Mix.fold(elem: GE, n: Int)(fun: GE => GE) is equivalent to

(1 to n).foldLeft(elem) { (res, _) => fun(res) }

Mix.fold is often used in the SuperCollider examples to apply a filtering process such as reverberation several times. For cases where the iteration index is needed, the full form as shown above can be used instead.

Value Params
elem

the graph element whose channels to mix together

See also

BinaryOpUGen

Companion
object
object ModDif extends ProductReader[ModDif]

A UGen that returns the minimum difference of two values in modulo arithmetics. On a circle, there are two distances between two points. This UGen returns the smaller value of the two.

A UGen that returns the minimum difference of two values in modulo arithmetics. On a circle, there are two distances between two points. This UGen returns the smaller value of the two.

===Examples===

// different moduli
play {
 val sig = LFSaw.ar(10)
 val dist = ModDif.kr(sig, 0, MouseX.kr(0, 1.0/5) * (0 to 8))
 Splay.ar(SinOsc.ar(dist * 4000 + 400)) * 0.1
}
// wrapping amplitude cross-fade
play {
 val numChan = 12
 val x    = SinOsc.ar(Seq.fill(numChan)(Rand(300.0, 800.0)))
 val dist = ModDif.kr(MouseX.kr(0, numChan * 2), 0 until numChan, numChan)
 val sig  = x * (1 - dist).max(0)
 Splay.ar(sig) * 0.2
}
See also
Companion
class
final case
class ModDif(rate: Rate, x: GE, y: GE, mod: GE) extends SingleOut

A UGen that returns the minimum difference of two values in modulo arithmetics. On a circle, there are two distances between two points. This UGen returns the smaller value of the two.

A UGen that returns the minimum difference of two values in modulo arithmetics. On a circle, there are two distances between two points. This UGen returns the smaller value of the two.

Value Params
mod

the modulo argument, i.e. the maximum value output, which is double of the maximal difference that will be returned by the UGen.

x

the first input value

y

the second input value

See also
Companion
object
object MoogFF extends ProductReader[MoogFF]

A Moog VCF style UGen. This is a type of resonant low pass filter.

A Moog VCF style UGen. This is a type of resonant low pass filter.

The design of this filter is described in Federico Fontana, "Preserving the Digital Structure of the Moog VCF." In: Proceedings of the ICMC, Copenhagen 2007. Ported to SuperCollider by Dan Stowell.

===Examples===

// mouse controlled
play {
 val in   = WhiteNoise.ar(01.1)
 val freq = MouseY.kr(100, 10000, 1)
 val gain = MouseX.kr(0, 4)
 Limiter.ar(MoogFF.ar(in, freq, gain))
}
Companion
class
final case
class MoogFF(rate: MaybeRate, in: GE, freq: GE, gain: GE, reset: GE) extends SingleOut

A Moog VCF style UGen. This is a type of resonant low pass filter.

A Moog VCF style UGen. This is a type of resonant low pass filter.

The design of this filter is described in Federico Fontana, "Preserving the Digital Structure of the Moog VCF." In: Proceedings of the ICMC, Copenhagen 2007. Ported to SuperCollider by Dan Stowell.

Value Params
freq

cutoff frequency in Hertz

gain

filter resonance gain, between 0 and 4

reset

when greater than zero, this will reset the state of the digital filters at the beginning of the next control block.

Companion
object
object MostChange extends ProductReader[MostChange]

A UGen that switches between two input signal depending on which is changing more. Change is based on the absolute of the differentiation of the respective signals.

A UGen that switches between two input signal depending on which is changing more. Change is based on the absolute of the differentiation of the respective signals.

===Examples===

// mouse-x versus mouse-y
play {
 val x   = MouseX.kr(lag = 1)
 val y   = MouseY.kr(lag = 1)
 val c   = MostChange.kr(x, y)
 val isX = c sig_== x
 val isY = 1 - isX
 // if X change stronger, modulate pan position
 val p   = LFTri.ar(c * 10 * isX)
 // if Y change stronger, modulate sine frequency
 val f   = LFTri.ar(c * 10 * isY).linExp(-1, 1, 100, 4000)
 // report current state
 c.poll(5, "c")
 x.poll(isX, "now X")
 y.poll(isY, "now Y")
 Pan2.ar(SinOsc.ar(f) * 0.1, p)
}
See also
Companion
class
final case
class MostChange(rate: Rate, a: GE, b: GE) extends SingleOut

A UGen that switches between two input signal depending on which is changing more. Change is based on the absolute of the differentiation of the respective signals.

A UGen that switches between two input signal depending on which is changing more. Change is based on the absolute of the differentiation of the respective signals.

Value Params
a

first input signal to select from

b

second input signal to select from

See also
Companion
object
object MouseButton extends ProductReader[MouseButton]

A UGen that outputs two different values depending on whether the mouse button is pressed. This is useful for testing purposes. Mouse interaction with the regular desktop and windowing system is in no way altered by running this UGen.

A UGen that outputs two different values depending on whether the mouse button is pressed. This is useful for testing purposes. Mouse interaction with the regular desktop and windowing system is in no way altered by running this UGen.

===Examples===

// toggle sine frequency
play { SinOsc.ar(MouseButton.kr(400, 440, 0.1)) * 0.1 }
See also
Companion
class
final case
class MouseButton(lo: GE, hi: GE, lag: GE) extends SingleOut with ControlRated

A UGen that outputs two different values depending on whether the mouse button is pressed. This is useful for testing purposes. Mouse interaction with the regular desktop and windowing system is in no way altered by running this UGen.

A UGen that outputs two different values depending on whether the mouse button is pressed. This is useful for testing purposes. Mouse interaction with the regular desktop and windowing system is in no way altered by running this UGen.

Value Params
hi

value output while button is pressed

lag

60 dB decay time of a lag-time smoothing. Use zero to avoid any smoothing.

lo

value output while button is not pressed

See also
Companion
object
object MouseX extends ProductReader[MouseX]

A UGen that maps the horizontal screen location of the mouse to a given linear or exponential range. This is useful for testing purposes. Mouse interaction with the regular desktop and windowing system is in no way altered by running this UGen.

A UGen that maps the horizontal screen location of the mouse to a given linear or exponential range. This is useful for testing purposes. Mouse interaction with the regular desktop and windowing system is in no way altered by running this UGen.

===Examples===

// control sine frequency
play {
 val freq = MouseX.kr(100, 4000, 1)
 SinOsc.ar(freq) * 0.1 * AmpComp.kr(freq)
}
See also
Companion
class
final case
class MouseX(lo: GE, hi: GE, warp: GE, lag: GE) extends SingleOut with ControlRated

A UGen that maps the horizontal screen location of the mouse to a given linear or exponential range. This is useful for testing purposes. Mouse interaction with the regular desktop and windowing system is in no way altered by running this UGen.

A UGen that maps the horizontal screen location of the mouse to a given linear or exponential range. This is useful for testing purposes. Mouse interaction with the regular desktop and windowing system is in no way altered by running this UGen.

Value Params
hi

value when the mouse is on the right side of the screen. '''Note''': this value is never reached, because the maximum mouse coordinate is one pixel less than the screen size. For example, if the screen width is 1440, lo is 0.0 and hi is 1.0, the maximum value output is 1.0 * 1439/1440 = 0.999306 .

lag

60 dB decay time of a lag-time smoothing. Use zero to avoid any smoothing.

lo

value when the mouse is on the left side of the screen

warp

curve shape. Either zero (default) for a linear mapping, or 1 for an exponential mapping. '''Note''': When using exponential mapping, make sure the lo value is greater than zero, otherwise NaN values will be output.

See also
Companion
object
object MouseY extends ProductReader[MouseY]

A UGen that maps the vertical screen location of the mouse to a given linear or exponential range. The lo value corresponds to the ''bottom'' of the screen, and the hi value corresponds to the ''top'' of the screen (not vice-versa).

A UGen that maps the vertical screen location of the mouse to a given linear or exponential range. The lo value corresponds to the ''bottom'' of the screen, and the hi value corresponds to the ''top'' of the screen (not vice-versa).

This UGen is useful for testing purposes. Mouse interaction with the regular desktop and windowing system is in no way altered by running this UGen.

===Examples===

// control sine frequency
play {
 val freq = MouseY.kr(100, 4000, 1)
 SinOsc.ar(freq) * 0.1 * AmpComp.kr(freq)
}
See also
Companion
class
final case
class MouseY(lo: GE, hi: GE, warp: GE, lag: GE) extends SingleOut with ControlRated

A UGen that maps the vertical screen location of the mouse to a given linear or exponential range. The lo value corresponds to the ''bottom'' of the screen, and the hi value corresponds to the ''top'' of the screen (not vice-versa).

A UGen that maps the vertical screen location of the mouse to a given linear or exponential range. The lo value corresponds to the ''bottom'' of the screen, and the hi value corresponds to the ''top'' of the screen (not vice-versa).

This UGen is useful for testing purposes. Mouse interaction with the regular desktop and windowing system is in no way altered by running this UGen.

Value Params
hi

value when the mouse is on the top side of the screen

lag

60 dB decay time of a lag-time smoothing. Use zero to avoid any smoothing.

lo

value when the mouse is on the bottom side of the screen. '''Note''': this value is never reached, because the maximum mouse coordinate is one pixel less than the screen height. For example, if the screen height is 900, lo is 0.0 and hi is 1.0, the minimum value output is 1.0 - 1.0 * 899.0/900 = 0.001111 .

warp

curve shape. Either zero (default) for a linear mapping, or 1 for an exponential mapping. '''Note''': When using exponential mapping, make sure the lo value is greater than zero, otherwise NaN values will be output.

See also
Companion
object
object NRand extends ProductReader[NRand]

A scalar UGen that generates a single random decimal value, averaging a given number of samples from a uniform distribution between lo and hi .

A scalar UGen that generates a single random decimal value, averaging a given number of samples from a uniform distribution between lo and hi .

===Examples===

// three clusters with different distributions
play {
 val z = 1 to 3 map { n =>
   Mix.fill(10)(FSinOsc.ar(NRand(200, 800, n))) * SinOsc.ar(0.4, n).max(0)
 }
 Splay.ar(z) * 0.025
}
See also
Companion
class
final case
class NRand(lo: GE, hi: GE, n: GE) extends SingleOut with ScalarRated with IsIndividual

A scalar UGen that generates a single random decimal value, averaging a given number of samples from a uniform distribution between lo and hi .

A scalar UGen that generates a single random decimal value, averaging a given number of samples from a uniform distribution between lo and hi .

Value Params
hi

upper limit of the output range

lo

lower limit of the output range

n

the number of random numbers to average. For n = 1 , the result is identical to Rand , for n = 2 , the distribution is triangular, and for larger values the distribution converges towards a Gaussian. '''Warning''': The value should be not be less than one.

See also
Companion
object
object NodeID extends ProductReader[NodeID]

Identifier of the node which contains the UGen.

Identifier of the node which contains the UGen.

===Examples===

// print the UGen value
play { NodeID.ir.poll(0) }
See also
Companion
class
final case
class NodeID() extends SingleOut with ScalarRated

Identifier of the node which contains the UGen.

Identifier of the node which contains the UGen.

See also
Companion
object
object Normalizer extends ProductReader[Normalizer]

A UGen that normalizes the input amplitude to the given level. Unlike Compander , this UGen will not overshoot, but it needs to look ahead in the input signal, introducing a delay in its output. The delay time is equal to twice the value of the dur parameter (the buffer internally used).

A UGen that normalizes the input amplitude to the given level. Unlike Compander , this UGen will not overshoot, but it needs to look ahead in the input signal, introducing a delay in its output. The delay time is equal to twice the value of the dur parameter (the buffer internally used).

===Examples===

// compare dry and wet
play {
 val z    = Decay2.ar(
   Impulse.ar(8, phase = LFSaw.kr(0.25) * 0.7),
   attack = 0.001, release = 0.3) * FSinOsc.ar(500)
 val in  = z * SinOsc.ar(0.05) * 0.5
 val flt = Normalizer.ar(in, dur = 0.15, level = 0.4)
 LinXFade2.ar(in, flt, MouseButton.kr(-1, 1))
}
See also
Companion
class
final case
class Normalizer(rate: Rate, in: GE, level: GE, dur: GE) extends SingleOut

A UGen that normalizes the input amplitude to the given level. Unlike Compander , this UGen will not overshoot, but it needs to look ahead in the input signal, introducing a delay in its output. The delay time is equal to twice the value of the dur parameter (the buffer internally used).

A UGen that normalizes the input amplitude to the given level. Unlike Compander , this UGen will not overshoot, but it needs to look ahead in the input signal, introducing a delay in its output. The delay time is equal to twice the value of the dur parameter (the buffer internally used).

Value Params
dur

look-ahead time in seconds. Shorter times will produce smaller delays and quicker transient response times, but may introduce amplitude modulation artifacts. ''(init-time only)''

in

input signal to be normalized

level

peak output amplitude level to which to normalize the input

See also
Companion
object
object NumAudioBuses extends ProductReader[NumAudioBuses]

Number of audio buses.

Number of audio buses.

===Examples===

// print the UGen value
play { NumAudioBuses.ir.poll(0) }
See also
Companion
class
final case
class NumAudioBuses() extends SingleOut with ScalarRated

Number of audio buses.

object NumBuffers extends ProductReader[NumBuffers]

Maximum number of audio buffers.

Maximum number of audio buffers.

===Examples===

// print the UGen value
play { NumBuffers.ir.poll(0) }
See also
Companion
class
final case
class NumBuffers() extends SingleOut with ScalarRated

Maximum number of audio buffers.

Maximum number of audio buffers.

See also
Companion
object
object NumChannels extends ProductReader[NumChannels]
Companion
class
final case
class NumChannels(in: GE) extends SingleOut with ScalarRated

A graph element that produces an integer with number-of-channels of the input element.

A graph element that produces an integer with number-of-channels of the input element.

Because ScalaCollider allows late-expanding graph elements, we have no direct way to get an integer of some array-size of a UGen's outputs. On the other hand, there may be sound synthesis definitions that can abstract over the number of channels at definition time.

===Examples===

// amplitude compensation
play {
 val sines: GE = Seq.fill(8)(SinOsc.ar(ExpRand(200, 2000)))
 val norm = Mix(sines) / NumChannels(sines)   // guarantee that they don't clip
 norm * 0.2
}
Value Params
in

the element whose number-of-channels to produce

See also
Companion
object
object NumControlBuses extends ProductReader[NumControlBuses]

Number of control buses.

Number of control buses.

===Examples===

// print the UGen value
play { NumControlBuses.ir.poll(0) }
See also
Companion
class
final case
class NumControlBuses() extends SingleOut with ScalarRated

Number of control buses.

object NumInputBuses extends ProductReader[NumInputBuses]

Number of input buses.

Number of input buses.

===Examples===

// print the UGen value
play { NumInputBuses.ir.poll(0) }
See also
Companion
class
final case
class NumInputBuses() extends SingleOut with ScalarRated

Number of input buses.

object NumOutputBuses extends ProductReader[NumOutputBuses]

Number of output buses.

Number of output buses.

===Examples===

// print the UGen value
play { NumOutputBuses.ir.poll(0) }
See also
Companion
class
final case
class NumOutputBuses() extends SingleOut with ScalarRated

Number of output buses.

object NumRunningSynths extends ProductReader[NumRunningSynths]

Number of currently running synths.

Number of currently running synths.

===Examples===

// print the UGen value
play { NumRunningSynths.ir.poll(0) }
See also
Companion
class
final case
class NumRunningSynths() extends SingleOut with ScalarRated

Number of currently running synths.

Number of currently running synths.

See also
Companion
object
object OffsetOut extends ProductReader[OffsetOut]

A UGen that writes a signal onto a bus, delaying the signal such that the input will begin to appear on the bus precisely when the encompassing Synth was scheduled according to its OSC bundle. I.e. if the synth is scheduled to be started part way through a control cycle, OffsetOut will maintain the correct offset by buffering the output and delaying it until the exact time that the synth was scheduled for.

A UGen that writes a signal onto a bus, delaying the signal such that the input will begin to appear on the bus precisely when the encompassing Synth was scheduled according to its OSC bundle. I.e. if the synth is scheduled to be started part way through a control cycle, OffsetOut will maintain the correct offset by buffering the output and delaying it until the exact time that the synth was scheduled for.

This UGen adds ("mixes") the input-signal to the existing contents of the bus.

Multi-channel input signals, for example a PanAz , are written as such to the bus without expansion. That is, the bus index argument is used for the first channel, the second channel will appear on bus + 1 , etc.

If you have an expanding multi-channel input, however, you have to be careful. For example, if you have PanAz.ar(2, SinOsc.ar(Seq(444, 555, 666)) * 0.2, Seq(-1, 0, 1)) , this results in one output UGen carrying one channel, and another one carrying two channels. (The way this works is consistent with SCLang). In order to get the correct behaviour (left outputs of the PanAz summed, and right output of the PanAz summed), wrap this expression in a Mix(...) before passing it to the output UGen.

'''Note''': You cannot currently achieve sample accurate scheduling in SuperCollider. This UGen is therefore more or less useless.

===Examples===

// compare left-right
val sd = SynthDef.recv("offset-out") {
 val x = Impulse.ar(2)
 val y = SubsampleOffset.ir
 y.poll(0, "offset")
 Out      .ar(0, x)
 OffsetOut.ar(1, x)    // right channel will be delayed against left
}

val x = Synth(s)
s ! osc.Bundle.millis(System.currentTimeMillis + 1000, x.newMsg(sd.name, s))
See also
Companion
class
final case
class OffsetOut(bus: GE, in: GE) extends ZeroOut with AudioRated with HasSideEffect with IsIndividual

A UGen that writes a signal onto a bus, delaying the signal such that the input will begin to appear on the bus precisely when the encompassing Synth was scheduled according to its OSC bundle. I.e. if the synth is scheduled to be started part way through a control cycle, OffsetOut will maintain the correct offset by buffering the output and delaying it until the exact time that the synth was scheduled for.

A UGen that writes a signal onto a bus, delaying the signal such that the input will begin to appear on the bus precisely when the encompassing Synth was scheduled according to its OSC bundle. I.e. if the synth is scheduled to be started part way through a control cycle, OffsetOut will maintain the correct offset by buffering the output and delaying it until the exact time that the synth was scheduled for.

This UGen adds ("mixes") the input-signal to the existing contents of the bus.

Multi-channel input signals, for example a PanAz , are written as such to the bus without expansion. That is, the bus index argument is used for the first channel, the second channel will appear on bus + 1 , etc.

If you have an expanding multi-channel input, however, you have to be careful. For example, if you have PanAz.ar(2, SinOsc.ar(Seq(444, 555, 666)) * 0.2, Seq(-1, 0, 1)) , this results in one output UGen carrying one channel, and another one carrying two channels. (The way this works is consistent with SCLang). In order to get the correct behaviour (left outputs of the PanAz summed, and right output of the PanAz summed), wrap this expression in a Mix(...) before passing it to the output UGen.

'''Note''': You cannot currently achieve sample accurate scheduling in SuperCollider. This UGen is therefore more or less useless.

Value Params
bus

bus index to write to. For an audio-rate UGen, this is an audio-bus, for a control-rate UGen, this is a control-bus.

in

signal to write to the bus. If the UGen is audio-rate, the input must also be audio-rate.

See also
Companion
object
object OnePole extends ProductReader[OnePole]

A one pole (IIR) filter UGen. Implements the formula :

A one pole (IIR) filter UGen. Implements the formula :

out(i) = ((1 - abs(coef)) * in(i)) + (coef * out(i-1))

'''Warning:''' there are bugs when the coefficient is modulated

See also
Companion
class
final case
class OnePole(rate: MaybeRate, in: GE, coeff: GE) extends SingleOut

A one pole (IIR) filter UGen. Implements the formula :

A one pole (IIR) filter UGen. Implements the formula :

out(i) = ((1 - abs(coef)) * in(i)) + (coef * out(i-1))

'''Warning:''' there are bugs when the coefficient is modulated

Value Params
coeff

feedback coefficient. Should be between -1 and +1

in

input signal to be processed

See also
Companion
object
object OneZero extends ProductReader[OneZero]

A one zero (FIR) filter UGen. Implements the formula :

A one zero (FIR) filter UGen. Implements the formula :

out(i) = ((1 - abs(coef)) * in(i)) + (coef * in(i-1))
See also
Companion
class
final case
class OneZero(rate: MaybeRate, in: GE, coeff: GE) extends SingleOut

A one zero (FIR) filter UGen. Implements the formula :

A one zero (FIR) filter UGen. Implements the formula :

out(i) = ((1 - abs(coef)) * in(i)) + (coef * in(i-1))
Value Params
coeff

feed forward coefficient. +0.5 makes a two point averaging filter (see also LPZ1 ), -0.5 makes a differentiator (see also HPZ1 ), +1 makes a single sample delay (see also Delay1 ), -1 makes an inverted single sample delay.

in

input signal to be processed

See also
Companion
object
object Onsets extends ProductReader[Onsets]

An onset detecting UGen for musical audio signals. It detects the beginning of notes/drumbeats/etc. Outputs a control-rate trigger signal which is 1 when an onset is detected, and 0 otherwise.

An onset detecting UGen for musical audio signals. It detects the beginning of notes/drumbeats/etc. Outputs a control-rate trigger signal which is 1 when an onset is detected, and 0 otherwise.

The onset detection should work well for a general range of monophonic and polyphonic audio signals. The onset detection is purely based on signal analysis and does not make use of any "top-down" inferences such as tempo.

There are different functions available for the analysis:

  • 0 "power" -- generally OK, good for percussive input, and also very efficient
  • 1 "magsum" -- generally OK, good for percussive input, and also very efficient
  • 2 "complex" -- performs generally very well, but more CPU-intensive - 3 "rcomplex" (default) -- performs generally very well, and slightly more efficient than "complex" - 4 "phase" -- generally good, especially for tonal input, medium efficiency - 5 "wphase" -- generally very good, especially for tonal input, medium efficiency - 6 "mkl" -- generally very good, medium efficiency, pretty different from the other methods

The differences aren't large, so it is recommended you stick with the default "rcomplex" unless you find specific problems with it. Then maybe try "wphase". The "mkl" type is a bit different from the others so maybe try that too. They all have slightly different characteristics, and in tests perform at a similar quality level.

See also
Companion
class
final case
class Onsets(chain: GE, thresh: GE, fun: GE, decay: GE, noiseFloor: GE, minGap: GE, medianSpan: GE, whType: GE, raw: GE) extends SingleOut with ControlRated with IsIndividual

An onset detecting UGen for musical audio signals. It detects the beginning of notes/drumbeats/etc. Outputs a control-rate trigger signal which is 1 when an onset is detected, and 0 otherwise.

An onset detecting UGen for musical audio signals. It detects the beginning of notes/drumbeats/etc. Outputs a control-rate trigger signal which is 1 when an onset is detected, and 0 otherwise.

The onset detection should work well for a general range of monophonic and polyphonic audio signals. The onset detection is purely based on signal analysis and does not make use of any "top-down" inferences such as tempo.

There are different functions available for the analysis:

  • 0 "power" -- generally OK, good for percussive input, and also very efficient
  • 1 "magsum" -- generally OK, good for percussive input, and also very efficient
  • 2 "complex" -- performs generally very well, but more CPU-intensive - 3 "rcomplex" (default) -- performs generally very well, and slightly more efficient than "complex" - 4 "phase" -- generally good, especially for tonal input, medium efficiency - 5 "wphase" -- generally very good, especially for tonal input, medium efficiency - 6 "mkl" -- generally very good, medium efficiency, pretty different from the other methods

The differences aren't large, so it is recommended you stick with the default "rcomplex" unless you find specific problems with it. Then maybe try "wphase". The "mkl" type is a bit different from the others so maybe try that too. They all have slightly different characteristics, and in tests perform at a similar quality level.

Value Params
chain

the output (buffer) of an FFT UGen which transforms the audio input to track. For the FFT chain, you should typically use a frame size of 512 or 1024 (at 44.1 kHz sampling rate) and 50% hop size (which is the default setting in SC). For different sampling rates choose an FFT size to cover a similar time-span (around 10 to 20 ms).

decay

(advanced setting) Specifies the time (in seconds) for the normalisation to "forget" about a recent onset. If you find too much re-triggering (e.g. as a note dies away unevenly) then you might wish to increase this value. Not used with "mkl".

fun

index of a function to be used to analyse the signal. See main paragraph for possible values (usually can be left to default).

medianSpan

(advanced setting) Specifies the size (in FFT frames) of the median window used for smoothing the detection function before triggering.

minGap

(advanced setting) Specifies a minimum gap (in FFT frames) between onset detections, a brute-force way to prevent too many doubled detections.

noiseFloor

(advanced setting) This is a lower limit, connected to the idea of how quiet the sound is expected to get without becoming indistinguishable from noise. For some cleanly-recorded classical music with wide dynamic variations, it was found helpful to go down as far as 1e-6. Not used with "mkl".

raw

(advanced setting) ? ''(init-time only)''

thresh

the detection threshold, typically between 0 and 1, although in rare cases you may find values outside this range useful

whType

(advanced setting) ?

See also
Companion
object
object Osc extends ProductReader[Osc]

An oscillator UGen that linearly interpolates a wavetable. It has frequency and phase modulation inputs. The wave table is provided by a buffer filled with a wavetable format signal. The buffer size must be a power of 2.

An oscillator UGen that linearly interpolates a wavetable. It has frequency and phase modulation inputs. The wave table is provided by a buffer filled with a wavetable format signal. The buffer size must be a power of 2.

The buffer is typically filled by a b_gen OSC message. (e.g. buf.sine1(...) , buf.sine2(...) etc.)

===Examples===

// sine1 example
val b = Buffer.alloc(s, 512)
b.sine1(partials = (1 to 6).map(1.0f / _),
 normalize = true, wavetable = true, clear = true)

play {
 Osc.ar(b.id, 200) * 0.3
}
See also
Companion
class
final case
class Osc(rate: Rate, buf: GE, freq: GE, phase: GE) extends SingleOut with IsIndividual

An oscillator UGen that linearly interpolates a wavetable. It has frequency and phase modulation inputs. The wave table is provided by a buffer filled with a wavetable format signal. The buffer size must be a power of 2.

An oscillator UGen that linearly interpolates a wavetable. It has frequency and phase modulation inputs. The wave table is provided by a buffer filled with a wavetable format signal. The buffer size must be a power of 2.

The buffer is typically filled by a b_gen OSC message. (e.g. buf.sine1(...) , buf.sine2(...) etc.)

Value Params
buf

the buffer with the wavetable in special wavetable format. the size must be a power of two.

freq

frequency of table scans in Hz, corresponding to the fundamental frequency of the sound.

phase

phase offset or modulator in radians. The value should be within the range of -8Pi to +8Pi.

See also
Companion
object
object OscN extends ProductReader[OscN]
Companion
class
final case
class OscN(rate: Rate, buf: GE, freq: GE, phase: GE) extends SingleOut with IsIndividual
Companion
object
object Out extends ProductReader[Out]

A UGen that writes a signal onto a bus. It adds ("mixes") the input-signal to the existing contents of the bus.

A UGen that writes a signal onto a bus. It adds ("mixes") the input-signal to the existing contents of the bus.

Multi-channel input signals, for example a PanAz , are written as such to the bus without expansion. That is, the bus index argument is used for the first channel, the second channel will appear on bus + 1 , etc.

If you have an expanding multi-channel input, however, you have to be careful. For example, if you have PanAz.ar(2, SinOsc.ar(Seq(444, 555, 666)) * 0.2, Seq(-1, 0, 1)) , this results in one output UGen carrying one channel, and another one carrying two channels. (The way this works is consistent with SCLang). In order to get the correct behaviour (left outputs of the PanAz summed, and right output of the PanAz summed), wrap this expression in a Mix(...) before passing it to the output UGen.

===Examples===

// cross-synth routing
// allocate an internal stereo audio-bus
val bus = Bus.audio(s, 2)

// writes to internal bus (initially inaudible)
val x = play {
 Out.ar(bus.index, Dust.ar(Seq(345, 345)))
}

// reads internal bus and makes it audible.
// must be after `x` to be able to read the bus signal
val y = play(target = x, addAction = addAfter) {
 val in = In.ar(bus.index, 2)
 Resonz.ar(in, 555, 0.1) * 10
}

// when done, do not forget to free the bus
y.free(); x.free(); bus.free()
See also
Companion
class
final case
class Out(rate: Rate, bus: GE, in: GE) extends ZeroOut with HasSideEffect with IsIndividual

A UGen that writes a signal onto a bus. It adds ("mixes") the input-signal to the existing contents of the bus.

A UGen that writes a signal onto a bus. It adds ("mixes") the input-signal to the existing contents of the bus.

Multi-channel input signals, for example a PanAz , are written as such to the bus without expansion. That is, the bus index argument is used for the first channel, the second channel will appear on bus + 1 , etc.

If you have an expanding multi-channel input, however, you have to be careful. For example, if you have PanAz.ar(2, SinOsc.ar(Seq(444, 555, 666)) * 0.2, Seq(-1, 0, 1)) , this results in one output UGen carrying one channel, and another one carrying two channels. (The way this works is consistent with SCLang). In order to get the correct behaviour (left outputs of the PanAz summed, and right output of the PanAz summed), wrap this expression in a Mix(...) before passing it to the output UGen.

Value Params
bus

bus index to write to. For an audio-rate UGen, this is an audio-bus, for a control-rate UGen, this is a control-bus. '''Note''' that the bus index can only be modulated at control-rate.

in

signal to write to the bus. If the UGen is audio-rate, the input must also be audio-rate.

See also
Companion
object
object PV_Add extends ProductReader[PV_Add]

A phase vocoder UGen that performs a complex addition of the two inputs. The formula is (Re(A) + Re(B)) + i(Im(A) + Im(B)) .

A phase vocoder UGen that performs a complex addition of the two inputs. The formula is (Re(A) + Re(B)) + i(Im(A) + Im(B)) .

Companion
class
final case
class PV_Add(chainA: GE, chainB: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that performs a complex addition of the two inputs. The formula is (Re(A) + Re(B)) + i(Im(A) + Im(B)) .

A phase vocoder UGen that performs a complex addition of the two inputs. The formula is (Re(A) + Re(B)) + i(Im(A) + Im(B)) .

Value Params
chainA

the first FFT'ed buffer (this gets replaced by the output signal)

chainB

the second FFT'ed buffer

Companion
object
object PV_BinScramble extends ProductReader[PV_BinScramble]

A phase vocoder UGen that randomizes the order of the bins. The trigger will select a new random ordering.

A phase vocoder UGen that randomizes the order of the bins. The trigger will select a new random ordering.

Companion
class
final case
class PV_BinScramble(chain: GE, wipe: GE, width: GE, trig: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that randomizes the order of the bins. The trigger will select a new random ordering.

A phase vocoder UGen that randomizes the order of the bins. The trigger will select a new random ordering.

Value Params
chain

the FFT'ed buffer

trig

causes a new random bin re-ordering to be made. a trigger occurs when passing from non-positive to positive value.

width

a value from zero to one, indicating the maximum randomized distance of a bin from its original location in the spectrum.

wipe

the amount of bins scrambled, from 0 (none) to 1 (all bins scrambled).

Companion
object
object PV_BinShift extends ProductReader[PV_BinShift]

A phase vocoder UGen that stretches and shifts the spectrum. It takes each bin, first stretches (scales) its position (bin number) with a given factor, and then adds a shift to it.

A phase vocoder UGen that stretches and shifts the spectrum. It takes each bin, first stretches (scales) its position (bin number) with a given factor, and then adds a shift to it.

Companion
class
final case
class PV_BinShift(chain: GE, stretch: GE, shift: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that stretches and shifts the spectrum. It takes each bin, first stretches (scales) its position (bin number) with a given factor, and then adds a shift to it.

A phase vocoder UGen that stretches and shifts the spectrum. It takes each bin, first stretches (scales) its position (bin number) with a given factor, and then adds a shift to it.

Value Params
chain

the FFT'ed buffer

shift

the translation of the spectrum, in number of bins. Since the FFT produces a linear frequency axis, the will produce harmonic distortion.

stretch

the factor to multiply each bin position with, where 0.5 kind of transposes the signal down by an octave, and 2 transposes it up by an octave.

Companion
object
object PV_BinWipe extends ProductReader[PV_BinWipe]

A phase vocoder UGen that combine low and high bins from two inputs. It does so by copying low bins from one input and the high bins of the other, thus realizes a kind of "wipe" between the two input signals.

A phase vocoder UGen that combine low and high bins from two inputs. It does so by copying low bins from one input and the high bins of the other, thus realizes a kind of "wipe" between the two input signals.

See also
Companion
class
final case
class PV_BinWipe(chainA: GE, chainB: GE, wipe: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that combine low and high bins from two inputs. It does so by copying low bins from one input and the high bins of the other, thus realizes a kind of "wipe" between the two input signals.

A phase vocoder UGen that combine low and high bins from two inputs. It does so by copying low bins from one input and the high bins of the other, thus realizes a kind of "wipe" between the two input signals.

Value Params
chainA

the first FFT'ed buffer (this gets replaced by the output signal)

chainB

the second FFT'ed buffer

wipe

can range between -1 and +1. if wipe == 0 then the output is the same as inA. if wipe > 0 then it begins replacing with bins from inB from the bottom up. if wipe < 0 then it begins replacing with bins from inB from the top down.

See also
Companion
object
object PV_BrickWall extends ProductReader[PV_BrickWall]

A phase vocoder UGen that clears bins above or below a cutoff point.

A phase vocoder UGen that clears bins above or below a cutoff point.

Companion
class
final case
class PV_BrickWall(chain: GE, wipe: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that clears bins above or below a cutoff point.

A phase vocoder UGen that clears bins above or below a cutoff point.

Value Params
chain

the FFT'ed buffer

wipe

can range between -1 and +1. if wipe == 0 then there is no effect. if wipe > 0 then it acts like a high pass filter, clearing bins from the bottom up. if wipe < 0 then it acts like a low pass filter, clearing bins from the top down.

Companion
object
object PV_ConformalMap extends ProductReader[PV_ConformalMap]

A UGen that applies the conformal mapping z => (z - a) / (1 - za*) to its input FFT bins z .

A UGen that applies the conformal mapping z => (z - a) / (1 - za*) to its input FFT bins z .

It makes a transformation of the complex plane so the output is full of phase vocoder artifacts but may be musically interesting. One should usually keep |a| < 1 , although bigger values may be used to produce noise. A value of a = 0 gives back the input mostly unperturbed.

===Examples===

// mouse control
play {
 val sf   = Seq.fill(3)(Rand(0.1, 0.5))
 val sadd = Seq(1, 1.1, 1.5, 1.78, 2.45, 6.7).map(_ * 220)
 val in   = Mix(LFSaw.ar(SinOsc.kr(sf).mulAdd(10, sadd)) * 0.3)
 val fft  = FFT(LocalBuf(2048), in)
 val re   = MouseX.kr(0.01,  2.0, 1)
 val im   = MouseY.kr(0.01, 10.0, 1)
 val pv   = PV_ConformalMap(fft, re, im)
 val out  = IFFT.ar(pv)
 val vrb  = CombN.ar(out, 0.1, 0.1, 10)
 Pan2.ar(out + vrb * 0.5, 0, 0.3)
}
Companion
class
final case
class PV_ConformalMap(chain: GE, real: GE, imag: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A UGen that applies the conformal mapping z => (z - a) / (1 - za*) to its input FFT bins z .

A UGen that applies the conformal mapping z => (z - a) / (1 - za*) to its input FFT bins z .

It makes a transformation of the complex plane so the output is full of phase vocoder artifacts but may be musically interesting. One should usually keep |a| < 1 , although bigger values may be used to produce noise. A value of a = 0 gives back the input mostly unperturbed.

Value Params
chain

the FFT'ed buffer

imag

imaginary part of the complex parameter a

real

real part of the complex parameter a

Companion
object
object PV_Conj extends ProductReader[PV_Conj]

A phase vocoder UGen that converts the bins into their complex conjugate counterparts. The complex conjugate is equal to the input, but with reversed sign of the imaginary part.

A phase vocoder UGen that converts the bins into their complex conjugate counterparts. The complex conjugate is equal to the input, but with reversed sign of the imaginary part.

Companion
class
final case
class PV_Conj(chain: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that converts the bins into their complex conjugate counterparts. The complex conjugate is equal to the input, but with reversed sign of the imaginary part.

A phase vocoder UGen that converts the bins into their complex conjugate counterparts. The complex conjugate is equal to the input, but with reversed sign of the imaginary part.

Value Params
chain

the FFT'ed buffer

Companion
object
object PV_Copy extends ProductReader[PV_Copy]

A phase vocoder UGen that copies the spectral frames from chainA to chainB. This allows for parallel processing of spectral data without the need for multiple FFT UGens, and to copy out data at that point in the chain for other purposes. chainA and chainB must be the same size. The output will carry further chainA, so you chan insert the ugen at the appropriate place in the signal chain.

A phase vocoder UGen that copies the spectral frames from chainA to chainB. This allows for parallel processing of spectral data without the need for multiple FFT UGens, and to copy out data at that point in the chain for other purposes. chainA and chainB must be the same size. The output will carry further chainA, so you chan insert the ugen at the appropriate place in the signal chain.

Companion
class
final case
class PV_Copy(chainA: GE, chainB: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that copies the spectral frames from chainA to chainB. This allows for parallel processing of spectral data without the need for multiple FFT UGens, and to copy out data at that point in the chain for other purposes. chainA and chainB must be the same size. The output will carry further chainA, so you chan insert the ugen at the appropriate place in the signal chain.

A phase vocoder UGen that copies the spectral frames from chainA to chainB. This allows for parallel processing of spectral data without the need for multiple FFT UGens, and to copy out data at that point in the chain for other purposes. chainA and chainB must be the same size. The output will carry further chainA, so you chan insert the ugen at the appropriate place in the signal chain.

Value Params
chainA

the first FFT'ed buffer (this gets replaced by the output signal)

chainB

the second FFT'ed buffer

Companion
object
object PV_CopyPhase extends ProductReader[PV_CopyPhase]

A phase vocoder UGen that combines the magnitudes of first input and phases of the second input. phases of the first input.

A phase vocoder UGen that combines the magnitudes of first input and phases of the second input. phases of the first input.

Companion
class
final case
class PV_CopyPhase(chainA: GE, chainB: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that combines the magnitudes of first input and phases of the second input. phases of the first input.

A phase vocoder UGen that combines the magnitudes of first input and phases of the second input. phases of the first input.

Value Params
chainA

the first FFT'ed buffer (this gets replaced by the output signal)

chainB

the second FFT'ed buffer

Companion
object
object PV_Diffuser extends ProductReader[PV_Diffuser]

A phase vocoder UGen that adds a different constant random phase shift to each bin. The trigger will select a new set of random phases.

A phase vocoder UGen that adds a different constant random phase shift to each bin. The trigger will select a new set of random phases.

Companion
class
final case
class PV_Diffuser(chain: GE, trig: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that adds a different constant random phase shift to each bin. The trigger will select a new set of random phases.

A phase vocoder UGen that adds a different constant random phase shift to each bin. The trigger will select a new set of random phases.

Value Params
chain

the FFT'ed buffer

trig

to trigger a new selection of random phases. A trigger occurs when passing from non-positive to positive value.

Companion
object
object PV_Div extends ProductReader[PV_Div]

A phase vocoder UGen that performs a complex division of the two inputs. Be careful that chainB , the divisor, does not contain zeroes as they would obviously blow up the division.

A phase vocoder UGen that performs a complex division of the two inputs. Be careful that chainB , the divisor, does not contain zeroes as they would obviously blow up the division.

Companion
class
final case
class PV_Div(chainA: GE, chainB: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that performs a complex division of the two inputs. Be careful that chainB , the divisor, does not contain zeroes as they would obviously blow up the division.

A phase vocoder UGen that performs a complex division of the two inputs. Be careful that chainB , the divisor, does not contain zeroes as they would obviously blow up the division.

Value Params
chainA

the first FFT'ed buffer (this gets replaced by the output signal)

chainB

the second FFT'ed buffer

Companion
object
object PV_HainsworthFoote extends ProductReader[PV_HainsworthFoote]

An FFT based onset detector UGen using a balance of two features. It is based on work described in Hainsworth (2003), "Techniques for the Automated Analysis of Musical Audio," PhD thesis, University of Cambridge. See especially p. 128. The Hainsworth metric is a modification of the Kullback Liebler distance.

An FFT based onset detector UGen using a balance of two features. It is based on work described in Hainsworth (2003), "Techniques for the Automated Analysis of Musical Audio," PhD thesis, University of Cambridge. See especially p. 128. The Hainsworth metric is a modification of the Kullback Liebler distance.

===Examples===

// observe detection
play {
 val sig = Decay.ar(Dust.ar(2), 0.1) * WhiteNoise.ar(0.25)
 val th  = MouseX.kr(0.3, 1.0, lag = 0)
 th.poll(HPZ1.kr(th).abs, "thresh")
 val h   = MouseY.kr(1.0, 0.1, lag = 0)
 val f   = 1 - h
 h.poll(HPZ1.kr(h).abs, "h-f")
 val tr  = PV_HainsworthFoote.ar(FFT(LocalBuf(2048), sig), h, f, thresh = th)
 Seq(sig, SinOsc.ar(440) * Decay.ar(tr * 0.01, 0.1))
}
See also
Companion
class
final case
class PV_HainsworthFoote(rate: Rate, chain: GE, hainsworth: GE, foote: GE, thresh: GE, waitTime: GE) extends SingleOut with IsIndividual

An FFT based onset detector UGen using a balance of two features. It is based on work described in Hainsworth (2003), "Techniques for the Automated Analysis of Musical Audio," PhD thesis, University of Cambridge. See especially p. 128. The Hainsworth metric is a modification of the Kullback Liebler distance.

An FFT based onset detector UGen using a balance of two features. It is based on work described in Hainsworth (2003), "Techniques for the Automated Analysis of Musical Audio," PhD thesis, University of Cambridge. See especially p. 128. The Hainsworth metric is a modification of the Kullback Liebler distance.

Value Params
chain

the fft signal (buffer) to analyze

foote

what strength of detection signal from normalized Foote metric (0 to 1) to use.

hainsworth

what strength of detection signal from Hainsworth metric (0 to 1) to use.

thresh

threshold level for detection

waitTime

after an onset is detected, further detections are suppressed for this period in seconds, preventing multiple rapid triggers

See also
Companion
object
object PV_JensenAndersen extends ProductReader[PV_JensenAndersen]

An FFT based onset detector UGen using a mix of extracted features. It is based on work described in Jensen and Andersen (2003), "Real-time Beat Estimation Using Feature Extraction," in: Proceedings of the Computer Music Modeling and Retrieval Symposium.

An FFT based onset detector UGen using a mix of extracted features. It is based on work described in Jensen and Andersen (2003), "Real-time Beat Estimation Using Feature Extraction," in: Proceedings of the Computer Music Modeling and Retrieval Symposium.

First order derivatives of the features are taken. The threshold may need to be set low to pick up on changes.

===Examples===

// observe detection
play {
 val sig = Decay.ar(Dust.ar(2), 0.1) * WhiteNoise.ar(0.25)
 val th  = MouseX.kr(0.1, 1.0, lag = 0)
 th.poll(HPZ1.kr(th).abs, "thresh")
 val tr  = PV_JensenAndersen.ar(FFT(LocalBuf(2048), sig), thresh = th)
 Seq(sig, SinOsc.ar(440) * Decay.ar(tr * 0.01, 0.1))
}
See also
Companion
class
final case
class PV_JensenAndersen(rate: Rate, chain: GE, centroid: GE, hfe: GE, hfc: GE, flux: GE, thresh: GE, waitTime: GE) extends SingleOut with IsIndividual

An FFT based onset detector UGen using a mix of extracted features. It is based on work described in Jensen and Andersen (2003), "Real-time Beat Estimation Using Feature Extraction," in: Proceedings of the Computer Music Modeling and Retrieval Symposium.

An FFT based onset detector UGen using a mix of extracted features. It is based on work described in Jensen and Andersen (2003), "Real-time Beat Estimation Using Feature Extraction," in: Proceedings of the Computer Music Modeling and Retrieval Symposium.

First order derivatives of the features are taken. The threshold may need to be set low to pick up on changes.

Value Params
centroid

proportion (0 to 1) of spectral centroid feature

chain

the fft signal (buffer) to analyze

flux

proportion (0 to 1) of spectral flux feature

hfc

proportion (0 to 1) of high frequency content feature

hfe

proportion (0 to 1) of high frequency energy feature

thresh

threshold level for detection

waitTime

after an onset is detected, further detections are suppressed for this period in seconds, preventing multiple rapid triggers

See also
Companion
object
object PV_LocalMax extends ProductReader[PV_LocalMax]

A phase vocoder UGen that passes only those bins whose magnitudes constitute local maxima. Additionally, the given threshold is also used to filter out bins whose magnitude lies below this threshold.

A phase vocoder UGen that passes only those bins whose magnitudes constitute local maxima. Additionally, the given threshold is also used to filter out bins whose magnitude lies below this threshold.

Companion
class
final case
class PV_LocalMax(chain: GE, thresh: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that passes only those bins whose magnitudes constitute local maxima. Additionally, the given threshold is also used to filter out bins whose magnitude lies below this threshold.

A phase vocoder UGen that passes only those bins whose magnitudes constitute local maxima. Additionally, the given threshold is also used to filter out bins whose magnitude lies below this threshold.

Value Params
chain

the FFT'ed buffer

thresh

magnitude threshold used for general filtering, prior to the local-maximum-filtering

Companion
object
object PV_MagAbove extends ProductReader[PV_MagAbove]

A phase vocoder UGen that passes only those bins whose magnitudes are above a given threshold.

A phase vocoder UGen that passes only those bins whose magnitudes are above a given threshold.

Companion
class
final case
class PV_MagAbove(chain: GE, thresh: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that passes only those bins whose magnitudes are above a given threshold.

A phase vocoder UGen that passes only those bins whose magnitudes are above a given threshold.

Value Params
chain

the FFT'ed buffer

thresh

magnitude threshold.

Companion
object
object PV_MagBelow extends ProductReader[PV_MagBelow]

A phase vocoder UGen that passes only those bins whose magnitudes are below a given threshold.

A phase vocoder UGen that passes only those bins whose magnitudes are below a given threshold.

Companion
class
final case
class PV_MagBelow(chain: GE, thresh: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that passes only those bins whose magnitudes are below a given threshold.

A phase vocoder UGen that passes only those bins whose magnitudes are below a given threshold.

Value Params
chain

the FFT'ed buffer

thresh

magnitude threshold.

Companion
object
object PV_MagClip extends ProductReader[PV_MagClip]

A phase vocoder UGen that limits (clips) the magnitude of the bins to a given threshold.

A phase vocoder UGen that limits (clips) the magnitude of the bins to a given threshold.

Companion
class
final case
class PV_MagClip(chain: GE, thresh: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that limits (clips) the magnitude of the bins to a given threshold.

A phase vocoder UGen that limits (clips) the magnitude of the bins to a given threshold.

Value Params
chain

the FFT'ed buffer

thresh

magnitude threshold. Each bin's magnitude is limited to be not greater than this threshold.

Companion
object
object PV_MagDiv extends ProductReader[PV_MagDiv]

A phase vocoder UGen that divides magnitudes of two inputs and keeps the phases of the first input.

A phase vocoder UGen that divides magnitudes of two inputs and keeps the phases of the first input.

Companion
class
final case
class PV_MagDiv(chainA: GE, chainB: GE, zeroes: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that divides magnitudes of two inputs and keeps the phases of the first input.

A phase vocoder UGen that divides magnitudes of two inputs and keeps the phases of the first input.

Value Params
chainA

the first FFT'ed buffer (this gets replaced by the output signal)

chainB

the second FFT'ed buffer

zeroes

the noise floor to assume when detecting zero bins in chainB that would cause a division by zero and hence blow up. The ugen will use divide by this magnitude instead when zeroes are detected, resulting in a maximum boost of zeroes.reciprocal .

Companion
object
object PV_MagFreeze extends ProductReader[PV_MagFreeze]

A phase vocoder UGen that freezes the magnitudes at current levels. Freezing happens when the freeze input has a value of > 0.

A phase vocoder UGen that freezes the magnitudes at current levels. Freezing happens when the freeze input has a value of > 0.

Companion
class
final case
class PV_MagFreeze(chain: GE, freeze: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that freezes the magnitudes at current levels. Freezing happens when the freeze input has a value of > 0.

A phase vocoder UGen that freezes the magnitudes at current levels. Freezing happens when the freeze input has a value of > 0.

Value Params
chain

the FFT'ed buffer

freeze

whether the current levels are frozen (> 0) or not (0).

Companion
object
object PV_MagMul extends ProductReader[PV_MagMul]

A phase vocoder UGen that multiplies the magnitudes of two inputs and keeps the phases of the first input.

A phase vocoder UGen that multiplies the magnitudes of two inputs and keeps the phases of the first input.

Companion
class
final case
class PV_MagMul(chainA: GE, chainB: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that multiplies the magnitudes of two inputs and keeps the phases of the first input.

A phase vocoder UGen that multiplies the magnitudes of two inputs and keeps the phases of the first input.

Value Params
chainA

the first FFT'ed buffer (this gets replaced by the output signal)

chainB

the second FFT'ed buffer

Companion
object
object PV_MagNoise extends ProductReader[PV_MagNoise]

A phase vocoder UGen that multiplies the magnitudes by random noise.

A phase vocoder UGen that multiplies the magnitudes by random noise.

Companion
class
final case
class PV_MagNoise(chain: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that multiplies the magnitudes by random noise.

A phase vocoder UGen that multiplies the magnitudes by random noise.

Value Params
chain

the FFT'ed buffer

Companion
object
object PV_MagShift extends ProductReader[PV_MagShift]

A phase vocoder UGen that stretches and shifts the magnitudes of the spectrum. This is live PV_BinShift but instead of scaling and shifting the whole complex bins (magnitude and phase), this only operates on the magnitudes and leaves the phases in their original bins.

A phase vocoder UGen that stretches and shifts the magnitudes of the spectrum. This is live PV_BinShift but instead of scaling and shifting the whole complex bins (magnitude and phase), this only operates on the magnitudes and leaves the phases in their original bins.

Companion
class
final case
class PV_MagShift(chain: GE, stretch: GE, shift: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that stretches and shifts the magnitudes of the spectrum. This is live PV_BinShift but instead of scaling and shifting the whole complex bins (magnitude and phase), this only operates on the magnitudes and leaves the phases in their original bins.

A phase vocoder UGen that stretches and shifts the magnitudes of the spectrum. This is live PV_BinShift but instead of scaling and shifting the whole complex bins (magnitude and phase), this only operates on the magnitudes and leaves the phases in their original bins.

Value Params
chain

the FFT'ed buffer

shift

the translation of the spectrum, in number of bins

stretch

the factor to multiply each bin position with

Companion
object
object PV_MagSmear extends ProductReader[PV_MagSmear]

A phase vocoder UGen that averages each bin's magnitude with its neighbors.

A phase vocoder UGen that averages each bin's magnitude with its neighbors.

Companion
class
final case
class PV_MagSmear(chain: GE, bins: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that averages each bin's magnitude with its neighbors.

A phase vocoder UGen that averages each bin's magnitude with its neighbors.

Value Params
bins

number of bins to average on each side of bin. As this number rises, so will CPU usage.

chain

the FFT'ed buffer

Companion
object
object PV_MagSquared extends ProductReader[PV_MagSquared]

A phase vocoder UGen that squares the magnitudes and re-normalizes to previous peak. This makes weak bins weaker.

A phase vocoder UGen that squares the magnitudes and re-normalizes to previous peak. This makes weak bins weaker.

Companion
class
final case
class PV_MagSquared(chain: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that squares the magnitudes and re-normalizes to previous peak. This makes weak bins weaker.

A phase vocoder UGen that squares the magnitudes and re-normalizes to previous peak. This makes weak bins weaker.

Value Params
chain

the FFT'ed buffer

Companion
object
object PV_Max extends ProductReader[PV_Max]

A phase vocoder UGen that outputs the bins with the maximum magnitude of the two inputs.

A phase vocoder UGen that outputs the bins with the maximum magnitude of the two inputs.

Companion
class
final case
class PV_Max(chainA: GE, chainB: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that outputs the bins with the maximum magnitude of the two inputs.

A phase vocoder UGen that outputs the bins with the maximum magnitude of the two inputs.

Value Params
chainA

the first FFT'ed buffer (this gets replaced by the output signal)

chainB

the second FFT'ed buffer

Companion
object
object PV_Min extends ProductReader[PV_Min]

A phase vocoder UGen that outputs the bins with the minimum magnitude of the two inputs.

A phase vocoder UGen that outputs the bins with the minimum magnitude of the two inputs.

Companion
class
final case
class PV_Min(chainA: GE, chainB: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that outputs the bins with the minimum magnitude of the two inputs.

A phase vocoder UGen that outputs the bins with the minimum magnitude of the two inputs.

Value Params
chainA

the first FFT'ed buffer (this gets replaced by the output signal)

chainB

the second FFT'ed buffer

Companion
object
object PV_Mul extends ProductReader[PV_Mul]

A phase vocoder UGen that performs a complex multiplication of the two inputs. The formula is (Re(A) * Re(B) - Im(A) * Im(B)) + i(Im(A) * Re(B) + Re(A) * Im(B)) .

A phase vocoder UGen that performs a complex multiplication of the two inputs. The formula is (Re(A) * Re(B) - Im(A) * Im(B)) + i(Im(A) * Re(B) + Re(A) * Im(B)) .

Companion
class
final case
class PV_Mul(chainA: GE, chainB: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that performs a complex multiplication of the two inputs. The formula is (Re(A) * Re(B) - Im(A) * Im(B)) + i(Im(A) * Re(B) + Re(A) * Im(B)) .

A phase vocoder UGen that performs a complex multiplication of the two inputs. The formula is (Re(A) * Re(B) - Im(A) * Im(B)) + i(Im(A) * Re(B) + Re(A) * Im(B)) .

Value Params
chainA

the first FFT'ed buffer (this gets replaced by the output signal)

chainB

the second FFT'ed buffer

Companion
object
object PV_PhaseShift extends ProductReader[PV_PhaseShift]

A phase vocoder UGen that shifts the phase of each bins by a given amount.

A phase vocoder UGen that shifts the phase of each bins by a given amount.

Companion
class
final case
class PV_PhaseShift(chain: GE, shift: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that shifts the phase of each bins by a given amount.

A phase vocoder UGen that shifts the phase of each bins by a given amount.

Value Params
chain

the FFT'ed buffer

shift

phase shift in radians

Companion
object
object PV_PhaseShift270 extends ProductReader[PV_PhaseShift270]

A phase vocoder UGen that shift the phase of all bins by 270 (or -90) degrees.

A phase vocoder UGen that shift the phase of all bins by 270 (or -90) degrees.

Companion
class
final case
class PV_PhaseShift270(chain: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that shift the phase of all bins by 270 (or -90) degrees.

A phase vocoder UGen that shift the phase of all bins by 270 (or -90) degrees.

Value Params
chain

the FFT'ed buffer

Companion
object
object PV_PhaseShift90 extends ProductReader[PV_PhaseShift90]

A phase vocoder UGen that shift the phase of all bins by 90 degrees.

A phase vocoder UGen that shift the phase of all bins by 90 degrees.

Companion
class
final case
class PV_PhaseShift90(chain: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that shift the phase of all bins by 90 degrees.

A phase vocoder UGen that shift the phase of all bins by 90 degrees.

Value Params
chain

the FFT'ed buffer

Companion
object
object PV_RandComb extends ProductReader[PV_RandComb]

A phase vocoder UGen that randomly clears out bins of the signal. Which bins are wiped out is subject to a random choice (only the amount is specified) that remains constant between triggers.

A phase vocoder UGen that randomly clears out bins of the signal. Which bins are wiped out is subject to a random choice (only the amount is specified) that remains constant between triggers.

Companion
class
final case
class PV_RandComb(chain: GE, wipe: GE, trig: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that randomly clears out bins of the signal. Which bins are wiped out is subject to a random choice (only the amount is specified) that remains constant between triggers.

A phase vocoder UGen that randomly clears out bins of the signal. Which bins are wiped out is subject to a random choice (only the amount is specified) that remains constant between triggers.

Value Params
chain

the FFT'ed buffer

trig

causes a new random bin selection to be made. a trigger occurs when passing from non-positive to positive value.

wipe

the probability (from 0 to 1) of bins being wiped out, hence 0 means no bins are wiped out, 1 means all bins are wiped out (output will be silence).

Companion
object
object PV_RandWipe extends ProductReader[PV_RandWipe]

A phase vocoder UGen that cross-fades between two input spectra by taking bins randomly from them according to a given probability.

A phase vocoder UGen that cross-fades between two input spectra by taking bins randomly from them according to a given probability.

See also
Companion
class
final case
class PV_RandWipe(chainA: GE, chainB: GE, wipe: GE, trig: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that cross-fades between two input spectra by taking bins randomly from them according to a given probability.

A phase vocoder UGen that cross-fades between two input spectra by taking bins randomly from them according to a given probability.

Value Params
chainA

the first FFT'ed buffer (this gets replaced by the output signal)

chainB

the second FFT'ed buffer

trig

a signal the triggers the re-newed process of determining for each bin whether it will be taken from input A or B. A trigger occurs when passing from non-positive to positive value.

wipe

the crossfader position from 0.0 (all bins are taken from chainA ) to 1.0 (all bins are taken from chainB ). For instance, if wipe is 0.5, half of the bins are taken from either input. The decision whether a bin is taken from A or B is random, however remains constant between two triggers.

See also
Companion
object
object PV_RectComb extends ProductReader[PV_RectComb]

A phase vocoder UGen that makes a series of gaps in a spectrum. This is done by multiplying the spectrum with a kind of rectangle wave that goes from zero to nyquist. The high slope of the rectangle lets the input bins pass (quasi pass-band), the low slope filters them out (quasi stop-band).

A phase vocoder UGen that makes a series of gaps in a spectrum. This is done by multiplying the spectrum with a kind of rectangle wave that goes from zero to nyquist. The high slope of the rectangle lets the input bins pass (quasi pass-band), the low slope filters them out (quasi stop-band).

See also
Companion
class
final case
class PV_RectComb(chain: GE, numTeeth: GE, phase: GE, width: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that makes a series of gaps in a spectrum. This is done by multiplying the spectrum with a kind of rectangle wave that goes from zero to nyquist. The high slope of the rectangle lets the input bins pass (quasi pass-band), the low slope filters them out (quasi stop-band).

A phase vocoder UGen that makes a series of gaps in a spectrum. This is done by multiplying the spectrum with a kind of rectangle wave that goes from zero to nyquist. The high slope of the rectangle lets the input bins pass (quasi pass-band), the low slope filters them out (quasi stop-band).

Value Params
chain

the FFT'ed buffer

numTeeth

the number of periods in the rectangle wave, where zero would mean the input signal is not affected, one means that there is exactly one period of the wave across the spectrum, hence one pass-band and one stop-band.

phase

the phase offset of the rectangle wave, where 1.0 is one full period. This is like the offset into the wavetable holding the rectangle, so a value of 0.25 means we start 25% into the basic waveform, and after 0.75 periods the next full period (high slope) begins.

width

the pulse width between 0.0 (infinitely small high slope, so all bins filtered out) to 0.5 (half period is high slope, half period is low slope) to 1.0 (maximally wide high slope, no bins filtered out).

See also
Companion
object
object PV_RectComb2 extends ProductReader[PV_RectComb2]

A phase vocoder UGen that switches between two input spectra according to a rectangle wave. This is basically identical to PV_RectComb , however during the low slopes of the rectangle wave, instead of clearing out the bins, it copies over the corresponding bins of the second fft input buffer.

A phase vocoder UGen that switches between two input spectra according to a rectangle wave. This is basically identical to PV_RectComb , however during the low slopes of the rectangle wave, instead of clearing out the bins, it copies over the corresponding bins of the second fft input buffer.

See also
Companion
class
final case
class PV_RectComb2(chainA: GE, chainB: GE, numTeeth: GE, phase: GE, width: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A phase vocoder UGen that switches between two input spectra according to a rectangle wave. This is basically identical to PV_RectComb , however during the low slopes of the rectangle wave, instead of clearing out the bins, it copies over the corresponding bins of the second fft input buffer.

A phase vocoder UGen that switches between two input spectra according to a rectangle wave. This is basically identical to PV_RectComb , however during the low slopes of the rectangle wave, instead of clearing out the bins, it copies over the corresponding bins of the second fft input buffer.

Value Params
chainA

the first FFT'ed buffer (this gets replaced by the output signal)

chainB

the second FFT'ed buffer

numTeeth

the number of periods in the rectangle wave, where zero would mean the first input signal is fully passed through, one means that there is exactly one period of the wave across the spectrum, hence one pass-band (first signal passed through) and one stop-band (second signal passed through).

phase

the phase offset of the rectangle wave, where 1.0 is one full period. This is like the offset into the wavetable holding the rectangle, so a value of 0.25 means we start 25% into the basic waveform, and after 0.75 periods the next full period (high slope) begins.

width

the pulse width between 0.0 (infinitely small high slope, so all bins are copied from the second input) to 0.5 (half period is high slope -- copied from first input --, half period is low slope -- copied from second input) to 1.0 (maximally wide high slope, so all bins passed from the first input).

See also
Companion
object
object PackFFT extends ProductReader[PackFFT]

A UGen that writes a complex input signal into an FFT buffer. The input is a sequence of interleaved magnitudes and phases. It is written to an FFT buffer ready for transforming it back into time-domain audio using IFFT.

A UGen that writes a complex input signal into an FFT buffer. The input is a sequence of interleaved magnitudes and phases. It is written to an FFT buffer ready for transforming it back into time-domain audio using IFFT.

===Examples===

// harmonic sound with changing overtone intensities
play {
 // create simple undulating magnitudes
 val m0 = FSinOsc.kr(Seq.fill(100)(ExpRand(0.1, 1))) * 0.5 + 0.5
 // give them a "rolloff" to make the sound less unpleasant
 val m1 = m0 * Seq.tabulate(100)(_.linLin(0, 99, 1.0, 0.01).squared)
 // turn the bins on and off at different rates
 val mags = m1 * LFPulse.kr(Seq.fill(100)(2 pow IRand(-3, 5)))
 // ignore phase
 val phases: GE = Seq.fill(100)(0)
 // We need to create an FFT chain to feed our data in to.
 // The easiest way is to do an FFT on some signal which we then ignore!
 val buf = FFT(LocalBuf(512), DC.ar(0))
 // now we can do the packing
 val chain = PackFFT(buf, 512, Zip(mags, phases), 0, 99, 1)
 val sig = IFFT.ar(chain)
 Pan2.ar(sig)
}
See also
Companion
class
final case
class PackFFT(chain: GE, fftSize: GE, values: GE, from: GE, to: GE, clear: GE) extends SingleOut with ControlRated with HasSideEffect with IsIndividual

A UGen that writes a complex input signal into an FFT buffer. The input is a sequence of interleaved magnitudes and phases. It is written to an FFT buffer ready for transforming it back into time-domain audio using IFFT.

A UGen that writes a complex input signal into an FFT buffer. The input is a sequence of interleaved magnitudes and phases. It is written to an FFT buffer ready for transforming it back into time-domain audio using IFFT.

Value Params
clear

if 1 , clears the buffer before packing the values, setting its contents to zero.

from

index of lower bin

to

index of upper bin (inclusive)

values

input data to pack. It should be a flat sequence containing interleaved magnitude and phase components of all bins in ascending order. E.g. [mag0, phase0, mag1, phase1, mag2, phase2, ... magN, phaseN]. This input is typically demand-rate.

See also
Companion
object
object Pad extends ProductReader[Pad]

A graph element that controls the multi-channel expansion of its in argument to match the to argument by padding (extending and wrapping) it.

A graph element that controls the multi-channel expansion of its in argument to match the to argument by padding (extending and wrapping) it.

Companion
class
final case
class Pad(in: GE, to: GE) extends SingleOut

A graph element that controls the multi-channel expansion of its in argument to match the to argument by padding (extending and wrapping) it.

A graph element that controls the multi-channel expansion of its in argument to match the to argument by padding (extending and wrapping) it.

Value Params
in

the element to replicate

to

the reference element that controls the multi-channel expansion. the signal itself is not used or output by Pad.

Companion
object
object Pan2 extends ProductReader[Pan2]

A stereo panorama UGen based on equal-power amplitude control. When in center position ( pos = 0 ), the signal is attenuated by sqrt(0.5) or approx. -3 dB.

A stereo panorama UGen based on equal-power amplitude control. When in center position ( pos = 0 ), the signal is attenuated by sqrt(0.5) or approx. -3 dB.

===Examples===

// periodic left-right oscillation
play { Pan2.ar(PinkNoise.ar(0.4), SinOsc.kr(0.25), 0.3) }
See also
Companion
class
final case
class Pan2(rate: Rate, in: GE, pos: GE, level: GE) extends MultiOut

A stereo panorama UGen based on equal-power amplitude control. When in center position ( pos = 0 ), the signal is attenuated by sqrt(0.5) or approx. -3 dB.

A stereo panorama UGen based on equal-power amplitude control. When in center position ( pos = 0 ), the signal is attenuated by sqrt(0.5) or approx. -3 dB.

Value Params
in

(monophonic) input signal to be panned

level

additional gain control

pos

panorama position between -1 (hard left) via 0 (center) to +1 (hard right)

See also
Companion
object
object Pan4 extends ProductReader[Pan4]

A four channel equal-power panorama UGen. The outputs are in order leftFront , rightFront , leftBack , rightBack .

A four channel equal-power panorama UGen. The outputs are in order leftFront , rightFront , leftBack , rightBack .

===Examples===

// mouse controlled pan position
play {
 val x = MouseX.kr(-1, 1)
 val y = MouseY.kr(-1, 1)
 val p = Pan4.ar(PinkNoise.ar, x, y)
 // make a stereo mix with different timbre front and back
 val f = Resonz.ar(Seq(p.leftFront, p.rightFront), 4000, 0.2) * 4
 val r = Resonz.ar(Seq(p.leftBack , p.rightBack ), 1500, 0.2) * 4
 f + r
}
See also
Companion
class
final case
class Pan4(rate: Rate, in: GE, xpos: GE, ypos: GE, level: GE) extends MultiOut

A four channel equal-power panorama UGen. The outputs are in order leftFront , rightFront , leftBack , rightBack .

A four channel equal-power panorama UGen. The outputs are in order leftFront , rightFront , leftBack , rightBack .

Value Params
in

(monophonic) input signal to be panned

level

additional gain control

xpos

horizontal panorama position from -1 (left) to +1 (right)

ypos

front-to-back panorama position from -1 (back) to +1 (front)

See also
Companion
object
object PanAz extends ProductReader[PanAz]

An azimuth-based panorama UGen. It uses vector-based-amplitude panning where the arbitrary number of speakers is supposed to be distributed in a circle with even spacing between them. It uses an equal-power-curve to transition between adjacent speakers. '''Note''' the different default value for the orient argument!

An azimuth-based panorama UGen. It uses vector-based-amplitude panning where the arbitrary number of speakers is supposed to be distributed in a circle with even spacing between them. It uses an equal-power-curve to transition between adjacent speakers. '''Note''' the different default value for the orient argument!

Use case: To spread an multi-channel input signal across an output bus with a different number of channels, such that the first input channel is played on the first output channel (no spread to adjacent channels) and the last input channel is played to the last output channel (no spread to adjacent channels), you would create a dedicated PanAz per input channel where the pan position is inChanIdx * 2f / (inChannels - 1) * (outChannels - 1) / outChannels .

See also
Companion
class
final case
class PanAz(rate: Rate, numChannels: Int, in: GE, pos: GE, level: GE, width: GE, orient: GE) extends MultiOut

An azimuth-based panorama UGen. It uses vector-based-amplitude panning where the arbitrary number of speakers is supposed to be distributed in a circle with even spacing between them. It uses an equal-power-curve to transition between adjacent speakers. '''Note''' the different default value for the orient argument!

An azimuth-based panorama UGen. It uses vector-based-amplitude panning where the arbitrary number of speakers is supposed to be distributed in a circle with even spacing between them. It uses an equal-power-curve to transition between adjacent speakers. '''Note''' the different default value for the orient argument!

Use case: To spread an multi-channel input signal across an output bus with a different number of channels, such that the first input channel is played on the first output channel (no spread to adjacent channels) and the last input channel is played to the last output channel (no spread to adjacent channels), you would create a dedicated PanAz per input channel where the pan position is inChanIdx * 2f / (inChannels - 1) * (outChannels - 1) / outChannels .

Value Params
in

the input signal

level

a control rate level input (linear multiplier).

numChannels

the number of output channels

orient

the offset in the output channels regarding a pan position of zero. Note that ScalaCollider uses a default of zero which means that a pan pos of zero outputs the signal exactly on the first output channel. This is different in sclang where the default is 0.5 which means that a pan position of zero will output the signal between the first and second speaker. Accordingly, an orient of 1.0 would result in a channel offset of one, where a pan position of zero would output the signal exactly on the second output channel, and so forth.

pos

the pan position. Channels are evenly spaced over a cyclic period of 2.0. the output channel position is pos / 2 * numChannels + orient . Thus, assuming an orient of 0.0 , and numChannels being for example 3 , a pos of 0*2.0/3 == 0.0 corresponds to the first output channel, a pos of 1*2.0/3 corresponds to the second output channel, a pos of 2*2.0/3=4.0/3 corresponds to the third and last output channel, and a pos of 3*2.0/3=2.0 completes the circle and wraps again to the first channel. Using a bipolar pan position, such as a sawtooth that ranges from -1 to +1, all channels will be cyclically panned through. Must be control rate.

width

the width of the panning envelope. The default of 2.0 pans between pairs of adjacent speakers. Width values greater than two will spread the pan over greater numbers of speakers. Width values less than one will leave silent gaps between speakers.

See also
Companion
object
object PanB extends ProductReader[PanB]

An Ambisonics B-format encoding UGen. B-format is the name for first order Ambisonics which has four channels W, X, Y, Z. By omitting the elevation control, we get a two dimensional planar encoded signal consisting only of the X and Y channels.

An Ambisonics B-format encoding UGen. B-format is the name for first order Ambisonics which has four channels W, X, Y, Z. By omitting the elevation control, we get a two dimensional planar encoded signal consisting only of the X and Y channels.

Note that unlike PanB2, azimuth is in radians.

See also
Companion
class
final case
class PanB(rate: Rate, in: GE, azimuth: GE, elevation: GE, level: GE) extends MultiOut

An Ambisonics B-format encoding UGen. B-format is the name for first order Ambisonics which has four channels W, X, Y, Z. By omitting the elevation control, we get a two dimensional planar encoded signal consisting only of the X and Y channels.

An Ambisonics B-format encoding UGen. B-format is the name for first order Ambisonics which has four channels W, X, Y, Z. By omitting the elevation control, we get a two dimensional planar encoded signal consisting only of the X and Y channels.

Note that unlike PanB2, azimuth is in radians.

Value Params
azimuth

position around the circle in radians. -Pi/+Pi is behind, -Pi/2 is left, 0 is front, +Pi/2 is right.

elevation

elevation in radians, from -Pi/2 (bottom) to +Pi/2 (top)

in

(monophonic) input signal to be encoded

level

additional gain control

See also
Companion
object
object PanB2 extends ProductReader[PanB2]

A two dimensional Ambisonics B-format encoding UGen. B-format is the name for first order Ambisonics which normally has four channels W, X, Y, Z. By omitting the elevation control, we get a two dimensional planar encoded signal consisting only of the W, X and Y channels.

A two dimensional Ambisonics B-format encoding UGen. B-format is the name for first order Ambisonics which normally has four channels W, X, Y, Z. By omitting the elevation control, we get a two dimensional planar encoded signal consisting only of the W, X and Y channels.

Note that unlike PanB, azimuth is normalized between -1 and +1.

===Examples===

// 4-channel rotation of opposite sounds
play {
 val p = WhiteNoise.ar(0.05)                     // first source
 val q = Mix(LFSaw.ar(Seq(200, 200.37))) * 0.03  // second source
 // B-format encode 2 signals at opposite sides of the circle
 val enc = PanB2.ar(p, -0.5) + PanB2.ar(q, +0.5)
 val Seq(w, x, y) = (0 to 2).map(enc out _)
 val rot = Rotate2.ar(x, y, MouseX.kr(-1, +1))
 // B-format decode to quad (front-left, front-right, rear-left, rear-right)
 DecodeB2.ar(4, w, rot.xr, rot.yr)
}
See also
Companion
class
final case
class PanB2(rate: Rate, in: GE, azimuth: GE, level: GE) extends MultiOut

A two dimensional Ambisonics B-format encoding UGen. B-format is the name for first order Ambisonics which normally has four channels W, X, Y, Z. By omitting the elevation control, we get a two dimensional planar encoded signal consisting only of the W, X and Y channels.

A two dimensional Ambisonics B-format encoding UGen. B-format is the name for first order Ambisonics which normally has four channels W, X, Y, Z. By omitting the elevation control, we get a two dimensional planar encoded signal consisting only of the W, X and Y channels.

Note that unlike PanB, azimuth is normalized between -1 and +1.

Value Params
azimuth

position around the circle from -1 to +1. -1 and +1 correspond to -180/+180 degrees (behind), -0.5 is 90 degrees to the left, 0 is frontal, +0.5 is 90 degrees to the right.

in

(monophonic) input signal to be encoded

level

additional gain control

See also
Companion
object
object PartConv extends ProductReader[PartConv]

A UGen for partitioned convolution. Its advantage over non-partitioning UGens such as Convolution2 is that the impulse response can be arbitrarily large amortization is used to spread processing and avoid CPU spikes.

A UGen for partitioned convolution. Its advantage over non-partitioning UGens such as Convolution2 is that the impulse response can be arbitrarily large amortization is used to spread processing and avoid CPU spikes.

The impulse response buffer must be specially prepared, using a /b_gen command that transforms an existing regularly formatted buffer to a new partitioned convolution ready buffer.

===Examples===

// Dan Stowell's reverb
// synthesize impulse response
val ir = (1f +: Vector.fill(100)(0f)) ++ (1f to 0f by -0.00002f).map { f =>
 if (math.random < 0.5)
   0f
 else
   f.pow(8) * (math.random - 0.5).signum * 0.1f
}

// ir.plot()

// send the IR to a regular buffer
val irBuf = Buffer(s)
irBuf.alloc(ir.size)
irBuf.setData(ir)

// calculate the partitioning parameters
val fftSize  = 2048
val numPart  = (ir.size * 2.0 / fftSize).ceil.toInt  // 49
val partSize = fftSize * numPart  // 100352

// create the specially formatted partitioned buffer
val partBuf  = Buffer(s)
partBuf.alloc(partSize)
// currently no predefined method for this command!
s ! osc.Message("/b_gen", partBuf.id, "PreparePartConv", irBuf.id, fftSize)

// now we can forget about the input buffer
irBuf.free()

val x = play {
 // trigger IR every 4 seconds
 val in = Impulse.ar(0.25) * 0.5
 PartConv.ar(in, fftSize, partBuf.id)
}

// do not forget to free the buffer eventually
x.free(); partBuf.free()
See also
Companion
class
final case
class PartConv(rate: Rate, in: GE, fftSize: GE, buf: GE) extends SingleOut with IsIndividual

A UGen for partitioned convolution. Its advantage over non-partitioning UGens such as Convolution2 is that the impulse response can be arbitrarily large amortization is used to spread processing and avoid CPU spikes.

A UGen for partitioned convolution. Its advantage over non-partitioning UGens such as Convolution2 is that the impulse response can be arbitrarily large amortization is used to spread processing and avoid CPU spikes.

The impulse response buffer must be specially prepared, using a /b_gen command that transforms an existing regularly formatted buffer to a new partitioned convolution ready buffer.

Value Params
buf

buffer identifier for the fixed kernel (init-time only). ''(init-time only)''

fftSize

FFT size which is twice the input signal partition size. This must be a multiple of the control-block size, and there must be at least two blocks per partition (to allow for amortization) ''(init-time only)''

in

the realtime input to be convolved

See also
Companion
object
object Pause extends ProductReader[Pause]

A UGen which pauses and resumes another node. Note that the UGen initially assumes the node is running, that is, if gate is initially 1, this will '''not''' resume a paused node. Instead, the gate must go to zero and back to one to resume the node. Additionally, this UGen will only cause action if the gate value changes, that is, if the node is paused or resumed otherwise, this UGen will not interfere with that action, unless the gate value is adjusted.

A UGen which pauses and resumes another node. Note that the UGen initially assumes the node is running, that is, if gate is initially 1, this will '''not''' resume a paused node. Instead, the gate must go to zero and back to one to resume the node. Additionally, this UGen will only cause action if the gate value changes, that is, if the node is paused or resumed otherwise, this UGen will not interfere with that action, unless the gate value is adjusted.

See also
Companion
class
final case
class Pause(gate: GE, node: GE) extends SingleOut with ControlRated with HasSideEffect

A UGen which pauses and resumes another node. Note that the UGen initially assumes the node is running, that is, if gate is initially 1, this will '''not''' resume a paused node. Instead, the gate must go to zero and back to one to resume the node. Additionally, this UGen will only cause action if the gate value changes, that is, if the node is paused or resumed otherwise, this UGen will not interfere with that action, unless the gate value is adjusted.

A UGen which pauses and resumes another node. Note that the UGen initially assumes the node is running, that is, if gate is initially 1, this will '''not''' resume a paused node. Instead, the gate must go to zero and back to one to resume the node. Additionally, this UGen will only cause action if the gate value changes, that is, if the node is paused or resumed otherwise, this UGen will not interfere with that action, unless the gate value is adjusted.

Value Params
gate

when 0, node is paused, when 1, node is resumed

node

the id of the node to be paused or resumed

See also
Companion
object
object PauseSelf extends ProductReader[PauseSelf]

A UGen that, when triggered, pauses enclosing synth. It pauses the enclosing synth when the input signal crosses from non-positive to positive.

A UGen that, when triggered, pauses enclosing synth. It pauses the enclosing synth when the input signal crosses from non-positive to positive.

''Note'' that if the trigger is initially high the UGen will not react. For example, PauseSelf.kr("foo".kr) will not work if the control is initially 1 . A work-around is to wrap the input in this case in a Trig object: PauseSelf.kr(Trig.kr("foo".kr)) . This is most likely a bug.

This UGen outputs its input signal for convenience.

See also
Companion
class
final case
class PauseSelf(trig: GE) extends SingleOut with ControlRated with HasSideEffect

A UGen that, when triggered, pauses enclosing synth. It pauses the enclosing synth when the input signal crosses from non-positive to positive.

A UGen that, when triggered, pauses enclosing synth. It pauses the enclosing synth when the input signal crosses from non-positive to positive.

''Note'' that if the trigger is initially high the UGen will not react. For example, PauseSelf.kr("foo".kr) will not work if the control is initially 1 . A work-around is to wrap the input in this case in a Trig object: PauseSelf.kr(Trig.kr("foo".kr)) . This is most likely a bug.

This UGen outputs its input signal for convenience.

Value Params
trig

the input signal which will trigger the action.

See also
Companion
object
object PauseSelfWhenDone extends ProductReader[PauseSelfWhenDone]

A UGen that, when its input UGen is finished, pauses enclosing synth. This is essentially a shortcut for PauseSelf.kr(Done.kr(src)) , so instead of providing a trigger signal it reads directly the done flag of an appropriate ugen (such as Line or PlayBuf ).

A UGen that, when its input UGen is finished, pauses enclosing synth. This is essentially a shortcut for PauseSelf.kr(Done.kr(src)) , so instead of providing a trigger signal it reads directly the done flag of an appropriate ugen (such as Line or PlayBuf ).

This UGen outputs its input signal for convenience.

See also
Companion
class
final case
class PauseSelfWhenDone(src: GE & HasDoneFlag) extends SingleOut with ControlRated with HasSideEffect

A UGen that, when its input UGen is finished, pauses enclosing synth. This is essentially a shortcut for PauseSelf.kr(Done.kr(src)) , so instead of providing a trigger signal it reads directly the done flag of an appropriate ugen (such as Line or PlayBuf ).

A UGen that, when its input UGen is finished, pauses enclosing synth. This is essentially a shortcut for PauseSelf.kr(Done.kr(src)) , so instead of providing a trigger signal it reads directly the done flag of an appropriate ugen (such as Line or PlayBuf ).

This UGen outputs its input signal for convenience.

Value Params
src

the input UGen which when finished will trigger the action.

See also
Companion
object
object Peak extends ProductReader[Peak]

A UGen to measure a signal's peak amplitude. Technically, this UGen works like RunningMax after the absolute value of the input signal is taken.

A UGen to measure a signal's peak amplitude. Technically, this UGen works like RunningMax after the absolute value of the input signal is taken.

The UGen keeps an internal state that reflects the maximum absolute input value observed. When a trigger occurs at the reset input, it first copies the current maximum value to its output and then (quasi-simultaneously) resets its internal state to the current absolute input value. This way, the peak value seen from the outside at trigger time is the correct peak value up to that moment. See the 'illustrate timing' example to understand this timing.

===Examples===

// illustrate timing
play {
 val i  = Impulse.ar(0)
 // first impulse after 100ms
 val t1 = DelayN.ar(i * 1.0 , 0.100, 0.100)
 // one sample later
 val t2 = Delay1.ar(t1) * 0.5
 // another sample later
 val t3 = Delay1.ar(t2)
 val p  = Peak.ar(t1 + t2, t2)
 // at t1, peak has already seen t1
 p.poll(t1, "t1")
 // at t2, peak still reports 1.0, while internally resetting
 p.poll(t2, "t2")
 // at t3, we observe 0.5, therefore peak did reset at t2
 p.poll(t3, "t3")
 ()
}
See also
Companion
class
final case
class Peak(rate: Rate, in: GE, trig: GE) extends SingleOut

A UGen to measure a signal's peak amplitude. Technically, this UGen works like RunningMax after the absolute value of the input signal is taken.

A UGen to measure a signal's peak amplitude. Technically, this UGen works like RunningMax after the absolute value of the input signal is taken.

The UGen keeps an internal state that reflects the maximum absolute input value observed. When a trigger occurs at the reset input, it first copies the current maximum value to its output and then (quasi-simultaneously) resets its internal state to the current absolute input value. This way, the peak value seen from the outside at trigger time is the correct peak value up to that moment. See the 'illustrate timing' example to understand this timing.

Value Params
in

input signal to analyze

trig

resets the maximum observed value to the current absolute value of the input signal

See also
Companion
object
object PeakFollower extends ProductReader[PeakFollower]

A UGen that continually reports the peak amplitude of the signal received at the input. If the absolute input level drops below the observed peak value, this value decreases by the factor given as decay parameter (but no more than the current absolute input level).

A UGen that continually reports the peak amplitude of the signal received at the input. If the absolute input level drops below the observed peak value, this value decreases by the factor given as decay parameter (but no more than the current absolute input level).

===Examples===

// mouse-controlled decay
play {
 val in    = Impulse.ar(2)
 val decay = MouseX.kr(0.995, 1.0001, 1).min(1.0)
 decay.poll(HPZ1.kr(decay).abs, "decay")
 val p     = PeakFollower.ar(in, decay)
 val tr    = Impulse.ar(20)
 val pm    = RunningMax.ar(p, tr)
 pm.roundTo(0.001).poll(20, "peak")
 in
}
See also
Companion
class
final case
class PeakFollower(rate: MaybeRate, in: GE, decay: GE) extends SingleOut

A UGen that continually reports the peak amplitude of the signal received at the input. If the absolute input level drops below the observed peak value, this value decreases by the factor given as decay parameter (but no more than the current absolute input level).

A UGen that continually reports the peak amplitude of the signal received at the input. If the absolute input level drops below the observed peak value, this value decreases by the factor given as decay parameter (but no more than the current absolute input level).

Value Params
decay

feedback coefficient controlling the release rate. This should be less than one, otherwise the UGen may blow up.

in

input signal to trace

See also
Companion
object
object Phasor extends ProductReader[Phasor]

A linear repeating ramp UGen between start and end values. Using a trigger input, it can be reset to a specific position. Upon reaching the end of its ramp, Phasor will wrap back to its start value. '''Note''': Since end is defined as the wrap point, its value is never actually output.

A linear repeating ramp UGen between start and end values. Using a trigger input, it can be reset to a specific position. Upon reaching the end of its ramp, Phasor will wrap back to its start value. '''Note''': Since end is defined as the wrap point, its value is never actually output.

===Examples===

// glissandi
play {
 // mouse-x controls phasor speed
 val freq  = MouseX.kr(0.2, 2, 1)
 // mouse button can be used to jump back
 val reset = MouseButton.kr(lag = 0)
 val p     = Phasor.ar(reset, freq / SampleRate.ir)
 SinOsc.ar(p.linLin(0, 1, 600, 1000)) * 0.1
}
See also
Companion
class
final case
class Phasor(rate: Rate, trig: GE, speed: GE, lo: GE, hi: GE, resetVal: GE) extends SingleOut

A linear repeating ramp UGen between start and end values. Using a trigger input, it can be reset to a specific position. Upon reaching the end of its ramp, Phasor will wrap back to its start value. '''Note''': Since end is defined as the wrap point, its value is never actually output.

A linear repeating ramp UGen between start and end values. Using a trigger input, it can be reset to a specific position. Upon reaching the end of its ramp, Phasor will wrap back to its start value. '''Note''': Since end is defined as the wrap point, its value is never actually output.

Value Params
hi

end value of the ramp (exclusive)

lo

start value of the ramp

resetVal

value to jump to upon receiving a trigger in the trig input

speed

amount of increment ''per sample frame''. I.e at a speed of 1, each sample output by the UGen will be 1 greater than the preceding sample. To achieve a specific frequency f in Hertz, use a speed value of f / SampleRate.ir .

trig

trigger signal that causes the phasor to jump to the resetVal position

See also
Companion
object
object PhysicalIn extends ProductReader[PhysicalIn]

A graph element which reads from a connected sound driver input. This is a convenience element for accessing physical input signals, e.g. from a microphone connected to your audio interface. It expands to a regular In UGen offset by NumOutputBuses.ir.

A graph element which reads from a connected sound driver input. This is a convenience element for accessing physical input signals, e.g. from a microphone connected to your audio interface. It expands to a regular In UGen offset by NumOutputBuses.ir.

For example, consider an audio interface with channels 1 to 8 being analog line inputs, channels 9 and 10 being AES/EBU and channels 11 to 18 being ADAT inputs. To read a combination of the analog and ADAT inputs, either of the following statement can be used:

PhysicalIn(Seq(0, 8), Seq(8, 8))
PhysicalIn(Seq(0, 8), Seq(8))      // numChannels wraps!

If SuperCollider runs with less physical inputs than requested by this UGen, invalid channels are muted.

Companion
class
final case
class PhysicalIn(indices: GE, numChannels: Seq[Int]) extends Lazy with AudioRated

A graph element which reads from a connected sound driver input. This is a convenience element for accessing physical input signals, e.g. from a microphone connected to your audio interface. It expands to a regular In UGen offset by NumOutputBuses.ir.

A graph element which reads from a connected sound driver input. This is a convenience element for accessing physical input signals, e.g. from a microphone connected to your audio interface. It expands to a regular In UGen offset by NumOutputBuses.ir.

For example, consider an audio interface with channels 1 to 8 being analog line inputs, channels 9 and 10 being AES/EBU and channels 11 to 18 being ADAT inputs. To read a combination of the analog and ADAT inputs, either of the following statement can be used:

PhysicalIn(Seq(0, 8), Seq(8, 8))
PhysicalIn(Seq(0, 8), Seq(8))      // numChannels wraps!

If SuperCollider runs with less physical inputs than requested by this UGen, invalid channels are muted.

Value Params
indices

the physical index to read from (beginning at zero which corresponds to the first channel of the audio interface or sound driver). It may be a multichannel element to specify discrete indices.

numChannels

the number of consecutive channels to read for each index. Wraps around if the sequence has less elements than indices has channels.

Companion
object
object PhysicalOut extends ProductReader[PhysicalOut]

A graph element which writes to a connected sound driver output. This is a convenience element for Out with the ability to provide a set of discrete indices to which corresponding channels of the input signal are mapped, whereas multichannel expansion with respect to the index argument of Out typically do not achieve what you expect.

A graph element which writes to a connected sound driver output. This is a convenience element for Out with the ability to provide a set of discrete indices to which corresponding channels of the input signal are mapped, whereas multichannel expansion with respect to the index argument of Out typically do not achieve what you expect.

If SuperCollider runs with less physical outputs than requested by this UGen, the output is muted.

===Examples===

// flip left and right when writing a stereo signal
play {
 val indices = Seq(1, 0)
 val in:GE   = Seq(SinOsc.ar * LFPulse.ar(4), WhiteNoise.ar)
 // sine appears on the right channel, and noise on the left
 PhysicalOut(indices, in * 0.2)
}
Companion
class
final case
class PhysicalOut(indices: GE, in: GE) extends ZeroOut with AudioRated

A graph element which writes to a connected sound driver output. This is a convenience element for Out with the ability to provide a set of discrete indices to which corresponding channels of the input signal are mapped, whereas multichannel expansion with respect to the index argument of Out typically do not achieve what you expect.

A graph element which writes to a connected sound driver output. This is a convenience element for Out with the ability to provide a set of discrete indices to which corresponding channels of the input signal are mapped, whereas multichannel expansion with respect to the index argument of Out typically do not achieve what you expect.

If SuperCollider runs with less physical outputs than requested by this UGen, the output is muted.

Value Params
in

the signal to write

indices

the physical index to write to (beginning at zero which corresponds to the first channel of the audio interface or sound driver). may be a multichannel argument to specify discrete channels. In this case, any remaining channels in in are associated with the last bus index offset.

Companion
object
object PinkNoise extends ProductReader[PinkNoise]

A noise generator UGen whose spectrum falls off in power by 3 dB per octave. This gives equal power over the span of each octave. This version gives 8 octaves of pink noise.

A noise generator UGen whose spectrum falls off in power by 3 dB per octave. This gives equal power over the span of each octave. This version gives 8 octaves of pink noise.

The values produced by this UGen were observed to lie with very high probability between approx. -0.65 and +0.81 (before being multiplied by mul ). The RMS is approx. -16 dB.

===Examples===

// plain noise
play { PinkNoise.ar(Seq(0.2, 0.2)) }
See also
Companion
class
final case
class PinkNoise(rate: Rate, mul: GE) extends SingleOut with IsIndividual

A noise generator UGen whose spectrum falls off in power by 3 dB per octave. This gives equal power over the span of each octave. This version gives 8 octaves of pink noise.

A noise generator UGen whose spectrum falls off in power by 3 dB per octave. This gives equal power over the span of each octave. This version gives 8 octaves of pink noise.

The values produced by this UGen were observed to lie with very high probability between approx. -0.65 and +0.81 (before being multiplied by mul ). The RMS is approx. -16 dB.

Value Params
mul

Not actually a UGen input, this argument produces a multiplication of the output by this factor. A multi-channel mul argument will cause the generation of multiple independent noise generators.

See also
Companion
object
object Pitch extends ProductReader[Pitch]

An autocorrelation based pitch following UGen. It is more accurate than ZeroCrossing , but more also more CPU costly. For most purposes the default settings can be used and only in needs to be supplied.

An autocorrelation based pitch following UGen. It is more accurate than ZeroCrossing , but more also more CPU costly. For most purposes the default settings can be used and only in needs to be supplied.

The UGen has two outputs: The first output is the frequency estimate in Hertz, the second output is a toggle hasFreq , which tells whether a pitch was found (1) or not (0). If the clarify argument is used, hasFreq has more fine grained information.

The pitch follower executes periodically at the rate specified by execFreq in cps. First it detects whether the input peak to peak amplitude is above the ampThresh . If it is not then no pitch estimation is performed, the hasFreq output is set to zero and the freq output is held at its previous value. Otherwise, the autocorrelation is calculated, and the first peak after the peak around the lag of zero that is above peakThresh times the amplitude of the peak at lag zero is reported.

===Examples===

// pitch-follower resynthesizing with saw tooth
play {
 // be careful and use headphones!
 val in      = Mix(PhysicalIn.ar(0, 2))
 val amp     = Amplitude.kr(in, 0.05, 0.05)
 val p       = Pitch.kr(in, ampThresh = 0.02, median = 7)
 val saw     = Mix(VarSaw.ar(p.freq * Seq(0.5, 1, 2), 0, LFNoise1.kr(0.3,0.1,0.1)) * amp)
 Mix.fold(saw, 6) { res =>
   AllpassN.ar(res, 0.040, Rand(0, 0.040), Rand(0, 0.040), 2)
 }
}
Companion
class
final case
class Pitch(rate: Rate, in: GE, initFreq: GE, minFreq: GE, maxFreq: GE, execFreq: GE, binsPerOct: GE, median: GE, ampThresh: GE, peakThresh: GE, downSample: GE, clarity: GE) extends MultiOut

An autocorrelation based pitch following UGen. It is more accurate than ZeroCrossing , but more also more CPU costly. For most purposes the default settings can be used and only in needs to be supplied.

An autocorrelation based pitch following UGen. It is more accurate than ZeroCrossing , but more also more CPU costly. For most purposes the default settings can be used and only in needs to be supplied.

The UGen has two outputs: The first output is the frequency estimate in Hertz, the second output is a toggle hasFreq , which tells whether a pitch was found (1) or not (0). If the clarify argument is used, hasFreq has more fine grained information.

The pitch follower executes periodically at the rate specified by execFreq in cps. First it detects whether the input peak to peak amplitude is above the ampThresh . If it is not then no pitch estimation is performed, the hasFreq output is set to zero and the freq output is held at its previous value. Otherwise, the autocorrelation is calculated, and the first peak after the peak around the lag of zero that is above peakThresh times the amplitude of the peak at lag zero is reported.

Value Params
ampThresh

The minimum amplitude threshold above which the pitch follower operates. An input signal below this threshold is not analyzed. ''(init-time only)''

binsPerOct

A value which guides the search for the peak frequency in the first coarse step. Its setting does not affect the final pitch resolution; setting it larger will cause the coarse search to take longer, and setting it smaller will cause the fine search to take longer. ''(init-time only)''

clarity

If the clarity argument is greater than zero (it is zero by default) then the hasFreq output is given additional detail. Rather than simply being 1 when a pitch is detected, it is a "clarity" measure in the range between zero and one. (Technically, it's the height of the autocorrelation peak normalised by the height of the zero-lag peak.) It therefore gives a kind of measure of "purity" of the pitched signal. ''(init-time only)''

downSample

An integer factor by which the input signal is down sampled to reduce CPU overhead. This will also reduce the pitch resolution. The default value of 1 means that the input signal is not down sampled. ''(init-time only)''

execFreq

The frequency at which the pitch is estimated. This will be automatically clipped to be between minFreq and maxFreq . ''(init-time only)''

in

The signal to be analyzed.

initFreq

The initial value of the freq output, until the first valid pitch is found. ''(init-time only)''

maxFreq

The maximum frequency in Hertz to be considered for reporting. ''(init-time only)''

median

This specifies the length of a median filter applied to the frequency output estimation. With the default value of 1 the filter is defeated. Median filtering can help eliminating single spikes and jitter. This will however add latency to the output. ''(init-time only)''

minFreq

The minimum frequency in Hertz to be considered for reporting. ''(init-time only)''

peakThresh

This is a threshold used to find the first peak in the autocorrelation signal which gives the reported frequency. It is a factor of the energy of the signal (autocorrelation coefficient at zero). Set this value higher (e.g. to 1 ) to eliminate false frequencies corresponding to overtones. ''(init-time only)''

Companion
object
object PitchShift extends ProductReader[PitchShift]

A time domain granular pitch shifter. Grains have a triangular amplitude envelope and an overlap of 4:1.

A time domain granular pitch shifter. Grains have a triangular amplitude envelope and an overlap of 4:1.

Companion
class
final case
class PitchShift(in: GE, winSize: GE, pitchRatio: GE, pitchDispersion: GE, timeDispersion: GE) extends SingleOut with AudioRated

A time domain granular pitch shifter. Grains have a triangular amplitude envelope and an overlap of 4:1.

A time domain granular pitch shifter. Grains have a triangular amplitude envelope and an overlap of 4:1.

Value Params
in

The input signal.

pitchDispersion

The maximum random deviation of the pitch from the pitchRatio.

pitchRatio

The ratio of the pitch shift. Must be from 0 to 4.

timeDispersion

A random offset of from zero to timeDispersion seconds is added to the delay of each grain. Use of some dispersion can alleviate a hard comb filter effect due to uniform grain placement. It can also be an effect in itself. timeDispersion can be no larger than windowSize.

winSize

The size of the grain window in seconds. ''(init-time only)''

Companion
object
object PlayBuf extends ProductReader[PlayBuf]

A UGen to play back samples from a buffer in memory.

A UGen to play back samples from a buffer in memory.

PlayBuf provides a kind of high-level interface to sample-playback, whereas BufRd represents a kind of lower-level access. While BufRd has a random-access-pointer in the form of a phase input, PlayBuf advances the phase automatically based on a given playback speed. PlayBuf uses cubic interpolation.

See also
Companion
class
final case
class PlayBuf(rate: Rate, numChannels: Int, buf: GE, speed: GE, trig: GE, offset: GE, loop: GE, doneAction: GE) extends MultiOut with HasSideEffect with IsIndividual with HasDoneFlag

A UGen to play back samples from a buffer in memory.

A UGen to play back samples from a buffer in memory.

PlayBuf provides a kind of high-level interface to sample-playback, whereas BufRd represents a kind of lower-level access. While BufRd has a random-access-pointer in the form of a phase input, PlayBuf advances the phase automatically based on a given playback speed. PlayBuf uses cubic interpolation.

Value Params
buf

the identifier of the buffer to use

doneAction

what to do when the play head reaches the buffer end. This is only effective when loop is zero.

loop

1 to loop after the play head reaches the buffer end, 0 to not loop. This can be modulated.

numChannels

the number of channels that the buffer will be. Since this is a constant, a change in number of channels of the underlying bus must be reflected by creating different SynthDefs. If a buffer identifier is used of a buffer that has a different numChannels then specified in the PlayBuf, it will fail silently.

offset

sample frame to start playback. This is read when a trigger occurs. It may be fractional.

speed

1 advances the play head by the server's sample rate each second. So 2 means doubling speed (and pitch), and 0.5 means half speed (and half pitch). Negative numbers can be used for backwards playback. If the underlying buffer represents a sound at a different sample rate, the rate should be multiplied by BufRateScale.kr(buf) to obtain the correct speed.

trig

a trigger which causes a jump to the given offset . A trigger occurs when a signal changes from non-positive to positive (e.g. <= 0 to > 0).

See also
Companion
object
object Pluck extends ProductReader[Pluck]

A Karplus-Strong UGen.

A Karplus-Strong UGen.

Companion
class
final case
class Pluck(in: GE, trig: GE, maxDelayTime: GE, delayTime: GE, decayTime: GE, coeff: GE) extends SingleOut with AudioRated

A Karplus-Strong UGen.

A Karplus-Strong UGen.

Value Params
coeff

the coefficient of the internal OnePole filter. Values should be between -1 and +1 (larger values will be unstable... so be careful!).

decayTime

Time for the echoes to decay by 60 decibels. Negative times emphasize odd partials.

delayTime

Delay time in seconds.

in

An excitation signal.

maxDelayTime

Maximum delay time in seconds (initializes the internal delay buffer). ''(init-time only)''

trig

Upon a negative to positive transition, the excitation signal will be fed into the delay line.

Companion
object
object Poll extends ProductReader[Poll]

A UGen for printing the current output value of its input to the console.

A UGen for printing the current output value of its input to the console.

See also
Companion
class
final case
class Poll(rate: MaybeRate, trig: GE, in: GE, label: String, trigId: GE) extends SingleOut with HasSideEffect

A UGen for printing the current output value of its input to the console.

A UGen for printing the current output value of its input to the console.

Value Params
in

the signal you want to poll

label

a string or symbol to be printed with the polled value

trig

a non-positive to positive transition telling Poll to return a value

trigId

if greater then 0, a "/tr" OSC message is sent back to the client (similar to SendTrig )

See also
Companion
object
object Pulse extends ProductReader[Pulse]

A band-limited pulse wave generator UGen, capable of pulse width modulation.

A band-limited pulse wave generator UGen, capable of pulse width modulation.

'''Note''': The fine behavior depends on the server's block-size which interacts with the pulse width. The behavior is more regular if the duty period sr / freq * width is an integer multiple of the block-size. A width of 1.0 can produce strange results.

===Examples===

// modulate frequency
play { Pulse.ar(XLine.kr(40, 4000, 6)) * 0.2 }
// modulate pulse width
play { Pulse.ar(200, Line.kr(0.01, 0.99, 8)) * 0.2 }
// two pulses with different frequencies through resonant filter
play { RLPF.ar(Pulse.ar(Seq(100, 250)) * 0.2, XLine.kr(8000, 400, 6), 0.05) }
See also
Companion
class
final case
class Pulse(rate: Rate, freq: GE, width: GE) extends SingleOut

A band-limited pulse wave generator UGen, capable of pulse width modulation.

A band-limited pulse wave generator UGen, capable of pulse width modulation.

'''Note''': The fine behavior depends on the server's block-size which interacts with the pulse width. The behavior is more regular if the duty period sr / freq * width is an integer multiple of the block-size. A width of 1.0 can produce strange results.

Value Params
freq

Fundamental frequency in Hertz

width

Pulse width ratio from zero to one. 0.5 makes a square wave.

See also
Companion
object
object PulseCount extends ProductReader[PulseCount]

A UGen that counts the number of triggers observed.

A UGen that counts the number of triggers observed.

===Examples===

// count mouse clicks, reset at 10
play {
 val tr    = MouseButton.kr(lag = 0)
 val reset = PulseDivider.kr(tr, 10)
 val c     = PulseCount.kr(tr, reset)
 c.poll(tr + Impulse.kr(0), "count")
 ()
}
See also
Companion
class
final case
class PulseCount(rate: MaybeRate, trig: GE, reset: GE) extends SingleOut

A UGen that counts the number of triggers observed.

A UGen that counts the number of triggers observed.

Value Params
reset

when triggered, resets the counter to zero. When both trig and reset are triggered at the same time, the reset takes precedence (output will be zero).

trig

a trigger happens when the signal changes from non-positive to positive

See also
Companion
object
object PulseDivider extends ProductReader[PulseDivider]

A UGen that decimates trigger by outputting one impulse each time a certain number of triggers at its input have been received.

A UGen that decimates trigger by outputting one impulse each time a certain number of triggers at its input have been received.

===Examples===

// every two mouse-button clicks
play {
 val in  = MouseButton.kr(lag = 0)
 in.poll(in, "in")
 val out = PulseDivider.kr(in, 2, -1)
 out.poll(out, "out")
 ()
}
// rhythmic 1:4 pattern
play {
 val p = Impulse.ar(8)
 val d = PulseDivider.ar(p, 4)
 val a = SinOsc.ar(1200) * Decay2.ar(p, 0.005, 0.1) * 0.3
 val b = SinOsc.ar( 600) * Decay2.ar(d, 0.005, 0.5) * 0.3
 Seq(a, b)
}
See also
Companion
class
final case
class PulseDivider(rate: MaybeRate, trig: GE, div: GE, start: GE) extends SingleOut

A UGen that decimates trigger by outputting one impulse each time a certain number of triggers at its input have been received.

A UGen that decimates trigger by outputting one impulse each time a certain number of triggers at its input have been received.

Value Params
div

decimation factor of the UGen. A value of 1 would cause an output trigger for each input trigger, whereas a value of 2 would cause an output trigger each time the internal counter has seen two input triggers.

start

value of the internal counter. For example, if div is 2 , then a start value of 0 (default) means that the first output trigger happens after two input triggers, a start value of 1 means that the first output trigger happens after just one input trigger. Negative values can increase the number of required input triggers for the first output trigger. For example, if start is -1 , the first output trigger happens after three input triggers.

trig

a trigger occurs when the signal changes from non-positive to positive.

See also
Companion
object
object QuadC extends ProductReader[QuadC]

A cubic-interpolating sound generator based on the difference equation:

A cubic-interpolating sound generator based on the difference equation:

x[n+1] = a * pow(x[n], 2) + b * x[n] + c

===Examples===

// default parameters
play { QuadC.ar(SampleRate.ir/4) * 0.2 }
// logistic map
play {
 // equation: x1 = -r*x0^2 + r*x0
 val r = MouseX.kr(3.5441, 4)    // stable range
 QuadC.ar(SampleRate.ir/4, -r, r, 0, 0.1) * 0.4
}
// logistic map as frequency control
play {
 val r = MouseX.kr(3.5441, 4)    // stable range
 SinOsc.ar(QuadC.ar(40, -r, r, 0, 0.1).mulAdd(800, 900)) * 0.4
}
See also
Companion
class
final case
class QuadC(rate: Rate, freq: GE, a: GE, b: GE, c: GE, xi: GE) extends SingleOut

A cubic-interpolating sound generator based on the difference equation:

A cubic-interpolating sound generator based on the difference equation:

x[n+1] = a * pow(x[n], 2) + b * x[n] + c
Value Params
a

Equation variable

b

Equation variable

c

Equation variable

freq

Iteration frequency in Hertz

xi

Initial value of x

See also
Companion
object
object QuadL extends ProductReader[QuadL]

A linear-interpolating sound generator based on the difference equation:

A linear-interpolating sound generator based on the difference equation:

x[n+1] = a * pow(x[n], 2) + b * x[n] + c

===Examples===

// default parameters
play { QuadL.ar(SampleRate.ir/4) * 0.2 }
// logistic map
play {
 // equation: x1 = -r*x0^2 + r*x0
 val r = MouseX.kr(3.5441, 4)    // stable range
 QuadL.ar(SampleRate.ir/4, -r, r, 0, 0.1) * 0.4
}
// logistic map as frequency control
play {
 val r = MouseX.kr(3.5441, 4)    // stable range
 SinOsc.ar(QuadL.ar(40, -r, r, 0, 0.1).mulAdd(800, 900)) * 0.4
}
See also
Companion
class
final case
class QuadL(rate: Rate, freq: GE, a: GE, b: GE, c: GE, xi: GE) extends SingleOut

A linear-interpolating sound generator based on the difference equation:

A linear-interpolating sound generator based on the difference equation:

x[n+1] = a * pow(x[n], 2) + b * x[n] + c
Value Params
a

Equation variable

b

Equation variable

c

Equation variable

freq

Iteration frequency in Hertz

xi

Initial value of x

See also
Companion
object
object QuadN extends ProductReader[QuadN]

A non-interpolating sound generator based on the difference equation:

A non-interpolating sound generator based on the difference equation:

x[n+1] = a * pow(x[n], 2) + b * x[n] + c

===Examples===

// default parameters
play { QuadN.ar(SampleRate.ir/4) * 0.2 }
// logistic map
play {
 // equation: x1 = -r*x0^2 + r*x0
 val r = MouseX.kr(3.5441, 4)    // stable range
 QuadN.ar(SampleRate.ir/4, -r, r, 0, 0.1) * 0.4
}
// logistic map as frequency control
play {
 val r = MouseX.kr(3.5441, 4)    // stable range
 SinOsc.ar(QuadN.ar(40, -r, r, 0, 0.1).mulAdd(800, 900)) * 0.4
}
See also
Companion
class
final case
class QuadN(rate: Rate, freq: GE, a: GE, b: GE, c: GE, xi: GE) extends SingleOut

A non-interpolating sound generator based on the difference equation:

A non-interpolating sound generator based on the difference equation:

x[n+1] = a * pow(x[n], 2) + b * x[n] + c
Value Params
a

Equation variable

b

Equation variable

c

Equation variable

freq

Iteration frequency in Hertz

xi

Initial value of x

See also
Companion
object
object RHPF extends ProductReader[RHPF]

A resonant high pass filter UGen.

A resonant high pass filter UGen.

===Examples===

// mouse controlled frequency and Q
play {
 val in   = WhiteNoise.ar(0.5)
 val freq = MouseX.kr(200, 10000, 1)
 val q    = MouseY.kr(1, 100, 1) // bottom to top
 val flt  = RHPF.ar(in, freq, q.reciprocal)
 flt / q.sqrt // compensate for energy loss
}
See also
Companion
class
final case
class RHPF(rate: MaybeRate, in: GE, freq: GE, rq: GE) extends SingleOut

A resonant high pass filter UGen.

A resonant high pass filter UGen.

Value Params
freq

cutoff frequency in Hertz

in

input signal to be filtered

rq

reciprocal of Q. The Q (or quality) is conventionally defined as cutoff-frequency / bandwidth, meaning that rq  = bandwidth / cutoff-frequency. A higher Q or lower rq produces a steeper filter.

See also
Companion
object
object RLPF extends ProductReader[RLPF]

A resonant low pass filter UGen.

A resonant low pass filter UGen.

===Examples===

// mouse controlled frequency and Q
play {
 val in   = WhiteNoise.ar(0.5)
 val freq = MouseX.kr(200, 10000, 1)
 val q    = MouseY.kr(1, 100, 1) // bottom to top
 val flt  = RLPF.ar(in, freq, q.reciprocal)
 flt / q.sqrt // compensate for energy loss
}
See also
Companion
class
final case
class RLPF(rate: MaybeRate, in: GE, freq: GE, rq: GE) extends SingleOut

A resonant low pass filter UGen.

A resonant low pass filter UGen.

Value Params
freq

cutoff frequency in Hertz

in

input signal to be filtered

rq

reciprocal of Q. The Q (or quality) is conventionally defined as cutoff-frequency / bandwidth, meaning that rq  = bandwidth / cutoff-frequency. A higher Q or lower rq produces a steeper filter.

See also
Companion
object
object RadiansPerSample extends ProductReader[RadiansPerSample]

A UGen that delivers the conversion factor from frequency in Hertz to radians (normalized frequency). The relation is RadiansPerSample * sr = 2pi , thus multiplying the UGen with a frequency between zero and nyquist (sr/2) yields the normalized frequency between zero and pi.

A UGen that delivers the conversion factor from frequency in Hertz to radians (normalized frequency). The relation is RadiansPerSample * sr = 2pi , thus multiplying the UGen with a frequency between zero and nyquist (sr/2) yields the normalized frequency between zero and pi.

===Examples===

// print the UGen value
play { RadiansPerSample.ir.poll(0) }
See also
Companion
class
final case
class RadiansPerSample() extends SingleOut with ScalarRated

A UGen that delivers the conversion factor from frequency in Hertz to radians (normalized frequency). The relation is RadiansPerSample * sr = 2pi , thus multiplying the UGen with a frequency between zero and nyquist (sr/2) yields the normalized frequency between zero and pi.

A UGen that delivers the conversion factor from frequency in Hertz to radians (normalized frequency). The relation is RadiansPerSample * sr = 2pi , thus multiplying the UGen with a frequency between zero and nyquist (sr/2) yields the normalized frequency between zero and pi.

See also
Companion
object
object Ramp extends ProductReader[Ramp]

A UGen which produces a linear lag (time smear) regarding and input signal. Other than Lag which is a feedback filter with exponential decay, Ramp applies a linear ramp. This is achieved by sampling the input signal at regular intervals given by the lagTime and starting a new line segment after each interval.

A UGen which produces a linear lag (time smear) regarding and input signal. Other than Lag which is a feedback filter with exponential decay, Ramp applies a linear ramp. This is achieved by sampling the input signal at regular intervals given by the lagTime and starting a new line segment after each interval.

See also
Companion
class
final case
class Ramp(rate: MaybeRate, in: GE, dur: GE) extends SingleOut

A UGen which produces a linear lag (time smear) regarding and input signal. Other than Lag which is a feedback filter with exponential decay, Ramp applies a linear ramp. This is achieved by sampling the input signal at regular intervals given by the lagTime and starting a new line segment after each interval.

A UGen which produces a linear lag (time smear) regarding and input signal. Other than Lag which is a feedback filter with exponential decay, Ramp applies a linear ramp. This is achieved by sampling the input signal at regular intervals given by the lagTime and starting a new line segment after each interval.

Value Params
dur

the ramp-time (seconds) which is also the interval of the sampling

in

the signal to smooth out

See also
Companion
object
object Rand extends ProductReader[Rand]

A scalar UGen that generates a single random decimal value, using a uniform distribution from lo to hi .

A scalar UGen that generates a single random decimal value, using a uniform distribution from lo to hi .

===Examples===

// random sine frequencies
play {
 val m = Mix.fill(10)(FSinOsc.ar(Rand(200.0, 800.0)))
 m * Line.kr(0.025, 0, 4, doneAction = freeSelf)
}
See also
Companion
class
final case
class Rand(lo: GE, hi: GE) extends SingleOut with ScalarRated with IsIndividual

A scalar UGen that generates a single random decimal value, using a uniform distribution from lo to hi .

A scalar UGen that generates a single random decimal value, using a uniform distribution from lo to hi .

Value Params
hi

upper limit of the output range

lo

lower limit of the output range

See also
Companion
object
object RandID extends ProductReader[RandID]

A UGen that determines which random number generator is used for the enclosing synth. All synths that use the same generator reproduce the same sequence of numbers when the same seed is set again.

A UGen that determines which random number generator is used for the enclosing synth. All synths that use the same generator reproduce the same sequence of numbers when the same seed is set again.

===Examples===

// button alternatingly resets left and right seed
0 to 1 map { i =>
 play {
   RandID.ir(i)
   val x     = Impulse.kr(4)
   val pch   = TIRand.kr(40, 100, x)
   val b     = MouseButton.kr(lag = 0)
   val tr    = PulseDivider.kr(b, 2, i)
   pch.poll(x, if (i == 0) "left " else "right")
   RandSeed.kr(tr + Impulse.kr(0), 234)
   Out.ar(i, SinOsc.ar(pch.midiCps) * 0.2)
 }
}
See also
Companion
class
final case
class RandID(rate: Rate, id: GE) extends SingleOut with HasSideEffect

A UGen that determines which random number generator is used for the enclosing synth. All synths that use the same generator reproduce the same sequence of numbers when the same seed is set again.

A UGen that determines which random number generator is used for the enclosing synth. All synths that use the same generator reproduce the same sequence of numbers when the same seed is set again.

Value Params
id

the random number generator identifier from zero until the maximum number of generators specified with the server switch -r (default: 64)

See also
Companion
object
object RandSeed extends ProductReader[RandSeed]

A UGen that resets the seed of the synth's random number generator upon receiving a trigger. All synths that use the same random number generator reproduce the same sequence of numbers again. The generator can be set using the RandID UGen.

A UGen that resets the seed of the synth's random number generator upon receiving a trigger. All synths that use the same random number generator reproduce the same sequence of numbers again. The generator can be set using the RandID UGen.

===Examples===

// reset seed via mouse button
play {
 val freq = TIRand.kr(40, 100, Impulse.kr(4)).midiCps
 RandSeed.kr(MouseButton.kr(lag = 0) + Impulse.kr(0), 234)
 SinOsc.ar(freq) * 0.2
}
See also
Companion
class
final case
class RandSeed(rate: Rate, trig: GE, seed: GE) extends SingleOut with HasSideEffect

A UGen that resets the seed of the synth's random number generator upon receiving a trigger. All synths that use the same random number generator reproduce the same sequence of numbers again. The generator can be set using the RandID UGen.

A UGen that resets the seed of the synth's random number generator upon receiving a trigger. All synths that use the same random number generator reproduce the same sequence of numbers again. The generator can be set using the RandID UGen.

Value Params
seed

the seed for the random number generator, read at the moment the trigger arrives.

trig

trigger that causes the seed to be set

See also
Companion
object
object RecordBuf extends ProductReader[RecordBuf]

Records input into a Buffer. If recLevel is 1.0 and preLevel is 0.0 then the new input overwrites the old data. If they are both 1.0 then the new data is added to the existing data. (Any other settings are also valid.)

Records input into a Buffer. If recLevel is 1.0 and preLevel is 0.0 then the new input overwrites the old data. If they are both 1.0 then the new data is added to the existing data. (Any other settings are also valid.)

===Examples===

// record and replay
// a four second mono buffer
val b = Buffer.alloc(s, s.sampleRate.toInt * 4)

// record for four seconds
play {
 val sig = Formant.ar(XLine.kr(400, 1000, 4), 2000, 800) * 0.125
 RecordBuf.ar(sig, b.id, doneAction = freeSelf, loop = 0)
}

// play it back
play {
 PlayBuf.ar(1, b.id, doneAction = freeSelf, loop = 0)
}
See also
Companion
class
final case
class RecordBuf(rate: Rate, in: GE, buf: GE, offset: GE, recLevel: GE, preLevel: GE, run: GE, loop: GE, trig: GE, doneAction: GE) extends SingleOut with HasSideEffect with IsIndividual with HasDoneFlag

Records input into a Buffer. If recLevel is 1.0 and preLevel is 0.0 then the new input overwrites the old data. If they are both 1.0 then the new data is added to the existing data. (Any other settings are also valid.)

Records input into a Buffer. If recLevel is 1.0 and preLevel is 0.0 then the new input overwrites the old data. If they are both 1.0 then the new data is added to the existing data. (Any other settings are also valid.)

Value Params
buf

the identifier of the buffer to use

doneAction

what to do when the write head reaches the buffer end. This is only effective when loop is zero.

in

the signal to record

loop

1 to loop after the write head reaches the buffer end, 0 to not loop. This can be modulated.

offset

sample frame to begin writing from. This is read when a trigger occurs.

preLevel

value by which the previous buffer contents is multiplied when recording. If this value is zero, the buffer contents is completely overwritten. If this value is one, the new signal is added to the previous content.

recLevel

value to multiply by input before mixing with existing data.

run

if zero the recording pauses, otherwise it resumes. The value of run is only read at control-rate! When the recording is paused, the "write-head" remains in its current position and does not advance.

trig

a trigger which causes a jump to the given offset . A trigger occurs when a signal changes from non-positive to positive (e.g. <= 0 to > 0).

See also
Companion
object
object Reduce extends ProductReader[Reduce]
Companion
class
final case
class Reduce(elem: GE, op: Op) extends SingleOut
Companion
object
object RepeatChannels extends ProductReader[RepeatChannels]
Companion
class
final case
class RepeatChannels(a: GE, num: Int) extends Lazy

An auxiliary graph element that repeats the channels of an input signal, allowing for example for an exhaustive element-wise combination with another signal.

An auxiliary graph element that repeats the channels of an input signal, allowing for example for an exhaustive element-wise combination with another signal.

Normally, the way multi-channel expansion works is that when two signals are combined, the output signal has a number of channels that is the ''maximum'' of the individual number of channels, and channels will be automatically wrapped around.

For example, in x * y if x has three and y has five channels, the result expands to

Seq[GE](
 x.out(0) * y.out(0), x.out(1) * y.out(1),
 x.out(2) * y.out(2), x.out(0) * y.out(3),
 x.out(1) * y.out(4)
)

Using this element, we can enforce the appearance of all combinations of channels, resulting in a signal whose number of channels is the ''sum'' of the individual number of channels.

For example, RepeatChannels(x, 5) expands to

Seq[GE](
 x.out(0), x.out(0), x.out(0), x.out(0), x.out(0),
 x.out(1), x.out(1), x.out(1), x.out(1), x.out(1),
 x.out(2), x.out(2), x.out(2), x.out(2), x.out(2)
)

And RepeatChannels(x, 5) * y accordingly expands to the fifteen-channels signal

Seq[GE](
 (x out 0) * (y out 0), (x out 0) * (y out 1), (x out 0) * (y out 2), (x out 0) * (y out 3), (x out 0) * (y out 4),
 (x out 1) * (y out 0), (x out 1) * (y out 1), (x out 1) * (y out 2), (x out 1) * (y out 3), (x out 1) * (y out 4),
 (x out 2) * (y out 0), (x out 2) * (y out 1), (x out 2) * (y out 2), (x out 2) * (y out 3), (x out 2) * (y out 4)
)
Value Params
a

the signal whose channels to repeat

num

the number of repetitions for each input channel

See also
Companion
object
object ReplaceOut extends ProductReader[ReplaceOut]

A UGen that replace the contents of a bus with an input signal. Other than Out , the signal is not added to the previous contents of the bus but replaces it, allowing for a simple way of an "insert" effect.

A UGen that replace the contents of a bus with an input signal. Other than Out , the signal is not added to the previous contents of the bus but replaces it, allowing for a simple way of an "insert" effect.

Multi-channel input signals, for example a PanAz , are written as such to the bus without expansion. That is, the bus index argument is used for the first channel, the second channel will appear on bus + 1 , etc.

If you have an expanding multi-channel input, however, you have to be careful. For example, if you have PanAz.ar(2, SinOsc.ar(Seq(444, 555, 666)) * 0.2, Seq(-1, 0, 1)) , this results in one output UGen carrying one channel, and another one carrying two channels. (The way this works is consistent with SCLang). In order to get the correct behaviour (left outputs of the PanAz summed, and right output of the PanAz summed), wrap this expression in a Mix(...) before passing it to the output UGen.

===Examples===

// insert-effect
val noise = play {
 Out.ar(0, WhiteNoise.ar(Seq(0.1, 0.1)))
}

val filter = play(target = noise, addAction = addAfter) {
 val in = In.ar(0, 2)
 val f  = Resonz.ar(in, 444, 0.1) * 20
 ReplaceOut.ar(0, f)
}

filter.run(false)  // bypass
filter.run(true )  // engage
See also
Companion
class
final case
class ReplaceOut(bus: GE, in: GE) extends ZeroOut with AudioRated with HasSideEffect with IsIndividual

A UGen that replace the contents of a bus with an input signal. Other than Out , the signal is not added to the previous contents of the bus but replaces it, allowing for a simple way of an "insert" effect.

A UGen that replace the contents of a bus with an input signal. Other than Out , the signal is not added to the previous contents of the bus but replaces it, allowing for a simple way of an "insert" effect.

Multi-channel input signals, for example a PanAz , are written as such to the bus without expansion. That is, the bus index argument is used for the first channel, the second channel will appear on bus + 1 , etc.

If you have an expanding multi-channel input, however, you have to be careful. For example, if you have PanAz.ar(2, SinOsc.ar(Seq(444, 555, 666)) * 0.2, Seq(-1, 0, 1)) , this results in one output UGen carrying one channel, and another one carrying two channels. (The way this works is consistent with SCLang). In order to get the correct behaviour (left outputs of the PanAz summed, and right output of the PanAz summed), wrap this expression in a Mix(...) before passing it to the output UGen.

Value Params
bus

bus index to write to. For an audio-rate UGen, this is an audio-bus, for a control-rate UGen, this is a control-bus.

in

signal to write to the bus. If the UGen is audio-rate, the input must also be audio-rate.

See also
Companion
object
object Resonz extends ProductReader[Resonz]

A two pole resonant filter UGen. It has zeroes at z = +1 and z = -1.

A two pole resonant filter UGen. It has zeroes at z = +1 and z = -1.

Based on K. Steiglitz, "A Note on Constant-Gain Digital Resonators", Computer Music Journal, vol 18, no. 4, pp. 8-10, Winter 1994.

===Examples===

// modulated frequency
play {
 val in   = Saw.ar(200) * 0.5
 val freq = SinOsc.ar(XLine.ar(0.3, 100, 20)).mulAdd(3600, 4000)
 Resonz.ar(in, freq)
}
// mouse controlled frequency and Q
play {
 val in   = WhiteNoise.ar(0.5)
 val freq = MouseX.kr(200, 10000, 1)
 val q    = MouseY.kr(1, 100, 1) // bottom to top
 val flt  = Resonz.ar(in, freq, q.reciprocal)
 flt * q.sqrt // compensate for energy loss
}
See also
Companion
class
final case
class Resonz(rate: MaybeRate, in: GE, freq: GE, rq: GE) extends SingleOut

A two pole resonant filter UGen. It has zeroes at z = +1 and z = -1.

A two pole resonant filter UGen. It has zeroes at z = +1 and z = -1.

Based on K. Steiglitz, "A Note on Constant-Gain Digital Resonators", Computer Music Journal, vol 18, no. 4, pp. 8-10, Winter 1994.

Value Params
freq

resonant frequency in Hertz

in

input signal to be filtered

rq

reciprocal of Q. The Q (or quality) is conventionally defined as center-frequency / bandwidth, meaning that rq  = bandwidth / center-frequency. A higher Q or lower rq produces a steeper filter.

See also
Companion
object
object Ringz extends ProductReader[Ringz]

A resonant or "ringing" filter UGen. This is the same as Resonz , except that instead of a Q parameter, the bandwidth is specified as a 60 dB ring decay time. One Ringz is equivalent to one component of the Klank UGen.

A resonant or "ringing" filter UGen. This is the same as Resonz , except that instead of a Q parameter, the bandwidth is specified as a 60 dB ring decay time. One Ringz is equivalent to one component of the Klank UGen.

''Note'': Ringz and derived UGens Klank and Formlet produce output RMS depending on the server's sampling rate. This is to achieve the same amplitude for single-sample impulse inputs.

===Examples===

// module ring time
play { Ringz.ar(Impulse.ar(6) * 0.3, 2000, XLine.kr(4, 0.04, 8)) }
// modulated frequency
play {
 val in   = Saw.ar(200) * 0.02
 val freq = SinOsc.ar(XLine.ar(0.3, 100, 20)).mulAdd(2800, 4800)
 Ringz.ar(in, freq)
}
// multiple glissandi excited by noise
play {
 val ex = WhiteNoise.ar(0.001)
 Mix.fill(10) {
   Ringz.ar(ex,
     XLine.kr(ExpRand(100, 5000), ExpRand(100, 5000), 20),
   0.5)
 }
}
See also
Companion
class
final case
class Ringz(rate: MaybeRate, in: GE, freq: GE, decay: GE) extends SingleOut

A resonant or "ringing" filter UGen. This is the same as Resonz , except that instead of a Q parameter, the bandwidth is specified as a 60 dB ring decay time. One Ringz is equivalent to one component of the Klank UGen.

A resonant or "ringing" filter UGen. This is the same as Resonz , except that instead of a Q parameter, the bandwidth is specified as a 60 dB ring decay time. One Ringz is equivalent to one component of the Klank UGen.

''Note'': Ringz and derived UGens Klank and Formlet produce output RMS depending on the server's sampling rate. This is to achieve the same amplitude for single-sample impulse inputs.

Value Params
decay

the 60 dB decay time in seconds

freq

resonant frequency in Hertz

in

input signal to be filtered

See also
Companion
object
object Rotate2 extends ProductReader[Rotate2]

A UGen that can be used for rotating an ambisonic B-format sound field around an axis. It uses an equal-power rotation so it also works well on stereo sounds. It takes two audio inputs ( x , y ) and an angle control ( pos ). It outputs again two channels, using these formulas:

A UGen that can be used for rotating an ambisonic B-format sound field around an axis. It uses an equal-power rotation so it also works well on stereo sounds. It takes two audio inputs ( x , y ) and an angle control ( pos ). It outputs again two channels, using these formulas:

xr = cos(angle) * x + sin(angle) * y
yr = cos(angle) * y - sin(angle) * x

where angle = pos * Pi . This allows, for example, the use of LFSaw to create a continuous rotation around a circle. '''Note''': Be careful when accessing the output channels. xr and yr are the X and Y output channels, whereas x and y refers to the X and Y input channel.

===Examples===

// 4-channel rotation of opposite sounds
play {
 val p = WhiteNoise.ar(0.05)                     // first source
 val q = Mix(LFSaw.ar(Seq(200, 200.37))) * 0.03  // second source
 // B-format encode 2 signals at opposite sides of the circle
 val enc = PanB2.ar(p, -0.5) + PanB2.ar(q, +0.5)
 val Seq(w, x, y) = (0 to 2).map(enc out _)
 val rot = Rotate2.ar(x, y, MouseX.kr(-1, +1))
 // B-format decode to quad (front-left, front-right, rear-left, rear-right)
 DecodeB2.ar(4, w, rot.xr, rot.yr)
}
Companion
class
final case
class Rotate2(rate: Rate, x: GE, y: GE, pos: GE) extends MultiOut

A UGen that can be used for rotating an ambisonic B-format sound field around an axis. It uses an equal-power rotation so it also works well on stereo sounds. It takes two audio inputs ( x , y ) and an angle control ( pos ). It outputs again two channels, using these formulas:

A UGen that can be used for rotating an ambisonic B-format sound field around an axis. It uses an equal-power rotation so it also works well on stereo sounds. It takes two audio inputs ( x , y ) and an angle control ( pos ). It outputs again two channels, using these formulas:

xr = cos(angle) * x + sin(angle) * y
yr = cos(angle) * y - sin(angle) * x

where angle = pos * Pi . This allows, for example, the use of LFSaw to create a continuous rotation around a circle. '''Note''': Be careful when accessing the output channels. xr and yr are the X and Y output channels, whereas x and y refers to the X and Y input channel.

Value Params
pos

angle to rotate around the circle, normalized between -1 and +1. -1 and +1 corresponds to -180 and +180 degrees (behind), -0.5 is 90 degrees left, 0 is frontal, +0.5 is 90 degrees right.

x

B-format X input channel

y

B-format Y input channel

Companion
object
object RunningMax extends ProductReader[RunningMax]

A UGen to measure a signal's maximum value between triggers.

A UGen to measure a signal's maximum value between triggers.

The UGen keeps an internal state that reflects the maximum input value observed. When a trigger occurs at the reset input, it first copies the current maximum value to its output and then (quasi-simultaneously) resets its internal state to the current input value.

===Examples===

// illustrate timing
play {
 val n = BrownNoise.ar
 val t = Impulse.ar(4)
 val r = RunningMax.ar(n, t)
 // value at the moment the reset
 // is triggered
 n.poll(t, "cur")
 // this is the maximum of the
 // recent two input samples
 // (the one during reset and
 // the current one), therefore
 // equal or slightly greater than
 // the 'cur' value
 r.poll(Delay1.ar(t), "max")
 ()
}
See also
Companion
class
final case
class RunningMax(rate: Rate, in: GE, trig: GE) extends SingleOut

A UGen to measure a signal's maximum value between triggers.

A UGen to measure a signal's maximum value between triggers.

The UGen keeps an internal state that reflects the maximum input value observed. When a trigger occurs at the reset input, it first copies the current maximum value to its output and then (quasi-simultaneously) resets its internal state to the current input value.

Value Params
in

input signal to analyze

trig

resets the maximum observed value to the current value of the input signal

See also
Companion
object
object RunningMin extends ProductReader[RunningMin]

A UGen to measure a signal's minimum value between triggers.

A UGen to measure a signal's minimum value between triggers.

The UGen keeps an internal state that reflects the minimum input value observed. When a trigger occurs at the reset input, it first copies the current minimum value to its output and then (quasi-simultaneously) resets its internal state to the current input value.

===Examples===

// illustrate timing
play {
 val n = BrownNoise.ar
 val t = Impulse.ar(4)
 val r = RunningMin.ar(n, t)
 // value at the moment the reset
 // is triggered
 n.poll(t, "cur")
 // this is the minimum of the
 // recent two input samples
 // (the one during reset and
 // the current one), therefore
 // equal or slightly less than
 // the 'cur' value
 r.poll(Delay1.ar(t), "min")
 ()
}
See also
Companion
class
final case
class RunningMin(rate: Rate, in: GE, trig: GE) extends SingleOut

A UGen to measure a signal's minimum value between triggers.

A UGen to measure a signal's minimum value between triggers.

The UGen keeps an internal state that reflects the minimum input value observed. When a trigger occurs at the reset input, it first copies the current minimum value to its output and then (quasi-simultaneously) resets its internal state to the current input value.

Value Params
in

input signal to analyze

trig

resets the minimum observed value to the current value of the input signal

See also
Companion
object
object RunningSum extends ProductReader[RunningSum]

A UGen calculating the sum of an input signal over a sliding window of given number of samples.

A UGen calculating the sum of an input signal over a sliding window of given number of samples.

''Note'': Unlike RunningMin and RunningMax , this is not a trigger based operation, but at any one time, the sum of the past length values is reported, continuously sliding the analysis window.

===Examples===

// poll waveform's DC offset
play {
 val freq = 441
 val n    = SampleRate.ir / freq
 // mean over period of a pulse with 50% duty is 0.5
 val mean = RunningSum.ar(LFPulse.ar(freq), n) / n
 mean.roundTo(0.01).poll(label = "mean")
 ()
}
See also
Companion
class
final case
class RunningSum(rate: MaybeRate, in: GE, length: GE) extends SingleOut

A UGen calculating the sum of an input signal over a sliding window of given number of samples.

A UGen calculating the sum of an input signal over a sliding window of given number of samples.

''Note'': Unlike RunningMin and RunningMax , this is not a trigger based operation, but at any one time, the sum of the past length values is reported, continuously sliding the analysis window.

Value Params
in

the input signal to sum up

length

the length of the sliding window over the input signal. these are the number of audio sample-frames for audio-rate calculation, or the number of blocks for control-rate calculation summed up. ''Warning'': The UGen crashes when length is zero. ''(init-time only)''

See also
Companion
object
object SOS extends ProductReader[SOS]

A second order filter section (biquad) UGen. Filter coefficients are given directly rather than calculated for you. The formula is equivalent to:

A second order filter section (biquad) UGen. Filter coefficients are given directly rather than calculated for you. The formula is equivalent to:

out(i) = a0 * in(i) + a1 * in(i-1) + a2 * in(i-2) + b1 * out(i-1) + b2 * out(i-2)

===Examples===

// same as TwoPole
play {
 val theta = MouseX.kr(0.2*math.Pi, 0.9*math.Pi)
 val rho   = MouseY.kr(0.6, 0.98)
 val b1    = 2.0 * rho * theta.cos
 val b2    = -(rho.squared)
 SOS.ar(WhiteNoise.ar(Seq(0.05, 0.05)), 1.0, 0.0, 0.0, b1, b2)
}
// used as control signal
play {
 val theta = MouseX.kr(0.2*math.Pi, math.Pi)
 val rho   = MouseY.kr(0.6, 0.99)
 val b1    = 2.0 * rho * theta.cos
 val b2    = -(rho.squared)
 val vib   = SOS.kr(LFSaw.kr(3.16), 1.0, 0.0, 0.0, b1, b2)
 SinOsc.ar(vib * 200 + 600) * 0.2
}
See also
Companion
class
final case
class SOS(rate: MaybeRate, in: GE, a0: GE, a1: GE, a2: GE, b1: GE, b2: GE) extends SingleOut

A second order filter section (biquad) UGen. Filter coefficients are given directly rather than calculated for you. The formula is equivalent to:

A second order filter section (biquad) UGen. Filter coefficients are given directly rather than calculated for you. The formula is equivalent to:

out(i) = a0 * in(i) + a1 * in(i-1) + a2 * in(i-2) + b1 * out(i-1) + b2 * out(i-2)
Value Params
in

input signal to be filtered

See also
Companion
object
object SampleDur extends ProductReader[SampleDur]

A UGen that reports the server's current (audio) sample period in seconds. This is equivalent to the reciprocal of SampleRate

A UGen that reports the server's current (audio) sample period in seconds. This is equivalent to the reciprocal of SampleRate

===Examples===

// print the sample period
play { SampleDur.ir.poll(0) }
See also
Companion
class
final case
class SampleDur() extends SingleOut with ScalarRated

A UGen that reports the server's current (audio) sample period in seconds. This is equivalent to the reciprocal of SampleRate

A UGen that reports the server's current (audio) sample period in seconds. This is equivalent to the reciprocal of SampleRate

See also
Companion
object
object SampleRate extends ProductReader[SampleRate]

A UGen that reports the server's current (audio) sample rate. This is equivalent to the reciprocal of SampleDur

A UGen that reports the server's current (audio) sample rate. This is equivalent to the reciprocal of SampleDur

===Examples===

// print the sample rate
play { SampleRate.ir.poll(0) }
// use a fraction as oscillator frequency
play {
 val div    = MouseX.kr(512, 2, 1, 0).roundTo(1)
 val change = HPZ1.kr(div).abs
 val freq   = SampleRate.ir / div
 freq.poll(change, label = "freq")
 SinOsc.ar(freq) * 0.1
}
See also
Companion
class
final case
class SampleRate() extends SingleOut with ScalarRated

A UGen that reports the server's current (audio) sample rate. This is equivalent to the reciprocal of SampleDur

A UGen that reports the server's current (audio) sample rate. This is equivalent to the reciprocal of SampleDur

See also
Companion
object
object Saw extends ProductReader[Saw]

A band-limited sawtooth wave generator UGen.

A band-limited sawtooth wave generator UGen.

===Examples===

// modulate frequency
play { Saw.ar(XLine.kr(40, 4000, 6)) * 0.2 }
// two saws with different frequencies through resonant filter
play { RLPF.ar(Saw.ar(Seq(100, 250)) * 0.2, XLine.kr(8000, 400, 6), 0.05) }
See also
Companion
class
final case
class Saw(rate: Rate, freq: GE) extends SingleOut

A band-limited sawtooth wave generator UGen.

A band-limited sawtooth wave generator UGen.

Value Params
freq

Fundamental frequency in Hertz

See also
Companion
object
object Schmidt extends ProductReader[Schmidt]

A Schmidt trigger UGen. Initially it outputs zero. When the input signal rises above hi , its output switches to 1.0, which is hold until the signal falls below lo , switching the output again to 0.0. The produces a kind of hysteresis behavior, preventing heavy oscillations in a noisy system which might occur with a single-threshold trigger.

A Schmidt trigger UGen. Initially it outputs zero. When the input signal rises above hi , its output switches to 1.0, which is hold until the signal falls below lo , switching the output again to 0.0. The produces a kind of hysteresis behavior, preventing heavy oscillations in a noisy system which might occur with a single-threshold trigger.

Companion
class
final case
class Schmidt(rate: MaybeRate, in: GE, lo: GE, hi: GE) extends SingleOut

A Schmidt trigger UGen. Initially it outputs zero. When the input signal rises above hi , its output switches to 1.0, which is hold until the signal falls below lo , switching the output again to 0.0. The produces a kind of hysteresis behavior, preventing heavy oscillations in a noisy system which might occur with a single-threshold trigger.

A Schmidt trigger UGen. Initially it outputs zero. When the input signal rises above hi , its output switches to 1.0, which is hold until the signal falls below lo , switching the output again to 0.0. The produces a kind of hysteresis behavior, preventing heavy oscillations in a noisy system which might occur with a single-threshold trigger.

Value Params
hi

high threshold

in

input signal to be analyzed

lo

low threshold

Companion
object
object ScopeOut extends ProductReader[ScopeOut]
Companion
class
final case
class ScopeOut(rate: Rate, buf: GE, in: GE) extends ZeroOut with HasSideEffect with IsIndividual
Companion
object
object ScopeOut2 extends ProductReader[ScopeOut2]
Companion
class
final case
class ScopeOut2(rate: Rate, buf: GE, in: GE, maxFrames: GE, frames: GE) extends ZeroOut with HasSideEffect with IsIndividual
Companion
object
object Select extends ProductReader[Select]

A UGen which selects among a sequence of inputs, according to an index signal. Note that, although only one signal of the multi input is let through at a time, still all ugens are continuously running.

A UGen which selects among a sequence of inputs, according to an index signal. Note that, although only one signal of the multi input is let through at a time, still all ugens are continuously running.

See also
Companion
class
final case
class Select(rate: Rate, index: GE, in: GE) extends SingleOut

A UGen which selects among a sequence of inputs, according to an index signal. Note that, although only one signal of the multi input is let through at a time, still all ugens are continuously running.

A UGen which selects among a sequence of inputs, according to an index signal. Note that, although only one signal of the multi input is let through at a time, still all ugens are continuously running.

Value Params
in

a graph element which is composed of the channels to be indexed.

index

an index signal into the channels of the in argument. The index is automatically clipped to lie between 0 and in.numOutputs - 1 . The index is truncated to its integer part (not rounded), hence using for instance an index of 0.9 will still be interpreted as index 0 .

See also
Companion
object
object SendReply extends ProductReader[SendReply]

A UGen which sends an sequence of values from the server to all notified clients upon receiving triggers. The message sent is osc.Message(<(String) msgName>, <(Int) nodeId>, <(Int) replyId>, <(Float) values>*) .

A UGen which sends an sequence of values from the server to all notified clients upon receiving triggers. The message sent is osc.Message(<(String) msgName>, <(Int) nodeId>, <(Int) replyId>, <(Float) values>*) .

For sending a single value, SendTrig provides an alternative.

See also
Note

The argument order is different from its sclang counterpart.

Companion
class
final case
class SendReply(rate: MaybeRate, trig: GE, values: GE, msgName: String, id: GE) extends ZeroOut with HasSideEffect

A UGen which sends an sequence of values from the server to all notified clients upon receiving triggers. The message sent is osc.Message(<(String) msgName>, <(Int) nodeId>, <(Int) replyId>, <(Float) values>*) .

A UGen which sends an sequence of values from the server to all notified clients upon receiving triggers. The message sent is osc.Message(<(String) msgName>, <(Int) nodeId>, <(Int) replyId>, <(Float) values>*) .

For sending a single value, SendTrig provides an alternative.

Value Params
id

an integer identifier which is contained in the reply message. While you can distinguish different SendReply instances from the same Synth by choosing different OSC message names, depending on the application you may use the same message name but different ids (similar to SendTrig ).

msgName

a string specifying the OSC message's name. by convention, this should start with a forward slash and contain only 7-bit ascii characters.

trig

a non-positive to positive transition triggers a message

values

a graph element comprising the signal channels to be polled

See also
Note

The argument order is different from its sclang counterpart.

Companion
object
object SendTrig extends ProductReader[SendTrig]

A UGen that sends a value from the server to all notified clients upon receiving triggers. The message sent is osc.Message("/tr", <(Int) nodeId>, <(Int) trigId>, <(Float) value>) .

A UGen that sends a value from the server to all notified clients upon receiving triggers. The message sent is osc.Message("/tr", <(Int) nodeId>, <(Int) trigId>, <(Float) value>) .

For sending an array of values, or using an arbitrary reply command, see SendReply .

See also
Note

The argument order is different from its sclang counterpart.

Companion
class
final case
class SendTrig(rate: MaybeRate, trig: GE, value: GE, id: GE) extends ZeroOut with HasSideEffect

A UGen that sends a value from the server to all notified clients upon receiving triggers. The message sent is osc.Message("/tr", <(Int) nodeId>, <(Int) trigId>, <(Float) value>) .

A UGen that sends a value from the server to all notified clients upon receiving triggers. The message sent is osc.Message("/tr", <(Int) nodeId>, <(Int) trigId>, <(Float) value>) .

For sending an array of values, or using an arbitrary reply command, see SendReply .

Value Params
id

an arbitrary integer that will be sent along with the "/tr" message. This is useful to distinguish between several SendTrig instances per SynthDef.

trig

the trigger signal causing the value to be read and sent. A trigger occurs when passing from non-positive to positive.

value

a changing signal or constant that will be polled at the time of trigger, and its value passed with the trigger message

See also
Note

The argument order is different from its sclang counterpart.

Companion
object
object SetBuf extends ProductReader[SetBuf]

A scalar (init-time) UGen that overwrites contents of a buffer with given values.

A scalar (init-time) UGen that overwrites contents of a buffer with given values.

See also
Companion
class
final case
class SetBuf(buf: GE, values: GE, offset: GE) extends SingleOut with ScalarRated with HasSideEffect with IsIndividual

A scalar (init-time) UGen that overwrites contents of a buffer with given values.

A scalar (init-time) UGen that overwrites contents of a buffer with given values.

Value Params
buf

the buffer to write the values into

offset

frame offset into the buffer

values

values to write into the buffer

See also
Companion
object
object SetResetFF extends ProductReader[SetResetFF]

A flip-flop UGen with two inputs, one (set) triggering an output of 1.0, the other (reset) triggering an output of 0.0. Subsequent triggers happening within the same input slot have no effect. If both inputs receive a trigger at the same time, the ''reset'' input takes precedence.

A flip-flop UGen with two inputs, one (set) triggering an output of 1.0, the other (reset) triggering an output of 0.0. Subsequent triggers happening within the same input slot have no effect. If both inputs receive a trigger at the same time, the ''reset'' input takes precedence.

===Examples===

// mouse-button toggle
play {
 // make sure lag is zero, otherwise the output
 // never falls back exactly to zero!
 val set   = MouseButton.kr(lag = 0)
 val reset = Impulse.kr(1)
 val ff    = SetResetFF.kr(set, reset)
 SinOsc.ar(ff.mulAdd(400, 800)) * 0.1
}
// limit trigger rate
play {
 // with a combination of TDelay and SetResetFF
 // we can build a filter that lets triggers
 // pass at a maximum rate.
 val dur   = 1.0  // minimum spacing between triggers
 val in    = Dust.ar(10)  // high frequency trigger
 val lim   = SetResetFF.ar(in, TDelay.ar(in, dur))
 val time  = Timer.ar(lim)
 time.poll(lim, "bang")
 ()
}
See also
Companion
class
final case
class SetResetFF(rate: MaybeRate, trig: GE, reset: GE) extends SingleOut

A flip-flop UGen with two inputs, one (set) triggering an output of 1.0, the other (reset) triggering an output of 0.0. Subsequent triggers happening within the same input slot have no effect. If both inputs receive a trigger at the same time, the ''reset'' input takes precedence.

A flip-flop UGen with two inputs, one (set) triggering an output of 1.0, the other (reset) triggering an output of 0.0. Subsequent triggers happening within the same input slot have no effect. If both inputs receive a trigger at the same time, the ''reset'' input takes precedence.

Value Params
reset

trigger that sets output to 0. A trigger happens when the signal changes from non-positive to positive.

trig

trigger that sets output to 1. A trigger happens when the signal changes from non-positive to positive.

See also
Companion
object
object Shaper extends ProductReader[Shaper]

A waveshaping UGen. Waveshaping is a the process of translating an input signal by indexing a table (buffer).

A waveshaping UGen. Waveshaping is a the process of translating an input signal by indexing a table (buffer).

'''Advanced notes:''' wavetable format:

Signal: [a0, a1, a2...]
Wavetable: [2*a0-a1, a1-a0, 2*a1-a2, a2-a1, 2*a2-a3, a3-a2...]

This strange format is not a standard linear interpolation (integer + frac), but for (integer part -1) and (1+frac)) due to some efficient maths for integer to float conversion in the underlying C code.

See also
Companion
class
final case
class Shaper(rate: Rate, buf: GE, in: GE) extends SingleOut with IsIndividual

A waveshaping UGen. Waveshaping is a the process of translating an input signal by indexing a table (buffer).

A waveshaping UGen. Waveshaping is a the process of translating an input signal by indexing a table (buffer).

'''Advanced notes:''' wavetable format:

Signal: [a0, a1, a2...]
Wavetable: [2*a0-a1, a1-a0, 2*a1-a2, a2-a1, 2*a2-a3, a3-a2...]

This strange format is not a standard linear interpolation (integer + frac), but for (integer part -1) and (1+frac)) due to some efficient maths for integer to float conversion in the underlying C code.

Value Params
buf

buffer filled in wavetable format containing the transfer function.

in

signal to be fed into the wave shaper

See also
Companion
object
object Silent extends ProductReader[Silent]

A graph element that produces a constant silent (zero) audio-rate output signal.

A graph element that produces a constant silent (zero) audio-rate output signal.

See also
Companion
class
final case
class Silent(numChannels: Int) extends Lazy with AudioRated

A graph element that produces a constant silent (zero) audio-rate output signal.

A graph element that produces a constant silent (zero) audio-rate output signal.

Value Params
numChannels

the number of output channels

See also
Companion
object
object SinOsc extends ProductReader[SinOsc]

A sinusoidal (sine tone) oscillator UGen. This is the same as Osc except that it uses a built-in interpolating sine table of 8192 entries.

A sinusoidal (sine tone) oscillator UGen. This is the same as Osc except that it uses a built-in interpolating sine table of 8192 entries.

'''Note''' that currently (SC 3.7.x), the first frame generated is not zero (i.e. the value of the sine oscillation at time zero) but the value at time 1 / SampleRate.ir .

===Examples===

// plain oscillator
play { SinOsc.ar(441) * 0.2 }
// modulate frequency
play { SinOsc.ar(SinOsc.ar(XLine.kr(1, 1000, 9)).mulAdd(200, 800)) * 0.25 }
// modulate phase
play { SinOsc.ar(800, SinOsc.ar(XLine.kr(1, 1000, 9)) * 2*math.Pi) * 0.25 }
See also
Companion
class
final case
class SinOsc(rate: Rate, freq: GE, phase: GE) extends SingleOut

A sinusoidal (sine tone) oscillator UGen. This is the same as Osc except that it uses a built-in interpolating sine table of 8192 entries.

A sinusoidal (sine tone) oscillator UGen. This is the same as Osc except that it uses a built-in interpolating sine table of 8192 entries.

'''Note''' that currently (SC 3.7.x), the first frame generated is not zero (i.e. the value of the sine oscillation at time zero) but the value at time 1 / SampleRate.ir .

Value Params
freq

frequency in Hertz

phase

phase offset or modulator in radians

See also
Companion
object
object SinOscFB extends ProductReader[SinOscFB]

A sine oscillator UGen that has phase modulation feedback. Its output plugs back into the phase input, allowing a modulation between a sine wave and a sawtooth-like wave. "Over-modulation" causes chaotic oscillation. It may be useful to simulate feedback FM synths.

A sine oscillator UGen that has phase modulation feedback. Its output plugs back into the phase input, allowing a modulation between a sine wave and a sawtooth-like wave. "Over-modulation" causes chaotic oscillation. It may be useful to simulate feedback FM synths.

===Examples===

// mouse-controlled feedback
play { SinOscFB.ar(441, MouseX.kr(0, math.Pi)) * 0.1 }
See also
Companion
class
final case
class SinOscFB(rate: Rate, freq: GE, feedback: GE) extends SingleOut

A sine oscillator UGen that has phase modulation feedback. Its output plugs back into the phase input, allowing a modulation between a sine wave and a sawtooth-like wave. "Over-modulation" causes chaotic oscillation. It may be useful to simulate feedback FM synths.

A sine oscillator UGen that has phase modulation feedback. Its output plugs back into the phase input, allowing a modulation between a sine wave and a sawtooth-like wave. "Over-modulation" causes chaotic oscillation. It may be useful to simulate feedback FM synths.

Value Params
feedback

the amplitude of phase feedback in radians. a value of zero produces a clean sine wave.

freq

frequency in Hertz

See also
Companion
object
object Slew extends ProductReader[Slew]

A slew rate limiter UGen. Limits the slope of an input signal. The slope is expressed in units per second.

A slew rate limiter UGen. Limits the slope of an input signal. The slope is expressed in units per second.

Since the UGen is initialized with the initial value of the input signal, some tricks must be applied to set it to an alternative start value. For example:

val in = Select.kr(ToggleFF.kr(1), Seq("start".ir, "target".kr))
Slew.kr(in)  // begins at "start" and moves towards "target"
Companion
class
final case
class Slew(rate: MaybeRate, in: GE, up: GE, down: GE) extends SingleOut

A slew rate limiter UGen. Limits the slope of an input signal. The slope is expressed in units per second.

A slew rate limiter UGen. Limits the slope of an input signal. The slope is expressed in units per second.

Since the UGen is initialized with the initial value of the input signal, some tricks must be applied to set it to an alternative start value. For example:

val in = Select.kr(ToggleFF.kr(1), Seq("start".ir, "target".kr))
Slew.kr(in)  // begins at "start" and moves towards "target"
Value Params
down

maximum downward slope.

in

input signal

up

maximum upward slope.

Companion
object
object Slope extends ProductReader[Slope]

A UGen measuring the slope of signal. It calculates the rate of change per second of a signal, as given by the following formula:

A UGen measuring the slope of signal. It calculates the rate of change per second of a signal, as given by the following formula:

out(i) = (in(i) - in(i-1)) * sampleRate

It thus equal to HPZ1.ar(_) * 2 * SampleRate.ir

Companion
class
final case
class Slope(rate: MaybeRate, in: GE) extends SingleOut

A UGen measuring the slope of signal. It calculates the rate of change per second of a signal, as given by the following formula:

A UGen measuring the slope of signal. It calculates the rate of change per second of a signal, as given by the following formula:

out(i) = (in(i) - in(i-1)) * sampleRate

It thus equal to HPZ1.ar(_) * 2 * SampleRate.ir

Value Params
in

input signal to be measured

Companion
object
object SpecCentroid extends ProductReader[SpecCentroid]

A UGen to measure the spectral centroid. Given an FFT chain, this measures the spectral centroid, which is the weighted mean frequency, or the "centre of mass" of the spectrum. (DC is ignored.) This can be a useful indicator of the perceptual brightness of a signal.

A UGen to measure the spectral centroid. Given an FFT chain, this measures the spectral centroid, which is the weighted mean frequency, or the "centre of mass" of the spectrum. (DC is ignored.) This can be a useful indicator of the perceptual brightness of a signal.

Note that the output frequency is pretty close to the correct value when feeding in a sine signal, but the estimate is usually too high when using for example filtered noise. In that case, you will get better results using SpecPcile at 50%.

Note that despite running at control-rate, the output remains constant for each FFT frame. E.g. with an FFT size of 1024 and 50% overlap, a new measure is generated every 512 audio frames, or (at control block size 64) every 8 control blocks.

See also
Companion
class
final case
class SpecCentroid(chain: GE) extends SingleOut with ControlRated with IsIndividual

A UGen to measure the spectral centroid. Given an FFT chain, this measures the spectral centroid, which is the weighted mean frequency, or the "centre of mass" of the spectrum. (DC is ignored.) This can be a useful indicator of the perceptual brightness of a signal.

A UGen to measure the spectral centroid. Given an FFT chain, this measures the spectral centroid, which is the weighted mean frequency, or the "centre of mass" of the spectrum. (DC is ignored.) This can be a useful indicator of the perceptual brightness of a signal.

Note that the output frequency is pretty close to the correct value when feeding in a sine signal, but the estimate is usually too high when using for example filtered noise. In that case, you will get better results using SpecPcile at 50%.

Note that despite running at control-rate, the output remains constant for each FFT frame. E.g. with an FFT size of 1024 and 50% overlap, a new measure is generated every 512 audio frames, or (at control block size 64) every 8 control blocks.

Value Params
chain

the fft signal (buffer) to analyze

See also
Companion
object
object SpecFlatness extends ProductReader[SpecFlatness]

A UGen to measure spectral flatness. Given an FFT chain this calculates the Spectral Flatness measure, defined as a power spectrum's geometric mean divided by its arithmetic mean. This gives a measure which ranges from approx 0 for a pure sinusoid, to approx 1 for white noise.

A UGen to measure spectral flatness. Given an FFT chain this calculates the Spectral Flatness measure, defined as a power spectrum's geometric mean divided by its arithmetic mean. This gives a measure which ranges from approx 0 for a pure sinusoid, to approx 1 for white noise.

The measure is calculated linearly. For some applications you may wish to convert the value to a decibel scale. '''Note''' that this UGen may output NaN when the input is zero (probably due to division by zero). In that case, CheckBadValues can be used to prevent further problems.

Note that despite running at control-rate, the output remains constant for each FFT frame. E.g. with an FFT size of 1024 and 50% overlap, a new measure is generated every 512 audio frames, or (at control block size 64) every 8 control blocks.

See also
Companion
class
final case
class SpecFlatness(chain: GE) extends SingleOut with ControlRated with IsIndividual

A UGen to measure spectral flatness. Given an FFT chain this calculates the Spectral Flatness measure, defined as a power spectrum's geometric mean divided by its arithmetic mean. This gives a measure which ranges from approx 0 for a pure sinusoid, to approx 1 for white noise.

A UGen to measure spectral flatness. Given an FFT chain this calculates the Spectral Flatness measure, defined as a power spectrum's geometric mean divided by its arithmetic mean. This gives a measure which ranges from approx 0 for a pure sinusoid, to approx 1 for white noise.

The measure is calculated linearly. For some applications you may wish to convert the value to a decibel scale. '''Note''' that this UGen may output NaN when the input is zero (probably due to division by zero). In that case, CheckBadValues can be used to prevent further problems.

Note that despite running at control-rate, the output remains constant for each FFT frame. E.g. with an FFT size of 1024 and 50% overlap, a new measure is generated every 512 audio frames, or (at control block size 64) every 8 control blocks.

Value Params
chain

the fft signal (buffer) to analyze

See also
Companion
object
object SpecPcile extends ProductReader[SpecPcile]

A UGen to find the percentile of a signal's magnitude spectrum. Given an FFT chain this calculates the cumulative distribution of the frequency spectrum, and outputs the frequency value which corresponds to the desired percentile. For example, to find the frequency at which 90% of the spectral energy lies below that frequency, you want the 90-percentile, which means the value of percent should be 0.9. The 90-percentile or 95-percentile is often used as a measure of spectral roll-off.

A UGen to find the percentile of a signal's magnitude spectrum. Given an FFT chain this calculates the cumulative distribution of the frequency spectrum, and outputs the frequency value which corresponds to the desired percentile. For example, to find the frequency at which 90% of the spectral energy lies below that frequency, you want the 90-percentile, which means the value of percent should be 0.9. The 90-percentile or 95-percentile is often used as a measure of spectral roll-off.

Note that despite running at control-rate, the output remains constant for each FFT frame. E.g. with an FFT size of 1024 and 50% overlap, a new measure is generated every 512 audio frames, or (at control block size 64) every 8 control blocks.

Companion
class
final case
class SpecPcile(chain: GE, percent: GE, interp: GE) extends SingleOut with ControlRated with IsIndividual

A UGen to find the percentile of a signal's magnitude spectrum. Given an FFT chain this calculates the cumulative distribution of the frequency spectrum, and outputs the frequency value which corresponds to the desired percentile. For example, to find the frequency at which 90% of the spectral energy lies below that frequency, you want the 90-percentile, which means the value of percent should be 0.9. The 90-percentile or 95-percentile is often used as a measure of spectral roll-off.

A UGen to find the percentile of a signal's magnitude spectrum. Given an FFT chain this calculates the cumulative distribution of the frequency spectrum, and outputs the frequency value which corresponds to the desired percentile. For example, to find the frequency at which 90% of the spectral energy lies below that frequency, you want the 90-percentile, which means the value of percent should be 0.9. The 90-percentile or 95-percentile is often used as a measure of spectral roll-off.

Note that despite running at control-rate, the output remains constant for each FFT frame. E.g. with an FFT size of 1024 and 50% overlap, a new measure is generated every 512 audio frames, or (at control block size 64) every 8 control blocks.

Value Params
chain

the fft signal (buffer) to analyze

interp

specifies whether interpolation should be used to try and make the percentile frequency estimate more accurate, at the cost of a little higher CPU usage. Set it to 1 to enable this.

percent

the percentage between 0.0 (0%) and 1.0 (100%)

Companion
object
object Splay extends ProductReader[Splay]

A graph element that spreads a sequence of input channels across a stereo pair of channels. This works by feeding each input channel through a dedicated Pan2 UGen, and mixing the results together.

A graph element that spreads a sequence of input channels across a stereo pair of channels. This works by feeding each input channel through a dedicated Pan2 UGen, and mixing the results together.

The stereo panning position from -1 to +1 for each input channel with index ch is calculated by the formula:

(ch * 2.0 / (num-in-channels - 1) - 1) + center

'''Note:''' the spread argument is currently not implemented, and thus channels will always be distributed with a spread of 1.0.

See also

Pan

Companion
class
final case
class Splay(rate: Rate, in: GE, spread: GE, center: GE, level: GE) extends Lazy

A graph element that spreads a sequence of input channels across a ring of output channels. This works by feeding each input channel through a dedicated Pan2 UGen, and mixing the results together.

A graph element that spreads a sequence of input channels across a ring of output channels. This works by feeding each input channel through a dedicated Pan2 UGen, and mixing the results together.

The stereo panning position from -1 to +1 for each input channel with index ch is calculated by the formula:

(ch * 2.0 / (num-in-channels - 1) - 1) + center

'''Note:''' the spread argument is currently not implemented, and thus channels will always be distributed with a spread of 1.0.

Value Params
center

shifts the center of the distribution

in

the input signal

level

a global gain factor (see Pan2)

spread

the spacing between input channels with respect to the output panning. '''Note:''' currently not implemented

See also
Companion
object
object SplayAz extends ProductReader[SplayAz]

A graph element that spreads a sequence of input channels across a ring of output channels. This works by feeding each input channel through a dedicated PanAz UGen, and mixing the results together.

A graph element that spreads a sequence of input channels across a ring of output channels. This works by feeding each input channel through a dedicated PanAz UGen, and mixing the results together.

The panning position of each input channel with index ch is calculated by the formula:

val pf = 2.0 / (num-in-channels - 1) * (num-out-channels - 1) / num-out-channels
ch * pf + center

'''Note:''' the spread argument is currently not implemented, and thus channels will always be distributed with a spread of 1.0.

See also
Companion
class
final case
class SplayAz(rate: Rate, numChannels: Int, in: GE, spread: GE, center: GE, level: GE, width: GE, orient: GE) extends Lazy

A graph element that spreads a sequence of input channels across a ring of output channels. This works by feeding each input channel through a dedicated PanAz UGen, and mixing the results together.

A graph element that spreads a sequence of input channels across a ring of output channels. This works by feeding each input channel through a dedicated PanAz UGen, and mixing the results together.

The panning position of each input channel with index ch is calculated by the formula:

val pf = 2.0 / (num-in-channels - 1) * (num-out-channels - 1) / num-out-channels
ch * pf + center

'''Note:''' the spread argument is currently not implemented, and thus channels will always be distributed with a spread of 1.0.

Value Params
center

the position of the first channel (see PanAz)

in

the input signal

level

a global gain factor (see PanAz)

numChannels

the number of output channels

orient

the orient parameter for each PanAz

spread

the spacing between input channels with respect to the output panning. '''Note:''' currently not implemented

width

the width parameter for each PanAz

See also
Companion
object
object Spring extends ProductReader[Spring]
Companion
class
final case
class Spring(rate: MaybeRate, in: GE, spring: GE, damp: GE) extends SingleOut
Companion
object
object StandardL extends ProductReader[StandardL]

A linear-interpolating sound generator based on the difference equations:

A linear-interpolating sound generator based on the difference equations:

x[n+1] = (x[n] + y[n+1]) % 2pi
y[n+1] = (y[n] + k * sin(x[n])) % 2pi

The standard map is an area preserving map of a cylinder discovered by the plasma physicist Boris Chirikov.

===Examples===

// vary frequency
play { StandardL.ar(MouseX.kr(20, SampleRate.ir)) * 0.3 }
// mouse-controlled parameter
play { StandardL.ar(SampleRate.ir/2, MouseX.kr(0.9, 4)) * 0.3 }
// as a frequency control
play { SinOsc.ar(StandardL.ar(40, MouseX.kr(0.9, 4)) * 800 + 900) * 0.4 }
See also
Companion
class
final case
class StandardL(rate: Rate, freq: GE, k: GE, xi: GE, yi: GE) extends SingleOut

A linear-interpolating sound generator based on the difference equations:

A linear-interpolating sound generator based on the difference equations:

x[n+1] = (x[n] + y[n+1]) % 2pi
y[n+1] = (y[n] + k * sin(x[n])) % 2pi

The standard map is an area preserving map of a cylinder discovered by the plasma physicist Boris Chirikov.

Value Params
freq

Iteration frequency in Hertz

k

Perturbation amount

xi

Initial value of x

yi

Initial value of y

See also
Companion
object
object StandardN extends ProductReader[StandardN]

A non-interpolating sound generator based on the difference equations:

A non-interpolating sound generator based on the difference equations:

x[n+1] = (x[n] + y[n+1]) % 2pi
y[n+1] = (y[n] + k * sin(x[n])) % 2pi

The standard map is an area preserving map of a cylinder discovered by the plasma physicist Boris Chirikov.

===Examples===

// vary frequency
play { StandardN.ar(MouseX.kr(20, SampleRate.ir)) * 0.3 }
// mouse-controlled parameter
play { StandardN.ar(SampleRate.ir/2, MouseX.kr(0.9, 4)) * 0.3 }
// as a frequency control
play { SinOsc.ar(StandardN.ar(40, MouseX.kr(0.9, 4)) * 800 + 900) * 0.4 }
See also
Companion
class
final case
class StandardN(rate: Rate, freq: GE, k: GE, xi: GE, yi: GE) extends SingleOut

A non-interpolating sound generator based on the difference equations:

A non-interpolating sound generator based on the difference equations:

x[n+1] = (x[n] + y[n+1]) % 2pi
y[n+1] = (y[n] + k * sin(x[n])) % 2pi

The standard map is an area preserving map of a cylinder discovered by the plasma physicist Boris Chirikov.

Value Params
freq

Iteration frequency in Hertz

k

Perturbation amount

xi

Initial value of x

yi

Initial value of y

See also
Companion
object
object Stepper extends ProductReader[Stepper]

A pulse counting UGen. Each trigger increments a counter which is output as a signal. The counter wraps inside the interval from lo to hi (inclusive). That if you use a lo other than zero, you might want to adjust resetVal as well. Stepper always starts with the value in resetVal , no matter what lo is or whether the reset trigger is high or not.

A pulse counting UGen. Each trigger increments a counter which is output as a signal. The counter wraps inside the interval from lo to hi (inclusive). That if you use a lo other than zero, you might want to adjust resetVal as well. Stepper always starts with the value in resetVal , no matter what lo is or whether the reset trigger is high or not.

===Examples===

// arpeggio
play {
 val tr    = Impulse.ar(10)
 val step  = Stepper.ar(tr, lo = 4, hi = 16)
 val freq  = step * 100
 SinOsc.ar(freq) * AmpComp.ar(freq) * 0.1
}
See also
Companion
class
final case
class Stepper(rate: MaybeRate, trig: GE, reset: GE, lo: GE, hi: GE, step: GE, resetVal: GE) extends SingleOut

A pulse counting UGen. Each trigger increments a counter which is output as a signal. The counter wraps inside the interval from lo to hi (inclusive). That if you use a lo other than zero, you might want to adjust resetVal as well. Stepper always starts with the value in resetVal , no matter what lo is or whether the reset trigger is high or not.

A pulse counting UGen. Each trigger increments a counter which is output as a signal. The counter wraps inside the interval from lo to hi (inclusive). That if you use a lo other than zero, you might want to adjust resetVal as well. Stepper always starts with the value in resetVal , no matter what lo is or whether the reset trigger is high or not.

Value Params
hi

The maximum value output. For an incremental step value, the counter jumps to lo if it were to rise beyond hi . Note that values greater than 0x7FFFFFBF (the default) cause numeric overflow and the UGen to malfunction.

lo

The minimum value output. For a decremental step value, the counter jumps to hi if it were to fall below lo .

reset

A trigger which resets the counter to resetVal immediately.

step

The amount by which the counter increases or decreases upon receiving triggers. Note that if you use a decremental counter, still lo must be the minimum and hi must be the maximum value output. If lo > hi , the UGen behaves wrongly. In the case of decremental counter, set resetVal to hi . E.g. to count from 4 down to 0, use Stepper.kr(trig, lo = 0, hi = 4, step = -1, resetVal = 4) , or, if you want to ignore an initial high trigger, you could do Stepper.kr(Impulse.kr(1), lo = 0, hi = 4, step = -1, resetVal = 0) -- so resetVal is lo but due to the initial trigger from Impulse the Stepper will in fact start outputting from 4 .

trig

The trigger signal which increments the counter. A trigger happens when the signal changes from non-positive to positive. Note that if the UGen is created with the trigger initially high, the counter will also be incremented immediately. Thus a Stepper.kr(Impulse.kr(1)) will begin by outputting 1 . If you want to avoid this, you could their subtract Impulse.kr(0) from the trigger input, or set resetVal to hi . E.g. Stepper.kr(Impulse.kr(1), lo = 0, hi = 4, resetVal = 4) will produce the sequence 0, 1, 2, 4, 0, ...

See also
Companion
object
object StereoConvolution2L extends ProductReader[StereoConvolution2L]

A frequency domain stereo convolution UGen, capable of performing linear cross-fades between kernel updates. When receiving a trigger, there is a linear cross-fade between the old kernel the new buffer contents. It operates similar to Convolution2L , however uses two buffers and outputs a stereo signal, resulting in better CPU usage than two discrete instances of Convolution2L as this way one FFT transformation per period is saved.

A frequency domain stereo convolution UGen, capable of performing linear cross-fades between kernel updates. When receiving a trigger, there is a linear cross-fade between the old kernel the new buffer contents. It operates similar to Convolution2L , however uses two buffers and outputs a stereo signal, resulting in better CPU usage than two discrete instances of Convolution2L as this way one FFT transformation per period is saved.

'''Warning: This UGen seems currently broken (SC 3.6.3)'''

See also
Companion
class
final case
class StereoConvolution2L(rate: Rate, in: GE, kernelL: GE, kernelR: GE, trig: GE, frameSize: GE, fadePeriods: GE) extends MultiOut with IsIndividual

A frequency domain stereo convolution UGen, capable of performing linear cross-fades between kernel updates. When receiving a trigger, there is a linear cross-fade between the old kernel the new buffer contents. It operates similar to Convolution2L , however uses two buffers and outputs a stereo signal, resulting in better CPU usage than two discrete instances of Convolution2L as this way one FFT transformation per period is saved.

A frequency domain stereo convolution UGen, capable of performing linear cross-fades between kernel updates. When receiving a trigger, there is a linear cross-fade between the old kernel the new buffer contents. It operates similar to Convolution2L , however uses two buffers and outputs a stereo signal, resulting in better CPU usage than two discrete instances of Convolution2L as this way one FFT transformation per period is saved.

'''Warning: This UGen seems currently broken (SC 3.6.3)'''

Value Params
fadePeriods

fade duration expressed as number of convolved blocks. If the desired duration in seconds is dur , then the number of periods can be calculated as fadePeriods = dur * SampleRate.ir / frameSize . ''(init-time only)''

frameSize

size of the kernel. this must be a power of two. the FFT calculated internally by the UGen has a size of twice this value. The maximum allowed frameSize is 16384. ''(init-time only)''

in

the realtime input to be convolved

kernelL

buffer identifier for the left channel's fixed kernel, which may be modulated in combination with the trigger

kernelR

buffer identifier for the right channel's fixed kernel, which may be modulated in combination with the trigger

trig

updates the kernel on a change from non-positive to positive (<= 0 to >0), and starts a new cross-fade from the previous kernel to the new one over the given amount of periods.

See also
Companion
object
object SubsampleOffset extends ProductReader[SubsampleOffset]

A UGen that reports the fractional sample offset of the current Synth from its requested scheduled start.

A UGen that reports the fractional sample offset of the current Synth from its requested scheduled start.

When a synth is created from a time stamped osc-bundle, it starts calculation at the next possible block (normally 64 samples). Using an OffsetOut UGen, one can delay the audio so that it matches sample accurately.

For some synthesis methods, one even needs subsample accuracy. SubsampleOffset provides the information where, within the current sample, the synth was scheduled. It can be used to offset envelopes or resample the audio output.

===Examples===

// print offset
SynthDef.recv("SubsampleOffset") {
 SubsampleOffset.ir.poll(0, "offset")
}

// create 2 pulse trains 1 sample apart, move one relatively to the other.
// when cursor is at the left, the impulses are adjacent, on the right, they are
// exactly 1 sample apart.

val dt = s.sampleRate.reciprocal // 1 sample delay

val x1, x2 = Synth(s)

// needed to use System.currentTimeMillis with osc.Bundle.secs
val SECONDS_FROM_1900_TO_1970 = 2208988800L

// We create two identical synths with a delay of half a sample,
// they should thus report offsets 0.5 apart (plus some floating point noise).

// execute the following three lines together!
val t0 = System.currentTimeMillis * 0.001 + SECONDS_FROM_1900_TO_1970
s ! osc.Bundle.secs(t0 + 0.2        , x1.newMsg("SubsampleOffset"))
s ! osc.Bundle.secs(t0 + 0.2 + dt/2 , x2.newMsg("SubsampleOffset"))
See also
Companion
class
final case
class SubsampleOffset() extends SingleOut with ScalarRated

A UGen that reports the fractional sample offset of the current Synth from its requested scheduled start.

A UGen that reports the fractional sample offset of the current Synth from its requested scheduled start.

When a synth is created from a time stamped osc-bundle, it starts calculation at the next possible block (normally 64 samples). Using an OffsetOut UGen, one can delay the audio so that it matches sample accurately.

For some synthesis methods, one even needs subsample accuracy. SubsampleOffset provides the information where, within the current sample, the synth was scheduled. It can be used to offset envelopes or resample the audio output.

See also
Companion
object
object Sweep extends ProductReader[Sweep]

A UGen which starts a linear raise from zero each time it is triggered.

A UGen which starts a linear raise from zero each time it is triggered.

When speed is one, one gets a continually-updating measurement of the time (in seconds) since the last trigger.

See also
Companion
class
final case
class Sweep(rate: Rate, trig: GE, speed: GE) extends SingleOut

A UGen which starts a linear raise from zero each time it is triggered.

A UGen which starts a linear raise from zero each time it is triggered.

When speed is one, one gets a continually-updating measurement of the time (in seconds) since the last trigger.

Value Params
speed

the amount of increment of the output signal per second. In SCLang this argument is named rate , while ScalaCollider uses speed to avoid conflict with the UGen's calculation rate.

trig

the trigger that restarts the ramp, when passing from non-positive to positive

See also
Companion
object
object SyncSaw extends ProductReader[SyncSaw]

A sawtooth oscillator UGen that is hard sync'ed to a fundamental pitch. That is, a sawtooth waveform is produced at one frequency, sawFreq , whereas a trigger at a another frequency, syncFreq , resets the phase of the sawtooth to zero.

A sawtooth oscillator UGen that is hard sync'ed to a fundamental pitch. That is, a sawtooth waveform is produced at one frequency, sawFreq , whereas a trigger at a another frequency, syncFreq , resets the phase of the sawtooth to zero.

This produces an effect similar to moving formants or pulse width modulation. This is not a band limited waveform, so it may alias.

===Examples===

// modulate saw frequency
play { SyncSaw.ar(100, Line.kr(100, 800, 12)) * 0.2 }
See also
Companion
class
final case
class SyncSaw(rate: Rate, syncFreq: GE, sawFreq: GE) extends SingleOut

A sawtooth oscillator UGen that is hard sync'ed to a fundamental pitch. That is, a sawtooth waveform is produced at one frequency, sawFreq , whereas a trigger at a another frequency, syncFreq , resets the phase of the sawtooth to zero.

A sawtooth oscillator UGen that is hard sync'ed to a fundamental pitch. That is, a sawtooth waveform is produced at one frequency, sawFreq , whereas a trigger at a another frequency, syncFreq , resets the phase of the sawtooth to zero.

This produces an effect similar to moving formants or pulse width modulation. This is not a band limited waveform, so it may alias.

Value Params
sawFreq

subordinate sawtooth frequency. It should typically be greater than syncFreq .

syncFreq

synchronizing (principal) frequency which is the perceived fundamental

See also
Companion
object
object T2A extends ProductReader[T2A]

A UGen that converts a control-rate trigger input into an audio-rate trigger output. A trigger occurs when a signal changes from less than or equal to zero to greater than zero. The output will have a single sample spike of the input trigger's amplitude at the beginning of the calculation block.

A UGen that converts a control-rate trigger input into an audio-rate trigger output. A trigger occurs when a signal changes from less than or equal to zero to greater than zero. The output will have a single sample spike of the input trigger's amplitude at the beginning of the calculation block.

===Examples===

// up-sample control-rate impulses
play {
 val trig = Impulse.kr(MouseX.kr(1, 100, 1))
 Ringz.ar(T2A.ar(trig), 800, 0.01) * 0.4
}
See also
Companion
class
final case
class T2A(in: GE) extends SingleOut with AudioRated

A UGen that converts a control-rate trigger input into an audio-rate trigger output. A trigger occurs when a signal changes from less than or equal to zero to greater than zero. The output will have a single sample spike of the input trigger's amplitude at the beginning of the calculation block.

A UGen that converts a control-rate trigger input into an audio-rate trigger output. A trigger occurs when a signal changes from less than or equal to zero to greater than zero. The output will have a single sample spike of the input trigger's amplitude at the beginning of the calculation block.

Value Params
in

control-rate trigger input

See also
Companion
object
object T2K extends ProductReader[T2K]

A UGen that converts an audio-rate trigger input into a control-rate trigger output. A trigger occurs when a signal changes from less than or equal to zero to greater than zero. The UGen behaves strangely in that for a rising slope input signal, it will report the maximum value seen within the calculation block, but if the slope extends to the next block, it will output that second's block maximum value again instead of waiting for a fall to <= 0.

A UGen that converts an audio-rate trigger input into a control-rate trigger output. A trigger occurs when a signal changes from less than or equal to zero to greater than zero. The UGen behaves strangely in that for a rising slope input signal, it will report the maximum value seen within the calculation block, but if the slope extends to the next block, it will output that second's block maximum value again instead of waiting for a fall to <= 0.

===Examples===

// down-sample audio-rate dust
play {
 val trig = T2K.kr(Dust.ar(4))
 Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1
}
See also
Companion
class
final case
class T2K(in: GE) extends SingleOut with ControlRated

A UGen that converts an audio-rate trigger input into a control-rate trigger output. A trigger occurs when a signal changes from less than or equal to zero to greater than zero. The UGen behaves strangely in that for a rising slope input signal, it will report the maximum value seen within the calculation block, but if the slope extends to the next block, it will output that second's block maximum value again instead of waiting for a fall to <= 0.

A UGen that converts an audio-rate trigger input into a control-rate trigger output. A trigger occurs when a signal changes from less than or equal to zero to greater than zero. The UGen behaves strangely in that for a rising slope input signal, it will report the maximum value seen within the calculation block, but if the slope extends to the next block, it will output that second's block maximum value again instead of waiting for a fall to <= 0.

Value Params
in

audio-rate trigger input

See also
Companion
object
object TBall extends ProductReader[TBall]
Companion
class
final case
class TBall(rate: MaybeRate, in: GE, g: GE, damp: GE, friction: GE) extends SingleOut
Companion
object
object TDelay extends ProductReader[TDelay]

A delay UGen for trigger signals. Other than a normal buffer delay, any new trigger arriving in the time between the previous trigger and the passing of the delay time is ignored.

A delay UGen for trigger signals. Other than a normal buffer delay, any new trigger arriving in the time between the previous trigger and the passing of the delay time is ignored.

Companion
class
final case
class TDelay(rate: MaybeRate, trig: GE, dur: GE) extends SingleOut

A delay UGen for trigger signals. Other than a normal buffer delay, any new trigger arriving in the time between the previous trigger and the passing of the delay time is ignored.

A delay UGen for trigger signals. Other than a normal buffer delay, any new trigger arriving in the time between the previous trigger and the passing of the delay time is ignored.

Value Params
dur

The delay time in seconds.

trig

The input trigger. A trigger is recognized when the signal passes from non-positive to positive. Note that, no matter what the amplitude of the input trigger is, the UGen will output a delayed trigger of amplitude 1.0.

Companion
object
object TDuty extends ProductReader[TDuty]

A UGen which polls results from demand-rate ugens in intervals specified by a duration input, and outputs them as trigger values. A value from the level ugen is demanded and output for one sample (when running at audio-rate) or one block (when running at control-rate) according to a stream of duration values. When there is a trigger at the reset input, the level and the dur input are reset.

A UGen which polls results from demand-rate ugens in intervals specified by a duration input, and outputs them as trigger values. A value from the level ugen is demanded and output for one sample (when running at audio-rate) or one block (when running at control-rate) according to a stream of duration values. When there is a trigger at the reset input, the level and the dur input are reset.

See also

DoneAction

Note

The argument order is different from its sclang counterpart.

Companion
class
final case
class TDuty(rate: Rate, dur: GE, level: GE, reset: GE, doneAction: GE, gapFirst: GE) extends SingleOut with HasSideEffect

A UGen which polls results from demand-rate ugens in intervals specified by a duration input, and outputs them as trigger values. A value from the level ugen is demanded and output for one sample (when running at audio-rate) or one block (when running at control-rate) according to a stream of duration values. When there is a trigger at the reset input, the level and the dur input are reset.

A UGen which polls results from demand-rate ugens in intervals specified by a duration input, and outputs them as trigger values. A value from the level ugen is demanded and output for one sample (when running at audio-rate) or one block (when running at control-rate) according to a stream of duration values. When there is a trigger at the reset input, the level and the dur input are reset.

Value Params
doneAction

a doneAction that is evaluated when the duration stream ends.

dur

the provider of time values. Can be a demand-rate ugen or any signal. The next poll is acquired after the previous duration.

gapFirst

when 0 (default), the UGen does the first level poll immediately and then waits for the first duration value. When this is 1, the UGen initially polls the first duration value, waits for that duration, and then polls the first level (along with polling the next duration value).

level

a demand-rate ugen providing the output values.

reset

a trigger which resets the dur input (if demand-rated) and the the level input ugen. The reset input may also be a demand-rate ugen, in this case providing a stream of reset times.

See also

DoneAction

Note

The argument order is different from its sclang counterpart.

Companion
object
object TExpRand extends ProductReader[TExpRand]

A UGen that generates a new random decimal value each time it is triggered, using an exponential distribution from lo to hi . Values lo and hi must both have the same sign and be non-zero.

A UGen that generates a new random decimal value each time it is triggered, using an exponential distribution from lo to hi . Values lo and hi must both have the same sign and be non-zero.

'''Note''': Audio-rate inputs for lo and hi are currently broken in SuperCollider, and will therefore be converted to control-rate inputs.

===Examples===

// random sine frequencies, triggered by mouse button
play {
 val tr = MouseButton.kr(lag = 0)
 val m  = Mix.fill(10)(SinOsc.ar(TExpRand.kr(200.0, 800.0, tr)))
 m * Linen.kr(tr, sustain = 0.025, release = 2)
}
See also
Companion
class
final case
class TExpRand(rate: Rate, lo: GE, hi: GE, trig: GE) extends SingleOut with IsIndividual

A UGen that generates a new random decimal value each time it is triggered, using an exponential distribution from lo to hi . Values lo and hi must both have the same sign and be non-zero.

A UGen that generates a new random decimal value each time it is triggered, using an exponential distribution from lo to hi . Values lo and hi must both have the same sign and be non-zero.

'''Note''': Audio-rate inputs for lo and hi are currently broken in SuperCollider, and will therefore be converted to control-rate inputs.

Value Params
hi

upper limit of the output range

lo

lower limit of the output range

trig

signal to trigger new random number

See also
Companion
object
object TGrains extends ProductReader[TGrains]

Triggers generate grains from a buffer. Each grain has a Hanning envelope

Triggers generate grains from a buffer. Each grain has a Hanning envelope

(sin2(x) for x from 0 to pi)

and is panned between two channels of multiple outputs. '''Warning''': Due to a bug (SC 3.6.6), this UGen does not work with LocalBuf but requires a regular buffer.

See also
Companion
class
final case
class TGrains(numChannels: Int, trig: GE, buf: GE, speed: GE, centerPos: GE, dur: GE, pan: GE, amp: GE, interp: GE) extends MultiOut with AudioRated with IsIndividual

Triggers generate grains from a buffer. Each grain has a Hanning envelope

Triggers generate grains from a buffer. Each grain has a Hanning envelope

(sin2(x) for x from 0 to pi)

and is panned between two channels of multiple outputs. '''Warning''': Due to a bug (SC 3.6.6), this UGen does not work with LocalBuf but requires a regular buffer.

Value Params
amp

Amplitude of the grain.

buf

The buffer index. It must be a one channel (mono) buffer.

centerPos

The position in the buffer in seconds at which the grain envelope will reach maximum amplitude.

dur

Duration of the grain in seconds.

interp

1, 2, or 4. Determines whether the grain uses (1) no interpolation, (2) linear interpolation, or (4) cubic interpolation.

numChannels

Number of output channels.

pan

A value from -1 to 1. Determines where to pan the output in the same manner as PanAz.

speed

1.0 is normal, 2.0 is one octave up, 0.5 is one octave down -1.0 is backwards normal rate etc.

trig

At each trigger, the following arguments are sampled and used as the arguments of a new grain. A trigger occurs when a signal changes from non-positive to positive value. If the trigger is audio rate then the grains will start with sample accuracy.

See also
Companion
object
object TIRand extends ProductReader[TIRand]

A UGen that outputs integer random numbers when triggered. The values have a uniform distribution from lo to hi (inclusive).

A UGen that outputs integer random numbers when triggered. The values have a uniform distribution from lo to hi (inclusive).

'''Note''': Audio-rate inputs for lo and hi are currently broken in SuperCollider, and will therefore be converted to control-rate inputs.

===Examples===

// random sine frequencies, triggered by mouse button
play {
 val tr = MouseButton.kr(lag = 0)
 val m  = Mix.fill(10)(SinOsc.ar(TIRand.kr(40, 100, tr).midiCps))
 m * Linen.kr(tr, sustain = 0.025, release = 2)
}
See also
Companion
class
final case
class TIRand(rate: Rate, lo: GE, hi: GE, trig: GE) extends SingleOut with IsIndividual

A UGen that outputs integer random numbers when triggered. The values have a uniform distribution from lo to hi (inclusive).

A UGen that outputs integer random numbers when triggered. The values have a uniform distribution from lo to hi (inclusive).

'''Note''': Audio-rate inputs for lo and hi are currently broken in SuperCollider, and will therefore be converted to control-rate inputs.

Value Params
hi

upper limit of the output range (inclusive)

lo

lower limit of the output range

trig

signal to trigger new random number

See also
Companion
object
object TRand extends ProductReader[TRand]

A UGen that generates a new random decimal value each time it is triggered, using a uniform distribution from lo to hi .

A UGen that generates a new random decimal value each time it is triggered, using a uniform distribution from lo to hi .

'''Note''': Audio-rate inputs for lo and hi are currently broken in SuperCollider, and will therefore be converted to control-rate inputs.

===Examples===

// random sine frequencies, triggered by mouse button
play {
 val tr = MouseButton.kr(lag = 0)
 val m  = Mix.fill(10)(SinOsc.ar(TRand.kr(200.0, 800.0, tr)))
 m * Linen.kr(tr, sustain = 0.025, release = 2)
}
See also
Companion
class
final case
class TRand(rate: Rate, lo: GE, hi: GE, trig: GE) extends SingleOut with IsIndividual

A UGen that generates a new random decimal value each time it is triggered, using a uniform distribution from lo to hi .

A UGen that generates a new random decimal value each time it is triggered, using a uniform distribution from lo to hi .

'''Note''': Audio-rate inputs for lo and hi are currently broken in SuperCollider, and will therefore be converted to control-rate inputs.

Value Params
hi

upper limit of the output range

lo

lower limit of the output range

trig

signal to trigger new random number

See also
Companion
object
object TWindex extends ProductReader[TWindex]

A UGen providing a probability-weighted index into a sequence upon receiving a trigger.

A UGen providing a probability-weighted index into a sequence upon receiving a trigger.

When triggered, returns a random index value based the values of the channels of the prob argument functioning as probabilities. The index is zero based, hence goes from 0 to prob.numOutputs - 1 .

By default the sequence of probabilities should sum to 1.0, however for convenience, this can be achieved by the ugen when the normalize flag is set to 1 (less efficient).

See also
Companion
class
final case
class TWindex(rate: Rate, trig: GE, prob: GE, normalize: GE) extends SingleOut

A UGen providing a probability-weighted index into a sequence upon receiving a trigger.

A UGen providing a probability-weighted index into a sequence upon receiving a trigger.

When triggered, returns a random index value based the values of the channels of the prob argument functioning as probabilities. The index is zero based, hence goes from 0 to prob.numOutputs - 1 .

By default the sequence of probabilities should sum to 1.0, however for convenience, this can be achieved by the ugen when the normalize flag is set to 1 (less efficient).

Value Params
normalize

0 if the seq argument already sums up to 1.0 and thus doesn't need normalization, 1 if the sum is not guaranteed to be 1.0 and thus the ugen is asked to provide the normalization.

prob

a multi-channel graph element, where the output channels correspond to to the probabilities of their respective indices being chosen.

trig

the trigger used to calculate a new index. a trigger occurs when passing from non-positive to positive

See also
Companion
object
object Timer extends ProductReader[Timer]

A UGen that returns time since last triggered. The time returned is in seconds and is measured from the last received trigger. Note that currently it seems the initial memory is at -1 sample, so for Impulse.ar(1) the result (at 44.1 kHz) is 2.26757e-05, followed strangely by 1.00002, and then (as expected) 1.0.

A UGen that returns time since last triggered. The time returned is in seconds and is measured from the last received trigger. Note that currently it seems the initial memory is at -1 sample, so for Impulse.ar(1) the result (at 44.1 kHz) is 2.26757e-05, followed strangely by 1.00002, and then (as expected) 1.0.

See also
Companion
class
final case
class Timer(rate: MaybeRate, trig: GE) extends SingleOut

A UGen that returns time since last triggered. The time returned is in seconds and is measured from the last received trigger. Note that currently it seems the initial memory is at -1 sample, so for Impulse.ar(1) the result (at 44.1 kHz) is 2.26757e-05, followed strangely by 1.00002, and then (as expected) 1.0.

A UGen that returns time since last triggered. The time returned is in seconds and is measured from the last received trigger. Note that currently it seems the initial memory is at -1 sample, so for Impulse.ar(1) the result (at 44.1 kHz) is 2.26757e-05, followed strangely by 1.00002, and then (as expected) 1.0.

Value Params
trig

the trigger to update the output signal. A trigger occurs when trig signal crosses from non-positive to positive.

See also
Companion
object
object ToggleFF extends ProductReader[ToggleFF]

A UGen that toggles like a flip-flop between zero and one upon receiving a trigger. The flip-flop initially outputs zero and changes to one when the first trigger arrives.

A UGen that toggles like a flip-flop between zero and one upon receiving a trigger. The flip-flop initially outputs zero and changes to one when the first trigger arrives.

===Examples===

// mouse-button toggle
play {
 // make sure lag is zero, otherwise the output
 // never falls back exactly to zero!
 val tr = MouseButton.kr(lag = 0)
 val ff = ToggleFF.kr(tr)
 SinOsc.ar(ff.mulAdd(400, 800)) * 0.1
}
See also
Companion
class
final case
class ToggleFF(rate: MaybeRate, trig: GE) extends SingleOut

A UGen that toggles like a flip-flop between zero and one upon receiving a trigger. The flip-flop initially outputs zero and changes to one when the first trigger arrives.

A UGen that toggles like a flip-flop between zero and one upon receiving a trigger. The flip-flop initially outputs zero and changes to one when the first trigger arrives.

Value Params
trig

a signal to trigger the flip-flop. a trigger occurs when the signal changes from non-positive to positive.

See also
Companion
object
object Trig extends ProductReader[Trig]

A UGen which holds and outputs an input value for a given duration when triggered.

A UGen which holds and outputs an input value for a given duration when triggered.

When a trigger occurs at the input, the input value is sampled and output for the specified duration, otherwise zero is output. When a new trigger occurs while this ugens outputs 1, the hold-time is reset to the duration.

''Warning:'' The hold-time is subject to a bug that depends on the input signal. For example with Trig1.ar(Impulse.ar(0), 4 * SampleDur.ir) one actually gets a high signal for five sample frames instead of four.

===Examples===

// hold dust spikes
play { Trig.ar(Dust.ar(1), 0.2) * SinOsc.ar(800) * 0.2 }
See also
Companion
class
final case
class Trig(rate: Rate, in: GE, dur: GE) extends SingleOut

A UGen which holds and outputs an input value for a given duration when triggered.

A UGen which holds and outputs an input value for a given duration when triggered.

When a trigger occurs at the input, the input value is sampled and output for the specified duration, otherwise zero is output. When a new trigger occurs while this ugens outputs 1, the hold-time is reset to the duration.

''Warning:'' The hold-time is subject to a bug that depends on the input signal. For example with Trig1.ar(Impulse.ar(0), 4 * SampleDur.ir) one actually gets a high signal for five sample frames instead of four.

Value Params
dur

the duration for which the ugens holds the value of the input signal when triggered

in

the trigger. This can be any signal. A trigger happens when the signal changes from non-positive to positive.

See also
Companion
object
object Trig1 extends ProductReader[Trig1]

A UGen which outputs a value of 1 for a given duration when triggered.

A UGen which outputs a value of 1 for a given duration when triggered.

When a trigger occurs at the input, a value of 1 is output for the specified duration, otherwise zero is output. When a new trigger occurs while this ugens outputs 1, the hold-time is reset to the duration.

''Warning:'' The hold-time is subject to a bug that depends on the input signal. For example with Trig1.ar(Impulse.ar(0), 4 * SampleDur.ir) one actually gets a high signal for five sample frames instead of four.

===Examples===

// hold dust spikes
play { Trig1.ar(Dust.ar(1), 0.2) * SinOsc.ar(800) * 0.2 }
See also
Companion
class
final case
class Trig1(rate: Rate, in: GE, dur: GE) extends SingleOut

A UGen which outputs a value of 1 for a given duration when triggered.

A UGen which outputs a value of 1 for a given duration when triggered.

When a trigger occurs at the input, a value of 1 is output for the specified duration, otherwise zero is output. When a new trigger occurs while this ugens outputs 1, the hold-time is reset to the duration.

''Warning:'' The hold-time is subject to a bug that depends on the input signal. For example with Trig1.ar(Impulse.ar(0), 4 * SampleDur.ir) one actually gets a high signal for five sample frames instead of four.

Value Params
dur

the duration for which the ugens holds the value of 1 when triggered

in

the trigger. This can be any signal. A trigger happens when the signal changes from non-positive to positive.

See also
Companion
object
object TwoPole extends ProductReader[TwoPole]

A two pole filter UGen. This provides lower level access to setting of pole location. For general purposes Resonz is better.

A two pole filter UGen. This provides lower level access to setting of pole location. For general purposes Resonz is better.

===Examples===

// static frequency
play { TwoPole.ar(WhiteNoise.ar(0.005), 2000, 0.95) }
// sweeping frequency
play { TwoPole.ar(WhiteNoise.ar(0.005), XLine.kr(800, 8000, 8), 0.95) }
// mouse controlled frequency
play { TwoPole.ar(WhiteNoise.ar(0.005), MouseX.kr(800, 8000, 1), 0.95) }
See also
Companion
class
final case
class TwoPole(rate: MaybeRate, in: GE, freq: GE, radius: GE) extends SingleOut

A two pole filter UGen. This provides lower level access to setting of pole location. For general purposes Resonz is better.

A two pole filter UGen. This provides lower level access to setting of pole location. For general purposes Resonz is better.

Value Params
freq

frequency of pole angle, in Hertz

in

input signal to be filtered

radius

radius of pole angle. Should be between 0 and 1

See also
Companion
object
object TwoZero extends ProductReader[TwoZero]

A two zero filter UGen.

A two zero filter UGen.

===Examples===

// frequency sweep
play { TwoZero.ar(WhiteNoise.ar(0.125), XLine.kr(20, 20000, 8), 1) }
See also
Companion
class
final case
class TwoZero(rate: MaybeRate, in: GE, freq: GE, radius: GE) extends SingleOut

A two zero filter UGen.

A two zero filter UGen.

Value Params
freq

frequency of zero angle, in Hertz

in

input signal to be filtered

radius

radius of zero

See also
Companion
object
object Unpack1FFT extends ProductReader[Unpack1FFT]
Companion
class
final case
class Unpack1FFT(chain: GE, fftSize: GE, bin: GE, which: GE) extends SingleOut with DemandRated with IsIndividual
Companion
object
object VDiskIn extends ProductReader[VDiskIn]

A UGen to stream in a signal from an audio file with variable playback speed. Continuously plays a longer audio file from disk. This requires a buffer to be preloaded with one buffer size of sound. If loop is set to 1, the file will loop.

A UGen to stream in a signal from an audio file with variable playback speed. Continuously plays a longer audio file from disk. This requires a buffer to be preloaded with one buffer size of sound. If loop is set to 1, the file will loop.

'''Note''': The buffer size must be a multiple of (2 * the server's block size). See Buffer#cue for details.

If the speed is too high, the UGen will not execute, posting a warning.

See also

Buffer#cue

Companion
class
final case
class VDiskIn(rate: Rate, numChannels: Int, buf: GE, speed: GE, loop: GE, sendId: GE) extends MultiOut with HasSideEffect with IsIndividual with HasDoneFlag

A UGen to stream in a signal from an audio file with variable playback speed. Continuously plays a longer audio file from disk. This requires a buffer to be preloaded with one buffer size of sound. If loop is set to 1, the file will loop.

A UGen to stream in a signal from an audio file with variable playback speed. Continuously plays a longer audio file from disk. This requires a buffer to be preloaded with one buffer size of sound. If loop is set to 1, the file will loop.

'''Note''': The buffer size must be a multiple of (2 * the server's block size). See Buffer#cue for details.

If the speed is too high, the UGen will not execute, posting a warning.

Value Params
buf

the id of the buffer with the correct number of channels and frames

loop

whether the file should loop when its end is reached

numChannels

the amount of channels the file and the buffer will have. This is an Int and hence must be pre-determined. Different SynthDefs must be created for different numbers of channels

sendId

If a value other than zero is used, the UGen sends an OSC message with this id and the file position each time it reloads the buffer: OSCMessage("/diskin", nodeId, sendId, frame)

speed

controls the speed of playback. The buffer is always streamed at a frequency of SampleRate.ir * speed , so the buffer's own sample rate is irrelevant. Factors below 4 are probably fine, but the higher the value, the more disk activity there is, and the more likelihood there will be a problem. The following must be true: rate < bufFrames / (2 * blockSize) , e.g with typical default values, this will be 32768 / (2 * 64) = 256 .

See also

Buffer#cue

Companion
object
object VOsc extends ProductReader[VOsc]
Companion
class
final case
class VOsc(rate: Rate, bufPos: GE, freq: GE, phase: GE) extends SingleOut with IsIndividual
Companion
object
object VOsc3 extends ProductReader[VOsc3]
Companion
class
final case
class VOsc3(rate: Rate, bufPos: GE, freq1: GE, freq2: GE, freq3: GE) extends SingleOut with IsIndividual
Companion
object
object VarSaw extends ProductReader[VarSaw]

A sawtooth-triangle oscillator UGen with variable duty. A width of zero produces a sawtooth of falling slope, with an initial phase of zero making it start at +1. A width of 0.5 produces a triangle wave, starting at -1 then raising to +1, then falling again to -1. A width of 1.0 produces a sawtooth of rising slope, starting -1.

A sawtooth-triangle oscillator UGen with variable duty. A width of zero produces a sawtooth of falling slope, with an initial phase of zero making it start at +1. A width of 0.5 produces a triangle wave, starting at -1 then raising to +1, then falling again to -1. A width of 1.0 produces a sawtooth of rising slope, starting -1.

Increasing the initial wave will increase the offset into the waveform. For example, with a phase of 0.5 and a width of 0.5, the result is a triangle waveform that starts at +1.

There is a strange anomaly for the falling sawtooth (zero width): Instead of starting directly at +1, the first sample is -1 and only from the second sample at +1 the waveform starts falling. In other words, the waveform has a delay of one sample.

===Examples===

// width modulation
play {
 val freq  = LFPulse.kr(3, 0, 0.3).mulAdd(200, 200)
 val width = LFTri.kr(1.0).mulAdd(0.5, 0.5)
 VarSaw.ar(freq, 0, width) * 0.2
}
See also
Companion
class
final case
class VarSaw(rate: Rate, freq: GE, iphase: GE, width: GE) extends SingleOut

A sawtooth-triangle oscillator UGen with variable duty. A width of zero produces a sawtooth of falling slope, with an initial phase of zero making it start at +1. A width of 0.5 produces a triangle wave, starting at -1 then raising to +1, then falling again to -1. A width of 1.0 produces a sawtooth of rising slope, starting -1.

A sawtooth-triangle oscillator UGen with variable duty. A width of zero produces a sawtooth of falling slope, with an initial phase of zero making it start at +1. A width of 0.5 produces a triangle wave, starting at -1 then raising to +1, then falling again to -1. A width of 1.0 produces a sawtooth of rising slope, starting -1.

Increasing the initial wave will increase the offset into the waveform. For example, with a phase of 0.5 and a width of 0.5, the result is a triangle waveform that starts at +1.

There is a strange anomaly for the falling sawtooth (zero width): Instead of starting directly at +1, the first sample is -1 and only from the second sample at +1 the waveform starts falling. In other words, the waveform has a delay of one sample.

Value Params
freq

frequency in Hertz

iphase

initial phase offset in cycle (0 to 1)

width

duty cycle from zero to one.

See also
Companion
object
object Vibrato extends ProductReader[Vibrato]

A low frequency oscillator UGen for modelling vibrato. It produces a modulating frequency value in Hertz that can be used as the frequency parameter of another UGen.

A low frequency oscillator UGen for modelling vibrato. It produces a modulating frequency value in Hertz that can be used as the frequency parameter of another UGen.

By setting more extreme settings, one can get back to the timbres of FM synthesis. One can also add in some noise to the vibrato rate and vibrato size (modulation depth) to make for a more realistic motor pattern.

The vibrato output is a waveform based on a squared envelope shape with four stages marking out 0.0 to 1.0, 1.0 to 0.0, 0.0 to -1.0, and -1.0 back to 0.0. The vibrato rate determines how quickly one moves through these stages.

===Examples===

// constant setting
play { SinOsc.ar(Vibrato.ar(DC.ar(400.0), 1, 0.02)) * 0.2 }
// beat and beatVar mouse control
play {
 val beat    = MouseX.kr(2.0, 100.0)
 val beatVar = MouseY.kr(0.0, 1.0)
 val freq    = Vibrato.ar(DC.ar(400.0), beat, 0.1, 1.0, 1.0, beatVar, 0.1)
 SinOsc.ar(freq) * 0.2
}
Companion
class
final case
class Vibrato(rate: Rate, freq: GE, beat: GE, depth: GE, delay: GE, onset: GE, beatVar: GE, depthVar: GE, iphase: GE) extends SingleOut

A low frequency oscillator UGen for modelling vibrato. It produces a modulating frequency value in Hertz that can be used as the frequency parameter of another UGen.

A low frequency oscillator UGen for modelling vibrato. It produces a modulating frequency value in Hertz that can be used as the frequency parameter of another UGen.

By setting more extreme settings, one can get back to the timbres of FM synthesis. One can also add in some noise to the vibrato rate and vibrato size (modulation depth) to make for a more realistic motor pattern.

The vibrato output is a waveform based on a squared envelope shape with four stages marking out 0.0 to 1.0, 1.0 to 0.0, 0.0 to -1.0, and -1.0 back to 0.0. The vibrato rate determines how quickly one moves through these stages.

Value Params
beat

vibrato rate, that is the speed of wobble in Hertz. Note that if this is set to a too low value, you may never get vibrato back, since this input is only checked at the end of a cycle.

beatVar

random (noise) variation on the beat parameter, expressed as a proportion of beat . It can change once per cycle of vibrato.

delay

delay in seconds before vibrato is established. ''(init-time only)''

depth

amount of vibrato frequency deviation around the fundamental, as a proportion of the fundamental.

depthVar

random (noise) variation on the depth of modulation, expressed as a proportion of depth . It can change once per cycle of vibrato. The noise affects independently the up and the down part of vibrato shape within a cycle.

freq

fundamental frequency in Hertz. If the Vibrato UGen is running at audio rate, this must be an audio-rate input as well.

iphase

initial phase of vibrato modulation, allowing starting above or below the fundamental rather than on it. ''(init-time only)''

onset

transition time in seconds from no vibrato to full vibrato after the initial delay time. ''(init-time only)''

Companion
object
object Warp1 extends ProductReader[Warp1]
Companion
class
final case
class Warp1(numChannels: Int, buf: GE, pos: GE, speed: GE, winSize: GE, envBuf: GE, overlaps: GE, winRand: GE, interp: GE) extends MultiOut with AudioRated with IsIndividual
Companion
object
object WhiteNoise extends ProductReader[WhiteNoise]

A noise generator UGens whose spectrum has equal power at all frequencies. Output values range from -1 to +1 (before being multiplied by mul ). The RMS is approx. -4.8 dB.

A noise generator UGens whose spectrum has equal power at all frequencies. Output values range from -1 to +1 (before being multiplied by mul ). The RMS is approx. -4.8 dB.

===Examples===

// plain noise
play { WhiteNoise.ar(Seq(0.25, 0.25)) }
See also
Companion
class
final case
class WhiteNoise(rate: Rate, mul: GE) extends SingleOut with IsIndividual

A noise generator UGens whose spectrum has equal power at all frequencies. Output values range from -1 to +1 (before being multiplied by mul ). The RMS is approx. -4.8 dB.

A noise generator UGens whose spectrum has equal power at all frequencies. Output values range from -1 to +1 (before being multiplied by mul ). The RMS is approx. -4.8 dB.

Value Params
mul

Not actually a UGen input, this argument produces a multiplication of the output by this factor. A multi-channel mul argument will cause the generation of multiple independent noise generators.

See also
Companion
object
object Wrap extends ProductReader[Wrap]

A UGen that constrains a signal to a given range, by "wrapping" values outside the range. This is similar to the wrap2 binary operator but permits both a lower range value lo and an upper range value hi .

A UGen that constrains a signal to a given range, by "wrapping" values outside the range. This is similar to the wrap2 binary operator but permits both a lower range value lo and an upper range value hi .

An input value greater than or equal to hi will be wrapped back to (in - hi) % (hi - lo) + lo . An input value less than lo will be wrapped back to hi - (lo - in) % (hi - lo) .

===Examples===

// wrap pulse wave to modulate timbre
play {
 val hi = SinOsc.ar(0.1).linExp(-1, 1, 0.01, 1.0)
 Wrap.ar(Pulse.ar(300), 0, hi) * 0.2 / hi
}
See also
Companion
class
final case
class Wrap(rate: Rate, in: GE, lo: GE, hi: GE) extends SingleOut

A UGen that constrains a signal to a given range, by "wrapping" values outside the range. This is similar to the wrap2 binary operator but permits both a lower range value lo and an upper range value hi .

A UGen that constrains a signal to a given range, by "wrapping" values outside the range. This is similar to the wrap2 binary operator but permits both a lower range value lo and an upper range value hi .

An input value greater than or equal to hi will be wrapped back to (in - hi) % (hi - lo) + lo . An input value less than lo will be wrapped back to hi - (lo - in) % (hi - lo) .

Value Params
hi

upper margin of wrapping (exclusive)

in

input signal to constrain

lo

lower margin of wrapping (inclusive)

See also
Companion
object
object WrapIndex extends ProductReader[WrapIndex]

A UGen which reads a single sample value from a buffer at a given index.

A UGen which reads a single sample value from a buffer at a given index.

It uses the in argument as index into the buffer, truncating that argument to an integer. Out-of-range index values are wrapped around the valid range. For example, if the buffer has four samples, index 4 is wrapped to index 0, index 5 is wrapped to index 1, index -1 is wrapped to index 3, index -2 is wrapped to index 2, etc.

While designed for monophonic buffers, it works with multi-channel buffers by treating them as de-interleaved. See the Index UGen for details.

See also
Companion
class
final case
class WrapIndex(rate: Rate, buf: GE, in: GE) extends SingleOut with IsIndividual

A UGen which reads a single sample value from a buffer at a given index.

A UGen which reads a single sample value from a buffer at a given index.

It uses the in argument as index into the buffer, truncating that argument to an integer. Out-of-range index values are wrapped around the valid range. For example, if the buffer has four samples, index 4 is wrapped to index 0, index 5 is wrapped to index 1, index -1 is wrapped to index 3, index -2 is wrapped to index 2, etc.

While designed for monophonic buffers, it works with multi-channel buffers by treating them as de-interleaved. See the Index UGen for details.

Value Params
buf

The buffer to read from.

in

The sample index into the buffer. This is truncated to an integer automatically.

See also
Companion
object
object WrapOut extends ProductReader[WrapOut]

An element which writes an input signal to a bus, optionally applying a short fade-in. This is automatically added when using the play { ... } syntax. If the fade time is given, an envelope is added with a control named "gate" which can be used to release the synth. The bus is given by a control named "out" and defaults to zero.

An element which writes an input signal to a bus, optionally applying a short fade-in. This is automatically added when using the play { ... } syntax. If the fade time is given, an envelope is added with a control named "gate" which can be used to release the synth. The bus is given by a control named "out" and defaults to zero.

Companion
class
final case
class WrapOut(in: GE, fadeTime: Double) extends ZeroOut with WritesBus

An element which writes an input signal to a bus, optionally applying a short fade-in. This is automatically added when using the play { ... } syntax. If the fade time is given, an envelope is added with a control named "gate" which can be used to release the synth. The bus is given by a control named "out" and defaults to zero.

An element which writes an input signal to a bus, optionally applying a short fade-in. This is automatically added when using the play { ... } syntax. If the fade time is given, an envelope is added with a control named "gate" which can be used to release the synth. The bus is given by a control named "out" and defaults to zero.

Value Params
fadeTime

the fade in time; use a negative number for no fading

in

the signal to play to the default output

Companion
object
object XFade2 extends ProductReader[XFade2]

An equal power two channel cross fading UGen. In center position ( pan = 0 ), both input signals are attenuated by sqrt(0.5) or approx. -3 dB.

An equal power two channel cross fading UGen. In center position ( pan = 0 ), both input signals are attenuated by sqrt(0.5) or approx. -3 dB.

See also
Companion
class
final case
class XFade2(rate: Rate, inA: GE, inB: GE, pan: GE, level: GE) extends SingleOut

An equal power two channel cross fading UGen. In center position ( pan = 0 ), both input signals are attenuated by sqrt(0.5) or approx. -3 dB.

An equal power two channel cross fading UGen. In center position ( pan = 0 ), both input signals are attenuated by sqrt(0.5) or approx. -3 dB.

Value Params
inA

The first input signal

inB

The second input signal

level

An overall amplitude multiplier that is applied to the output signal

pan

the cross-fade position from -1 (only input A audible) to +1 (only input B audible)

See also
Companion
object
object XLine extends ProductReader[XLine]

An exponential curve generator UGen that moves from a start value to the end value in a given duration.

An exponential curve generator UGen that moves from a start value to the end value in a given duration.

At a given point in time 0 <= t <= dur , the output value is start * (stop/start).pow(t/dur) .

'''Warning''': It must be ensured that the both start is not zero and start and end have the same sign (e.g. a start of -1 and an end of -0.001 are valid), otherwise the UGen will output a NaN ! While in the case of end being zero the UGen will also output zero, it is recommended to treat this case as pathological as well.

===Examples===

// glissando
play { SinOsc.ar(Line.kr(200, 2000, 10, freeSelf)) * 0.2 }
See also
Companion
class
final case
class XLine(rate: Rate, start: GE, end: GE, dur: GE, doneAction: GE) extends SingleOut with HasSideEffect with HasDoneFlag

An exponential curve generator UGen that moves from a start value to the end value in a given duration.

An exponential curve generator UGen that moves from a start value to the end value in a given duration.

At a given point in time 0 <= t <= dur , the output value is start * (stop/start).pow(t/dur) .

'''Warning''': It must be ensured that the both start is not zero and start and end have the same sign (e.g. a start of -1 and an end of -0.001 are valid), otherwise the UGen will output a NaN ! While in the case of end being zero the UGen will also output zero, it is recommended to treat this case as pathological as well.

Value Params
doneAction

A done-action that is evaluated when the Line has reached the end value after the given duration

dur

Duration in seconds ''(init-time only)''

end

Ending value ''(init-time only)''

start

Starting value ''(init-time only)''

See also
Companion
object
object XOut extends ProductReader[XOut]

A UGen that cross-fades the contents of a bus with an input signal. A linear cross-fade can go from 0.0 (previous bus contents preserved, no input signal added) via 0.5 (previous signal attenuated by -6 dB, input signal attenuated by -6 dB and added) to 1.0 (contents completely replaced by input signal).

A UGen that cross-fades the contents of a bus with an input signal. A linear cross-fade can go from 0.0 (previous bus contents preserved, no input signal added) via 0.5 (previous signal attenuated by -6 dB, input signal attenuated by -6 dB and added) to 1.0 (contents completely replaced by input signal).

===Examples===

// cross-fade two synths
val sin = play {
 Out.ar(0, SinOsc.ar(440) * 0.1)
}

val noise = play(target = sin, addAction = addAfter) {
 XOut.ar(0, PinkNoise.ar(0.1), xfade = "xfade".kr(0))
}

noise.set("xfade" -> 0.5) // both signals heard
noise.set("xfade" -> 1.0) // just noise
noise.set("xfade" -> 0.0) // just sine
See also
Note

The argument order is different from its sclang counterpart.

Companion
class
final case
class XOut(rate: Rate, bus: GE, in: GE, xfade: GE) extends ZeroOut with HasSideEffect with IsIndividual

A UGen that cross-fades the contents of a bus with an input signal. A linear cross-fade can go from 0.0 (previous bus contents preserved, no input signal added) via 0.5 (previous signal attenuated by -6 dB, input signal attenuated by -6 dB and added) to 1.0 (contents completely replaced by input signal).

A UGen that cross-fades the contents of a bus with an input signal. A linear cross-fade can go from 0.0 (previous bus contents preserved, no input signal added) via 0.5 (previous signal attenuated by -6 dB, input signal attenuated by -6 dB and added) to 1.0 (contents completely replaced by input signal).

Value Params
bus

bus index to write to. For an audio-rate UGen, this is an audio-bus, for a control-rate UGen, this is a control-bus.

in

signal to write to the bus. If the UGen is audio-rate, the input must also be audio-rate.

xfade

cross-fade value. The new bus contents will be old_bus_content * (1 - xfade) + in * xfade

See also
Note

The argument order is different from its sclang counterpart.

Companion
object
object ZeroCrossing extends ProductReader[ZeroCrossing]

A pitch estimation UGen based on counting the zero-crossings of the input signal. This is a very crude pitch follower, but can be useful in some situations.

A pitch estimation UGen based on counting the zero-crossings of the input signal. This is a very crude pitch follower, but can be useful in some situations.

===Examples===

// reconstruct sine frequency
play {
 val f1 = SinOsc.kr(0.2).mulAdd(600, 700).roundTo(100)
 val a  = SinOsc.ar(f1) * 0.1
 val f2 = ZeroCrossing.ar(a)
 f2.poll(10, "estimation")
 val b  = SinOsc.ar(f2) * 0.1
 Seq(a, b)
}
See also
Companion
class
final case
class ZeroCrossing(rate: MaybeRate, in: GE) extends SingleOut

A pitch estimation UGen based on counting the zero-crossings of the input signal. This is a very crude pitch follower, but can be useful in some situations.

A pitch estimation UGen based on counting the zero-crossings of the input signal. This is a very crude pitch follower, but can be useful in some situations.

Value Params
in

signal to analyze

See also
Companion
object
object Zip extends ProductReader[Zip]
Companion
class
final case
class Zip(elems: GE*) extends Lazy

A graph element that interleaves a number of (multi-channel) input signals. For example, if two stereo-signals a and b are zipped, the output will be a four-channel signal corresponding to [ a out 0, b out 0, a out 1, b out 1 ]. If the input signals have different numbers of channels, the minimum number of channels is used.

A graph element that interleaves a number of (multi-channel) input signals. For example, if two stereo-signals a and b are zipped, the output will be a four-channel signal corresponding to [ a out 0, b out 0, a out 1, b out 1 ]. If the input signals have different numbers of channels, the minimum number of channels is used.

===Examples===

// peak and RMS metering
val x = play {
 val sig   = PhysicalIn.ar(0 to 1)  // stereo input
 val tr    = Impulse.kr(5)
 val peak  = Peak.kr(sig, tr)
 val rms   = A2K.kr(Lag.ar(sig.squared, 0.1))
 SendReply.kr(tr, Zip(peak, rms), "/meter")
}

val r = message.Responder.add(x.server) {
 case osc.Message("/meter", x.id, _, peakL: Float, rmsL: Float, peakR: Float, rmsR: Float) =>
   println(f"peak-left $peakL%g, rms-left $rmsL%g, peak-right $peakR%g, rms-right $rmsR%g")

x.free(); r.remove()
Value Params
elems

the signals to interleave in a multi-channel output signal

Companion
object