def test_peakpick_zeroes(self):
""" check peakpick run on a vector full of zero returns no peak. """
- self.assertEqual(0., aubio_peakpick_pimrt_getval(self.o))
+ self.assertEqual(0., aubio_peakpicker_get_thresholded_input(self.o))
def test_peakpick_impulse(self):
""" check peakpick detects a single impulse as a peak. """
input = new_fvec(buf_size, channels)
fvec_write_sample(input, 1000., 0, index)
fvec_write_sample(input, 1000./2, 0, index+1)
- #print "%2s" % index, aubio_peakpick_pimrt(input, self.o), "|",
+ #print "%2s" % index, aubio_peakpicker_do(self.o, input), "|",
#for i in range(buf_size): print fvec_read_sample(input, 0, i),
#print
del_fvec(input)
fvec_write_sample(input, 1000., 0, index+1)
fvec_write_sample(input, 1000., 0, index+3)
fvec_write_sample(input, 1000./2, 0, index+4)
- peak_pick_result = aubio_peakpick_pimrt(input, self.o)
- if index == 2: self.assertEqual(1., peak_pick_result)
+ peak_pick_result = aubio_peakpicker_do(self.o, input)
+ if index == 2:
+ # we are at the peak. check the result is after current sample,
+ # and not after next one
+ self.failIf( 1. >= peak_pick_result )
+ self.failIf( 2. < peak_pick_result )
else: self.assertEqual(0., peak_pick_result)
- #print "%2s" % index, peak_pick_result, "|",
- #for i in range(buf_size): print fvec_read_sample(input, 0, i),
- #print
del_fvec(input)
for index in range(buf_size-4,buf_size-1):
input = new_fvec(buf_size, channels)
fvec_write_sample(input, 1000./2, 0, index)
fvec_write_sample(input, 1000., 0, index+1)
- #print "%2s" % index, aubio_peakpick_pimrt(input, self.o), "|",
- #for i in range(buf_size): print fvec_read_sample(input, 0, i),
- #print
+ peak_pick_result = aubio_peakpicker_do(self.o, input)
+ self.assertEqual(0., peak_pick_result)
del_fvec(input)
def test_peakpick_set_threshold(self):