Skip to content

Instantly share code, notes, and snippets.


François Maillet mailletf

View GitHub Profile
mailletf / gist:c49063d005dfc51a2df6
Last active Oct 16, 2020
Simplified version of real-time audio scoring for goal detection
View gist:c49063d005dfc51a2df6
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)
mailletf / gist:3484932dd29d62b36092
Created Apr 18, 2015
Display a mel-scaled power spectrogram using librosa
View gist:3484932dd29d62b36092
# Mostly taken from:
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)
mailletf /
Created Apr 18, 2015
Simple light show using phue
import time
from phue import Bridge
# connect to the hue bridge
b = Bridge(bridge_ip)
# Setup colors
colors = {
"bleu": [0.1393, 0.0813],