Changeset 8802f92


Ignore:
Timestamp:
Oct 8, 2009, 9:00:53 PM (15 years ago)
Author:
Paul Brossier <piem@piem.org>
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
Message:

tests/python/src/pitch/pitchdetection.py: update to latest pitch prototypes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/python/src/pitch/pitchdetection.py

    r3027c6e r8802f92  
    2828    """ run pitchdetection on an empty buffer """
    2929    vec = new_fvec(buf_size, channels)
     30    out = new_fvec(1, channels)
    3031    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.)
    3234    del vec
    3335
     
    3537    """ run pitchdetection on a train of 4 impulses """
    3638    vec = new_fvec(buf_size, channels)
     39    out = new_fvec(1, channels)
    3740    fvec_write_sample(vec,-1.,0,  0)
    3841    fvec_write_sample(vec, 1.,0,  buf_size/4)
     
    4144    frequency = samplerate/2*4/buf_size
    4245    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)
    4448    del vec
    4549
     
    4751    """ run pitchdetection on a train of 4 positive impulses of arbitrary size """
    4852    vec = new_fvec(buf_size, channels)
     53    out = new_fvec(1, channels)
    4954    frequency = samplerate/2*8/buf_size
    5055    for i in range(100):
     
    5358      fvec_write_sample(vec, 2.-.01*i,0,  buf_size/2)
    5459      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)
    5662    del vec
    5763
     
    5965    """ run pitchdetection on a train of 4 negative impulses of arbitrary size """
    6066    vec = new_fvec(buf_size, channels)
     67    out = new_fvec(1, channels)
    6168    frequency = samplerate/2*8/buf_size
    6269    for i in range(1,100):
     
    6572      fvec_write_sample(vec,-.01*i,0,  buf_size/2)
    6673      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)
    6876    del vec
    6977
     
    7179    """ run pitchdetection on a train of 8 impulses """
    7280    vec = new_fvec(buf_size, channels)
     81    out = new_fvec(1, channels)
    7382    fvec_write_sample(vec, 1.,0,  0)
    7483    fvec_write_sample(vec,-1.,0,  buf_size/8)
     
    8089    fvec_write_sample(vec,-1.,0,7*buf_size/8)
    8190    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),
    8393        samplerate/2/buf_size*8, 1)
    8494    del vec
Note: See TracChangeset for help on using the changeset viewer.