delay — Delays an input signal by some time interval.
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, default=0) -- initial disposition of delay-loop data space (see reson). The default value is 0.
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.
Here is an example of the delay opcode. Play delay.csd
Example 215. 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 -odac ;;;RT audio out ;-iadc ;;;uncomment -iadc if RT audio input is needed too ; For Non-realtime ouput leave only the line below: ; -o delay.wav -W ;;; for file output any platform </CsOptions> <CsInstruments> sr = 44100 ksmps = 32 nchnls = 2 0dbfs = 1 instr 1 adel init 0 ilev = p4 ;level of direct sound idelay = p5 *.001 ;Delay in ms ifd = p6 ;feedback ain diskin2 "fox.wav", 1, 1 adel delay ain + (adel*ifd), idelay;ifd = amount of feedback asig moogvcf adel, 1500, .6, 1 ;color feedback outs asig*ilev, ain endin </CsInstruments> <CsScore> ;Delay is in ms i 1 0 15 2 200 .95 ;with feedback i 1 4 5 2 20 .95 i 1 + 3 2 5 .95 i 1 + 3 3 5 0 ;no feedback e </CsScore> </CsoundSynthesizer>