3 from numpy.testing import TestCase, assert_equal, assert_almost_equal
4 from aubio import fvec, source, sink
5 from numpy import array
6 from utils import list_all_sounds
8 list_of_sounds = list_all_sounds('sounds')
11 class aubio_sink_test_case(TestCase):
14 if not len(list_of_sounds): self.skipTest('add some sound files in \'python/tests/sounds\'')
17 for path in list_of_sounds:
18 for samplerate, hop_size in zip([0, 44100, 8000, 32000], [512, 1024, 64, 256]):
19 f = source(path, samplerate, hop_size)
20 if samplerate == 0: samplerate = f.samplerate
21 g = sink('/tmp/f.wav', samplerate)
27 if read < f.hop_size: break
28 print "read", "%.2fs" % (total_frames / float(f.samplerate) ),
29 print "(", total_frames, "frames", "in",
30 print total_frames / f.hop_size, "blocks", "at", "%dHz" % f.samplerate, ")",
34 if __name__ == '__main__':
35 from unittest import main