deltapi
Prev | Orchestra Opcodes and Operators | Next

## deltapi

deltapi — Taps a delay line at variable offset times, uses interpolation.

## Description

Taps a delay line at variable offset times, uses interpolation.

## Syntax

    ares deltapi xdlt

## Performance

xdlt -- specifies the tapped delay time in seconds. 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; the xdlt argument in deltapi implies that an audio-varying delay is permitted there.

deltapi extracts sound by interpolated readout. By interpolating between adjacent stored samples deltapi represents a particular delay time with more accuracy, but it will take about twice as long to run.

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. To associate a delay tap unit with a specific delayr unit, it not only has to be located between that delayr and the appropriate delayw unit, but must also precede any following delayr units. See Example 2. (This feature added in Csound version 3.57 by Jens Groh and John ffitch).

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

Example 226. deltap example #1

      asource  buzz      1, 440, 20, 1
      atime    linseg    1, p3/2,.01, p3/2,1   ; trace a distance in secs
      ampfac   =         1/atime/atime         ; and calc an amp factor
      adump    delayr    1                     ; set maximum distance
      amove    deltapi   atime                 ; move sound source past
               delayw    asource               ; the listener
               out       amove * ampfac

Example 227. deltap example #2

      ainput1 =	.....
      ainput2 =	.....
      kdlyt1  =	.....
      kdlyt2  =	.....

    ;Read delayed signal, first delayr instance:
      adump   delayr  4.0
      adly1   deltap  kdlyt1       ; associated with first delayr instance

    ;Read delayed signal, second delayr instance:
      adump   delayr  4.0
      adly2   deltap  kdlyt2       ; associated with second delayr instance

    ;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

Here is yet another example of the deltapi opcode. It uses the file deltapi.csd.

Example 228. Example of the deltapi 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 deltapi.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 	deltapi	.4		;first tap (on left channel)
    adelM 	deltapi	1		;second tap (on middle channel)
    	delayw	gasig + (adelL * ifeedback)

    abuf3	delayr	gidel
    kdel	line    1, p3, .01	;vary delay time
    adelR 	deltapi .65 * 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

Prev | Up | Next
deltap3 | Home | deltapn