{"id":13800239,"url":"https://github.com/detly/gammatone","last_synced_at":"2025-12-16T19:46:47.457Z","repository":{"id":16184113,"uuid":"18930652","full_name":"detly/gammatone","owner":"detly","description":"Gammatone-based spectrograms, using gammatone filterbanks or Fourier transform weightings.","archived":true,"fork":false,"pushed_at":"2023-06-29T13:35:08.000Z","size":60223,"stargazers_count":220,"open_issues_count":0,"forks_count":68,"subscribers_count":20,"default_branch":"master","last_synced_at":"2024-11-18T15:51:50.430Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Matlab","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/detly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":"auditory_toolkit/COPYING","citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2014-04-19T01:31:35.000Z","updated_at":"2024-10-28T18:37:37.000Z","dependencies_parsed_at":"2024-01-08T12:14:34.320Z","dependency_job_id":null,"html_url":"https://github.com/detly/gammatone","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/detly%2Fgammatone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/detly%2Fgammatone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/detly%2Fgammatone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/detly%2Fgammatone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/detly","download_url":"https://codeload.github.com/detly/gammatone/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253913110,"owners_count":21983260,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T00:01:10.725Z","updated_at":"2025-12-16T19:46:42.404Z","avatar_url":"https://github.com/detly.png","language":"Matlab","funding_links":[],"categories":["Audio Related Packages"],"sub_categories":[],"readme":"Gammatone Filterbank Toolkit\n============================\n\n*Utilities for analysing sound using perceptual models of human hearing.*\n\nJason Heeris, 2013\n\nSummary\n-------\n\nThis is a port of Malcolm Slaney's and Dan Ellis' gammatone filterbank MATLAB\ncode, detailed below, to Python 2 and 3 using Numpy and Scipy. It analyses signals by\nrunning them through banks of gammatone filters, similar to Fourier-based\nspectrogram analysis.\n\n![Gammatone-based spectrogram of Für Elise](doc/FurElise.png)\n\nInstallation\n------------\n\nYou can install directly from this git repository using:\n\n```text\npip install git+https://github.com/detly/gammatone.git\n```\n\n...or you can clone the git repository however you prefer, and do:\n\n```text\npip install .\n```\n\n...or:\n\n```\npython setup.py install\n```\n\n...from the cloned tree.\n\n### Dependencies\n\n - numpy\n - scipy\n - nose\n - mock\n - matplotlib\n\nUsing the Code\n--------------\n\nSee the [API documentation](http://detly.github.io/gammatone/). For a\ndemonstration, find a `.wav` file (for example,\n[Für Elise](http://heeris.id.au/samples/FurElise.wav)) and run:\n\n```text\npython -m gammatone FurElise.wav -d 10\n```\n\n...to see a gammatone-gram of the first ten seconds of the track. If you've\ninstalled via `pip` or `setup.py install`, you should also be able to just run:\n\n```text\ngammatone FurElise.wav -d 10\n```\n\nBasis\n-----\n\nThis project is based on research into how humans perceive audio, originally\npublished by Malcolm Slaney:\n\n[Malcolm Slaney (1998) \"Auditory Toolbox Version 2\", Technical Report #1998-010,\nInterval Research Corporation, 1998.](\nhttp://cobweb.ecn.purdue.edu/~malcolm/interval/1998-010/\n)\n\nSlaney's report describes a way of modelling how the human ear perceives,\nemphasises and separates different frequencies of sound. A series of gammatone\nfilters are constructed whose width increases with increasing centre frequency,\nand this bank of filters is applied to a time-domain signal. The result of this\nis a spectrum that should represent the human experience of sound better than,\nsay, a Fourier-domain spectrum would.\n\nA gammatone filter has an impulse response that is a sine wave multiplied by a\ngamma distribution function. It is a common approach to modelling the auditory\nsystem.\n\nThe gammatone filterbank approach can be considered analogous (but not\nequivalent) to a discrete Fourier transform where the frequency axis is\nlogarithmic. For example, a series of notes spaced an octave apart would appear\nto be roughly linearly spaced; or a sound that was distributed across the same\nlinear frequency range would appear to have more spread at lower frequencies.\n\nThe real goal of this toolkit is to allow easy computation of the gammatone\nequivalent of a spectrogram — a time-varying spectrum of energy over audible\nfrequencies based on a gammatone filterbank.\n\nSlaney demonstrated his research with an initial implementation in MATLAB. This\nimplementation was later extended by Dan Ellis, who found a way to approximate a\n\"gammatone-gram\" by using the fast Fourier transform. Ellis' code calculates a\nmatrix of weights that can be applied to the output of a FFT so that a\nFourier-based spectrogram can easily be transformed into such an approximation.\n\nEllis' code and documentation is here: [Gammatone-like spectrograms](\nhttp://labrosa.ee.columbia.edu/matlab/gammatonegram/\n)\n\nInterest\n--------\n\nI became interested in this because of my background in science communication\nand my general interest in the teaching of signal processing. I find that the\nspectrogram approach to visualising signals is adequate for illustrating\nabstract systems or the mathematical properties of transforms, but bears little\ncorrespondence to a person's own experience of sound. If someone wants to see\nwhat their favourite piece of music \"looks like,\" a normal Fourier transform\nbased spectrogram is actually quite a poor way to visualise it. Features of the\naudio seem to be oddly spaced or unnaturally emphasised or de-emphasised\ndepending on where they are in the frequency domain.\n\nThe gammatone filterbank approach seems to be closer to what someone might\nintuitively expect a visualisation of sound to look like, and can help develop\nan intuition about alternative representations of signals.\n\nVerifying the port\n------------------\n\nSince this is a port of existing MATLAB code, I've written tests to verify the\nPython implementation against the original code. These tests aren't unit tests,\nbut they do generally test single functions. Running the tests has the same\nworkflow:\n\n  1. Run the scripts in the `test_generation` directory. This will create a\n     `.mat` file containing test data in `tests/data`.\n\n  2. Run `nosetest3` in the top level directory. This will find and run all the\n     tests in the `tests` directory.\n\nAlthough I'm usually loathe to check in generated files to version control, I'm\nwilling to make an exception for the `.mat` files containing the test data. My\nreasoning is that they represent the decoupling of my code from the MATLAB code,\nand if the two projects were separated, they would be considered a part of the\nPython code, not the original MATLAB code.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdetly%2Fgammatone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdetly%2Fgammatone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdetly%2Fgammatone/lists"}