cmp
Compares audio signals or arrays
Plugin opcode in emugens.
Compares audio signals or arrays, sample by sample or value by value. All comparison operations are possible: <, <=, >, >=, ==, !=
An audio signal can be compared against another audio signal, or against a scalar (i- or k-value).
An array can be compared against another array, against a scalar, or checked to be within the range of two scalars. All operations are available for i- and k- arrays
Syntax
aout cmp a1, S_operator, a2
aout cmp a1, S_operator, kb
kOut[] cmp kA[], S_operator, kb
kOut[] cmp kA[], S_operator, kB[]
kOut[] cmp k1, S_operator1, kIn[], S_operator2, k2
Initialization
S_operator -- Math operator, one of ">", ">=", "<", "<=", "=="
Performance
a1 / a2 -- Input signals
kb / ib -- Scalar term
kA[] / kB[] -- array inputs
Some example usages:
aout cmp aL, ">", aR ; aout = aL > aR for every sample
aout cmp aL, ">=", aR
aout cmp aL, "<", aR
aout cmp aL, "<", aR
aout cmp aL, "==", aR
kOut[] cmp kA, ">=", kb ; kA is an array
Examples
Here is an example of the cmp opcode. It uses the file cmp.csd.
See also
Arithmetic and Logic Operations
Credits
By: Eduardo Moguillansky 2017