Other
whisper/audio.py: the audio constants and log-Mel code in the openai/whisper repository
OpenAI, GitHub, openai/whisper repository (main branch), 2022
Read the originalRead on October 17, 2026
- What it is
- The source file in OpenAI's official Whisper repository that sets the audio constants the models use: sample rate, FFT size, hop length and chunk length. It is the code that runs, so it shows the exact values, not a summary of them.
- How much weight it carries
- Primary source: the code the official package runs. It describes the open-source Whisper release, not every commercial service built on Whisper, and later commits can change it.
Facts taken from this source
- In the open-source Whisper code, a chunk of 30 seconds at a sample rate of 16,000 per second is 480,000 samples.
“N_SAMPLES = CHUNK_LENGTH * SAMPLE_RATE # 480000 samples in a 30-second chunk” (Module constants, audio.py)
- Whisper's load_audio function decodes an audio file by starting the ffmpeg command-line tool as a subprocess, and it needs ffmpeg in the PATH to do so.
“This launches a subprocess to decode audio while down-mixing ... Requires the ffmpeg CLI in PATH.” (load_audio function in whisper/audio.py)
- The log-Mel spectrogram function in the Whisper code uses 80 Mel-frequency filters by default, and it supports only 80 or 128 filters.
“The number of Mel-frequency filters, only 80 and 128 are supported” (log_mel_spectrogram, parameter n_mels)