view 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
line wrap: on
line source

import tempo_estimator as est
import numpy as np

def test_detection_function():
    samples = np.array([1,0, 0,0, 0,0, 1,0, 0,0])
    df = est.detection_function(samples, 2)
    assert len(df) == 5
    assert df[3] > df[2]
    assert df[0] > df[2]

def test_tempo_120bpm():
    tempo = est.estimate_tempo_of_file('testfiles/120bpm.wav')
    assert abs(tempo - 120.0) < 0.5