{"id":23776,"library":"gammatone","title":"Gammatone Filterbank","description":"A Python implementation of gammatone filters for auditory modeling, including filterbank generation and cochleagram computation. Current version: 1.0.3 (patch release, adds f_max parameter to gtgram). Requires Python >=3.8.","status":"active","version":"1.0.3","language":"python","source_language":"en","source_url":"https://github.com/Lightning-Sandbox/gammatone","tags":["audio","filterbank","cochleagram","auditory model","gammatone"],"install":[{"cmd":"pip install gammatone","lang":"bash","label":"PyPI"}],"dependencies":[],"imports":[{"note":"","wrong":null,"symbol":"Gammatone","correct":"from gammatone.gammatone_impl import Gammatone"},{"note":"","wrong":null,"symbol":"gtgram","correct":"from gammatone.gtgram import gtgram"},{"note":"","wrong":null,"symbol":"gammatone_freq","correct":"from gammatone.filters import make_erb_filters, centre_freqs"}],"quickstart":{"code":"import numpy as np\nfrom gammatone.gtgram import gtgram\n\n# Generate a cochleagram from a sample audio signal\nfs = 16000\nduration = 0.1\nt = np.linspace(0, duration, int(fs*duration), endpoint=False)\nsignal = np.sin(2*np.pi*1000*t)  # 1 kHz tone\n\n# Compute gammatone spectrogram (cochleagram)\ncoch = gtgram(signal, fs, window_time=0.02, hop_time=0.01, channels=64, f_min=50, f_max=8000)\nprint(coch.shape)","lang":"python","description":"Create a gammatone-based cochleagram from an audio signal."},"warnings":[{"fix":"Call gtgram(... , f_max=8000) to extend coverage.","message":"The default f_max in gtgram is 4000 Hz. If you need higher frequencies (e.g., for 22050 Hz audio), pass f_max explicitly. Added in v1.0.3.","severity":"gotcha","affected_versions":"<1.0.3"},{"fix":"Mono mix: signal = np.mean(signal, axis=1) for stereo.","message":"Input signal must be 1-D array. If you pass a 2-D array (e.g., stereo audio), it will fail silently or produce incorrect shape.","severity":"gotcha","affected_versions":"all"},{"fix":"Use from gammatone.gammatone_impl import Gammatone","message":"Direct import from gammatone.gammatone (without _impl suffix) may be deprecated in future releases. Use gammatone.gammatone_impl for core filter classes.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'from gammatone.gammatone_impl import Gammatone'","cause":"Trying to import Gammatone from the top-level package instead of the implementation module.","error":"ImportError: cannot import name 'Gammatone' from 'gammatone'"},{"fix":"Reduce channels or increase f_max. Ensure f_max / f_min >= 2^(channels/ERB scale).","cause":"Requesting more channels than possible given the frequency range when using gtgram.","error":"ValueError: The number of channels is too high for the given f_max"},{"fix":"Upgrade: pip install --upgrade gammatone","cause":"Using an older version of gammatone (<1.0.3) that does not support the f_max parameter.","error":"TypeError: gtgram() got an unexpected keyword argument 'f_max'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}