Arduino & Python Soundlight Spectrum

Continuing with my initial Soundlight project, I have modified the code to produce six distinct lights depending on the frequency of the music! Why six? Well, that’s the limit of the Arduino’s PWM (analog out) pins, so that’s as much as you can get with a single Arduino Uno. It works by using Fast Fourier Transforms to analyze the sound frequencies and find how much sound is coming out from each frequency range (special shout out to Luis for helping me understand this beautiful math!)

Here’s a quick demo video:

Here is the Arduino code for receiving the serial data and changing the lights:

Here is the Python code that does all the heavy processing and Fast Fourier Transforms:

And finally, here’s how to wire it all up:
Arduino Soundlight Diagram