Gammatone-based spectrograms, using gammatone filterbanks or Fourier transform weightings.

Related tags

Audio gammatone
Overview

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.

Comments
  • Does not install on MacOsX Mavericks.

    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

    opened by lajash 13
  • Tests fail under Python 2.7

    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?

    opened by jfsantos 6
  • Imported division from __future__ for Python 2 compatibility

    Imported division from __future__ for Python 2 compatibility

    Turns out fixing this for Python 2 was very simple. The only issue was that in Python 2, the behaviour of the division operator / changes to integer division when both operands are integers. This pull request just adds from __future__ import division to all files to change this to the Python 3 behaviour (division is always float division). This does not need to be in a separate branch of the package, as this statement does nothing in Python 3, so the same codebase works both in Python 2 and 3.

    opened by jfsantos 4
  • Remove dependency on scikits.audiolab

    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.

    opened by detly 1
  • Problem regarding the example

    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

    opened by yqiu48 0
  • Why are you multiplying

    Why are you multiplying "window_time * fs" by 2?

    https://github.com/detly/gammatone/blob/0626328ef7c31d3b33214db2fdcd52e8601eb4c5/gammatone/fftweight.py#L151

    By doing so you obtain always a window length two times bigger

    opened by marinelliluca 0
  • center frequency calculation

    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.

    opened by bingo-todd 0
  • FIX gtgram:  add f_max parameter

    FIX gtgram: add f_max parameter

    Hi there, I was glad to find this port! Not sure to what extent you're intending to fix issues in this repo, but f_max is in the documentation but missing from gtgram(). Might also rename cutoff in centre_freqs to f_min for consistency?

    opened by christianbrodbeck 0
Owner
Jason Heeris
Jason Heeris
Automatically move or copy files based on metadata associated with the files. For example, file your photos based on EXIF metadata or use MP3 tags to file your music files.

Automatically move or copy files based on metadata associated with the files. For example, file your photos based on EXIF metadata or use MP3 tags to file your music files.

Rhet Turnbull 14 Nov 2, 2022
A voice based calculator by using termux api in Android

termux_voice_calculator This is. A voice based calculator by using termux api in Android Instagram account ?? ?? Requirements and installation Downloa

ʕ´•ᴥ•`ʔ╠ŞĦỮβĦa̷m̷╣ʕ´•ᴥ•`ʔ 2 Apr 29, 2022
An audio digital processing toolbox based on a workflow/pipeline principle

AudioTK Audio ToolKit is a set of audio filters. It helps assembling workflows for specific audio processing workloads. The audio workflow is split in

Matthieu Brucher 238 Oct 18, 2022
SU Music Player — The first open-source PyTgCalls based Pyrogram bot to play music in voice chats

SU Music Player — The first open-source PyTgCalls based Pyrogram bot to play music in voice chats Note Neither this, or PyTgCalls are fully

SU Projects 58 Jan 2, 2023
Linear Prediction Coefficients estimation from mel-spectrogram implemented in Python based on Levinson-Durbin algorithm.

LPC_for_TTS Linear Prediction Coefficients estimation from mel-spectrogram implemented in Python based on Levinson-Durbin algorithm. 基于Levinson-Durbin

Zewang ZHANG 58 Nov 17, 2022
FPGA based USB 2.0 high speed audio interface featuring multiple optical ADAT inputs and outputs

ADAT USB Audio Interface FPGA based USB 2.0 High Speed audio interface featuring multiple optical ADAT inputs and outputs Status / current limitations

Hans Baier 78 Dec 31, 2022
Sync Toolbox - Python package with reference implementations for efficient, robust, and accurate music synchronization based on dynamic time warping (DTW)

Sync Toolbox - Python package with reference implementations for efficient, robust, and accurate music synchronization based on dynamic time warping (DTW)

Meinard Mueller 66 Jan 2, 2023
A Python library and tools AUCTUS A6 based radios.

A Python library and tools AUCTUS A6 based radios.

Jonathan Hart 6 Nov 23, 2022
OpenClubhouse - A third-part web application based on flask to play Clubhouse audio.

OpenClubhouse - A third-part web application based on flask to play Clubhouse audio.

null 1.1k Jan 5, 2023
Terminal-based audio-to-text converter

att Terminal-based audio-to-text converter Project description A terminal-based audio-to-text converter written in python, enabling you to convert .wa

Sven Eschlbeck 4 Dec 15, 2022
Music Streaming Platform based on full implementation of DBSM

Symphony Music Streaming Platform based on full implementation of DBSM List of Commands Insert User (INSERT) Function to implement input in USER Get a

Parth Maradia 1 Nov 12, 2021
A GUI-based audio player with support for a large variety of formats

Miza-Player A GUI-based audio player with support for a large variety of formats, able to play from web-hosted media platforms such as YouTube, includ

Thomas Xin 3 Dec 14, 2022
Audio pitch-shifting & re-sampling utility, based on the EMU SP-1200

Pitcher.py Free & OS emulation of the SP-12 & SP-1200 signal chain (now with GUI) Pitch shift / bitcrush / resample audio files Written and tested in

morgan 13 Oct 3, 2022
The project aims to develop a personal-assistant for Windows & Linux-based systems

The project aims to develop a personal-assistant for Windows & Linux-based systems. Samiksha draws its inspiration from virtual assistants like Cortana for Windows, and Siri for iOS. It has been designed to provide a user-friendly interface for carrying out a variety of tasks by employing certain well-defined commands.

SHUBHANSHU RAI 1 Jan 16, 2022
Analysis of voices based on the Mel-frequency band

Speaker_partition_module Analysis of voices based on the Mel-frequency band. Goal: Identification of voices speaking (diarization) and calculation of

null 1 Feb 6, 2022
Telegram Voice-Chat Bot Written In Python Using Pyrogram.

Telegram Voice-Chat Bot Telegram Voice-Chat Bot To Play Music From Various Sources In Your Group Support All linux based os. Windows Mac Diagram Requi

TheHamkerCat 314 Dec 29, 2022
A fast MDCT implementation using SciPy and FFTs

MDCT A fast MDCT implementation using SciPy and FFTs Installation As usual pip install mdct Dependencies NumPy SciPy STFT Usage import mdct spectrum

Nils Werner 43 Sep 2, 2022
Simple, hackable offline speech to text - using the VOSK-API.

Nerd Dictation Offline Speech to Text for Desktop Linux. This is a utility that provides simple access speech to text for using in Linux without being

Campbell Barton 844 Jan 7, 2023
controls volume using hand gestures

controls volume using hand gestures

null 1 Oct 11, 2021