Giter Site home page Giter Site logo

gammatone's Introduction

Gammatone Filterbank Toolkit

Utilities for analysing sound using perceptual models of human hearing.

Jason Heeris, 2013

Summary

This is a port of Malcolm Slaney's and Dan Ellis' gammatone filterbank MATLAB code, detailed below, to Python 2 and 3 using Numpy and Scipy. It analyses signals by running them through banks of gammatone filters, similar to Fourier-based spectrogram analysis.

Gammatone-based spectrogram of Für Elise

Installation

You can install directly from this git repository using:

pip install git+https://github.com/detly/gammatone.git

...or you can clone the git repository however you prefer, and do:

pip install .

...or:

python setup.py install

...from the cloned tree.

Dependencies

  • numpy
  • scipy
  • nose
  • mock
  • matplotlib

Using the Code

See the API documentation. For a demonstration, find a .wav file (for example, Für Elise) and run:

python -m gammatone FurElise.wav -d 10

...to see a gammatone-gram of the first ten seconds of the track. If you've installed via pip or setup.py install, you should also be able to just run:

gammatone FurElise.wav -d 10

Basis

This project is based on research into how humans perceive audio, originally published by Malcolm Slaney:

Malcolm Slaney (1998) "Auditory Toolbox Version 2", Technical Report #1998-010, Interval Research Corporation, 1998.

Slaney's report describes a way of modelling how the human ear perceives, emphasises and separates different frequencies of sound. A series of gammatone filters are constructed whose width increases with increasing centre frequency, and this bank of filters is applied to a time-domain signal. The result of this is a spectrum that should represent the human experience of sound better than, say, a Fourier-domain spectrum would.

A gammatone filter has an impulse response that is a sine wave multiplied by a gamma distribution function. It is a common approach to modelling the auditory system.

The gammatone filterbank approach can be considered analogous (but not equivalent) to a discrete Fourier transform where the frequency axis is logarithmic. For example, a series of notes spaced an octave apart would appear to be roughly linearly spaced; or a sound that was distributed across the same linear frequency range would appear to have more spread at lower frequencies.

The real goal of this toolkit is to allow easy computation of the gammatone equivalent of a spectrogram — a time-varying spectrum of energy over audible frequencies based on a gammatone filterbank.

Slaney demonstrated his research with an initial implementation in MATLAB. This implementation was later extended by Dan Ellis, who found a way to approximate a "gammatone-gram" by using the fast Fourier transform. Ellis' code calculates a matrix of weights that can be applied to the output of a FFT so that a Fourier-based spectrogram can easily be transformed into such an approximation.

Ellis' code and documentation is here: Gammatone-like spectrograms

Interest

I became interested in this because of my background in science communication and my general interest in the teaching of signal processing. I find that the spectrogram approach to visualising signals is adequate for illustrating abstract systems or the mathematical properties of transforms, but bears little correspondence to a person's own experience of sound. If someone wants to see what their favourite piece of music "looks like," a normal Fourier transform based spectrogram is actually quite a poor way to visualise it. Features of the audio seem to be oddly spaced or unnaturally emphasised or de-emphasised depending on where they are in the frequency domain.

The gammatone filterbank approach seems to be closer to what someone might intuitively expect a visualisation of sound to look like, and can help develop an intuition about alternative representations of signals.

Verifying the port

Since this is a port of existing MATLAB code, I've written tests to verify the Python implementation against the original code. These tests aren't unit tests, but they do generally test single functions. Running the tests has the same workflow:

  1. Run the scripts in the test_generation directory. This will create a .mat file containing test data in tests/data.

  2. Run nosetest3 in the top level directory. This will find and run all the tests in the tests directory.

Although I'm usually loathe to check in generated files to version control, I'm willing to make an exception for the .mat files containing the test data. My reasoning is that they represent the decoupling of my code from the MATLAB code, and if the two projects were separated, they would be considered a part of the Python code, not the original MATLAB code.

gammatone's People

Contributors

detly avatar jfsantos avatar kirit93 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gammatone's Issues

Example!!

I can have an example of Gamma tone gram generation written in Python?
image

Problem regarding the example

Hi:
I recently downloaded your code and tried it on FurElise.wav as demonstrated. However, I've got different result
Figure_1

Is it normal? Please indulge me in this question I am new to signal processing

TypeError: super() takes at least 1 argument (0 given)

I cloned the gammatone repo and tried "python -m gammatone -a FurElise.wav -d 20". I'm getting 'TypeError: super() takes at least 1 argument (0 given)' error. Below is the stacktrace

  File "C:\Python27\Lib\runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "C:\Python27\Lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "G:\Experiments\Godrej\gammatone-master\gammatone-master\gammatone\__main__.py", line 6, in <module>
    main()
  File "gammatone\plot.py", line 169, in main
    return render_audio_from_file(args.sound_file, args.duration, args.function)
  File "gammatone\plot.py", line 134, in render_audio_from_file
    twin, thop, channels, fmin)
  File "gammatone\plot.py", line 80, in gtgram_plot
    formatter = ERBFormatter(f_min, fs/2, unit='Hz', places=0)
  File "gammatone\plot.py", line 48, in __init__
    super().__init__(*args, **kwargs)
TypeError: super() takes at least 1 argument (0 given)

Tests fail under Python 2.7

Using the same codebase and Python 2.7, 27 of the 91 tests fail. All of them are in the tests/test_fft_weights.py file. Do you have any idea on what could be causing this?

Reconstruction

Hi,

Is there a way to reconstruct the time domain signal from the gammatone-gram representation?

Thanks!

Does not install on MacOsX Mavericks.

Installing from source on Mavericks ( using setup.py with python3.4) results in the following errors :
running install
running bdist_egg
running egg_info
writing top-level names to Gammatone.egg-info/top_level.txt
writing requirements to Gammatone.egg-info/requires.txt
writing dependency_links to Gammatone.egg-info/dependency_links.txt
writing entry points to Gammatone.egg-info/entry_points.txt
writing Gammatone.egg-info/PKG-INFO
reading manifest file 'Gammatone.egg-info/SOURCES.txt'
writing manifest file 'Gammatone.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.6-intel/egg
running install_lib
running build_py
creating build/bdist.macosx-10.6-intel/egg
creating build/bdist.macosx-10.6-intel/egg/gammatone
copying build/lib/gammatone/init.py -> build/bdist.macosx-10.6-intel/egg/gammatone
copying build/lib/gammatone/main.py -> build/bdist.macosx-10.6-intel/egg/gammatone
copying build/lib/gammatone/fftweight.py -> build/bdist.macosx-10.6-intel/egg/gammatone
copying build/lib/gammatone/filters.py -> build/bdist.macosx-10.6-intel/egg/gammatone
copying build/lib/gammatone/gtgram.py -> build/bdist.macosx-10.6-intel/egg/gammatone
copying build/lib/gammatone/plot.py -> build/bdist.macosx-10.6-intel/egg/gammatone
creating build/bdist.macosx-10.6-intel/egg/tests
copying build/lib/tests/init.py -> build/bdist.macosx-10.6-intel/egg/tests
copying build/lib/tests/test_cfs.py -> build/bdist.macosx-10.6-intel/egg/tests
copying build/lib/tests/test_erb_space.py -> build/bdist.macosx-10.6-intel/egg/tests
copying build/lib/tests/test_fft_gtgram.py -> build/bdist.macosx-10.6-intel/egg/tests
copying build/lib/tests/test_fft_weights.py -> build/bdist.macosx-10.6-intel/egg/tests
copying build/lib/tests/test_filterbank.py -> build/bdist.macosx-10.6-intel/egg/tests
copying build/lib/tests/test_gammatone_filters.py -> build/bdist.macosx-10.6-intel/egg/tests
copying build/lib/tests/test_gammatonegram.py -> build/bdist.macosx-10.6-intel/egg/tests
copying build/lib/tests/test_specgram.py -> build/bdist.macosx-10.6-intel/egg/tests
byte-compiling build/bdist.macosx-10.6-intel/egg/gammatone/init.py to init.cpython-34.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/gammatone/main.py to main.cpython-34.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/gammatone/fftweight.py to fftweight.cpython-34.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/gammatone/filters.py to filters.cpython-34.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/gammatone/gtgram.py to gtgram.cpython-34.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/gammatone/plot.py to plot.cpython-34.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/tests/init.py to init.cpython-34.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/tests/test_cfs.py to test_cfs.cpython-34.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/tests/test_erb_space.py to test_erb_space.cpython-34.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/tests/test_fft_gtgram.py to test_fft_gtgram.cpython-34.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/tests/test_fft_weights.py to test_fft_weights.cpython-34.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/tests/test_filterbank.py to test_filterbank.cpython-34.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/tests/test_gammatone_filters.py to test_gammatone_filters.cpython-34.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/tests/test_gammatonegram.py to test_gammatonegram.cpython-34.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/tests/test_specgram.py to test_specgram.cpython-34.pyc
creating build/bdist.macosx-10.6-intel/egg/EGG-INFO
copying Gammatone.egg-info/PKG-INFO -> build/bdist.macosx-10.6-intel/egg/EGG-INFO
copying Gammatone.egg-info/SOURCES.txt -> build/bdist.macosx-10.6-intel/egg/EGG-INFO
copying Gammatone.egg-info/dependency_links.txt -> build/bdist.macosx-10.6-intel/egg/EGG-INFO
copying Gammatone.egg-info/entry_points.txt -> build/bdist.macosx-10.6-intel/egg/EGG-INFO
copying Gammatone.egg-info/requires.txt -> build/bdist.macosx-10.6-intel/egg/EGG-INFO
copying Gammatone.egg-info/top_level.txt -> build/bdist.macosx-10.6-intel/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/Gammatone-1.0-py3.4.egg' and adding 'build/bdist.macosx-10.6-intel/egg' to it
removing 'build/bdist.macosx-10.6-intel/egg' (and everything under it)
Processing Gammatone-1.0-py3.4.egg
Copying Gammatone-1.0-py3.4.egg to /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages
Adding Gammatone 1.0 to easy-install.pth file
Installing gammatone script to /Library/Frameworks/Python.framework/Versions/3.4/bin

Installed /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Gammatone-1.0-py3.4.egg
Processing dependencies for Gammatone==1.0
Searching for scikits.audiolab>=0.11.0.p3.1
Best match: scikits.audiolab 0.11.0.p3.1
Downloading https://github.com/detly/audiolab/archive/0.11.0.p3.1.zip#egg=scikits.audiolab-0.11.0.p3.1
Processing 0.11.0.p3.1.zip
Writing /tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/setup.cfg
Running audiolab-0.11.0.p3.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/egg-dist-tmp-ub0c5ts1
Warning: distutils distribution has been initialized, it may be too late to add an extension sndfileWarning: distutils distribution has been initialized, it may be too late to add a subpackage pysndfile/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/soundio/setup.py:21: UserWarning: Alsa not found - alsa backend not build
warnings.warn("Alsa not found - alsa backend not build")
warning: no files found matching 'scikits/audiolab/test_data/original.aif'
warning: no files found matching 'scikits/audiolab/test_data/test.aiff'
warning: no files found matching 'scikits/audiolab/test_data/test.au'
warning: no files found matching 'scikits/audiolab/test_data/test.flac'
warning: no files found matching 'scikits/audiolab/test_data/test.raw'
warning: no files found matching 'scikits/audiolab/test_data/test.sdif'
warning: no files found matching 'scikits/audiolab/test_data/test.wav'
warning: no files found matching '
' under directory 'docs/pdf'
warning: no files found matching '_' under directory 'docs/html'
warning: manifest_maker: MANIFEST.in, line 19: 'recursive-include' expects

...

warning: manifest_maker: MANIFEST.in, line 20: 'recursive-include' expects

...

warning: no files found matching 'scikits/audiolab/pysndfile/_sndfile.pyx'
warning: no files found matching 'scikits/audiolab/soundio/macosx/macosx_backend.pyx'
warning: no files found matching 'scikits/audiolab/soundio/alsa/_alsa_backend.pyx'
warning: no files found matching 'scikits/audiolab/pysndfile/_sndfile.c'
warning: no files found matching 'scikits/audiolab/soundio/macosx/macosx_backend.c'
warning: no files found matching 'scikits/audiolab/soundio/alsa/_alsa_backend.c'
In file included from /private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:275:
In file included from /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/numpy/core/include/numpy/arrayobject.h:4:
In file included from /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/numpy/core/include/numpy/ndarrayobject.h:17:
In file included from /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/numpy/core/include/numpy/ndarraytypes.h:1761:
/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]

warning "Using deprecated NumPy API, disable it by " \

^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:957:59: error: a parameter list without types is only allowed in a function definition
static CYTHON_INLINE PyObject ___Pyx_PyInt_to_py___quad_t(__quad_t);
^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:959:22: error: unknown type name '__quad_t'; did you mean 'u_quad_t'?
static CYTHON_INLINE __quad_t _Pyx_PyInt_from_py___quad_t(PyObject *);
^~~~~~~~
u_quad_t
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t u_quad_t; /
quads _/
^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:1640:14: warning: explicitly assigning a variable of type 'PyObject *' (aka 'struct _object *') to itself [-Wself-assign]
__pyx_self = __pyx_self;

/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:3752:14: warning: explicitly assigning a variable of type 'PyObject *' (aka 'struct _object *') to itself [-Wself-assign]
__pyx_self = __pyx_self;
~~~~~~~~~~ ^ ~~~~~~~~~~
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:3961:14: warning: explicitly assigning a variable of type 'PyObject *' (aka 'struct _object *') to itself [-Wself-assign]
__pyx_self = __pyx_self;
~~~~~~~~~~ ^ ~~~~~~~~~~
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:5158:15: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
  __pyx_t_8 = sf_strerror(__pyx_v_self->hdl);
            ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:8343:15: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
  __pyx_t_3 = sf_strerror(__pyx_v_self->hdl);
            ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14090:59: error: unknown type name '__quad_t'; did you mean 'u_quad_t'?
static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py___quad_t(__quad_t val) {
                                                        ^~~~~~~~
                                                        u_quad_t
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14091:11: error: unknown type name '__quad_t'; did you mean 'u_quad_t'?
  const __quad_t neg_one = (__quad_t)-1, const_zero = (__quad_t)0;
        ^~~~~~~~
        u_quad_t
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14091:31: error: use of undeclared identifier '__quad_t'; did you mean 'u_quad_t'?
  const __quad_t neg_one = (__quad_t)-1, const_zero = (__quad_t)0;
                            ^
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14091:58: error: use of undeclared identifier '__quad_t'; did you mean 'u_quad_t'?
  const __quad_t neg_one = (__quad_t)-1, const_zero = (__quad_t)0;
                                                       ^
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14093:17: error: use of undeclared identifier '__quad_t'; did you mean 'u_quad_t'?
  if ((sizeof(__quad_t) == sizeof(char))  ||
              ^
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14094:17: error: use of undeclared identifier '__quad_t'; did you mean 'u_quad_t'?
      (sizeof(__quad_t) == sizeof(short))) {
              ^
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14096:24: error: use of undeclared identifier '__quad_t'; did you mean 'u_quad_t'?
  } else if ((sizeof(__quad_t) == sizeof(int)) ||
                     ^
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14097:24: error: use of undeclared identifier '__quad_t'; did you mean 'u_quad_t'?
             (sizeof(__quad_t) == sizeof(long))) {
                     ^
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14102:23: error: use of undeclared identifier '__quad_t'; did you mean 'u_quad_t'?
  } else if (sizeof(__quad_t) == sizeof(PY_LONG_LONG)) {
                    ^
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14110:52: error: use of undeclared identifier '__quad_t'; did you mean 'u_quad_t'?
      return _PyLong_FromByteArray(bytes, sizeof(__quad_t),
                                                 ^
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14115:22: error: unknown type name '__quad_t'; did you mean 'u_quad_t'?
static CYTHON_INLINE __quad_t __Pyx_PyInt_from_py___quad_t(PyObject_ x) {
                   ^~~~~~~~
                   u_quad_t
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /\* quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14116:11: error: unknown type name '__quad_t'; did you mean 'u_quad_t'?
  const __quad_t neg_one = (__quad_t)-1, const_zero = (__quad_t)0;
        ^~~~~~~~
        u_quad_t
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14116:31: error: use of undeclared identifier '__quad_t'; did you mean 'u_quad_t'?
  const __quad_t neg_one = (__quad_t)-1, const_zero = (__quad_t)0;
                            ^
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14116:58: error: use of undeclared identifier '__quad_t'; did you mean 'u_quad_t'?
  const __quad_t neg_one = (__quad_t)-1, const_zero = (__quad_t)0;
                                                       ^
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14118:16: error: use of undeclared identifier '__quad_t'; did you mean 'u_quad_t'?
  if (sizeof(__quad_t) == sizeof(char)) {
             ^
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14120:21: error: use of undeclared identifier '__quad_t'; did you mean 'u_quad_t'?
          return (__quad_t)__Pyx_PyInt_AsUnsignedChar(x);
                  ^
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14122:21: error: use of undeclared identifier '__quad_t'; did you mean 'u_quad_t'?
          return (__quad_t)__Pyx_PyInt_AsSignedChar(x);
                  ^
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads */
                              ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
6 warnings and 20 errors generated.
In file included from /private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:275:
In file included from /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/numpy/core/include/numpy/arrayobject.h:4:
In file included from /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/numpy/core/include/numpy/ndarrayobject.h:17:
In file included from /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/numpy/core/include/numpy/ndarraytypes.h:1761:
/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: "Using deprecated NumPy API, disable it by "          "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
# warning "Using deprecated NumPy API, disable it by " \

^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:957:59: error: a parameter list without types is only allowed in a function definition
static CYTHON_INLINE PyObject ___Pyx_PyInt_to_py___quad_t(__quad_t);
                                                        ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:959:22: error: unknown type name '__quad_t'; did you mean 'u_quad_t'?
static CYTHON_INLINE __quad_t __Pyx_PyInt_from_py___quad_t(PyObject *);
                   ^~~~~~~~
                   u_quad_t
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:1640:14: warning: explicitly assigning a variable of type 'PyObject *' (aka 'struct _object *') to itself [-Wself-assign]
__pyx_self = __pyx_self;
~~~~~~~~~~ ^ ~~~~~~~~~~
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:3752:14: warning: explicitly assigning a variable of type 'PyObject *' (aka 'struct _object *') to itself [-Wself-assign]
__pyx_self = __pyx_self;
~~~~~~~~~~ ^ ~~~~~~~~~~
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:3961:14: warning: explicitly assigning a variable of type 'PyObject *' (aka 'struct _object *') to itself [-Wself-assign]
__pyx_self = __pyx_self;
~~~~~~~~~~ ^ ~~~~~~~~~~
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:5158:15: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
  __pyx_t_8 = sf_strerror(__pyx_v_self->hdl);
            ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:8343:15: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
  __pyx_t_3 = sf_strerror(__pyx_v_self->hdl);
            ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14090:59: error: unknown type name '__quad_t'; did you mean 'u_quad_t'?
static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py___quad_t(__quad_t val) {
                                                        ^~~~~~~~
                                                        u_quad_t
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14091:11: error: unknown type name '__quad_t'; did you mean 'u_quad_t'?
  const __quad_t neg_one = (__quad_t)-1, const_zero = (__quad_t)0;
        ^~~~~~~~
        u_quad_t
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14091:31: error: use of undeclared identifier '__quad_t'; did you mean 'u_quad_t'?
  const __quad_t neg_one = (__quad_t)-1, const_zero = (__quad_t)0;
                            ^
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14091:58: error: use of undeclared identifier '__quad_t'; did you mean 'u_quad_t'?
  const __quad_t neg_one = (__quad_t)-1, const_zero = (__quad_t)0;
                                                       ^
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14093:17: error: use of undeclared identifier '__quad_t'; did you mean 'u_quad_t'?
  if ((sizeof(__quad_t) == sizeof(char))  ||
              ^
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14094:17: error: use of undeclared identifier '__quad_t'; did you mean 'u_quad_t'?
      (sizeof(__quad_t) == sizeof(short))) {
              ^
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14096:24: error: use of undeclared identifier '__quad_t'; did you mean 'u_quad_t'?
  } else if ((sizeof(__quad_t) == sizeof(int)) ||
                     ^
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14097:24: error: use of undeclared identifier '__quad_t'; did you mean 'u_quad_t'?
             (sizeof(__quad_t) == sizeof(long))) {
                     ^
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14102:23: error: use of undeclared identifier '__quad_t'; did you mean 'u_quad_t'?
  } else if (sizeof(__quad_t) == sizeof(PY_LONG_LONG)) {
                    ^
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14110:52: error: use of undeclared identifier '__quad_t'; did you mean 'u_quad_t'?
      return _PyLong_FromByteArray(bytes, sizeof(__quad_t),
                                                 ^
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14115:22: error: unknown type name '__quad_t'; did you mean 'u_quad_t'?
static CYTHON_INLINE __quad_t __Pyx_PyInt_from_py___quad_t(PyObject_ x) {
                   ^~~~~~~~
                   u_quad_t
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /\* quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14116:11: error: unknown type name '__quad_t'; did you mean 'u_quad_t'?
  const __quad_t neg_one = (__quad_t)-1, const_zero = (__quad_t)0;
        ^~~~~~~~
        u_quad_t
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14116:31: error: use of undeclared identifier '__quad_t'; did you mean 'u_quad_t'?
  const __quad_t neg_one = (__quad_t)-1, const_zero = (__quad_t)0;
                            ^
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14116:58: error: use of undeclared identifier '__quad_t'; did you mean 'u_quad_t'?
  const __quad_t neg_one = (__quad_t)-1, const_zero = (__quad_t)0;
                                                       ^
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14118:16: error: use of undeclared identifier '__quad_t'; did you mean 'u_quad_t'?
  if (sizeof(__quad_t) == sizeof(char)) {
             ^
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14120:21: error: use of undeclared identifier '__quad_t'; did you mean 'u_quad_t'?
          return (__quad_t)__Pyx_PyInt_AsUnsignedChar(x);
                  ^
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads _/
                              ^
/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c:14122:21: error: use of undeclared identifier '__quad_t'; did you mean 'u_quad_t'?
          return (__quad_t)__Pyx_PyInt_AsSignedChar(x);
                  ^
/usr/include/sys/types.h:95:20: note: 'u_quad_t' declared here
typedef u_int64_t               u_quad_t;       /_ quads */
                              ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
6 warnings and 20 errors generated.
Warning: distutils distribution has been initialized, it may be too late to add an extension macosx_backendWarning: distutils distribution has been initialized, it may be too late to add a subpackage soundioWarning: distutils distribution has been initialized, it may be too late to add a subpackage audiolaberror: Setup script exited with error: Command "/usr/bin/clang -fno-strict-aliasing -Werror=declaration-after-statement -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -I/usr/local/include -I/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c /private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.c -o build/temp.macosx-10.6-intel-3.4/private/tmp/easy_install-1g_vbqt3/audiolab-0.11.0.p3.1/audiolab/pysndfile/_sndfile.o" failed with exit status 1

Remove dependency on scikits.audiolab

Installing scikits.audiolab on Windows is pretty much impossible. I shouldn't inflict this on anyone else. It should be removed as a dependency, because it makes this package uninstallable on Windows too.

So far I haven't found any other viable candidates, especially when it comes to reading MP3 files, but I'll keep looking.

Submit to pypi

Hello, can you submit this package to Pypi, seems the name is still available.

center frequency calculation

If I interpret the code right, the center frequencies are calculated in function rb_space as follows

  1. divide frequency range from cutoff to fs/2 into N (frequency band number) parts,
  2. separate points and start point are center frequencies of N frequency bands

In this way, the actual upper boundary of frequency range that filter bank can cover is lower than fs/2, especially when N is small.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.