kferg.dev

[ audio ]

Audio Reactive Programming: Envelope Followers

Posted by Kevin on

My weirdly specific hobby is coding visuals that react to music. (See here or here.) I thought I would share some of my audio processing and animation tricks. Most of my techniques for synchronizing animations to music start with envelope followers. In this article, I’ll explain what an envelope follower is and how it works. In a future article, I’ll give some examples of how to use one.

What’s cooler than a guitar that lights up when you play it? Nothing. Hardware This whole idea was inspired by Adafruit’s Neopixel LED strips. These are chains of RGB LEDs on a flexible PCB, with each light individually addressable. The lights are controlled by an Adafruit Trinket M0, which is an absolutely amazing tiny microcontroller board. The guitar is an old Squier Stratocaster. It’s my first guitar, which I bought way back when I was in high school.
For years, I’ve been interested in generating animations from audio. This is my first attempt to generate music from an animation! The GIF up there does not do it justice. Go play with it for a bit and come back. (Tip: if you’re on a phone or ipad, it supports multitouch!) Animation Clicking or tapping the screen creates a rotating dot that eventually fades away. The dots rotate in a circle in time with the tempo of the music.
This is a tiny analog audio mixer with two stereo 1/8" inputs. This is the first hardware project I was really satisfied with. It fits nicely in its enclosure, looks relatively tidy, runs forever on its battery, and does the thing it’s supposed to do. I’m a big fan of tiny music gadgets: Korg’s Volca series, Pocket Operators, OP-1, etc. The point of this tiny mixer is to let me play a couple of them together, without carrying a bunch of extra stuff around.