File: examples-hears_log_gammachirp.txt

package info (click to toggle)
brian 1.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, stretch
  • size: 23,436 kB
  • sloc: python: 68,707; cpp: 29,040; ansic: 5,182; sh: 111; makefile: 61
file content (48 lines) | stat: -rw-r--r-- 1,417 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
.. currentmodule:: brian

.. index::
   pair: example usage; figure
   pair: example usage; show
   pair: example usage; flipud
   pair: example usage; imshow
   pair: example usage; erbspace
   pair: example usage; LogGammachirp
   pair: example usage; whitenoise

.. _example-hears_log_gammachirp:

Example: log_gammachirp (hears)
===============================

Example of the use of the class :class:`~brian.hears.LogGammachirp` available in
the library. It implements a filterbank of IIR gammachirp filters as 
Unoki et al. 2001, "Improvement of an IIR asymmetric compensation gammachirp
filter". In this example, a white noise is filtered by a linear gammachirp
filterbank and the resulting cochleogram is plotted. The different impulse
responses are also plotted.

::

    from brian import *
    from brian.hears import *
    
    sound = whitenoise(100*ms).ramp()
    sound.level = 50*dB
    
    nbr_center_frequencies = 50  #number of frequency channels in the filterbank
    
    c1 = -2.96 #glide slope
    b1 = 1.81  #factor determining the time constant of the filters
    
    #center frequencies with a spacing following an ERB scale
    cf = erbspace(100*Hz, 1000*Hz, nbr_center_frequencies)
    
    gamma_chirp = LogGammachirp(sound, cf, c=c1, b=b1) 
    
    gamma_chirp_mon = gamma_chirp.process()
    
    figure()
    imshow(flipud(gamma_chirp_mon.T), aspect='auto')    
    show()