Commit 6b93432e authored by Jackson Garner's avatar Jackson Garner

add some beat detection

parent d480fe36
......@@ -6,8 +6,9 @@ from scipy import signal
import sounddevice
import time
import math
import msaf
import librosa
import numpy as np
volume = 0.5 # range [0.0, 1.0]
fs = 44100 # sampling rate, Hz, must be integer
......@@ -36,6 +37,14 @@ def plot(data):
rate, wav_data = wavfile.read("violin.wav", mmap=True)
#wav_data = samples
boundaries, labels = msaf.process("violin.wav")
audio = librosa.load("violin.wav", sr=fs)[0]
audio_harmonic, audio_percussive = librosa.effects.hpss(audio)
tempo, frames = librosa.beat.beat_track(y=audio_percussive,
sr=fs, hop_length=1024)
beat_times = librosa.frames_to_time(frames, sr=fs,
hop_length=1024)
print(beat_times)
sounddevice.play(wav_data, rate)
timestep = 1/24
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment