Changeset 31a5c405 for python/tests
- Timestamp:
- Feb 23, 2014, 8:39:25 PM (11 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 1a121ca
- Parents:
- 1164bcdf
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/tests/test_source.py
r1164bcdf r31a5c405 9 9 path = None 10 10 11 class aubio_source_test_case (TestCase):11 class aubio_source_test_case_base(TestCase): 12 12 13 13 def setUp(self): 14 14 if not len(list_of_sounds): self.skipTest('add some sound files in \'python/tests/sounds\'') 15 16 class aubio_source_test_case(aubio_source_test_case_base): 17 18 def test_close_file(self): 19 samplerate = 0 # use native samplerate 20 hop_size = 256 21 for p in list_of_sounds: 22 f = source(p, samplerate, hop_size) 23 f.close() 24 25 def test_close_file_twice(self): 26 samplerate = 0 # use native samplerate 27 hop_size = 256 28 for p in list_of_sounds: 29 f = source(p, samplerate, hop_size) 30 f.close() 31 f.close() 32 33 class aubio_source_read_test_case(aubio_source_test_case_base): 15 34 16 35 def read_from_sink(self, f): … … 69 88 self.read_from_sink(f) 70 89 71 def test_close_file(self): 72 samplerate = 0 # use native samplerate 73 hop_size = 256 74 for p in list_of_sounds: 75 f = source(p, samplerate, hop_size) 76 f.close() 90 class aubio_source_readmulti_test_case(aubio_source_read_test_case): 77 91 78 def test_close_file_twice(self): 79 samplerate = 0 # use native samplerate 80 hop_size = 256 81 for p in list_of_sounds: 82 f = source(p, samplerate, hop_size) 83 f.close() 84 f.close() 92 def read_from_sink(self, f): 93 total_frames = 0 94 while True: 95 vec, read = f.do_multi() 96 total_frames += read 97 if read < f.hop_size: break 98 print "read", "%.2fs" % (total_frames / float(f.samplerate) ), 99 print "(", total_frames, "frames", "in", 100 print f.channels, "channels and", 101 print total_frames / f.hop_size, "blocks", "at", "%dHz" % f.samplerate, ")", 102 print "from", f.uri 85 103 86 104 if __name__ == '__main__':
Note: See TracChangeset
for help on using the changeset viewer.