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

vdelay (Csound opcode)

asig_delayed vdelay asig, adelay_ms, imax_delay_ms [, iskip]
vdelay delays asig for adelay_ms. If adelay_ms is greater than imax_delay_ms, adelay_ms is folded around imax_delay_ms.
sr     = 44100
kr     = 4410
ksmps  = 10
nchnls = 2

instr 1
  ilen = p3
  kphasor phasor 2/ilen

  asig upsamp kphasor

  kdelay linseg 1000, ilen, 0
  adelay upsamp kdelay

  asig_delayed vdelay  asig, adelay, 1000

  outs asig*30000, asig_delayed*30000
i1 0 1
The name delay might be a bit missleading. The signal is not delayed but the original signal's value that was in effect before adelay is output. After 0.5 seconds, adelay has the value 500, so, asig_delayed gets the value that asig had before 500 ms (which is asig's value at 0 ms). After 0.75 seconds, adelay has the value 250, so asig_delayed gets the value that asig_delayed had before 250 ms (which is 500 ms = 750ms - 250ms), which is 1.

Related links

This opcode is used for the following instruments: