comb

comb — Reverberates an input signal with a “colored” frequency response.

Description

Reverberates an input signal with a “colored” frequency response.

Syntax

ares comb asig, krvt, ilpt [, iskip] [, insmps]

Initialization

ilpt -- loop time in seconds, which determines the “echo density” of the reverberation. This in turn characterizes the “color” of the comb filter whose frequency response curve will contain ilpt * sr/2 peaks spaced evenly between 0 and sr/2 (the Nyquist frequency). Loop time can be as large as available memory will permit. The space required for an n second loop is 4n*sr bytes. Delay space is allocated and returned as in delay.

iskip (optional, default=0) -- initial disposition of delay-loop data space (cf. reson). The default value is 0.

insmps (optional, default=0) -- delay amount, as a number of samples.

Performance

krvt -- the reverberation time (defined as the time in seconds for a signal to decay to 1/1000, or 60dB down from its original amplitude).

This filter reiterates input with an echo density determined by loop time ilpt. The attenuation rate is independent and is determined by krvt, the reverberation time (defined as the time in seconds for a signal to decay to 1/1000, or 60dB down from its original amplitude). Output from a comb filter will appear only after ilpt seconds.

Examples

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

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

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

; Initialize the audio mixer.
gamix init 0 

; Instrument #1.
instr 1 
  ; Generate a source signal.
  a1 oscili 30000, cpspch(p4), 1
  ; Output the direct sound.
  out a1  

  ; Add the source signal to the audio mixer.
  gamix = gamix + a1 
endin

; Instrument #99 (highest instr number executed last)
instr 99 
  krvt = 1.5
  ilpt = 0.1

  ; Comb-filter the mixed signal.
  a99 comb gamix, krvt, ilpt
  ; Output the result.
  out a99 

  ; Empty the mixer for the next pass.
  gamix = 0 
endin


</CsInstruments>
<CsScore>

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

; p4 = frequency (in a pitch-class)
; Play Instrument #1 for a tenth of a second, p4=7.00
i 1 0 0.1 7.00
; Play Instrument #1 for a tenth of a second, p4=7.02
i 1 1 0.1 7.02
; Play Instrument #1 for a tenth of a second, p4=7.04
i 1 2 0.1 7.04
; Play Instrument #1 for a tenth of a second, p4=7.06
i 1 3 0.1 7.06

; Make sure the comb-filter remains active.
i 99 0 5
e


</CsScore>
</CsoundSynthesizer>


See Also

alpass, reverb, valpass, vcomb

Credits

Author: William “Pete” Moss (vcomb and valpass)
University of Texas at Austin
Austin, Texas USA
January 2002

Example written by Kevin Conder.