tone

tone — A first-order recursive low-pass filter with variable frequency response.

Description

A first-order recursive low-pass filter with variable frequency response.

tone is a 1 term IIR filter. Its formula is:

yn = c1 * xn + c2 * yn-1

where

  • b = 2 - cos(2 π hp/sr);

  • c2 = b - sqrt(b2 - 1.0)

  • c1 = 1 - c2

Syntax

ares tone asig, khp [, iskip]

Initialization

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

ares -- the output audio signal.

asig -- the input audio signal.

khp -- the response curve's half-power point, in Hertz. Half power is defined as peak power / root 2.

tone implements a first-order recursive low-pass filter in which the variable khp (in Hz) determines the response curve's half-power point. Half power is defined as peak power / root 2.

Examples

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

Example 1122. Example of the tone 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     ;;;realtime audio out
;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
; For Non-realtime ouput leave only the line below:
; -o tone.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

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

instr 1

asig diskin2 "drumsMlp.wav", 1
     outs asig, asig
endin

instr 2

kton line 10000, p3, 0		;all the way down to 0 Hz
asig diskin2 "drumsMlp.wav", 1
asig tone asig, kton		;half-power point at 500 Hz
     outs asig, asig
endin

</CsInstruments>
<CsScore>

i 1 0 2
i 2 2 2

e

</CsScore>
</CsoundSynthesizer>


See also

Standard filters: Low-pass filters