/fft-hue

Minimal "react-to-music" Philips Hue script

Primary LanguagePython

fft-hue

Python script based on Fast Fourier Transform to dynamically animate your Philips Hue lights.


How-to

  1. Install dependencies pip install requests pyaudio numpy
  2. Create an authenticated user for your Hue Bridge : Philips' tutorial
  3. Add your devices/lights following this synthax (changing /lights/1/state)
r_1 = requests.put('http://' + hue_bridge_ip + '/api/' + user_id 
+'/lights/1/state', data='{"bri": ' + str(bri) +', "transitiontime" : 1, "hue": ' + hue +'}')
  1. Run script python fft_hue.py
  2. Make some noises

Tweakings

Sound sensibility can be adjusted with the activation_threshold variable.

Modify input_device_index to choose the audio device streamed. Open a Python shell with pyaudio.PyAudio().get_device_info_by_index(N) to check your available devices.


Dependencies

  • requests : HTTP Library (send requests to Hue Bridge)
  • pyaudio : Audio Library (open audio streams)
  • numpy : Scientific Library (fft and data manipulation)