annotate test_tempo_estimator.py @ 12:9973b7cd0d31 tip

Implement rest of tempo estimator
author Chris Cannam
date Mon, 08 Oct 2012 15:46:54 +0100
parents cb43d088e369
children
rev   line source
Chris@8 1
Chris@8 2 import tempo_estimator as est
Chris@11 3 import numpy as np
Chris@11 4
Chris@11 5 def test_detection_function():
Chris@11 6 samples = np.array([1,0, 0,0, 0,0, 1,0, 0,0])
Chris@11 7 df = est.detection_function(samples, 2)
Chris@11 8 assert len(df) == 5
Chris@11 9 assert df[3] > df[2]
Chris@11 10 assert df[0] > df[2]
Chris@8 11
Chris@8 12 def test_tempo_120bpm():
Chris@8 13 tempo = est.estimate_tempo_of_file('testfiles/120bpm.wav')
Chris@8 14 assert abs(tempo - 120.0) < 0.5
Chris@8 15
Chris@8 16