gtf — Apply a gammatone filter to an audio signal.


Apply a gammatone filter of various orders to an audio signal.


aout gtf ain, kfreq, idecay[, iorder, iphase]


idecay -- rate of decay

iorder -- (optional) Order of filter in rangs 1 to 10 defaulting to 4.

iphase -- (optional) Phase output, defaulting to zero.


asig -- audio signal to be filtered.

kfreq -- central frequency of filter in Hertz.

The gammatone filter is commonly used in models of the auditory system. The algorithm is based on Martin Cooke's Ph.D work (Cooke, 1993) using the base-band impulse invariant transformation. See


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

Example 412. Example of the gtf opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

; 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 gtf.wav -W ;;; for file output any platform

; By Stefano Cucchi 2020


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

instr 1	 
kcps  init cpspch(p4) 
asig1 vco2 0.5, kcps ; SOUND

kfreq1 linseg p5, p3, p6 ; frequency filter 1
kfreq2 expseg p6, p3, p5 ; frequency filter 2
idecay = p7 ; keep it very small

afilter1 gtf asig1, kfreq1, idecay ; SOUND - filter 1
afilter2 gtf asig1, kfreq2, idecay ; SOUND - filter 2

aref oscili 0.25, 440 ; AMPLITUDE reference
afilter1 balance afilter1, aref ; compare filtered SOUND with reference
afilter2 balance afilter2, aref ; ; compare filtered SOUND with reference

outs afilter1, afilter2




i 1 0 5 6.00 200 12000 0.1
i 1 5 5 6.00 200 12000 0.01		


See also

Specialized Filters: Other filters


By: John ffitch 2019