Changes in / [c721874:2d8880d5]
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/phasevoc.c
rc721874 r2d8880d5 34 34 fvec_t * data; /**current input grain [win_s] */ 35 35 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] */ 37 37 }; 38 38 -
src/types.h
rc721874 r2d8880d5 40 40 41 41 /** short sample format (32 or 64 bits) */ 42 //typedef float smpl_t;43 typedef double smpl_t;42 typedef float smpl_t; 43 //typedef double smpl_t; 44 44 /** long sample format (64 bits or more) */ 45 45 typedef double lsmp_t; -
tests/python/fft.py
rc721874 r2d8880d5 4 4 from aubio.aubiowrapper import * 5 5 6 buf_size = 8092 7 channels = 4 8 9 precision = 6 6 buf_size = 2048 7 channels = 1 10 8 11 9 class aubio_mfft_test_case(unittest.TestCase): … … 51 49 52 50 def test_aubio_mfft_do_impulse(self): 53 """ test aubio_mfft_do with an impulse onone channel """51 """ test aubio_mfft_do on impulse one channel """ 54 52 input = new_fvec(buf_size, channels) 55 53 fftgrain = new_cvec(buf_size, channels) 56 54 # 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) 59 56 aubio_mfft_do(self.o, input, fftgrain) 60 57 # check norm 61 58 for index in range(buf_size/2+1): 62 self.assert AlmostEqual(some_constant, cvec_read_norm(fftgrain, 0, index), precision)59 self.assertEqual(1., cvec_read_norm(fftgrain, 0, index), index) 63 60 for index in range(buf_size/2+1): 64 61 for channel in range(1, channels): … … 68 65 for channel in range(channels): 69 66 self.assertEqual(0., cvec_read_phas(fftgrain, channel, index)) 70 del fftgrain71 del input72 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.00341243245679 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 channels83 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 channel87 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 bin92 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)95 67 del fftgrain 96 68 del input … … 122 94 """ test aubio_mfft_rdo on impulse """ 123 95 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) 126 97 output = new_fvec(buf_size, channels) 127 98 aubio_mfft_rdo(self.o, fftgrain, output) 128 99 for index in range(buf_size/2+1): 129 100 for channel in range(channels): 130 self.assert AlmostEqual(fvec_read_sample(output, channel, index), 1./buf_size, precision)101 self.assertEqual(fvec_read_sample(output, channel, index),1./buf_size) 131 102 del fftgrain 132 103 del output … … 144 115 for index in range(buf_size/2+1): 145 116 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) 147 118 del fftgrain 148 119 del output
Note: See TracChangeset
for help on using the changeset viewer.