schmelczer-dev/src/content/work/lights-synchronized-to-music.md
2026-07-12 21:34:59 +01:00

22 lines
2.1 KiB
Markdown

---
title: 'My First Real Project: LEDs Driven by an FFT'
description: A Raspberry Pi music player that drove RGB strips through MOSFETs. The first thing I started and actually finished.
date: 2026-04-26
period: 'Spring 2016'
thumbnail:
src: ./_assets/leds.jpg
alt: RGB LED strips lit by a music synchronisation project.
article:
tags: ['systems', 'tools']
stack: ['Python', 'NumPy', 'FFT', 'Raspberry Pi', 'MOSFETs', 'vanilla web']
project:
title: Lights Synchronized to Music
---
Spring 2016. I had a Raspberry Pi, a couple of 12V RGB LED strips someone had given me, a handful of MOSFETs from an electronics kit, and no idea what I was doing. I wired one of the MOSFETs backwards and it got hot enough to leave a small mark on the breadboard, which is how I learned, slowly and because I had to, to read a datasheet. This was the first thing I ever started and actually finished.
The plan was roughly: play music, look at it somehow, make the lights match. My first attempt mapped raw audio amplitude to brightness, which makes the lights pulse at everything (clipping, voices, fan noise): a strobing mess that hurt to watch. I read about Fourier transforms just long enough to type `numpy.fft.fft(audio_chunk)` into a REPL, and that was the moment the project started behaving like the thing I'd imagined. Bass-heavy bins went to red, mids to green, highs to blue, and smoothing the output over a few frames killed the flicker.
The frontend was a vanilla web page served from the same Pi: pick a track, drag a few threshold sliders, watch the room change. A `<select>`, some sliders, an `XMLHttpRequest`. It worked.
None of this would impress anyone in 2026, and that's fine, because what I actually took from it wasn't the FFT or the MOSFETs. It was discovering that I'd rather have a finished janky thing than an elegant unfinished one. Most of the projects on this site are downstream of that discovery; [the ATtiny85 handheld](/articles/ad-astra-attiny85-game-engine/) four years later is the same instinct with the soldering iron held steadier. I'd still recommend the same first project to anyone: something physical, plugged together until it works, ugly on purpose.