Music 2 Led is an open source app that allows you to create real-time audio and midi visualizations on led strips using Arduino, Python and Electron. It was designed for DJ's, music groups or artists who want to add automated lighting effects to their shows.
All you need is a computer, an arduino and a ws2812b led strip.
A standalone server version is available to allow you to run projects on raspberry pi. ( Tested with a raspberry pi 4 ) It can be found here
- Download and install
- Build an arduino case
- Update the CONFIG.yml
- Setup custom effects to prepare your show
- Update
- Enjoy !
This is a config file example
--- # document start
# Desired framerate for all the strips
desirated_framerate: 60
# Display the GUI
# For performance reasons, please consider using GUI only for debug or work purpose
display_interface: true
# Audio ports
# List of used audio ports
# Available ports can be listed with --list-devices
# Can be changed with the option "Change audio channel"
audio_ports:
- name: Built-in Microphone
min_frequency: 200
max_frequency: 12000
# Strips
# They represents independant Arduino cases
strips:
- # Name of the strip
# Only used in the GUI
name: Led strip name
# Name of the associated serial port
# Available ports can be found with --list-devices
serial_port_name: /dev/tty.usbserial-14210
# Midi channels
# Can be listed with --list-devices
# midi_ports_for_visualization : used for midi based visualizers
# midi_ports_for_changing_mode : used for live changing modes
midi_ports_for_visualization:
- USB MIDI Interface
midi_ports_for_changing_mode:
- LPK25
# Default state that have to be used on start up
active_state_index: 0
# Physical shape
# Represents the physical shape of the strip
# Only used in the GUI
physical_shape:
- 254
# States
# These are default states for strips
# They contains all the variables that the visualizer need to run properly
states:
- # Name of the strip
# Only used in the GUI
name: 'Mirrored Energy light blue'
# Visualizer function
# These functions can be found in the documentation below
active_visualizer_effect: energy
# The propagation curve is used to determine how scroll propagation will
# work
active_propagation_curve: ease_in
# Default audio channel
active_audio_channel_index: 0
# Filters
audio_channel_min_frequency: 200
audio_channel_max_frequency: 12000
# Shapes
# Represents virtual shape that are used by the visualizer
# Be sure they not contains odd numbers
shapes:
- - 50
- 50
# Active shape index
# Determine what shape have to be used
active_shape_index: 0
# Available color schemes
# Can be changed via "Change color scheme" function
#
# You can call them using hexadecimal notation or using a real name according
# to the color list that can be found below ->
# python-app/helpers/color/colorSchemeFormatter.py
color_schemes:
- - '#FF0000'
- '#00FF00'
- '#0000FF'
- - red
- green
- blue
# Active color scheme index
# Determine what color scheme have to be used
active_color_scheme_index: 0
# Maximum allowed brightness
# Can be used to limit the power consumption
# Check the Arduino part readme for more informations about it
max_brightness: 255
# Reverse and mirror mods
is_reverse: false
is_mirror: false
# Time interval value that is used in time based visualizers
time_interval: 120
# Chunk size used in alternate colors
chunk_size: 5
... # document end
Music To Led has 16 visualization effects and 8 mods.
They can be live changed via dedicated Midi channels. You can choose to use programs like Ableton Live to automate these changes or use a dedicated synthetiser / pad to change them manually during the show.
Big principle You have to send a midi note signal for activating / modifying effects. See the doc below.
All the examples are based on a ["red", "green", "blue"] color scheme.
First, download binary file that can be downloaded here
./musicToLedServer --help
-h, --help show this help message and exit
-l, --list-devices list available devices
--test-audio-device TEST_AUDIO_DEVICE
Test a given audio port.
--test-midi-device TEST_MIDI_DEVICE
Test a given midi port.
--test-serial-device TEST_SERIAL_DEVICE
Test a given serial port. This will test your arduino / led installation by
displaying three ( red green bue ) pixels and make them roll on the strip.
--test-config-file TEST_CONFIG_FILE
Test a given config file.
--single-strip SINGLE_STRIP
Launch the first strip without gui and multiprocessing.
It's for testing purpose.
--with-config-file WITH_CONFIG_FILE
Launch with spectific config file. Default one is
CONFIG.yml just near the executable.
Shell interface
Once the wiring is finished and your code uploaded, you can test it following these simple steps :
-
- Connect the arduino to your computer through usb cable
-
- run ./musicToLedServer --list-devices and find the corresponding usb name
-
- run ./musicToLedServer --test-serial-device "YOUR CORRESPONDING USB NAME"
This program will use Audio ports, Midi ports and Serial ports.
To help you to configure your CONFIG.yml correctly, there is a little helper that will list all available ports for each of them.
./musicToLedServer --list-devices
This program is streaming audio from the default audio input device (set by the operating system).
Examples of typical audio sources:
- Audio cable connected to the audio input jack (requires USB sound card on Raspberry Pi)
- Webcam microphone, headset, studio recording microphone, etc
On OSX you have the "Built-In Microphone" as a default choice.
You can use a "virtual audio device" to transfer audio playback from one application to another. This means that you can play music on your computer and connect the playback directly into the program.
Linux users can use Jack Audio to create a virtual audio device.
On OSX, Loopback can be use to create a virtual audio device. For open source alternatives, you can use Soundflower and Jack Audio
This program is streaming midi from the default midi input device (set by the operating system).
On OSX, it's pretty easy to make some virtual MIDI channels.
Example for using them with ableton live :
To virtually test MIDI, you can use VMPK. It's a virtual midi keyboard right in your operating system.
You can validate the config file with
./musicToLedServer --test-config-file "./CONFIG.yml"
If you have any idea to improve this project or any problem using this, please feel free to upload an issue.
- Plug and play feature on all ports
- Effect blender
- Handling more than the WS2812B led strip
- DMX handling ?
Code is compatible with Python 3.7.
# on mint and for linux more generally you may have to install jack before
# apt-get install libjack-dev libasound2-dev
conda env create --name music-to-led-server --file environment.yml
conda activate music-to-led-server
For Raspberry Pi it has been tested on Raspberry 4, the 4go ram version. On Debian Buster.
Here are some conf file you can add to your debian mounted sd card to automate wifi and ssh stuff.
wpa_supplicant.conf
country=US # Your 2-digit country code
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
network={
ssid="YOUR_NETWORK_NAME"
psk="YOUR_PASSWORD"
key_mgmt=WPA-PSK
}
touch ssh
git clone https://github.com/tfrere/music-to-led-server
pip3 install -r requirements.txt
pip3 install mido
sudo apt-get install python3-pyaudio
sudo apt-get install python3-rtmidi
sudo apt-get install libatlas-base-dev
sudo apt-get install python3-numpy
This project was developed by Thibaud FRERE under MIT Licence.