This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyaudio | |
import librosa | |
import numpy as np | |
import requests | |
# ring buffer will keep the last 2 seconds worth of audio | |
ringBuffer = RingBuffer(2 * 22050) | |
def callback(in_data, frame_count, time_info, flag): | |
audio_data = np.fromstring(in_data, dtype=np.float32) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Mostly taken from: http://nbviewer.ipython.org/github/bmcfee/librosa/blob/master/examples/LibROSA%20demo.ipynb | |
import librosa | |
import matplotlib.pyplot as plt | |
# Load sound file | |
y, sr = librosa.load("filename.mp3") | |
# Let's make and display a mel-scaled power (energy-squared) spectrogram | |
S = librosa.feature.melspectrogram(y, sr=sr, n_mels=128) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from phue import Bridge | |
# connect to the hue bridge | |
b = Bridge(bridge_ip) | |
b.connect() | |
# Setup colors | |
colors = { | |
"bleu": [0.1393, 0.0813], |