#! /usr/bin/env python from nose2 import main from nose2.tools import params from numpy.testing import TestCase from aubio import source from utils import list_all_sounds list_of_sounds = list_all_sounds('sounds') samplerates = [0, 44100, 8000, 32000] hop_sizes = [512, 1024, 64] path = None all_params = [] for soundfile in list_of_sounds: for hop_size in hop_sizes: for samplerate in samplerates: all_params.append((hop_size, samplerate, soundfile)) class aubio_source_test_case_base(TestCase): def setUp(self): if not len(list_of_sounds): self.skipTest('add some sound files in \'python/tests/sounds\'') self.default_test_sound = list_of_sounds[0] class aubio_source_test_case(aubio_source_test_case_base): def test_close_file(self): samplerate = 0 # use native samplerate
#! /usr/bin/env python from numpy.testing import TestCase, assert_equal, assert_almost_equal from aubio import notes, source import numpy as np from utils import list_all_sounds list_of_sounds = list_all_sounds('sounds') AUBIO_DEFAULT_NOTES_SILENCE = -70. AUBIO_DEFAULT_NOTES_RELEASE_DROP = 10. AUBIO_DEFAULT_NOTES_MINIOI_MS = 30. class aubio_notes_default(TestCase): def test_members(self): o = notes() assert_equal([o.buf_size, o.hop_size, o.method, o.samplerate], [1024, 512, 'default', 44100]) class aubio_notes_params(TestCase): samplerate = 44100 def setUp(self): self.o = notes(samplerate=self.samplerate) def test_get_minioi_ms(self): assert_equal(self.o.get_minioi_ms(), AUBIO_DEFAULT_NOTES_MINIOI_MS)
#! /usr/bin/env python from numpy.testing import TestCase, assert_equal, assert_almost_equal from aubio import fvec, source from numpy import array from utils import list_all_sounds list_of_sounds = list_all_sounds("sounds") path = None class aubio_source_test_case_base(TestCase): def setUp(self): if not len(list_of_sounds): self.skipTest("add some sound files in 'python/tests/sounds'") class aubio_source_test_case(aubio_source_test_case_base): def test_close_file(self): samplerate = 0 # use native samplerate hop_size = 256 for p in list_of_sounds: f = source(p, samplerate, hop_size) f.close() def test_close_file_twice(self): samplerate = 0 # use native samplerate hop_size = 256 for p in list_of_sounds: f = source(p, samplerate, hop_size) f.close()