Python script based on Fast Fourier Transform to dynamically animate your Philips Hue lights.
- Install dependencies
pip install requests pyaudio numpy
- Create an authenticated user for your Hue Bridge : Philips' tutorial
- 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 +'}')
- Run script
python fft_hue.py
- Make some noises
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.