final class GEOps extends AnyVal
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
- Alphabetic
- By Inheritance
- GEOps
- AnyVal
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- Any
- final def ##: Int
- Definition Classes
- Any
- def %(b: GE): GE
Take the modulus of the signal.
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.
- def &(b: GE): GE
Treats the signals as integer numbers and combines their bit representations through
AND
. - def *(b: GE): GE
Multiplies two signals.
- def +(b: GE): GE
Adds two signals.
- def -(b: GE): GE
Subtracts a signal from the receiver.
- def /(b: GE): GE
Divides the receiver by another signal.
- def <(b: GE): GE
Compares two signals and outputs one if the receiver is less than the argument.
- def <<(b: GE): GE
Treats the signals as integer numbers and bit-shifts the receiver by the argument to the left.
- def <=(b: GE): GE
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.
- final def ==(arg0: Any): Boolean
- Definition Classes
- Any
- def >(b: GE): GE
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 }
- def >=(b: GE): GE
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.
- def >>(b: GE): GE
Treats the signals as integer numbers and bit-shifts the receiver by the argument to the right.
- def ^(b: GE): GE
Treats the signals as integer numbers and combines their bit representations through
XOR
. - def abs: GE
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
- def absDif(b: GE): GE
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 }
- def acos: GE
Uses the input signal as argument to the arc cosine (trigonometric) function.
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
- def amClip(b: GE): GE
Multiplies the input signal with the argument, while the argument is positive, otherwise outputs zero.
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) }
- def ampDb: GE
Converts the input signal from a linear (amplitude) factor to a level in decibels (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
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def asin: GE
Uses the input signal as argument to the arc sine (trigonometric) function.
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
- def atan: GE
Uses the input signal as argument to the arc tangent (trigonometric) function.
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
- def atan2(b: GE): GE
Uses the input signal and the argument to calculate the arc tangent (trigonometric) function.
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
- def bilinRand: GE
Produces a random signal linearly distributed between
-a
and+a
for input signala
.Produces a random signal linearly distributed between
-a
and+a
for input signala
.- See also
- def ceil: GE
Rounds the signal up to the next higher integer number.
Rounds the signal up to the next higher integer number.
- See also
- def clip(low: GE, high: GE): GE
Clips the receiver to a range defined by
low
andhigh
. - def clip2(b: GE): GE
Clips the input signal to the range given by +/- the argument.
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
- def coin: GE
Produces a random signal taking the values zero or one, using the input signal as probability.
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 is0.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.
- def cos: GE
Uses the input signal as argument to the cosine (trigonometric) function.
- def cosh: GE
Uses the input signal as argument to the hyperbolic cosine (trigonometric) function.
- def cpsMidi: GE
Converts the input signal from a frequency in cycles per second (Hertz) to a midi pitch number.
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
- def cpsOct: GE
Converts the input signal from a frequency in cycles per second (Hertz) to a "decimal octave".
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
- def cubed: GE
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
- def dbAmp: GE
Converts the input signal from a level in decibels (dB) to a linear factor.
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
- def difSqr(b: GE): GE
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 }
- def distort: GE
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
- def excess(b: GE): GE
Produces the difference of the input signal and it being clipped to the argument.
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 }
- def exp: GE
Exponentiates the signal (with base e).
Exponentiates the signal (with base e).
The inverse function is
log
.- See also
- def expExp(inLow: GE, inHigh: GE, outLow: GE, outHigh: GE): GE
Scales the input signal
a
from an exponential source range to an exponential target range.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
. - def expLin(inLow: GE, inHigh: GE, outLow: GE, outHigh: GE): GE
Scales the input signal
a
from an exponential source range to a linear target range.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
. - def expRand(b: GE): GE
Outputs random values exponentially distributed between the two signals.
- def firstArg(b: GE): GE
A dummy operation that ensures the topological order of the receiver UGen and the argument UGen.
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) () }
- def flatten: GE
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
- def floor: GE
Rounds the signal down to the next lower integer number.
Rounds the signal down to the next lower integer number.
- See also
- def fold(low: GE, high: GE): GE
Folds or "reflects" the input signal at the boundaries given by the arguments.
Folds or "reflects" the input signal at the boundaries given by the arguments. For example, with
low = -2
andhigh = +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. - def fold2(b: GE): GE
Folds or "reflects" the input signal at the boundaries given by +/- the argument.
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 }
- def frac: GE
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
- def gcd(b: GE): GE
Treats the signals as integer numbers and outputs the greatest common divisor of both.
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
- def getClass(): Class[_ <: AnyVal]
- Definition Classes
- AnyVal → Any
- def hannWindow: GE
Scans the von Hann window function between the input signal's range of 0 and 1.
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. - def hypot(b: GE): GE
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
- def hypotApx(b: GE): GE
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
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def lag(t1: GE = 0.1f, t2: GE = -1): GE
Applies a lag or smoothing filter to the input signal.
Applies a lag or smoothing filter to the input signal.
- 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
- def lag: GE
Applies a lag with time constant 0.1 seconds.
- def lag2(t1: GE = 0.1f, t2: GE = -1): GE
Applies two nested lag or smoothing filters to the input signal.
Applies two nested lag or smoothing filters to the input signal.
lag2
is equivalent to.lag.lag
but potentially less CPU intensive.- 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
- def lag2: GE
Applies two nested lags with time constant 0.1 seconds.
- def lag3(t1: GE = 0.1f, t2: GE = -1): GE
Applies three nested lag or smoothing filters to the input signal.
Applies three nested lag or smoothing filters to the input signal.
lag3
is equivalent to.lag.lag.lag
but potentially less CPU intensive.- 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
- def lag3: GE
Applies three nested lags with time constant 0.1 seconds.
- def lcm(b: GE): GE
Treats the signals as integer numbers and outputs the least common multiple of both.
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
- def linExp(inLow: GE, inHigh: GE, outLow: GE, outHigh: GE): GE
Scales the input signal
a
from a linear source range to an exponential target range.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
- def linLin(inLow: GE, inHigh: GE, outLow: GE, outHigh: GE): GE
Scales the input signal
a
from a linear source range to a linear target range.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
- def linRand: GE
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
- def log: GE
Takes the natural logarithm of the input signal.
- def log10: GE
Takes the logarithm of the input signal, using base 10.
- def log2: GE
Takes the logarithm of the input signal, using base 2.
- def max(b: GE): GE
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) }
- def midiCps: GE
Converts the input signal from midi pitch to a frequency in cycles per second (Hertz).
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 of69 + 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
- def midiRatio: GE
Converts the input signal from midi pitch interval to a frequency ratio.
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 of2.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
- def min(b: GE): GE
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) }
- def mod(b: GE): GE
Take the modulus of the signal.
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. - def modDif(y: GE = 0.0, mod: GE = 1.0): GE
Calculates the minimum distance between the input signal and a second signal
y
based on modulo arithmetics and a given modulo argumentmod
. - def mulAdd(mul: GE, add: GE): GE
Creates a
MulAdd
UGen, by first multiplying the receiver withmul
, then adding theadd
parameter.Creates a
MulAdd
UGen, by first multiplying the receiver withmul
, then adding theadd
parameter. It can be used to change the value range of the receiver. For example,SinOsc
has a nominal range of-1
to+1
. UsingSinOsc.ar.mulAdd(3, 4)
that range would become(-1 * 3) + 4 = 1
to(+1 * 3) + 4 = 7
.- See also
MulAdd
- def octCps: GE
Converts the input signal from "decimal octaves" to a frequency in cycles per second (Hertz).
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
- def out(range: Range): GE
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.
- 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
- def out(index: Int): GE
Creates a proxy that represents a specific output channel of the element.
Creates a proxy that represents a specific output channel of the element.
- 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
- def poll(trig: GE = 10, label: String = "$auto", trigId: GE = -1): Poll
Polls the output values of this graph element, and prints the result to the console.
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.- 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.- 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- trigId
if greater then 0, a
"/tr"
OSC message is sent back to the client (similar toSendTrig
)
- See also
Poll
- def poll: Poll
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
- def pow(b: GE): GE
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 output0.25
but-0.25
. This is to avoid problems with floating point noise and negative input numbers, soDC.kr(-0.5).pow(2.001)
does not result in aNaN
, for example. - def ramp: GE
Scans a ramp function rising from zero to one across the input signals' range of 0 and 1.
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.
- def rand: GE
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
- def rand2: GE
Produces a random signal evenly distributed between
-a
and+a
for input signala
.Produces a random signal evenly distributed between
-a
and+a
for input signala
.- See also
- def rangeRand(b: GE): GE
Outputs random values evenly distributed between the two signals.
- def ratioMidi: GE
Converts the input signal from a frequency ratio to a midi pitch interval.
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
- def reciprocal: GE
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"). - def rectWindow: GE
Scans the rectangular window function between the input signal's range of 0 and 1.
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. - def ring1(b: GE): GE
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 }
- def ring2(b: GE): GE
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 }
- def ring3(b: GE): GE
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 }
- def ring4(b: GE): GE
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 }
- def roundTo(b: GE): GE
Rounds the input signal up or down to a given degree of coarseness.
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. - def roundUpTo(b: GE): GE
Rounds the input signal up to a given degree of coarseness.
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. - def sCurve: GE
Scans a sinusoidal S-shaped function ("easy in, easy out") rising from zero to one across the input signals' range of 0 and 1.
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.
- def scaleNeg(b: GE): GE
Scales the negative part of the input by the argument, outputs positive input unaltered.
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)) }
- def sig_!=(b: GE): GE
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.
- def sig_==(b: GE): GE
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.
- def signum: GE
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
- def sin: GE
Uses the input signal as argument to the sine (trigonometric) function.
- def sinh: GE
Uses the input signal as argument to the hyperbolic sine (trigonometric) function.
- def softClip: GE
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
- def sqrDif(b: GE): GE
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 }
- def sqrSum(b: GE): GE
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 }
- def sqrt: GE
Takes the square root of the signal.
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
- def squared: GE
Takes the square of the signal, equivalent to
a * a
.Takes the square of the signal, equivalent to
a * a
.- See also
- def sum3Rand: GE
Produces a random signal following an approximated Gaussian distribution between zero and the input signal.
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 - def sumSqr(b: GE): GE
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 }
- def tan: GE
Uses the input signal as argument to the tangent (trigonometric) function.
- def tanh: GE
Uses the input signal as argument to the hyperbolic tangent (trigonometric) function.
- def thresh(b: GE): GE
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
- def toString(): String
- Definition Classes
- Any
- def triWindow: GE
Scans the triangular window function between the input signal's range of 0 and 1.
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. - def trunc(b: GE): GE
Removes the fractional part of the input signal.
Removes the fractional part of the input signal.
- See also
- def unary_!: GE
Logically negates the signal.
Logically negates the signal. Outputs
1
if the signal is greater than zero, otherwise outputs0
. - def unary_-: GE
Negatives the signal.
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) }
- def unary_~: GE
Treats the signal as integer numbers and inverts its bits.
- def welchWindow: GE
Scans the Welch window function between the input signal's range of 0 and 1.
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. - def wrap(low: GE, high: GE): GE
Wraps the input signal at the boundaries given by the arguments.
- def wrap2(b: GE): GE
Wraps the input signal at the boundaries given by +/- the argument.
- def |(b: GE): GE
Treats the signals as integer numbers and combines their bit representations through
OR
.