Tutorial 05 — Audio lane (synthetic spectrograms)¶
Master guide: ../GUIDE_E2E.md · Prev: 04 · Next: 06
Goal: Prove STE + binary CNN pattern on audio features, offline-friendly.
Honest scope¶
Classic BNNs are not production ASR/TTS. For real speech use INT8 Whisper / ONNX Runtime / vendor NPU INT8. This demo shows packing/QAT patterns on spectrogram-like inputs.
Quick run (always works offline)¶
bnn train-audio --epochs 5 --n-train 800 --n-test 200 --seed 0
Or:
python scripts/train_audio.py --epochs 5 --seed 0
Committed golden: results/audio_synth.json (verify: bnn repro).
Outputs: results/audio_synth.json (+ .md).
Pipeline¶
- Synthetic musical tones (8 pitch classes) — reproducible, no download required.
- NumPy STFT → cheap mel-like pool (
bnn/audio/features.py). - FP CNN vs Bi-Real-style binary CNN (
bnn/audio/models.py).
Optional NPZ cache under data/audio_cache/ after first run.
Smoke test¶
pytest tests\test_audio_smoke.py -q
No network. Safe for CI.