Sync LIFX lights to realtime audio from user's choice of microphone input. Visualization and audio analysis implemented from audio-reactive-led-strip
Program is tested with Python 3.10
with LIFX Candle Color
bulbs. It also requires the following Python dependencies:
- Numpy
- Scipy
- PyQtGraph
- PyQt5
- PyAudio
- LifxLAN
The pip package manager is used to install the python dependencies. If pip
is not found try using python -m pip install
instead.
pip install -r requirements.txt
Installing on MacOS requires portaudio
in addition to pyaudio which can be installed using:
brew install portaudio
It's recommended to set up the lights in the Official LIFX App rather than Apple Home to avoid connectivity issues with program. Refer to lights/data.txt
for information on the lights that are marked up.
- '#' ---> What each light is marked with in accordance to its Label and HK Code
- 'Label' ---> Name you should put when setting up each light in the app
- 'HK Code' ---> The code needed to connect each light when prompted in the app
The following should be done to one light after another to avoid confusion in light identification. It should also be done on the same WIFI that the program will be ran on.
- Reset light by turning it on/off 5 times. On 5th time, light should cycle through red, green, and blue, meaning it's ready for connecting
- In the LIFX app, click on the
+
thenNew Device
thenNew Light
- Click on corresponding light and enter its HK Code (refer to
lights/data.txt
and#
on light) when prompted
- Install Python and Python Dependencies
- Configure how many lights to-be used by changing
NUM_LIGHTS
insrc/config.py
.
NUM_LIGHTS = 7 <--- Total lights to-be used
- Configure the order of the light by adding the labels of each to
ORDER_LIGHTS
insrc/config.py
. Lights are positioned based on index in an array. Refer tolights/data.txt
to get labels for each light.
ORDER_LIGHTS = ["LIFX Candle Color 6F3ED0", <--- First position
"LIFX Candle Color 64BF40",
"LIFX Candle Color 674622",
"LIFX Candle Color 674613",
"LIFX Candle Color 6F3BF1",
"LIFX Candle Color 6F3080",
"LIFX Candle Color 6F49BA"] <--- Last position
- Run audio visualization command. The visualization also starts the syncing process to the lights. IMPORTANT: If on MacOS, make sure the following command is ran in MacOS's terminal to get access to audio devices.
python src/visualization.py
- Choose which audio device (by index) to retrieve audio from
Audio Devices:
Microphone (2- HyperX SoloCast) : 2 <--- (index)
Speakers (Realtek High Definiti : 7 <--- (index)
Realtek Digital Output (Realtek : 8 <--- (index)
Which to use: (index)
Adjust the sliders to change the corresponding properties
of all the lights. Click on different modes
to switch between light patterns. Click each control options to change status of lights and visualization.
- Frequency (0 - 22050) hz
- Brightness (0 - 65535)
- Saturation (0 - 65535)
- 'Energy' ---> strongest point in center
- 'Scroll' ---> wave effect from center
- 'Spectrum' ---> overall noise in audio
- 'Sine' ---> all lights follow a sine wave
- 'Flat' ---> shifts all light positions to the center of visualization (modifies other modes)
- 'Off' ---> turn all lights off
- 'On' ---> turn all lights on
- 'Kill' ---> shut down visualization and turns lights off