René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

if (Csound opcode)

if.orc
sr     = 44100
kr     = 44100
nchnls =     1

instr 1
  k_foo   init -1

  if k_foo < 10000 goto incr

  k_foo = -1

incr:
 
  k_foo = k_foo + 1

  a_out = k_foo

  out a_out
endin
if.sco
i1 0 2
An if-then-else construct:
if k1_0 > abs(kraw) then
  asig = araw
else
  if kraw > 0 then
    asig = k1_0
  else
    asig = -k1_0
  endif
endif
Unfortunately, an a-rate signal cannot be evaluated within an if construct. It has first do be converted into a k-rate signal with downsamp.
An if then else endif construct is used in the varpulse 01 instrument.