GEOps
are operations for graph elements (GE
). Instead of having these operations directly defined
in each UGen, which is a huge list, they appear here as extension methods. Therefore, you can
write SinOsc.ar.linLin ...
as if linLin
was defined for GE
or SinOsc
.
Many of these operations are defined for constant numbers, as well, for example you can
write 0.5.linLin ...
. These operations are defined separately.
- See also
GE
- Companion
- object
Value members
Concrete methods
Take the modulus of the signal. Negative input values are
wrapped to positive ones, e.g. (DC.kr(-4) % 5) sig_== DC.kr(1)
.
If the second operand is zero, the output is zero.
Take the modulus of the signal. Negative input values are
wrapped to positive ones, e.g. (DC.kr(-4) % 5) sig_== DC.kr(1)
.
If the second operand is zero, the output is zero.
An alias for mod.
Treats the signals as integer numbers and combines their bit representations through AND
.
Treats the signals as integer numbers and combines their bit representations through AND
.
Compares two signals and outputs one if the receiver is less than the argument.
Compares two signals and outputs one if the receiver is less than the argument.
Treats the signals as integer numbers and bit-shifts the receiver by the argument to the left.
Treats the signals as integer numbers and bit-shifts the receiver by the argument to the left.
Compares two signals and outputs one if the receiver is less than or equal to the argument.
Compares two signals and outputs one if the receiver is less than or equal to the argument.
Note that this can be surprising if the signals are not integer, because due to floating point noise two signals may be "almost identical" but not quite.
Compares two signals and outputs one if the receiver is greater than the argument.
Compares two signals and outputs one if the receiver is greater than the argument.
===Example===
// trigger an envelope
play {
val trig = SinOsc.ar(1) > 0
val env = EnvGen.kr(Env.perc, gate = trig, doneAction = doNothing) *
SinOsc.ar(440) * env * 0.1
}
Compares two signals and outputs one if the receiver is greater than or equal to the argument.
Compares two signals and outputs one if the receiver is greater than or equal to the argument.
Note that this can be surprising if the signals are not integer, because due to floating point noise two signals may be "almost identical" but not quite.
Treats the signals as integer numbers and bit-shifts the receiver by the argument to the right.
Treats the signals as integer numbers and bit-shifts the receiver by the argument to the right.
Treats the signals as integer numbers and combines their bit representations through XOR
.
Treats the signals as integer numbers and combines their bit representations through XOR
.
Takes the absolute values or magnitudes of the signal (negative numbers become positive).
Takes the absolute values or magnitudes of the signal (negative numbers become positive).
- See also
Calculates the absolute difference of the two arguments, equivalent to the formula abs(a - b)
.
Calculates the absolute difference of the two arguments, equivalent to the formula abs(a - b)
.
===Example===
play {
// creates a pulsation
val mul = (SinOsc.ar(2) * 0.5) absDif 0.2
SinOsc.ar(440) * mul
}
Uses the input signal as argument to the arc cosine (trigonometric) function.
Warning: produces NaN
if the input is less than -1
or greater than +1
Uses the input signal as argument to the arc cosine (trigonometric) function.
Warning: produces NaN
if the input is less than -1
or greater than +1
Multiplies the input signal with the argument, while the argument
is positive, otherwise outputs zero. Thus equivalent to a * b.max(0)
.
Multiplies the input signal with the argument, while the argument
is positive, otherwise outputs zero. Thus equivalent to a * b.max(0)
.
===Example===
play {
// a sine envelope
WhiteNoise.ar.amClip(SinOsc.kr(1) * 0.2)
}
Converts the input signal from a linear (amplitude) factor to a level in decibels (dB). A unit amplitude of 1.0 corresponds with 0 dB. A factor or amplitude of 2.0 corresponds to c. +6 dB. A factor or amplitude of 0.5 corresponds wot c. -6 dB.
Converts the input signal from a linear (amplitude) factor to a level in decibels (dB). A unit amplitude of 1.0 corresponds with 0 dB. A factor or amplitude of 2.0 corresponds to c. +6 dB. A factor or amplitude of 0.5 corresponds wot c. -6 dB.
The inverse function is dbAmp
.
- See also
Uses the input signal as argument to the arc sine (trigonometric) function.
Warning: produces NaN
if the input is less than -1
or greater than +1
Uses the input signal as argument to the arc sine (trigonometric) function.
Warning: produces NaN
if the input is less than -1
or greater than +1
Uses the input signal as argument to the arc tangent (trigonometric) function. It is also useful for "compressing" the range of an input signal.
Uses the input signal as argument to the arc tangent (trigonometric) function. It is also useful for "compressing" the range of an input signal.
There is also a binary operator atan2
for a greater (disambiguated) value range.
- See also
Uses the input signal and the argument to calculate the arc tangent (trigonometric) function.
The input signal is the numerator ("x") and the argument b
is the denominator ("y") of the parameter
to arg tangent.
Uses the input signal and the argument to calculate the arc tangent (trigonometric) function.
The input signal is the numerator ("x") and the argument b
is the denominator ("y") of the parameter
to arg tangent.
There is also a unary operator atan
.
- See also
Produces a random signal linearly distributed between -a
and +a
for input signal a
.
Produces a random signal linearly distributed between -a
and +a
for input signal a
.
- See also
Rounds the signal up to the next higher integer number.
Rounds the signal up to the next higher integer number.
- See also
Clips the receiver to a range defined by low
and high
.
Outputs low
if the receiver is smaller than low
, and
outputs high
if the receiver is larger than high
.
Clips the input signal to the range given by +/- the argument.
If the input falls below -b
, it is held at -b
.
If the input rises above +b
, it is held at +b
.
Clips the input signal to the range given by +/- the argument.
If the input falls below -b
, it is held at -b
.
If the input rises above +b
, it is held at +b
.
===Example===
play {
// fade in amplitude, fade out distortion
SinOsc.ar(500).clip2(Line.kr(0, 1, 8)) * 0.5
}
- See also
Produces a random signal taking the values zero or one, using the input
signal as probability. If the input is 0.5
, there is a 50:50 chance of the output
sample becoming zero or one. If the input is 0.1
, the chance of an output sample
becoming zero is 90% and the chance of it becoming one is 10%.
Produces a random signal taking the values zero or one, using the input
signal as probability. If the input is 0.5
, there is a 50:50 chance of the output
sample becoming zero or one. If the input is 0.1
, the chance of an output sample
becoming zero is 90% and the chance of it becoming one is 10%.
If the input is zero or less than zero, the output is constantly zero. If the input is one or greater than one, the output is constantly one.
Uses the input signal as argument to the cosine (trigonometric) function.
Uses the input signal as argument to the cosine (trigonometric) function.
Uses the input signal as argument to the hyperbolic cosine (trigonometric) function.
Uses the input signal as argument to the hyperbolic cosine (trigonometric) function.
Converts the input signal from a frequency in cycles per second (Hertz) to a midi pitch number.
A frequency of 440 cps corresponds to the midi pitch of 69
or note A4.
Converts the input signal from a frequency in cycles per second (Hertz) to a midi pitch number.
A frequency of 440 cps corresponds to the midi pitch of 69
or note A4.
The inverse function is midiCps
.
- See also
Converts the input signal from a frequency in cycles per second (Hertz) to a "decimal octave". A frequency of 261.626 cps corresponds to the note C4 or "decimal octave" 4.0.
Converts the input signal from a frequency in cycles per second (Hertz) to a "decimal octave". A frequency of 261.626 cps corresponds to the note C4 or "decimal octave" 4.0.
The inverse function is cpsOct
.
- See also
Takes the signal to the power of three, equivalent to a * a * a
.
Takes the signal to the power of three, equivalent to a * a * a
.
- See also
Converts the input signal from a level in decibels (dB) to a linear factor. A level of 0 dB corresponds to a factor of 1.0. A level of +6 dB corresponds to a factor of c. 2.0 (double amplitude). A level of -6 dB corresponds to a factor of c. 0.5 (half amplitude).
Converts the input signal from a level in decibels (dB) to a linear factor. A level of 0 dB corresponds to a factor of 1.0. A level of +6 dB corresponds to a factor of c. 2.0 (double amplitude). A level of -6 dB corresponds to a factor of c. 0.5 (half amplitude).
The inverse function is ampDb
.
- See also
Calculates the difference of the squared arguments, equivalent to the formula (a*a) - (b*b)
.
Calculates the difference of the squared arguments, equivalent to the formula (a*a) - (b*b)
.
===Example===
play {
(SinOsc.ar(800) difSqr SinOsc.ar(XLine.kr(200, 500, 5))) * 0.125
}
Produces a non-linear distortion using the formula a / (1 + abs(a))
.
Produces a non-linear distortion using the formula a / (1 + abs(a))
.
===Example===
// gradually increasing amount of distortion
play {
(SinOsc.ar(500) * XLine.kr(0.1, 10, 10)).distort * 0.25
}
- See also
Produces the difference of the input signal and it being clipped to the argument.
Thus equivalent to a - a.clip2(b)
.
Produces the difference of the input signal and it being clipped to the argument.
Thus equivalent to a - a.clip2(b)
.
===Example===
play {
SinOsc.ar(500).excess(Line.kr(0, 1, 8)) * 0.5
}
Exponentiates the signal (with base ''e'').
Exponentiates the signal (with base ''e'').
The inverse function is log
.
- See also
Scales the input signal a
from an exponential source range to an exponential target range.
The formula is (outHigh / outLow).pow((a / inLow).log / (inHigh / inLow).log) * outLow
.
Scales the input signal a
from an exponential source range to an exponential target range.
The formula is (outHigh / outLow).pow((a / inLow).log / (inHigh / inLow).log) * outLow
.
Scales the input signal a
from an exponential source range to a linear target range.
The formula is (a / inLow).log / (inHigh / inLow).log * (outHigh - outLow) + outLow
.
Scales the input signal a
from an exponential source range to a linear target range.
The formula is (a / inLow).log / (inHigh / inLow).log * (outHigh - outLow) + outLow
.
Outputs random values exponentially distributed between the two signals.
Outputs random values exponentially distributed between the two signals.
A dummy operation that ensures the topological order of the receiver UGen and the argument UGen. It ensures that the receiver is placed before the argument. Rarely used.
A dummy operation that ensures the topological order of the receiver UGen and the argument UGen. It ensures that the receiver is placed before the argument. Rarely used.
===Example===
// useful when two UGens need to be called, but only one of their outputs is used
play {
val a = Dpoll(Dseq(Seq(1, 2, 3, 4), inf), label = "a")
val b = Dpoll(Dseq(Seq(1955, 1952, 1823, 1452), inf), label = "b")
val c = Dpoll(a firstArg b, label = "a firstArg b ") // c = a
Duty.kr(0.4, 0, c)
()
}
Creates a Flatten
graph element that "flattens" the channels from a nested multi-channel structure,
into a one-dimensional multi-channel structure.
Creates a Flatten
graph element that "flattens" the channels from a nested multi-channel structure,
into a one-dimensional multi-channel structure.
For example Pan.ar(SinOsc.ar(Seq(400, 600)))
is a nested multi-channel structure, which appears
as two channels (nested) during expansion. Instead, Pan.ar(SinOsc.ar(Seq(400, 600))).flatten
appears
as a flat four-channel signal.
- See also
Flatten
Rounds the signal down to the next lower integer number.
Rounds the signal down to the next lower integer number.
- See also
Folds or "reflects" the input signal at the boundaries given by the arguments.
For example, with low = -2
and high = +3
if the input falls below -2, it is reflected such that input -2.1 becomes output -1.9.
If the input rises above +3, it is reflected such that input +3.1 becomes output +2.9.
Folds or "reflects" the input signal at the boundaries given by the arguments.
For example, with low = -2
and high = +3
if the input falls below -2, it is reflected such that input -2.1 becomes output -1.9.
If the input rises above +3, it is reflected such that input +3.1 becomes output +2.9.
- See also
Folds or "reflects" the input signal at the boundaries given by +/- the argument. For example, with boundaries of +/- 2, if the input falls below -2, it is reflected such that input -2.1 becomes output -1.9. If the input rises above +2, it is reflected such that input +2.1 becomes output +1.9.
Folds or "reflects" the input signal at the boundaries given by +/- the argument. For example, with boundaries of +/- 2, if the input falls below -2, it is reflected such that input -2.1 becomes output -1.9. If the input rises above +2, it is reflected such that input +2.1 becomes output +1.9.
===Example===
play {
SinOsc.ar(500).fold2(Line.kr(0, 1, 8)) * 0.5
}
- See also
Takes the fractional part of the signal, equivalent to modulus 1.0
.
Takes the fractional part of the signal, equivalent to modulus 1.0
.
- See also
Treats the signals as integer numbers and outputs the greatest common divisor of both.
This extends the usual definition by returning a negative number if both operands are negative.
"greater" means "divisible by" in this interpretation, so -1 gcd -1
returns a negative number.
Treats the signals as integer numbers and outputs the greatest common divisor of both.
This extends the usual definition by returning a negative number if both operands are negative.
"greater" means "divisible by" in this interpretation, so -1 gcd -1
returns a negative number.
===Example===
// rhythmic pitch patterns with mouse control
play {
val mx = MouseX.kr(-200, 200)
val my = MouseY.kr(-200, 200)
val freq = (SinOsc.kr(0.3) * 20).gcd(GESeq(mx, my)) * 30 + 500
SinOsc.ar(freq) * 0.1
}
- See also
Scans the von Hann window function between the input signal's range of 0 and 1.
The Hann window is a raised cosine starting and ending at zero at the interval
boundaries, and going to 1.0 at the center (input 0.5).
Outside of the interval [0, 1]
, the output will be zero.
Scans the von Hann window function between the input signal's range of 0 and 1.
The Hann window is a raised cosine starting and ending at zero at the interval
boundaries, and going to 1.0 at the center (input 0.5).
Outside of the interval [0, 1]
, the output will be zero.
Calculates the hypotenuse of both signals, or the square root of the sum of the squares of both.
Calculates the hypotenuse of both signals, or the square root of the sum of the squares of both.
===Example===
// hypot used to calculate a Doppler shift pitch and amplitude based on distance.
play {
// object travels 200 meters in 6 secs (= 120 km/h) passing 10 meters
// from the listener
val x = 10
val y = LFSaw.kr(1.0/6) * 100
val distance = x hypot y
val velocity = Slope.kr(distance)
val pitchRatio = (344 - velocity) / 344 // speed of sound is around 344 m/s
val amplitude = 20 / distance.squared
SinOsc.ar(500 * pitchRatio) * amplitude
}
- See also
An approximate and thus faster version of hypot
to calculate the hypotenuse of both signals,
or the square root of the sum of the squares of both.
An approximate and thus faster version of hypot
to calculate the hypotenuse of both signals,
or the square root of the sum of the squares of both.
- See also
Applies a lag or smoothing filter to the input signal.
Applies a lag or smoothing filter to the input signal.
- Value Params
- t1
the -60 dB lag time (decay to 0.01%) in seconds
- t2
if given (greater than or equal to zero), then
t1
gives the lag time for rising slopes, andt2
gives the lag time for falling slopes.
- See also
Lag
LagUD
Applies two nested lags with time constant 0.1 seconds.
Applies two nested lags with time constant 0.1 seconds.
Applies two nested lag or smoothing filters to the input signal. lag2
is equivalent to .lag.lag
but
potentially less CPU intensive.
Applies two nested lag or smoothing filters to the input signal. lag2
is equivalent to .lag.lag
but
potentially less CPU intensive.
- Value Params
- t1
the -60 dB lag time (decay to 0.01%) of each lag in seconds
- t2
if given (greater than or equal to zero), then
t1
gives the lag time for rising slopes, andt2
gives the lag time for falling slopes.
- See also
Lag2
Lag2UD
Applies three nested lags with time constant 0.1 seconds.
Applies three nested lags with time constant 0.1 seconds.
Applies three nested lag or smoothing filters to the input signal. lag3
is equivalent to .lag.lag.lag
but
potentially less CPU intensive.
Applies three nested lag or smoothing filters to the input signal. lag3
is equivalent to .lag.lag.lag
but
potentially less CPU intensive.
- Value Params
- t1
the -60 dB lag time (decay to 0.01%) of each lag in seconds
- t2
if given (greater than or equal to zero), then
t1
gives the lag time for rising slopes, andt2
gives the lag time for falling slopes.
- See also
Lag3
Lag3UD
Treats the signals as integer numbers and outputs the least common multiple of both. This extends the usual definition by returning a negative number if any of the operands is negative.
Treats the signals as integer numbers and outputs the least common multiple of both. This extends the usual definition by returning a negative number if any of the operands is negative.
===Example===
// rhythmic pitch patterns with mouse control
play {
val mx = MouseX.kr(-20, 20)
val my = MouseY.kr(-20, 20)
SinOsc.ar((SinOsc.kr(0.3) * 20) lcm (GESeq(mx, my) * 30 + 500)) * 0.1
}
- See also
Scales the input signal a
from a linear source range to an exponential target range.
The formula is (outHigh / outLow).pow((a - inLow) / (inHigh - inLow)) * outLow
.
Scales the input signal a
from a linear source range to an exponential target range.
The formula is (outHigh / outLow).pow((a - inLow) / (inHigh - inLow)) * outLow
.
- See also
LinExp
Scales the input signal a
from a linear source range to a linear target range.
The formula is (a - inLow) / (inHigh - inLow) * (outHigh - outLow) + outLow
.
Scales the input signal a
from a linear source range to a linear target range.
The formula is (a - inLow) / (inHigh - inLow) * (outHigh - outLow) + outLow
.
- See also
LinLin
Produces a random signal linearly distributed between zero and the input signal.
Produces a random signal linearly distributed between zero and the input signal.
- See also
Outputs the larger of two signals.
Outputs the larger of two signals.
===Example===
// LFO distorts and envelopes z
play {
val z = SinOsc.ar(500)
z max SinOsc.ar(0.1)
}
Converts the input signal from midi pitch to a frequency in cycles per second (Hertz).
A midi pitch of 69
corresponds to A4 or 440 cps. A pitch of 69 + 12 = 81
is one
octave up, i.e. A5 or 880 cps.
Converts the input signal from midi pitch to a frequency in cycles per second (Hertz).
A midi pitch of 69
corresponds to A4 or 440 cps. A pitch of 69 + 12 = 81
is one
octave up, i.e. A5 or 880 cps.
The inverse function is cpsMidi
.
===Example===
// midi pitch from 24 to 108 to oscillator frequency
play {
Saw.ar(Line.kr(24, 108, dur = 10).midiCps) * 0.2
}
- See also
Converts the input signal from midi pitch interval to a frequency ratio.
An interval of zero corresponds to unison and thus a frequency ratio of 1.0
.
An interval of +12
corresponds to an octave up or ratio of 2.0
.
An interval of -12
corresponds to an octave down or ratio of (1.0/2.0) = 0.5
.
Converts the input signal from midi pitch interval to a frequency ratio.
An interval of zero corresponds to unison and thus a frequency ratio of 1.0
.
An interval of +12
corresponds to an octave up or ratio of 2.0
.
An interval of -12
corresponds to an octave down or ratio of (1.0/2.0) = 0.5
.
The inverse function is ratioMidi
.
- See also
Outputs the smaller of two signals.
Outputs the smaller of two signals.
===Example===
// LFO distorts and envelopes z
play {
val z = SinOsc.ar(500)
z min SinOsc.ar(0.1)
}
Take the modulus of the signal. Negative input values are
wrapped to positive ones, e.g. DC.kr(-4).mod(5) sig_== DC.kr(1)
If the second operand is zero, the output is zero.
Take the modulus of the signal. Negative input values are
wrapped to positive ones, e.g. DC.kr(-4).mod(5) sig_== DC.kr(1)
If the second operand is zero, the output is zero.
Calculates the minimum distance between the input signal and a second signal y
based on modulo arithmetics
and a given modulo argument mod
.
On a circle, there are two distances between two points. This operation returns the smaller value
of the two.
Creates a MulAdd
UGen, by first multiplying the receiver with mul
, then adding the add
parameter.
It can be used to change the value range of the receiver. For example,
SinOsc
has a nominal range of -1
to +1
. Using SinOsc.ar.mulAdd(3, 4)
that
range would become (-1 * 3) + 4 = 1
to (+1 * 3) + 4 = 7
.
Creates a MulAdd
UGen, by first multiplying the receiver with mul
, then adding the add
parameter.
It can be used to change the value range of the receiver. For example,
SinOsc
has a nominal range of -1
to +1
. Using SinOsc.ar.mulAdd(3, 4)
that
range would become (-1 * 3) + 4 = 1
to (+1 * 3) + 4 = 7
.
- See also
MulAdd
Converts the input signal from "decimal octaves" to a frequency in cycles per second (Hertz). For example, octave 4 begins with 4.0 or note C4, corresponding to 261.626 cps. The tritone above that (plus 6 semitones or half an octave), is "decimal octave" 4.5, corresponding with note F♯4 or 369.994 cps.
Converts the input signal from "decimal octaves" to a frequency in cycles per second (Hertz). For example, octave 4 begins with 4.0 or note C4, corresponding to 261.626 cps. The tritone above that (plus 6 semitones or half an octave), is "decimal octave" 4.5, corresponding with note F♯4 or 369.994 cps.
The inverse function is cpsOct
.
- See also
Creates a proxy that represents a specific output channel of the element.
Creates a proxy that represents a specific output channel of the element.
- Value Params
- index
channel-index, zero-based. Indices which are greater than or equal to the number of outputs are wrapped around.
- Returns
a monophonic element that represents the given channel of the receiver
- See also
ChannelProxy
Creates a proxy that represents a specific range of output channels of the element.
Creates a proxy that represents a specific range of output channels of the element.
- Value Params
- range
a range of channels, zero-based. Indices which are greater than or equal to the number of outputs are wrapped around.
- Returns
a new element that represents the given channels of the receiver
- See also
ChannelRangeProxy
Creates a Poll
UGen, printing the receiver's values to the console, ten times a second.
Creates a Poll
UGen, printing the receiver's values to the console, ten times a second.
- See also
Poll
Polls the output values of this graph element, and prints the result to the console.
This is a convenient method for wrapping this graph element in a Poll
UGen.
Polls the output values of this graph element, and prints the result to the console.
This is a convenient method for wrapping this graph element in a Poll
UGen.
- Value Params
- label
a string to print along with the values, in order to identify different polls. Using the special label
"$auto"
(default) will generated automatic useful labels using information from the polled graph element- trig
a signal to trigger the printing. If this is a constant, it is interpreted as a frequency value and an
Impulse
generator of that frequency is used instead.- trigId
if greater then 0, a
"/tr"
OSC message is sent back to the client (similar toSendTrig
)
- See also
Poll
Takes the power of the signal.
Takes the power of the signal.
'''Warning:''' Unlike a normal power operation, the signum of the
left operand is always preserved. I.e. DC.kr(-0.5).pow(2)
will
not output 0.25
but -0.25
. This is to avoid problems with
floating point noise and negative input numbers, so
DC.kr(-0.5).pow(2.001)
does not result in a NaN
, for example.
Scans a ramp function rising from zero to one across the input signals' range of 0 and 1. The function moves linearly from the zero at the interval start to 1.0 at the interval end. When the input is smaller than zero, the output is zero, and when the input is larger than one, the output is one.
Scans a ramp function rising from zero to one across the input signals' range of 0 and 1. The function moves linearly from the zero at the interval start to 1.0 at the interval end. When the input is smaller than zero, the output is zero, and when the input is larger than one, the output is one.
Produces a random signal evenly distributed between zero and the input signal.
Produces a random signal evenly distributed between zero and the input signal.
- See also
Produces a random signal evenly distributed between -a
and +a
for input signal a
.
Produces a random signal evenly distributed between -a
and +a
for input signal a
.
- See also
Outputs random values evenly distributed between the two signals.
Outputs random values evenly distributed between the two signals.
Converts the input signal from a frequency ratio to a midi pitch interval.
A frequency ratio of 1.0 corresponds to the unison or midi interval 0.
A ratio of 2.0 corresponds to an octave up or the midi pitch interval +12
.
A ratio of 0.5 corresponds to an octave down or the midi pitch interval -12
.
Converts the input signal from a frequency ratio to a midi pitch interval.
A frequency ratio of 1.0 corresponds to the unison or midi interval 0.
A ratio of 2.0 corresponds to an octave up or the midi pitch interval +12
.
A ratio of 0.5 corresponds to an octave down or the midi pitch interval -12
.
The inverse function is midiRatio
.
- See also
Takes the reciprocal value of the input signal, equivalent to 1.0 / a
.
Takes the reciprocal value of the input signal, equivalent to 1.0 / a
.
''Warning:'' Outputs NaN
if the input is zero ("division by zero").
Scans the rectangular window function between the input signal's range of 0 and 1.
A rectangular window has value 1.0 at every point in the interval [0, 1]
.
Outside of that range, the output will be zero.
Scans the rectangular window function between the input signal's range of 0 and 1.
A rectangular window has value 1.0 at every point in the interval [0, 1]
.
Outside of that range, the output will be zero.
An optimized operation on the signals corresponding to the formula a * b + a
.
An optimized operation on the signals corresponding to the formula a * b + a
.
===Example===
play {
(SinOsc.ar(800) ring1 SinOsc.ar(XLine.kr(200, 500, 5))) * 0.125
}
An optimized operation on the signals corresponding to the formula a * b + a + b
.
An optimized operation on the signals corresponding to the formula a * b + a + b
.
===Example===
play {
(SinOsc.ar(800) ring2 SinOsc.ar(XLine.kr(200, 500, 5))) * 0.125
}
An optimized operation on the signals corresponding to the formula a * a * b
.
An optimized operation on the signals corresponding to the formula a * a * b
.
===Example===
play {
(SinOsc.ar(800) ring3 SinOsc.ar(XLine.kr(200, 500, 5))) * 0.125
}
An optimized operation on the signals corresponding to the formula a * a * b - b * b * a
.
An optimized operation on the signals corresponding to the formula a * a * b - b * b * a
.
===Example===
play {
(SinOsc.ar(800) ring4 SinOsc.ar(XLine.kr(200, 500, 5))) * 0.125
}
Rounds the input signal up or down to a given degree of coarseness. For example,
roundTo(1.0)
rounds to the closest integer, roundTo(0.1)
rounds to the closest
number for which modulus 0.1 is zero.
Rounds the input signal up or down to a given degree of coarseness. For example,
roundTo(1.0)
rounds to the closest integer, roundTo(0.1)
rounds to the closest
number for which modulus 0.1 is zero.
Rounds the input signal up to a given degree of coarseness. For example,
roundUpTo(1.0)
rounds up to the closest integer, roundTo(0.1)
rounds up to the closest
number for which modulus 0.1 is zero.
Rounds the input signal up to a given degree of coarseness. For example,
roundUpTo(1.0)
rounds up to the closest integer, roundTo(0.1)
rounds up to the closest
number for which modulus 0.1 is zero.
Scans a sinusoidal S-shaped function ("easy in, easy out") rising from zero to one across the input signals' range of 0 and 1. The function begins to rise from the zero at the interval start to 0.5 at the center to 1.0 at the interval end. When the input is smaller than zero, the output is zero, and when the input is larger than one, the output is one.
Scans a sinusoidal S-shaped function ("easy in, easy out") rising from zero to one across the input signals' range of 0 and 1. The function begins to rise from the zero at the interval start to 0.5 at the center to 1.0 at the interval end. When the input is smaller than zero, the output is zero, and when the input is larger than one, the output is one.
Scales the negative part of the input by the argument, outputs positive input unaltered.
Thus equivalent to a.min(0) * b + a.max(0)
.
Scales the negative part of the input by the argument, outputs positive input unaltered.
Thus equivalent to a.min(0) * b + a.max(0)
.
===Example===
play {
// increasing half-wave asymmetry
(SinOsc.ar(500) * 0.25).scaleNeg(Line.ar(1, -1, 4))
}
Compares two signals and outputs one if they are different, otherwise zero.
Compares two signals and outputs one if they are different, otherwise zero.
Note that this can be surprising if the signals are not integer, because due to floating point noise two signals may be "almost identical" but not quite, thus resulting in an output of one.
Compares two signals and outputs one if they are identical, otherwise zero.
Compares two signals and outputs one if they are identical, otherwise zero.
Note that this can be surprising if the signals are not integer, because due to floating point noise two signals may be "almost identical" but not quite, thus resulting in an output of zero.
Takes the signum of the signal, being 1
for positive signals, -1
for negative signals,
and zero for a zero input.
Takes the signum of the signal, being 1
for positive signals, -1
for negative signals,
and zero for a zero input.
- See also
Uses the input signal as argument to the sine (trigonometric) function.
Uses the input signal as argument to the sine (trigonometric) function.
Uses the input signal as argument to the hyperbolic sine (trigonometric) function.
Uses the input signal as argument to the hyperbolic sine (trigonometric) function.
Produces a non-linear distortion, wherein the input range of -0.5
to +0.5
is linear.
Produces a non-linear distortion, wherein the input range of -0.5
to +0.5
is linear.
===Example===
// gradually increasing amount of distortion
play {
(SinOsc.ar(500) * XLine.kr(0.1, 10, 10)).softClip * 0.25
}
- See also
Squares the difference of the two arguments, equivalent to the formula (a - b) * (a - b)
.
Squares the difference of the two arguments, equivalent to the formula (a - b) * (a - b)
.
===Example===
play {
(SinOsc.ar(800) sqrDif SinOsc.ar(XLine.kr(200, 500, 5))) * 0.125
}
Squares the sum of the two arguments, equivalent to the formula (a + b) * (a + b)
.
Squares the sum of the two arguments, equivalent to the formula (a + b) * (a + b)
.
===Example===
play {
(SinOsc.ar(800) sqrSum SinOsc.ar(XLine.kr(200, 500, 5))) * 0.125
}
Takes the square root of the signal. If the input is negative, it returns
the negative of the square root of the absolute value, i.e. sqrt(-2) == -sqrt(2)
,
so the output is valid for any input.
Takes the square root of the signal. If the input is negative, it returns
the negative of the square root of the absolute value, i.e. sqrt(-2) == -sqrt(2)
,
so the output is valid for any input.
- See also
Takes the square of the signal, equivalent to a * a
.
Takes the square of the signal, equivalent to a * a
.
- See also
Produces a random signal following an approximated Gaussian distribution between zero and the input signal.
It follows the formula Mix.fill(3)(Rand(0.0, 1.0)) - 1.5 * (2.0/3)
,
thus summing three evenly distributed signals
Produces a random signal following an approximated Gaussian distribution between zero and the input signal.
It follows the formula Mix.fill(3)(Rand(0.0, 1.0)) - 1.5 * (2.0/3)
,
thus summing three evenly distributed signals
Calculates the sum of the squared arguments, equivalent to the formula (a*a) + (b*b)
.
Calculates the sum of the squared arguments, equivalent to the formula (a*a) + (b*b)
.
===Example===
play {
(SinOsc.ar(800) sumSqr SinOsc.ar(XLine.kr(200, 500, 5))) * 0.125
}
Uses the input signal as argument to the tangent (trigonometric) function.
Uses the input signal as argument to the tangent (trigonometric) function.
Uses the input signal as argument to the hyperbolic tangent (trigonometric) function.
Uses the input signal as argument to the hyperbolic tangent (trigonometric) function.
A threshold comparison where the output is zero when input signal is less than the argument, otherwise the input signal is passed.
A threshold comparison where the output is zero when input signal is less than the argument, otherwise the input signal is passed.
===Example===
play {
// a low-rent gate
(LFNoise0.ar(50) * 0.5) thresh 0.45
}
- See also
Scans the triangular window function between the input signal's range of 0 and 1.
The triangular window moves from linearly from the zero at the interval start to
1.0 at the center (input 0.5) back to 0.0 at the interval end.
Outside of the interval [0, 1]
, the output will be zero.
Scans the triangular window function between the input signal's range of 0 and 1.
The triangular window moves from linearly from the zero at the interval start to
1.0 at the center (input 0.5) back to 0.0 at the interval end.
Outside of the interval [0, 1]
, the output will be zero.
Removes the fractional part of the input signal.
Removes the fractional part of the input signal.
- See also
Logically negates the signal. Outputs 1
if the signal is greater than zero, otherwise outputs 0
.
Logically negates the signal. Outputs 1
if the signal is greater than zero, otherwise outputs 0
.
Negatives the signal. As if multiplying the signal by -1
.
Negatives the signal. As if multiplying the signal by -1
.
===Example===
// pseudo-stereo by phase inversion
play {
val a = LFNoise1.ar(1500) * 0.5
Seq(a, -a)
}
Treats the signal as integer numbers and inverts its bits.
Treats the signal as integer numbers and inverts its bits.
Scans the Welch window function between the input signal's range of 0 and 1.
The Welch window is a parabolic curve starting and ending at zero at the interval
boundaries, and going to 1.0 at the center (input 0.5).
Outside of the interval [0, 1]
, the output will be zero.
Scans the Welch window function between the input signal's range of 0 and 1.
The Welch window is a parabolic curve starting and ending at zero at the interval
boundaries, and going to 1.0 at the center (input 0.5).
Outside of the interval [0, 1]
, the output will be zero.
Wraps the input signal at the boundaries given by the arguments.
If the input falls below low
, it is wrapped back to high
.
If the input rises above high
, it is wrapped back to low
.
Wraps the input signal at the boundaries given by +/- the argument.
If the input falls below -b
, it is wrapped back to +b
.
If the input rises above +b
, it is wrapped back to -b
.