Skip to content

petlukk/ea-CQT-audio-visualizer

Repository files navigation

Ea CQT Audio Visualizer

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.

Quick Start

pip install numpy soundcard
python visualizer.py              # system audio loopback
python visualizer.py file.wav     # WAV file

How It Works

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.

Files

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

About

A SIMD kernel compiler, a DFT nobody asked for, and an honest benchmark

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors