Changeset 8802f92 for tests/python/src
- Timestamp:
- Oct 8, 2009, 9:00:53 PM (15 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:
- 7280e67
- Parents:
- 3027c6e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/python/src/pitch/pitchdetection.py
r3027c6e r8802f92 28 28 """ run pitchdetection on an empty buffer """ 29 29 vec = new_fvec(buf_size, channels) 30 out = new_fvec(1, channels) 30 31 for i in range(100): 31 self.assertEqual(aubio_pitchdetection_do(self.o,vec),0.) 32 aubio_pitchdetection_do(self.o,vec, out) 33 self.assertEqual(fvec_read_sample(out, 0, 0),0.) 32 34 del vec 33 35 … … 35 37 """ run pitchdetection on a train of 4 impulses """ 36 38 vec = new_fvec(buf_size, channels) 39 out = new_fvec(1, channels) 37 40 fvec_write_sample(vec,-1.,0, 0) 38 41 fvec_write_sample(vec, 1.,0, buf_size/4) … … 41 44 frequency = samplerate/2*4/buf_size 42 45 for i in range(100): 43 self.assertEqual(aubio_pitchdetection_do(self.o,vec),frequency) 46 aubio_pitchdetection_do(self.o,vec, out) 47 self.assertEqual(fvec_read_sample(out, 0, 0),frequency) 44 48 del vec 45 49 … … 47 51 """ run pitchdetection on a train of 4 positive impulses of arbitrary size """ 48 52 vec = new_fvec(buf_size, channels) 53 out = new_fvec(1, channels) 49 54 frequency = samplerate/2*8/buf_size 50 55 for i in range(100): … … 53 58 fvec_write_sample(vec, 2.-.01*i,0, buf_size/2) 54 59 fvec_write_sample(vec, 2.-.01*i,0,3*buf_size/4) 55 self.assertAlmostEqual(aubio_pitchdetection_do(self.o,vec),frequency,1) 60 aubio_pitchdetection_do(self.o,vec, out) 61 self.assertAlmostEqual(fvec_read_sample(out, 0, 0),frequency,1) 56 62 del vec 57 63 … … 59 65 """ run pitchdetection on a train of 4 negative impulses of arbitrary size """ 60 66 vec = new_fvec(buf_size, channels) 67 out = new_fvec(1, channels) 61 68 frequency = samplerate/2*8/buf_size 62 69 for i in range(1,100): … … 65 72 fvec_write_sample(vec,-.01*i,0, buf_size/2) 66 73 fvec_write_sample(vec,-.01*i,0,3*buf_size/4) 67 self.assertAlmostEqual(aubio_pitchdetection_do(self.o,vec),frequency,1) 74 aubio_pitchdetection_do(self.o,vec, out) 75 self.assertAlmostEqual(fvec_read_sample(out, 0, 0),frequency,1) 68 76 del vec 69 77 … … 71 79 """ run pitchdetection on a train of 8 impulses """ 72 80 vec = new_fvec(buf_size, channels) 81 out = new_fvec(1, channels) 73 82 fvec_write_sample(vec, 1.,0, 0) 74 83 fvec_write_sample(vec,-1.,0, buf_size/8) … … 80 89 fvec_write_sample(vec,-1.,0,7*buf_size/8) 81 90 for i in range(100): 82 self.assertAlmostEqual(aubio_pitchdetection_do(self.o,vec), 91 aubio_pitchdetection_do(self.o,vec, out) 92 self.assertAlmostEqual(fvec_read_sample(out, 0, 0), 83 93 samplerate/2/buf_size*8, 1) 84 94 del vec
Note: See TracChangeset
for help on using the changeset viewer.