nestedap

nestedap — Three different nested all-pass filters.

Description

Three different nested all-pass filters, useful for implementing reverbs.

Syntax

ares nestedap asig, imode, imaxdel, idel1, igain1 [, idel2] [, igain2] \
      [, idel3] [, igain3] [, istor]

Initialization

imode -- operating mode of the filter:

  • 1 = simple all-pass filter

  • 2 = single nested all-pass filter

  • 3 = double nested all-pass filter

idel1, idel2, idel3 -- delay times of the filter stages. Delay times are in seconds and must be greater than zero. idel1 must be greater than the sum of idel2 and idel3.

igain1, igain2, igain3 -- gain of the filter stages.

imaxdel -- will be necessary if k-rate delays are implemented. Not currently used.

istor -- Skip initialization if non-zero (default: 0).

Performance

asig -- input signal

If imode = 1, the filter takes the form:

Picture of nestedap imode 1 filter.

Picture of imode 1 filter.

If imode = 2, the filter takes the form:

Picture of nestedap imode 2 filter.

Picture of imode 2 filter.

If imode = 3, the filter takes the form:

Picture of nestedap imode 3 filter.

Picture of imode 3 filter.

Examples

Here is an example of the nestedap opcode. It uses the file nestedap.csd, and beats.wav.

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

sr = 44100
kr = 4410
ksmps = 10
nchnls = 2

instr 5
  insnd     =           p4
  gasig     diskin2     insnd, 1
endin

instr 10
  imax      =           1
  idel1     =           p4/1000
  igain1    =           p5
  idel2     =           p6/1000
  igain2    =           p7
  idel3     =           p8/1000
  igain3    =           p9
  idel4     =           p10/1000
  igain4    =           p11
  idel5     =           p12/1000
  igain5    =           p13
  idel6     =           p14/1000
  igain6    =           p15

  afdbk     init 0

  aout1     nestedap gasig+afdbk*.4, 3, imax, idel1, igain1, idel2, igain2, idel3, igain3
  
  aout2     nestedap aout1, 2, imax, idel4, igain4, idel5, igain5

  aout      nestedap aout2, 1, imax, idel6, igain6

  afdbk     butterlp aout, 1000

            outs gasig+(aout+aout1)/2, gasig-(aout+aout1)/2
  
gasig     =           0
endin


</CsInstruments>
<CsScore>

f1 0 8192 10 1

; Diskin
;   Sta  Dur  Soundin
i5  0    3    "beats.wav"

; Reverb
;   St  Dur  Del1 Gn1  Del2  Gn2  Del3  Gn3  Del4  Gn4  Del5  Gn5  Del6  Gn6
i10 0   4    97   .11  23   .07   43   .09   72    .2   53    .2   119   .3
e


</CsScore>
</CsoundSynthesizer>


Credits

Author: Hans Mikelson
February 1999

New in Csound version 3.53

The example was updated May 2002, thanks to Hans Mikelson