Real-time terminal spectrum visualizer using a hand-written SIMD Constant-Q Transform in Ea.
84 musical bins (C2–B8), 7 octaves, 30 FPS. Beats NumPy's BLAS by 1.9x and FFT by 2.1x on the CQT workload.
pip install numpy soundcard
python visualizer.py # system audio loopback
python visualizer.py file.wav # WAV file
The CQT kernel fuses windowing, transform, magnitude, and smoothing into one SIMD pass. Twiddle tables with baked-in Hann windows are precomputed in Python; the Ea kernel does pure FMA over variable-length windows — no trig, no zero-padding, no wasted reads.
Ea CQT (fused SIMD) ~50 us
NumPy CQT (BLAS matmul) ~95 us
NumPy FFT (wrong answer) ~106 us
The full story — benchmark methodology, optimization attempts that failed, and why Ea wins — is in the blog post.
| File | What |
|---|---|
cqt_fast.ea |
Production CQT kernel (in-place smoothing) |
cqt.ea |
Original CQT kernel (separate output buffer) |
render.ea |
SIMD fill-grid kernel for terminal rendering |
visualizer.py |
Terminal visualizer (WASAPI loopback + WAV) |
test_cqt.py |
Correctness tests + benchmark |
blog.md |
Full writeup |