Mercurial > hg > python-tutorial-ssw2012-output
view tempo_estimator.py @ 10:7fc62809da94
Test and implement framer
author | Chris Cannam |
---|---|
date | Mon, 08 Oct 2012 15:34:50 +0100 |
parents | d43d1adecea6 |
children | cb43d088e369 |
line wrap: on
line source
import audiofile as af def estimate_tempo_of_samples(samples, samplerate): """Given some audio samples and their samplerate, return their estimated tempo in bpm.""" df = detection_function(samples) acf = autocorrelation(df) tempo = find_tempo_from_autocorrelation(acf) return tempo def estimate_tempo_of_file(filename): """Given the name of a WAV file, return the estimated tempo in bpm.""" (samples, samplerate) = af.read_all_mono_samples_from_file(filename) return estimate_tempo_of_samples(samples, samplerate)