Skip to content

Instantly share code, notes, and snippets.

Avatar

François Maillet mailletf

View GitHub Profile
@mailletf
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
mailletf / gist:3484932dd29d62b36092
Created Apr 18, 2015
Display a mel-scaled power spectrogram using librosa
View gist:3484932dd29d62b36092
# 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)
@mailletf
mailletf / lightshow.py
Created Apr 18, 2015
Simple light show using phue
View lightshow.py
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],
You can’t perform that action at this time.