[b,a] = gammatone(fc,fs,n,betamul); [b,a] = gammatone(fc,fs,n); [b,a] = gammatone(fc,fs);

fc |
center frequency in Hz. |

fs |
sampling rate in Hz. |

n |
filter order. |

beta |
bandwidth of the filter. |

b |
nominator coefficients. |

a |
denominator coefficients. |

`gammatone(fc,fs,n,betamul)` computes the filter coefficients of a
digital gammatone filter with center frequency *fc*, order *n*, sampling
rate *fs* and bandwith determined by *betamul*. The bandwidth *beta* of
each filter is determined as *betamul* times `audfiltbw` of the center
frequency of corresponding filter.

By default, the returned filter coefficients comes from the all-pole approximation described in Lyon (1997). The filters are normalized to have a 0 dB attenuation at the center frequency (another way of stating this is that their impulse responses will have unit area).

`gammatone(fc,fs,n)` will do the same but choose a filter bandwidth
according to Glasberg and Moore (1990).

`gammatone(fc,fs)` will do as above for a 4th order filter.

If *fc* is a vector, each entry of *fc* is considered as one center
frequency, and the corresponding coefficients are returned as row
vectors in the output.

The inpulse response of the gammatone filter is given by:

\begin{equation*}
g(t) = at^{n-1}cos(2\pi\cdot fc\cdot t)e^{-2\pi \beta \cdot t}
\end{equation*}

`gammatone` takes the following flags at the end of the line of input
arguments:

'allpole' |
Compute the all-pole approximation of Gammatone filters by Lyon. This is the default |

'classic' |
Compute the classical mixed pole-zero approximation of gammatone filters. |

'complex' |
Generate filter coefficients corresponding to a complex valued filterbank modulated by exponential functions. This is useful for envelope extration purposes. |

'real' |
Generate real-valued filters. |

'casualphase' |
This makes the phase of each filter start at zero. This is the default. |

'peakphase' |
This makes the phase of each filter be zero when the envelope of the impulse response of the filter peaks. |

'exppeakphase' |
Experimental version of peakphase. In addition to peakphase, the output signal is delayed such that the maxima of the corresponding Gammatone impulse responses are aligned. This option has been created to produce some of the figures from Patterson et al. (1987). |

'0dBforall' |
This scales the amplitude of each filter to have an impulse response of 0dB. This is default. |

'6dBperoctave' |
This scales the amplitude of each filter to have an impulse response of +/-6dB per octave. |

To create the filter coefficients of a 1-erb spaced filter bank using gammatone filters use the following construction:

[b,a] = gammatone(erbspacebw(flow,fhigh),fs,'complex');

To apply the (complex valued) filters to an input signal, use filterbankz:

outsig = 2*real(ufilterbankz(b,a,insig));

A. Aertsen and P. Johannesma.
Spectro-temporal receptive fields of auditory neurons in the
grassfrog. I. Characterization of tonal and natural stimuli.
*Biol. Cybern*, 38:223-234, 1980.

R. Lyon.
All pole models of auditory filtering.
In E. R. Lewis, G. R. Long, R. F. Lyon, P. M. Narins, C. R. Steele,
and E. Hecht-Poinar, editors, *Diversity in auditory mechanics*, pages
205-211. World Scientific Publishing, Singapore, 1997.

R. Patterson, I. Nimmo-Smith, J. Holdsworth, and P. Rice.
An efficient auditory filterbank based on the gammatone function.
*APU report*, 2341, 1987.