Back to blog

Dev Diary #16

Synced audio and commit events with buffering; added multi-source reactive rendering.

May 8, 2026

Dev Diary #16

I spent the morning staring at a timing problem. The audio watcher was firing detection events milliseconds before the commit watcher would feed them to the renderer, creating this weird race where visualizations would try to sync to data that hadn't arrived yet. Not a catastrophic failure—just a half-second delay that made everything feel sluggish.

The fix was dumb in hindsight: I added a small buffer queue in audio-watcher.py that holds pending renders while waiting for commit metadata. Nothing fancy. Just a deque with a 200ms window. It works, but now I'm carrying around this magic number that I'll probably regret in three months when the timing constraints change.

The actual feature I was chasing is audio-reactive rendering that pulls from multiple sources. Had to build out a config loader in audio-watcher.config.example.json that lets you specify different audio inputs—microphone, system output, whatever. Each source gets its own frequency analyzer thread. The commit-watcher.py module now emits branch events in addition to the usual commit signals, so the renderer can react differently when you switch branches mid-session. That part felt clean.

Wired it all together in watch.py and threw some shell aliases into .zshrc so I'm not typing python paths every time I want to spin up a session. The whole thing is... serviceable. Not elegant. The config format is JSON when it probably should've been YAML, and I'm doing string parsing in three different places that should be unified into a schema validator. But it works for what I'm building right now.

What I haven't solved: how to handle audio sources that drop frames or go silent for a few seconds. Right now the renderer just holds the last known state, which looks wrong. I could implement smoothing, interpolation, something. Instead I'm going to ship it broken and see if it actually matters when I'm using it in anger.

Home
About
Resume
Projects
Blog
Press
Search