!= — Determines if one value is not equal to another.


Determines if one value is not equal to another.


(a != b ? v1 : v2)

where a, b, v1 and v2 may be expressions, but a, b not audio-rate.


In the above conditional, a and b are first compared. If the indicated relation is true (a not equal to b), then the conditional expression has the value of v1; if the relation is false, the expression has the value of v2.

NB.: If v1 or v2 are expressions, these will be evaluated before the conditional is determined.

In terms of binding strength, all conditional operators (i.e. the relational operators (<, etc.), and ?, and : ) are weaker than the arithmetic and logical operators (+, -, *, /, && and ||).

These are operators not opcodes. Therefore, they can be used within orchestra statements, but do not form complete statements themselves.


Here is an example of the != operator. It uses the file notequal.csd.

Example 13. Example of the != operator.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

; Select audio/midi flags here according to platform
-odac      ;;;realtime audio out
;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
; For Non-realtime ouput leave only the line below:
; -o notequal.wav -W ;;; for file output any platform

sr = 44100
ksmps = 32
nchnls = 2
0dbfs  = 1

instr 1

ipch   = cpspch(p4)
iprint = p5
if (iprint != 1) goto skipPrint
print  ipch
asig   vco .7, ipch, 2, 0.5, 1
       outs asig, asig



f 1 0 65536 10 1	;sine wave

i1 0 .5 8.00 0
i1 + .5 8.01 1 ; this note will print it's ipch value and only this one will be played
i1 + .5 8.02 2


Its output should include lines like this:

instr 1:  ipch = 277.167

See Also

==, >=, >, <=, <