cmp

cmp — Compares two audio signals

Description

Compares two audio signals using the standard math operators

		aout cmp aL, ">", aR
	  

Syntax

aout cmp aL, S_operator, aR

Initialization

S_operator Math operator, one of ">", ">=", "`<", "`<=", "=="

Performance

aL -- Left signal

aR -- Right signal

kdur -- Duration of the trigger in seconds.

		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
		
	  

Examples

Here is an example of the cmp opcode. It uses the file cmp.csd.

Example 134. Example of the cmp opcode.

<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 128
nchnls = 6
0dbfs = 1.0

instr 1
    a0 linseg 0, p3, 1
    a1 linseg 1, p3, 0
    aout cmp a0, "<", a1
    outch 1, a0
	outch 2, a1
    outch 3, aout
endin

instr 2
    a0 linseg 0, p3, 1
    aout cmp a0, "<=", 0.5
    outch 4, aout
endin

instr 3
    a0 linseg 0, p3, 1
    aout cmp a0, "!=", 0.5
    outch 5, aout
endin

</CsInstruments>
<CsScore>
i 1 0 2
i 2 0 2
i 3 0 2

</CsScore>
</CsoundSynthesizer>


See Also

max, min,

Credits

By: Eduardo Moguillansky 2017