Changeset cc4f3f7 for tests/python


Ignore:
Timestamp:
Nov 3, 2007, 4:49:38 PM (13 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, pitchshift, sampler, timestretch, yinfft+
Children:
4f56a35
Parents:
0cbfa4a
Message:

phasevoc test: add ones

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/python/phasevoc.py

    r0cbfa4a rcc4f3f7  
    33from aubio.aubiowrapper import *
    44
    5 
    65buf_size = 1024
    76hop_size = 256
    87channels = 2
     8
     9precision = 6
    910
    1011class aubio_phasevoc_test(unittest.TestCase):
     
    1718
    1819  def test_create(self):
    19     """ test creation and deletion of phasevoc object """
     20    """ create and delete phasevoc object """
    2021    pass
    2122
    2223  def test_zeroes(self):
    23     """ test phasevoc object on zeroes """
    24     input = new_fvec(hop_size, channels)
     24    """ run phasevoc object on zeroes """
     25    input    = new_fvec(hop_size, channels)
    2526    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):
    2929      for channel in range(channels):
    3030        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.