Commit 1f32ab10 authored by Georg Krause's avatar Georg Krause

Get offset data

parent 8e9b4e7d
import glob
from essentia import Pool, array
from essentia.standard import *
from os import path
samples = glob.glob('/home/georg/samples/**/*.wav', recursive=True)
for sample in samples:
print(sample)
od = OnsetDetection(method='hfc')
w = Windowing(type = 'hann')
fft = FFT()
c2p = CartesianToPolar()
pool = Pool()
if not path.isdir(sample):
loader = essentia.standard.MonoLoader(filename=sample)
audio = loader()
print(len(audio))
for frame in FrameGenerator(audio, frameSize=1024, hopSize=512):
mag, phase = c2p(fft(w(frame)))
pool.add('features.hfc', od(mag, phase))
onsets = Onsets(delay=100)
onsets_hfc = onsets(array([pool['features.hfc'] ]),
[ 1 ])
print(onsets_hfc)
print()
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