1
.. currentmodule:: brian
4
pair: example usage; erbspace
5
pair: example usage; whitenoise
6
pair: example usage; ApproximateGammatone
8
.. _example-hears_approximate_gammatone:
10
Example: approximate_gammatone (hears)
11
======================================
13
Example of the use of the class :class:`~brian.hears.ApproximateGammatone`
14
available in the library. It implements a filterbank of approximate gammatone
15
filters as described in Hohmann, V., 2002, "Frequency analysis and synthesis
16
using a Gammatone filterbank", Acta Acustica United with Acustica.
17
In this example, a white noise is filtered by a gammatone filterbank and the
18
resulting cochleogram is plotted.
23
from brian.hears import *
25
level=50*dB # level of the input sound in rms dB SPL
26
sound = whitenoise(100*ms).ramp() # generation of a white noise
27
sound = sound.atlevel(level) # set the sound to a certain dB level
29
nbr_center_frequencies = 50 # number of frequency channels in the filterbank
30
# center frequencies with a spacing following an ERB scale
31
center_frequencies = erbspace(100*Hz, 1000*Hz, nbr_center_frequencies)
32
# bandwidth of the filters (different in each channel)
33
bw = 10**(0.037+0.785*log10(center_frequencies))
35
gammatone = ApproximateGammatone(sound, center_frequencies, bw, order=3)
37
gt_mon = gammatone.process()
40
imshow(flipud(gt_mon.T), aspect='auto')