Analyzes the frequency spectrum of an audio file and returns metrics that describe its tonal balance, brightness, and spectral shape.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| file_path | string | required | Path to audio file (WAV, FLAC, MP3, AIFF, OGG) |
Example Output
$ analyze_spectrum vocals.wav
Spectral Analysis Centroid: 2,847 Hz Rolloff: 8.2 kHz (95th percentile) Flatness: 0.0012 Contrast: 28.4 dB Dissonance: 0.23
Per-band Energy: Sub (20-60): -42.1 dB Low (60-250): -18.3 dB Low-mid (250-2k): -12.7 dB High-mid (2k-6k): -14.2 dB High (6k-20k): -22.8 dB
What the Numbers Mean
-
Centroid — The “center of mass” of the spectrum. Higher values mean brighter audio. Vocals typically sit at 2-4 kHz, kicks at 100-200 Hz, cymbals at 8-12 kHz.
-
Rolloff — The frequency below which 95% of the spectral energy sits. Tells you where the meaningful high-frequency content ends. A vocal with rolloff at 8 kHz has controlled highs; rolloff at 14 kHz has significant air/breath content.
-
Flatness — How noise-like vs tonal the audio is. 0.0 = pure tone, 1.0 = white noise. Music typically ranges 0.001-0.05. Drums are higher (0.05-0.2), sustained notes are lower (0.001-0.01).
-
Contrast — The difference in dB between peaks and valleys in the spectrum. Higher contrast means more defined tonal character; lower contrast means more even/flat response.
-
Dissonance — How much clashing harmonic content is present. Scale of 0-1. Values above 0.4 may indicate frequency masking or harmonic conflict.
Example Prompts
Frequency check
Analyze the frequency balance of my vocal at vocals.wav
Brightness comparison
Compare the spectral centroid of my mix versus the reference — is mine too dark?
Per-band breakdown
Show me the per-band energy distribution of bass.wav — I think there’s too much sub
Related Tools
- analyze_loudness — Loudness measurement (LUFS, peak) complements spectral data
- detect_problems — Identifies specific issues like mud, harshness, resonances
- compare_to_reference — Compare your spectrum against a reference track
- analyze_masking — Check if two stems are fighting in the same frequencies
Pro tip
If centroid seems off but you can’t hear why, check per-band energy. A high centroid with strong low-mid energy usually means harsh high-mids are pulling the average up — not that lows are missing.