diff options
Diffstat (limited to 'tests/test_peak_detection.py')
-rw-r--r-- | tests/test_peak_detection.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/test_peak_detection.py b/tests/test_peak_detection.py new file mode 100644 index 0000000..b24b701 --- /dev/null +++ b/tests/test_peak_detection.py @@ -0,0 +1,25 @@ +import os +import numpy as np +from nose.tools import assert_almost_equals +import simpl +import simpl.peak_detection as peak_detection + +float_precision = 5 +frame_size = 512 +hop_size = 512 +audio_path = os.path.join( + os.path.dirname(__file__), 'audio/flute.wav' +) + + +class TestPeakDetection(object): + @classmethod + def setup_class(cls): + cls.audio = simpl.read_wav(audio_path)[0] + + def test_peak_detection(self): + pd = peak_detection.PeakDetection() + pd.find_peaks(self.audio) + + assert len(pd.frames) == len(self.audio) / hop_size + assert len(pd.frames[0].peaks) == 0 |