BBC Waveform Data Example
This example demonstrates fast waveform loading using BBC's pre-computed peaks format. Waveforms appear almost instantly while audio loads in the background.
Loading...
About BBC Waveform Data
BBC's audiowaveform tool generates pre-computed peak data from audio files. This enables:
- Instant waveform display - peaks files are ~50KB vs ~3MB for audio
- Reduced server load - no need to decode audio for visualization
- Consistent rendering - same peaks regardless of browser/platform
- Progressive loading - show waveforms while audio loads in background
Sample rate note: Pre-computed peaks embed the source audio's sample rate. The browser's AudioContext typically runs at 48000 Hz. If the rates don't match (e.g., peaks generated from 44100 Hz audio on a 48000 Hz device), waveform-playlist falls back to generating peaks from the decoded audio. For best results, generate peaks from 48000 Hz audio or resample first.
Generating BBC Peaks Files
# Install audiowaveform (macOS) brew install audiowaveform # Generate from Opus (recommended — always 48000 Hz, matching most hardware) audiowaveform -i audio.opus -o peaks.dat -z 256 -b 8 # Generate from MP3 or WAV audiowaveform -i audio.mp3 -o peaks.dat -z 256 -b 8 # If source is 44100 Hz, encode to Opus first (resamples to 48000 Hz) ffmpeg -i audio.wav -c:a libopus audio.opus audiowaveform -i audio.opus -o peaks.dat -z 256 -b 8
For a complete code walkthrough of progressive loading with BBC peaks, see the Immediate Mode guide.
Audio Credits: "Ubiquitous" by Albert Kader — Minimal Techno stems from the Cambridge Music Technology multitrack library. Licensed under CC BY 4.0.