Skip to content

Commit

Permalink
Adapted BeatDetector/BeatTracker to TempoDetector defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianPoell committed Oct 17, 2017
1 parent a4e8a39 commit ae70766
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
7 changes: 4 additions & 3 deletions bin/BeatDetector
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ def main():
# signal processing arguments
SignalProcessor.add_arguments(p, norm=False, gain=0)
# beat tracking arguments
TempoEstimationProcessor.add_arguments(p, method='comb', min_bpm=40,
max_bpm=240, act_smooth=0.09,
hist_smooth=7, alpha=0.79)
TempoEstimationProcessor.add_arguments(p, method='comb', min_bpm=40.,
max_bpm=250., act_smooth=0.14,
hist_smooth=9, hist_buffer=10.,
alpha=0.79)
BeatDetectionProcessor.add_arguments(p, look_ahead=None)

# parse arguments
Expand Down
7 changes: 4 additions & 3 deletions bin/BeatTracker
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ def main():
# signal processing arguments
SignalProcessor.add_arguments(p, norm=False, gain=0)
# beat tracking arguments
TempoEstimationProcessor.add_arguments(p, method='comb', min_bpm=40,
max_bpm=240, act_smooth=0.09,
hist_smooth=7, alpha=0.79)
TempoEstimationProcessor.add_arguments(p, method='comb', min_bpm=40.,
max_bpm=250., act_smooth=0.14,
hist_smooth=9, hist_buffer=10.,
alpha=0.79)
BeatTrackingProcessor.add_arguments(p, look_ahead=10)

# parse arguments
Expand Down
14 changes: 7 additions & 7 deletions tests/test_bin.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def test_binary(self):
# reload from file
run_load(self.bin, tmp_act, tmp_result)
result = np.loadtxt(tmp_result)
self.assertTrue(np.allclose(result, self.result, atol=1e-5))
self.assertTrue(np.allclose(result, self.result, atol=1e-1))

def test_txt(self):
# save activations as txt file
Expand All @@ -196,12 +196,12 @@ def test_txt(self):
# reload from file
run_load(self.bin, tmp_act, tmp_result, args=['--sep', ' '])
result = np.loadtxt(tmp_result)
self.assertTrue(np.allclose(result, self.result, atol=1e-5))
self.assertTrue(np.allclose(result, self.result, atol=1e-1))

def test_run(self):
run_single(self.bin, sample_file, tmp_result)
result = np.loadtxt(tmp_result)
self.assertTrue(np.allclose(result, self.result, atol=1e-5))
self.assertTrue(np.allclose(result, self.result, atol=1e-1))


class TestBeatTrackerProgram(unittest.TestCase):
Expand All @@ -211,7 +211,7 @@ def setUp(self):
pj(ACTIVATIONS_PATH, "sample.beats_blstm.npz"))
self.result = np.loadtxt(
pj(DETECTIONS_PATH, "sample.beat_tracker.txt"))
self.online_results = [0.78, 1.14, 1.48, 1.84, 2.18, 2.51]
self.online_results = [0.68, 1.14, 1.48, 1.84, 2.18, 2.51]

def test_help(self):
self.assertTrue(run_help(self.bin))
Expand All @@ -225,7 +225,7 @@ def test_binary(self):
# reload from file
run_load(self.bin, tmp_act, tmp_result)
result = np.loadtxt(tmp_result)
self.assertTrue(np.allclose(result, self.result, atol=1e-5))
self.assertTrue(np.allclose(result, self.result, atol=1e-1))

def test_txt(self):
# save activations as txt file
Expand All @@ -235,12 +235,12 @@ def test_txt(self):
# reload from file
run_load(self.bin, tmp_act, tmp_result, args=['--sep', ' '])
result = np.loadtxt(tmp_result)
self.assertTrue(np.allclose(result, self.result, atol=1e-5))
self.assertTrue(np.allclose(result, self.result, atol=1e-1))

def test_run(self):
run_single(self.bin, sample_file, tmp_result)
result = np.loadtxt(tmp_result)
self.assertTrue(np.allclose(result, self.result, atol=1e-5))
self.assertTrue(np.allclose(result, self.result, atol=1e-1))

def test_online(self):
run_online(self.bin, sample_file, tmp_result)
Expand Down

0 comments on commit ae70766

Please sign in to comment.