Changes in / [c721874:2d8880d5]


Ignore:
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/phasevoc.c

    rc721874 r2d8880d5  
    3434  fvec_t * data;      /**current input grain [win_s] */
    3535  fvec_t * dataold;   /**last input frame [win_s-hop_s] */
    36   smpl_t * w;          /** grain window [win_s] */
     36  float * w;          /** grain window [win_s] */
    3737};
    3838
  • src/types.h

    rc721874 r2d8880d5  
    4040
    4141/** short sample format (32 or 64 bits) */
    42 //typedef float        smpl_t;
    43 typedef double       smpl_t;
     42typedef float        smpl_t;
     43//typedef double       smpl_t;
    4444/** long sample format (64 bits or more) */
    4545typedef double       lsmp_t;
  • tests/python/fft.py

    rc721874 r2d8880d5  
    44from aubio.aubiowrapper import *
    55
    6 buf_size = 8092
    7 channels = 4
    8 
    9 precision = 6
     6buf_size = 2048
     7channels = 1
    108
    119class aubio_mfft_test_case(unittest.TestCase):
     
    5149
    5250  def test_aubio_mfft_do_impulse(self):
    53     """ test aubio_mfft_do with an impulse on one channel """
     51    """ test aubio_mfft_do on impulse one channel """
    5452    input    = new_fvec(buf_size, channels)
    5553    fftgrain = new_cvec(buf_size, channels)
    5654    # write impulse in channel 0, sample 0.
    57     some_constant = 0.3412432456
    58     fvec_write_sample(input, some_constant, 0, 0)
     55    fvec_write_sample(input, 1., 0, 0)
    5956    aubio_mfft_do(self.o, input, fftgrain)
    6057    # check norm
    6158    for index in range(buf_size/2+1):
    62       self.assertAlmostEqual(some_constant, cvec_read_norm(fftgrain, 0, index), precision)
     59      self.assertEqual(1., cvec_read_norm(fftgrain, 0, index), index)
    6360    for index in range(buf_size/2+1):
    6461      for channel in range(1, channels):
     
    6865      for channel in range(channels):
    6966        self.assertEqual(0., cvec_read_phas(fftgrain, channel, index))
    70     del fftgrain
    71     del input
    72 
    73   def test_aubio_mfft_do_constant(self):
    74     """ test aubio_mfft_do with a constant on one channel """
    75     input    = new_fvec(buf_size, channels)
    76     fftgrain = new_cvec(buf_size, channels)
    77     # write impulse in channel 0, sample 0.
    78     some_constant = 0.003412432456
    79     for index in range(1,buf_size):
    80       fvec_write_sample(input, some_constant, 0, index)
    81     aubio_mfft_do(self.o, input, fftgrain)
    82     # check norm and phase == 0 in all other channels
    83     for index in range(buf_size/2+1):
    84       for channel in range(1, channels):
    85         self.assertEqual(0., cvec_read_norm(fftgrain, channel, index))
    86     # check norm and phase == 0 in first first and last bin of first channel
    87     self.assertAlmostEqual((buf_size-1)*some_constant, cvec_read_norm(fftgrain, 0, 0), precision)
    88     self.assertEqual(0., cvec_read_phas(fftgrain, 0, 0))
    89     self.assertEqual(0., cvec_read_norm(fftgrain, 0, buf_size/2+1))
    90     self.assertEqual(0., cvec_read_phas(fftgrain, 0, buf_size/2+1))
    91     # check unwrap2pi(phas) ~= pi everywhere but in first bin
    92     for index in range(1,buf_size/2+1):
    93        self.assertAlmostEqual ( math.pi, aubio_unwrap2pi(cvec_read_phas(fftgrain, 0, index)), precision)
    94        self.assertAlmostEqual(some_constant, cvec_read_norm(fftgrain, 0, index), precision)
    9567    del fftgrain
    9668    del input
     
    12294    """ test aubio_mfft_rdo on impulse """
    12395    fftgrain  = new_cvec(buf_size, channels)
    124     for channel in range(channels):
    125       cvec_write_norm(fftgrain, 1., channel, 0)
     96    cvec_write_norm(fftgrain, 1., 0, 0)
    12697    output    = new_fvec(buf_size, channels)
    12798    aubio_mfft_rdo(self.o, fftgrain, output)
    12899    for index in range(buf_size/2+1):
    129100      for channel in range(channels):
    130         self.assertAlmostEqual(fvec_read_sample(output, channel, index), 1./buf_size, precision)
     101        self.assertEqual(fvec_read_sample(output, channel, index),1./buf_size)
    131102    del fftgrain
    132103    del output
     
    144115    for index in range(buf_size/2+1):
    145116      for channel in range(channels):
    146         self.assertAlmostEqual(fvec_read_sample(output, channel, index), 0.67, precision)
     117        self.assertAlmostEqual(fvec_read_sample(output, channel, index), 0.67, 7)
    147118    del fftgrain
    148119    del output
Note: See TracChangeset for help on using the changeset viewer.