SoundStrips is a solo project I made over 2 weeks to control LED light strips using the Audio outputting from a computer. Using pyaudio and Pyserial, SoundStrips processes audio outputting from any audio device on your computer in realtime to control your LED light strips so that you can sync them with movies, video games, music, microphones, and more! This project was made and tested using Windows 10, python 3.8, a ws2812b 150 LED addressable light strip, and an Arduino MEGA 2560.
This project was made to minimize hardware audio processing and find a way to directly control the lights in a simple yet efficient way using software-side audio processing in python. Due to this approach, the only required parts are:
- an Arduino
- strip of addressable LED lights
- 5V power adapter to power the strip
- 300-500 ohm resistor
Each LED on a strip uses about 50mA when set to full brightness so make sure to use a 5V power adapter that can output more than (50mA * # of LEDs).
- LED light strip Ground & Arduino Ground <--> Power Adapter Ground
- LED light strip 5V <--> Power Adapter 5V
- LED light strip Data <--> 300-500 ohm resistor <--> Arduino DATA PIN 5
- Arduino USB-B <--> Computer USB-A
Since the Arduino saves and runs the most recent uploaded script on startup, this code will only need be uploaded to the Arduino once.
-
Go to Arduino.cc and download the Arduino IDE.
-
After installation, go to Tools -> board and Processor, and select the Arduino board and Processor you have.
-
Next, go to Sketch -> Libraries -> Manage Libraries, and search for FastLED. Install the latest version.
-
Upload the sketch onto your Arduino and choose COM3 as your serialport. (If you are unable to do so, change which serialport SoundStrips writes to in the python file. See Troubleshooting)
-
First, navigate to the "Sound Control Panel" in your "Sound Settings". Under "Recording", enable the "Stereo Mix" device. If "Stereo Mix" isn't visible, right click in the menu and check show disabled and disconnected devices. If that still does not work, see troubleshooting.
-
The python file has already been built and can be directly run as an application. Unzip and start up the application in the App Build folder. The Arduino must be connected with the sketch uploaded for the application to start.
-
Click the gear icon and refresh the device list to display all the current recording devices on your computer. For general audio outputted through applications, click "Stereo Mix" and push select.
-
Go back to the main menu by clicking the menu icon and customize how your lights will react to the sound. (See next section)
-
Click the power button to start.
If need be, you can tweak the python file for troubleshooting or customization and rebuild the application. (See Troubleshooting)
The SoundStrips application uses the tkinter GUI system to make interfacing easier.
The Power Button can turn on and off the lights. The power will automatically be turned off when a new audio device is selected and will have to be turned on again manually. Make sure to turn the power off before exiting the application so the serialport closes and is not left opened.
Presets you've made can be chosen from the dropdown and loaded in using the load button and deleted using the delete button. A preset saves the color, volume threshold, brightness, and the fade speed. It does NOT save which device you were using.
The customize menu is used to change how the lights react.
-
The volume thresholds sets the minimum and maximum level that the current volume has to reach to turn on the lights. These settings, unlike the rest, works in realtime and does not need to be uploaded to the Arduino for changes to take effect. Using the live feed can help you decide what values to set these at.
-
The brightness slider is very self explanatory.
-
The fade speed slider sets how fast the lights fade out after being turned on.
-
The color button sets the color of the lights.
-
Using the save button will save all the above settings into a preset. Presets are case sensitive and cannot have the same name.
-
Press the upload button to send the current set values to the Arduino. You must hit upload for changes to be sent to the arduino and take place.
The live feed can be paused and played and will show the current audio devices volume output. Use this to help set the volume threshold. The live feed will sometimes show in the top left of fullscreen games and applications to help you determine a good volume threshold aswell (experimental).
Select what audio device you want the application to listen to. Refresh the list using the refresh button and select a device with the select button. (Stereo Mix and Microphone have been tested to work)
The "Reset all Settings" button will reset the application to the default presets and device.
Some laptop manufacturers, Surfaces for example, have made the Stereo Mix audio device inaccessible. To work around this and use audio outputted from applications, install voicemeeter. After installing and restarting your computer, start up Voicemeeter and select WDM: Speakers as HARDWARE OUT. Voicemeeter should now come up in the audio device selection menu in Soundstrips. Tested on Surface Go.
The application "SoundStrips-Server" must always have the "images" folder, LICENSE.txt, and README.md in the same directory for the application to start.
Although this project calls for addressable LED light strips, it is possible to get this working for any light or component that can be interfaced using an Arduino by altering the code in the arduino file.
If need be, you can alter the python file to work better for yourself, customization, or troubleshooting. To rebuild the application, navigate to the .py file location using windows powershell and build using pyinstaller (python 3.x and containing libraires required):
pyinstaller.exe --onefile --windowed --icon.ico=images\icon.ico SoundStrips-Server.py
The built application will be in the "dist" folder and can be moved from there. Make sure to copy the "images" folder, LICENSE.txt, and README.md to the same directory as the newly built application after building.
For other issues or help, feel free to email me.