view test_tempo_estimator.py @ 11:cb43d088e369

Implement and test detection function
author Chris Cannam
date Mon, 08 Oct 2012 15:42:07 +0100
parents 99038dfea9e5
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