Processing WAV Files to Third-Octave Bands
A practical walk-through for turning raw WAV audio into octave and 1/3-octave bands with a stable IIR filter bank, correct band edges, and trustworthy levels.
What third-octave processing means
Third-octave analysis splits audio into logarithmically spaced bands where each band spans 2^(1/3) in frequency. This mirrors how humans hear loudness and is widely used in environmental noise, HVAC, machinery, and building acoustics.
For a band centered at f_c, the lower and upper edges are f_c / 2^(1/6) and f_c * 2^(1/6). Octave bands use 2^(1/2) instead.
WAV ingestion and metadata
- Read the PCM samples with the original sample rate and bit depth intact to avoid level changes.
- Normalize to floating-point only after reading; track the reference so levels can be reported correctly.
- Remove DC offset or very low-frequency rumble with a gentle high-pass (often 10-20 Hz).
- Keep the channel strategy explicit: per-channel bands, summed mono, or energy-combined stereo.
If you rely on absolute SPL, apply calibration before filtering so each band uses the same reference level.
Designing the IIR bandpass bank
Most analyzers use 4th-order or 6th-order IIR bandpass sections in second-order sections (SOS) form. This matches IEC/ANSI analog prototypes while keeping CPU cost low for streaming.
Store the band metadata (center, edges, order, weighting) with the results so the analysis is traceable.
Energy integration and time weighting
After filtering, convert each band to energy by squaring the signal and integrating over a defined time window. You can use fixed windows (125 ms, 1 s) or exponential time-weighting to mimic Fast or Slow meter responses.
- Power:
P = mean(x^2)in the window. - Level:
L = 10 * log10(P / P0)with a consistent reference. - Optional A- or C-weighting can be applied before bands or to the band levels.
Resampling and Nyquist limits
Ensure every band edge falls below Nyquist. If you need bands higher than fs/2, resample with an anti-imaging low-pass filter.
Many pipelines cap the highest band if the input sample rate is too low.
For long recordings, you can store band levels at a lower rate after low-pass filtering the envelope, which keeps files small while preserving trend data.
Quality checks and export
- Verify each band meets tolerance (IEC 61260-1) if you need compliance.
- Compare band sums to broadband RMS to catch missing energy or incorrect weighting.
- Export CSV with time stamps plus band centers for reliable downstream plotting.
Related guides
Compare streaming IIR filters with FFT bin summation and learn when each wins.
Read the comparisonTrade-offs in phase, CPU, stability, and latency for real-world DSP.
Compare IIR and FIRCalculate analog poles for octave and third-octave filters.
Open pole calculatorEstimate WAV storage size and compare 16-bit vs 24-bit workflows.
Open storage toolsSee the standard A-weighting curve equation and how to implement it digitally.
View A-weightingCalibrate recordings with acoustic calibrators, embedded metadata, and reference tones.
Open calibration guide