Use Non-Frames Version Previous Page Next Page
Signal Modifiers: Delay

delayr, delayw, delay, delay1

  ar      delayr     idlt[, iskip]
          delayw     asig
  ar      delay      asig, idlt[, iskip]
  ar      delay1     asig[, iskip]


A signal can be read from or written into a delay path, or it can be automatically delayed by some time interval.


idlt – requested delay time in seconds. This can be as large as available memory will permit. The space required for n seconds of delay is 4n * sr bytes. It is allocated at the time the instrument is first initialized, and returned to the pool at the end of a score section.

iskip (optional) – initial disposition of delay-loop data space ( see reson). The default value is 0.


delayr reads from an automatically established digital delay line, in which the signal retrieved has been resident for idlt seconds. This unit must be paired with and precede an accompanying delayw unit. Any other Csound statements can intervene.

delayw writes asig into the delay area established by the preceding delayr unit. Viewed as a pair, these two units permit the formation of modified feedback loops, etc. However, there is a lower bound on the value of idlt, which must be at least 1 control period (or 1/kr).

delayr/delayw pairs may be interleaved. Beginning another delayr/delayw pair before terminating a previous pair is no longer excluded. For the interleaved pairs, the first delayr unit is associated with the first delayw unit, the second delayr unit with the second delayw unit, and so on. In this way, it is possible to implement cross-coupled feedback that is completed within the same control-rate cycle. See Example 2. (This feature added in Csound version 3.57 by Jens Groh and John ffitch).

delay is a composite of the above two units, both reading from and writing into its own storage area. It can thus accomplish signal time-shift, although modified feedback is not possible. There is no minimum delay period.

delay1 is a special form of delay that serves to delay the audio signal asig by just one sample. It is thus functionally equivalent to "delay" asig, 1/sr but is more efficient in both time and space. This unit is particularly useful in the fabrication of generalized non-recursive filters.


Example 1

          tigoto    contin         ; except on a tie,
  a2      delay     a1, .05, 0     ; begin 50 msec clean delay of sig

Example 2

  ainput1 =     ..... 
  ainput2 =     .....

;Read delayed signal, first delayr instance: 
  adly1  delayr  0.11

;Read delayed signal, second delayr instance:
  adly2  delayr  0.07

;Do some cross-coupled manipulation: 
  afdbk1  =      0.7 * adly1 + 0.7 * adly2 + ainput1 
  afdbk2  =      -0.7 * adly1 + 0.7 * adly2 + ainput2 

;Feed back signal associated with first delayr instance:
          delayw afdbk1

;Feed back signal associated with second delayr instance:
          delayw afdbk2
          outs   adly1, adly2

Use Non-Frames Version Previous Page Next Page
Signal Modifiers: Delay