Skip to content

deltapn

Taps a delay line at variable offset times.

Syntax

ares = deltapn(xnumsamps [, indx])
ares deltapn xnumsamps [, indx]

Initialization

indx (optional, default=0) -- selects a pending delayr at initialization. Zero selects the newest reader. Pass the optional i-rate output of delayr to select that reader. See Selecting a delay line for index values and placement before delayw.

Performance

xnumsamps -- specifies the tapped delay time in number of samples. Each can range from 1 control period to the full delay time of the read/write pair; however, since there is no internal check for adherence to this range, the user is wholly responsible. Each argument can be a constant, a variable, or a time-varying signal.

deltapn reads whole samples without interpolation and truncates the fractional part of xnumsamps. It accepts k-rate or audio-rate delay times in samples. Hans Mikelson wrote this opcode.

This opcode can tap into a delayr/delayw pair, extracting delayed audio from the idlt seconds of stored sound. There can be any number of deltap and/or deltapi units between a read/write pair. Each receives an audio tap with no change of original amplitude.

This opcode can provide multiple delay taps for arbitrary delay path and feedback networks. They can deliver either constant-time or time-varying taps, and are useful for building chorus effects, harmonizers, and Doppler shifts. Constant-time delay taps (and some slowly changing ones) do not need interpolated readout; they are well served by deltap. Medium-paced or fast varying dlt's, however, will need the extra services of deltapi.

delayr/delayw pairs may be interleaved. With the default index, put a tap after its reader and before any following delayr or the matching delayw. An explicit indx can select an earlier pending reader even when another delayr intervenes. Jens Groh and John ffitch added interleaved read/write pairs in Csound 3.57.

N.B. k-rate delay times are not internally interpolated, but rather lay down stepped time-shifts of audio samples; this will be found quite adequate for slowly changing tap times. For medium to fast-paced changes, however, one should provide a higher resolution audio-rate timeshift as input.

Examples

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

Example of the deltapn opcode.
<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 deltap3.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1   

gasig  init 0   
gidel  = 1              ;delay time in seconds

instr 1

ain  pluck .7, 440, 1000, 0, 1
     outs ain, ain

vincr gasig, ain        ;send to global delay
endin

instr 2 

ifeedback = p4  

abuf2   delayr  gidel
adelL   deltapn 4000            ;first tap (on left channel)
adelM   deltapn 44100           ;second tap (on middle channel)
        delayw  gasig + (adelL * ifeedback)

abuf3   delayr  gidel
kdel    line    100, p3, 1      ;vary delay time
adelR   deltapn  100 * kdel     ;one pitch changing tap (on the right chn.)
        delayw  gasig + (adelR * ifeedback)
;make a mix of all deayed signals       
        outs    adelL + adelM, adelR + adelM

clear   gasig
endin

</CsInstruments>
<CsScore>

i 1 0 1
i 1 3 1
i 2 0 3  0      ;no feedback
i 2 3 8 .8      ;lots of feedback
e
</CsScore>
</CsoundSynthesizer>

See also

Delay