Long-Form-Audio-Pipeline
December 15, 2025 · View on GitHub
A preprocessing pipeline for preparing long-form audio recordings for speech-to-text (ASR) APIs. This tool optimizes audio files for transcription by reducing file size, normalizing audio levels, and cleaning up the signal before upload.
Why Preprocess?
While many ASR APIs perform server-side preprocessing, this pipeline:
- Reduces upload time and bandwidth by compressing audio before transmission
- Ensures consistent input quality regardless of original recording conditions
- Removes unnecessary data (silence, stereo channels) that don't aid transcription
- Optimizes for speech recognition with filters tuned for voice clarity
Pipeline Stages
The preprocessing script applies the following transformations in order:
| Stage | Transformation | Details |
|---|---|---|
| 1 | Silence Detection & Trimming | Detects silence at start/end (threshold: -50dB, min duration: 0.5s) and trims it |
| 2 | Stereo to Mono Conversion | Mixes stereo channels to mono (0.5×L + 0.5×R) — ASR doesn't benefit from stereo |
| 3 | Sample Rate Conversion | Resamples to 16kHz — the standard rate for most STT systems |
| 4 | Loudness Normalization | Applies EBU R128 normalization (I=-16 LUFS, TP=-1.5 dB, LRA=11) |
| 5 | High-Pass Filter | Removes low-frequency rumble below 80Hz common in voice recordings |
| 6 | Speech Clarity EQ | 4-band EQ optimized for voice intelligibility (see below) |
| 7 | Dynamic Range Compression | Gentle compression (threshold: -20dB, ratio: 3:1) to even out volume levels |
| 8 | Codec Transformation | Encodes to OGG Opus at 48kbps VBR with voip application mode |
Speech Clarity EQ Details
The EQ stage applies frequency adjustments specifically tuned for speech intelligibility:
| Frequency | Adjustment | Purpose |
|---|---|---|
| 300 Hz | -3 dB cut | Reduces muddiness in the low-mid range |
| 1.5 kHz | +3 dB boost | Enhances vowel presence and clarity |
| 3 kHz | +4 dB boost | Boosts consonant clarity (the "intelligibility band") |
| 4 kHz+ | +2 dB shelf | Adds air and crispness to sibilants |
These adjustments were derived from frequency analysis of real voice recordings, targeting the bands that most impact ASR accuracy.
Example Results
Processing a real-world voice recording through this pipeline:
| Metric | Before | After |
|---|---|---|
| File Size | 482.87 MB | 16.80 MB |
| Format | WAV (PCM 16-bit) | OGG (Opus) |
| Channels | Stereo | Mono |
| Sample Rate | 44100 Hz | 16000 Hz |
| Duration | 2870.32s (~47 min) | 2869.71s |
| Compression Ratio | — | 28.7× |
The 0.6 seconds trimmed from the start was detected silence before speech began.
GUI Application
A desktop GUI is available for easy audio processing and EQ calibration.

Features:
- Drag & drop audio file input
- Automatic output naming (
_processed.oggsuffix) - EQ calibration workflow with sample extraction
- Import/export EQ presets (
.conf,.json,.ffmpegformats) - View and edit current EQ bands
| Tab | Description |
|---|---|
| Process Audio | Drop files for processing with current EQ preset |
| EQ Calibration | Extract samples, edit in Audacity, compute custom EQ |
| Current Preset | View, import, and export EQ presets |
Install GUI (Debian/Ubuntu)
sudo apt install ./audio-processor_1.0.0_all.deb
Or run directly:
./install_gui.sh # Sets up Python venv and PyQt6
./run_gui.sh # Launch the GUI
Installation
Dependencies
- ffmpeg with libopus support
- ffprobe (included with ffmpeg)
- Standard Unix tools:
awk,grep,sed
On Ubuntu/Debian:
sudo apt install ffmpeg
Usage
Quick Start (Single File)
# Process a single file with default EQ
./preprocess_for_stt.sh recording.wav
Batch Processing with Custom EQ
This pipeline supports creating your own EQ preset by editing a sample in your preferred audio editor:
# 1. Extract a 15-second sample for calibration
./extract_sample.sh calibration.wav
# 2. Edit samples/sample_before.wav in your audio editor
# Apply your preferred EQ adjustments
# Export as samples/sample_after.wav
# 3. Compute your custom EQ preset
./compute_eq.sh
# 4. Drop files in the 'in/' folder and batch process
./process_batch.sh
Directory Structure
├── in/ # Drop input files here
├── out/ # Processed files appear here
├── samples/
│ ├── sample_before.wav # Raw sample for editing
│ └── sample_after.wav # Your edited sample (you create this)
├── eq_preset.conf # Generated EQ preset
├── extract_sample.sh # Extract calibration sample
├── compute_eq.sh # Derive EQ from before/after
├── process_batch.sh # Batch process with custom EQ
└── preprocess_for_stt.sh # Single-file processor (default EQ)
Supported Input Formats
Any format ffmpeg can decode:
- WAV, FLAC, AIFF (uncompressed)
- MP3, AAC, OGG, M4A (compressed)
- Most other audio formats
Configuration
Edit the variables at the top of preprocess_for_stt.sh:
SAMPLE_RATE=16000 # Target sample rate (Hz)
BITRATE="48k" # OGG Opus bitrate
SILENCE_THRESHOLD="-50dB" # Silence detection threshold
SILENCE_DURATION="0.5" # Minimum silence duration (seconds)
When to Use This
This pipeline is specifically intended for:
- Voice memos and dictation recordings
- Interview recordings
- Podcast audio for transcription
- Meeting recordings
- Any long-form speech content destined for ASR
It's optimized for speech, not music. The high-pass filter and compression settings are tuned for voice clarity.
License
MIT