Changeset 26fecba
- Timestamp:
- Nov 28, 2016, 4:25:11 PM (8 years ago)
- Branches:
- sampler
- Children:
- 598774b
- Parents:
- 024584d
- git-author:
- Paul Brossier <piem@piem.org> (10/03/16 11:46:37)
- git-committer:
- Paul Brossier <piem@piem.org> (11/28/16 16:25:11)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/tests/test_source.py
r024584d r26fecba 3 3 from nose2 import main 4 4 from nose2.tools import params 5 from numpy.testing import TestCase 5 from numpy.testing import TestCase, assert_equal 6 6 from aubio import source 7 7 from utils import list_all_sounds 8 import numpy as np 8 9 9 10 import warnings … … 52 53 total_frames = 0 53 54 while True: 54 _, read = f()55 samples , read = f() 55 56 total_frames += read 56 if read < f.hop_size: break 57 if read < f.hop_size: 58 assert_equal(samples[read:], 0) 59 if 'silence' not in f.uri: 60 self.assertEquals(np.count_nonzero(samples[:read]), read) 61 break 57 62 #result_str = "read {:.2f}s ({:d} frames in {:d} blocks at {:d}Hz) from {:s}" 58 63 #result_params = total_frames / float(f.samplerate), total_frames, total_frames//f.hop_size, f.samplerate, f.uri … … 150 155 total_frames = 0 151 156 while True: 152 _, read = f.do_multi()157 samples, read = f.do_multi() 153 158 total_frames += read 154 if read < f.hop_size: break 159 if read < f.hop_size: 160 assert_equal(samples[:,read:], 0) 161 if 'silence' not in f.uri: 162 self.assertEquals(np.count_nonzero(samples[:,:read]), read) 163 break 155 164 #result_str = "read {:.2f}s ({:d} frames in {:d} channels and {:d} blocks at {:d}Hz) from {:s}" 156 165 #result_params = total_frames / float(f.samplerate), total_frames, f.channels, int(total_frames/f.hop_size), f.samplerate, f.uri
Note: See TracChangeset
for help on using the changeset viewer.