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:

  1. Start the script
  2. Tell amazon Alexa to turn on music
  3. 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.
  4. 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

Known issues

  • 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.

File structure:

  • Main script, takes input and works on it, calls all other scripts
  • visio/ 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/ helper functions
  • visio/vendor/ helper script to change between rgb and other colour spaces

Team :

Disco Hue

Built With

Share this project: