This repository contains code for the hands-on session of the VCCA 2026 tutorial on Computational Models of the Auditory Periphery. The goal is to help participants build intuition for how sound is transformed by early stages of the auditory system, from the acoustic waveform to a simplified auditory-nerve representation. The tutorial slides are available HERE.
The tutorial is designed for researchers, clinicians, engineers, and students who may come from different backgrounds but want a practical, computational view of peripheral auditory processing.
The notebook walks through a simplified auditory-periphery model in stages:
-
Input sound waveform
- Load an example speech-in-noise waveform.
- Visualize the waveform and spectrogram.
-
Cochlear frequency analysis
- Use a bank of gammatone filters to approximate frequency selectivity along the cochlea.
- Each filter channel represents a different cochlear place or characteristic frequency.
-
Inner hair cell transduction
- Apply half-wave rectification as a simple approximation to inner hair cell transduction.
- This converts oscillatory basilar-membrane-like motion into a more neural-like nonnegative signal.
-
Limits of phase locking
- Apply a low-pass filter to approximate the fact that auditory-nerve fibers do not preserve fine temporal phase equally well at all frequencies.
-
Auditory-nerve rate-level functions
- Convert inner-hair-cell-like output into instantaneous firing rates.
- Compare high-, medium-, and low-spontaneous-rate auditory nerve fiber types.
-
Spike count simulation
- Generate stochastic spike counts from firing rates using a binomial spike generator.
- Visualize the result as a simplified nervegram, a time-by-frequency representation of auditory-nerve activity.
vcca-tutorial-periphery/
├── model_of_auditory_periphery_simplified_w_comments.ipynb # Main tutorial notebook
├── Model_of_Auditory_Periphery_Zilany.ipynb # Notebook for simulating a more detailed nerve model (Bruce et al., 2018)
├── modules.py # PyTorch modules for filters and neural transformations
├── filters.py # FIR filter construction utilities
├── utils.py # Signal generation, plotting, and auditory-scale utilities
├── LICENSE # MIT License
└── .gitignore
The easiest way to run the tutorial is through Google Colab:
- Click the Open in Colab badge at the top of this README.
- In Colab, select Runtime > Run all or step through the notebook one cell at a time.
- Make sure the example audio file expected by the notebook is available at the path specified in the notebook:
audio_file_path = "/content/example_speech_in_noise.wav"If your audio file is stored somewhere else, update audio_file_path before running the notebook.
Clone the repository:
git clone https://github.com/Annesya/vcca-tutorial-periphery.git
cd vcca-tutorial-peripheryCreate and activate a virtual environment:
python -m venv .venv
source .venv/bin/activate # macOS/Linux
# .venv\Scripts\activate # Windows PowerShellInstall dependencies:
pip install numpy scipy matplotlib soundfile tqdm ipython jupyter soxr torch torchaudioStart Jupyter:
jupyter notebookThen open:
model_of_auditory_periphery_simplified_w_comments.ipynb
The notebook expects an example audio file named:
example_speech_in_noise.wav
In Colab, the current notebook path assumes:
/content/example_speech_in_noise.wav
You can either:
- upload a file with that name into the Colab session, or
- change the
audio_file_pathvariable in the notebook to point to your own.wavfile.
For best results, use a monophonic or stereo .wav file with speech, noise, tones, or another sound that illustrates time-frequency structure.
The notebook is designed to be modified interactively. Useful parameters to change include:
lowest_CF = 60
highest_CF = 8000
num_CFs = 50
filter_bandwidth = 1
phaselock_cutoff = 3000These control the cochlear filterbank and inner-hair-cell low-pass stage.
Auditory nerve fiber parameters can also be changed:
rate_spont_hsr = 70.0
rate_spont_msr = 4.0
rate_spont_lsr = 0.1
threshold_hsr = 0.0
threshold_msr = 12.0
threshold_lsr = 28.0
dynamic_range_hsr = 20.0
dynamic_range_msr = 40.0
dynamic_range_lsr = 80.0Try changing these values to see how different assumptions about fiber threshold, dynamic range, and spontaneous firing rate alter the final nervegram.
At a high level, the notebook implements the following signal-processing chain:
Sound waveform
↓
Gammatone filterbank
↓
Cochlear subband signals
↓
Half-wave rectification
↓
Inner-hair-cell low-pass filtering
↓
Auditory nerve rate-level function
↓
Stochastic spike-count generation
↓
Nervegram visualization
Each stage is intentionally simplified so that participants can see the relationship between auditory physiology and signal-processing operations.
You do not need to understand every implementation detail to benefit from the notebook. A useful way to follow the tutorial is to ask, at each stage:
- What biological structure or process is this stage trying to approximate?
- What signal-processing operation is being used as the approximation?
- What information is preserved, transformed, compressed, or lost?
- How do the model parameters affect the resulting auditory representation?
Install the missing package:
pip install soxrInstall PyTorch and torchaudio:
pip install torch torchaudioFor GPU-specific installations, follow the official PyTorch installation instructions for your CUDA version.
The notebook should run on CPU. If CUDA is unavailable, the code automatically selects CPU:
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")If you run into GPU-specific issues, restart the runtime and use CPU mode.
Check that the file exists at the path used by:
audio_file_path = "/content/vcca-tutorial-periphery/example_speech_in_noise.wav"Update the path if needed.
This project is released under the MIT License. See LICENSE for details.
This material was prepared for the VCCA 2026 tutorial on computational models of the auditory periphery.
The codes shared in this tutorial have previously been developed and used for the following publications. Please cite them if you find this code useful.
Saddler, M.R. and McDermott, J.H., 2024. Models optimized for real-world tasks reveal the task-dependent necessity of precise temporal coding in hearing. Nature Communications, 15(1), p.10590.Banerjee, A., Saddler, M.R., Arenberg, J.G. and McDermott, J.H., 2025. A deep learning framework for understanding cochlear implants. bioRxiv.