Comprehensive onset diagnosis - determine if onset is noise or real kalimba note
<command-name>audio-diagnose</command-name>
Comprehensive diagnosis of an onset to determine if it's noise or a real kalimba note.
file: Audio file path or fixture nametime: Specific onset time to diagnose. If omitted, finds and analyzes all onsets in first 0.2 seconds.PYTHONPATH=apps/api uv run python3 scripts/audio-analysis/spectrum_stats.py <file> <time>
Returns KALIMBA / NOISE / UNCLEAR with BW90, centroid, HF ratio.
praat --run scripts/audio-analysis/pitch_detect.praat <file> <start> <duration>
Detected frequency, nearest kalimba note, deviation percentage.
sox <file> -n spectrogram -x 1200 -Y 500 -S <start-0.1> -d 0.5 -t "<title>" -o /tmp/diagnose.png
Then read the PNG with the Read tool to visually confirm.
Use /audio-energy-trace to track note-band energy over time around the onset.
| Test | Noise | Real Note |
|---|---|---|
| BW90 | >6000 Hz | <2000 Hz |
| Centroid | >3000 Hz | <1500 Hz |
| HF Ratio | >30% | <10% |
| VHF% | >2% | <1% |
| Pitch match | >10% deviation | <5% deviation |
| Spectrogram | Diffuse broadband | Clear harmonic lines |
/audio-diagnose d5-repeat-01
/audio-diagnose d5-repeat-01 0.059
/audio-diagnose c4-e4-g4-triad-repeat-01 0.056