This code was all written (and/or copied) in Notepad++, and compiled in PlatformIO. It should work right out of the box. Should. It is built for WS2812B LEDs, data connected on pin 13, this can be changed in the code.
I originally wrote this program for my sound-reactive speaker lights. This includes a compact webpage to control the colors manually. Sound-reactive code was originally based on G6EJD's work, and later modified to display more of the individual frequencies.
Later on I incorporated some code from a previous MIDI LED project to make it MIDI-responsive, with some modifications to make it work over WiFi. Network MIDI is natively supported by Mac, and can be added Windows by installing rtpMIDI.
Finally, I recently switched it to AsyncServer, and learned how to run the audio analysis routine (FFT) on the secondary ESP32 processor, freeing up the primary CPU to run the LEDs independently. Thanks to Andreas Spiess for his dual-core code template.
My ESP32 modules were defective and factory-locked at 160MHz. With a full-speed 240MHz ESP32 module, you should have better FFT capability.
- Install the necessary libraries.
Make sure you have the latest Arduino Core for ESP32 installed. Then install the following libraries:
- Compile and upload program (
src
) AND filesystem (data
)
-
change wireless SSID and password, LED data pin, and number of LEDs in
headers.h
(you may need to adjust the exponent inFFT.ino
for the best audio-reactive display, but it should still look OK without adjustment). You can also adjust the type of LED by changing it inLEDs.ino
- read FastLED documentation for which LED types are supported. -
pio run -t upload
(program) -
pio run -t uploadfs
(filesystem)
- Wire it up
-
WS2812B LED data pin -> ESP32 pin 13
-
audio in -> pin 39 (mono), pins 39 and 36 (stereo) - see diagram
stereo_input_wiring.jpg