delay

delay — Delays an input signal by some time interval.

Description

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

Syntax

ares delay asig, idlt [, iskip]

Initialization

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, default=0) -- initial disposition of delay-loop data space (see reson). The default value is 0.

Performance

asig -- audio signal

delay is a composite of delayr and delayw, 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.

Examples

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

Example 104. Example of the delay opcode.

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

<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
; Audio out   Audio in    No messages
-odac           -iadc     -d     ;;;RT audio I/O
; For Non-realtime ouput leave only the line below:
; -o delay.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

; Initialize the global variables.
sr = 44100
kr = 4410
ksmps = 10
nchnls = 2

; Instrument #1 -- Delayed beeps.
instr 1
  ; Make a basic sound.
  abeep vco 20000, 440, 1

  ; Delay the beep by .1 seconds.
  idlt = 0.1
  adel delay abeep, idlt

  ; Send the beep to the left speaker and
  ; the delayed beep to the right speaker.
  outs abeep, adel
endin


</CsInstruments>
<CsScore>

; Table #1, a sine wave.
f 1 0 16384 10 1

; Keep the score running for 2 seconds.
f 0 2

; Play Instrument #1.
i 1 0.0 0.2
i 1 0.5 0.2
e


</CsScore>
</CsoundSynthesizer>


See Also

delay1, delayr, delayw

Credits

Example written by Kevin Conder.