The Alternative Csound Reference Manual
Previous |  | Next

# reson

reson -- A second-order resonant filter.

## Description

A second-order resonant filter.

## Syntax

ar reson asig, kcf, kbw [, iscl] [, iskip]

## Initialization

iscl (optional, default=0) -- coded scaling factor for resonators. A value of 1 signifies a peak response factor of 1, i.e. all frequencies other than kcf are attenuated in accordance with the (normalized) response curve. A value of 2 raises the response factor so that its overall RMS value equals 1. (This intended equalization of input and output power assumes all frequencies are physically present; hence it is most applicable to white noise.) A zero value signifies no scaling of the signal, leaving that to some later adjustment (see balance). The default value is 0.

iskip (optional, default=0) -- initial disposition of internal data space. Since filtering incorporates a feedback loop of previous output, the initial status of the storage space used is significant. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.

## Performance

ar -- the output signal at audio rate.

asig -- the input signal at audio rate.

kcf -- the center frequency of the filter, or frequency position of the peak response.

kbw -- bandwidth of the filter (the Hz difference between the upper and lower half-power points).

reson is a second-order filter in which kcf controls the center frequency, or frequency position of the peak response, and kbw controls its bandwidth (the frequency difference between the upper and lower half-power points).

## Examples

Here is an example of the reson opcode. It uses the files reson.orc and reson.sco.

Example 1. Example of the reson opcode.

    /* reson.orc */
    ; Initialize the global variables.
    sr = 44100
    kr = 4410
    ksmps = 10
    nchnls = 1

    ; Instrument #1.
    instr 1
      ; Generate a sine waveform.
      asine buzz 15000, 440, 3, 1

      ; Vary the cut-off frequency from 220 to 1280.
      kcf line 220, p3, 1320
      kbw init 20

      ; Run the sine through a resonant filter.
      ares reson asine, kcf, kbw

      ; Give the filtered signal the same amplitude
      ; as the original signal.
      a1 balance ares, asine
      out a1
    endin
    /* reson.orc */

    /* reson.sco */
    ; Table #1, an ordinary sine wave.
    f 1 0 16384 10 1

    ; Play Instrument #1 for 4 seconds.
    i 1 0 4
    e
    /* reson.sco */

## See Also

areson, aresonk, atone, atonek, port, portk, resonk, tone, tonek

## Credits

Example written by Kevin Conder.

Previous | Home | Next
repluck | Up | resonk