The discohue project analyzes music played to the device running the script and translates the music into commands for the Philips Hue device. For a smooth user experience the music can be started via amazon Alexa. A basic workflow looks like this:
- Start the script
- Tell amazon Alexa to turn on music
- The script analyzes the music and translates it into a fitting light response. For slower music, the light response will be slow and smooth, for faster music faster and more abrupt.
- If you don't want anymore light response, stop the script.
pip install -r requirements
Use python 2.7
If you get an error when starting the script, try running
sudo pip input.pyo
- The Philips Hue bridge cannot take more than 10 commands per second per light
- latency issues on the network sometimes delay the response by the bridge. If we send commands quicker than the bridge can receive we get a delay in response
- Latency on the network cause a slight delay between music and light response
- If the music is too loud, the colour calculated from the volume of the music can be out of the limited colour range of the Philips Hue lights.
Workarounds for issues:
- Threads are used to mitigate response times. If all lights are still occupied by a command at the time the next command comes in, the current command gets skipped. This is because commands get queued on the Philips Hue device otherwise which eventually leads to the device getting badly out of sync with the music.
- The colour range problem is solved by "going in the other direction" as soon as a colour is out of range. This means that the colour response for a sound that is slightly above the volume treshold will be the same as for a sound slightly below the volume treshold.
- input.py: Main script, takes input and works on it, calls all other scripts
- visio/bridge.py: Ansteuerungsskript für die Philips Bridge, vewrantwortlich für die Steuerung des Hue devices.
- visio/.env: environment variables for configuration, can be overloaded the the scriptvendor
- visio/init.py: helper functions
- visio/vendor/rgb2xy.py: helper script to change between rgb and other colour spaces