Changeset cc4f3f7 for tests/python
- Timestamp:
- Nov 3, 2007, 4:49:38 PM (17 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:
- 4f56a35
- Parents:
- 0cbfa4a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/python/phasevoc.py
r0cbfa4a rcc4f3f7 3 3 from aubio.aubiowrapper import * 4 4 5 6 5 buf_size = 1024 7 6 hop_size = 256 8 7 channels = 2 8 9 precision = 6 9 10 10 11 class aubio_phasevoc_test(unittest.TestCase): … … 17 18 18 19 def test_create(self): 19 """ test creation and deletion ofphasevoc object """20 """ create and delete phasevoc object """ 20 21 pass 21 22 22 23 def test_zeroes(self): 23 """ testphasevoc object on zeroes """24 input = new_fvec(hop_size, channels)24 """ run phasevoc object on zeroes """ 25 input = new_fvec(hop_size, channels) 25 26 fftgrain = new_cvec(buf_size, channels) 26 aubio_pvoc_do (self.o, input, fftgrain) 27 aubio_pvoc_rdo(self.o, fftgrain, input) 28 for index in range(buf_size): 27 output = new_fvec(hop_size, channels) 28 for index in range(hop_size): 29 29 for channel in range(channels): 30 30 self.assertEqual(0., fvec_read_sample(input, channel, index)) 31 aubio_pvoc_do (self.o, input, fftgrain) 32 aubio_pvoc_rdo(self.o, fftgrain, output) 33 for index in range(hop_size): 34 for channel in range(channels): 35 self.assertEqual(0., fvec_read_sample(output, channel, index)) 36 del input 37 del fftgrain 38 39 def test_ones(self): 40 """ run phasevoc object on ones """ 41 input = new_fvec(hop_size, channels) 42 fftgrain = new_cvec(buf_size, channels) 43 output = new_fvec(hop_size, channels) 44 for index in range(hop_size): 45 for channel in range(channels): 46 fvec_write_sample(input, 1., channel, index) 47 self.assertEqual(1., fvec_read_sample(input, channel, index)) 48 # make sure the first buf_size-hop_size samples are zeroes 49 for i in range(buf_size/hop_size - 1): 50 aubio_pvoc_do (self.o, input, fftgrain) 51 aubio_pvoc_rdo(self.o, fftgrain, output) 52 for index in range(hop_size): 53 for channel in range(channels): 54 self.assertAlmostEqual(0., fvec_read_sample(output, channel, index), precision) 55 # make sure the first non zero input is correctly resynthesised 56 aubio_pvoc_do (self.o, input, fftgrain) 57 aubio_pvoc_rdo(self.o, fftgrain, output) 58 for index in range(hop_size): 59 for channel in range(channels): 60 self.assertAlmostEqual(1., fvec_read_sample(output, channel, index), precision) 61 del input 62 del fftgrain
Note: See TracChangeset
for help on using the changeset viewer.