Changeset 212da72
- Timestamp:
- Dec 3, 2007, 10:57:52 AM (17 years ago)
- 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:
- 45f1f06
- Parents:
- dddf1f5 (diff), 6913434 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Files:
-
- 20 added
- 15 edited
- 17 moved
Legend:
- Unmodified
- Added
- Removed
-
README
rdddf1f5 r212da72 119 119 CONTACT 120 120 121 The home page of this project can be found at http://aubio. piem.org/. Feel free121 The home page of this project can be found at http://aubio.org/. Feel free 122 122 to drop me a comment (piem@altern.org) or on the mailing list, aubio@piem.org. 123 123 Suggestions and feedback are most welcome. -
configure.ac
rdddf1f5 r212da72 82 82 AC_LIBTOOL_DLOPEN 83 83 dnl AC_DISABLE_STATIC 84 dnl allow cross compiling 85 AC_LIBTOOL_WIN32_DLL 84 86 AC_PROG_LIBTOOL 85 87 … … 89 91 AM_CONDITIONAL(MINGW, false) 90 92 AM_CONDITIONAL(DARWIN, false) 91 case "${ build_os}" in93 case "${host_os}" in 92 94 *mingw* | *cygwin*) 93 95 mingw32_support="yes" -
examples/utils.c
rdddf1f5 r212da72 22 22 void save_data (void); 23 23 void restore_data(lash_config_t * lash_config); 24 void flush_process(aubio_process_func_t process_func, aubio_print_func_t print);25 24 pthread_t lash_thread; 26 25 #endif /* LASH_SUPPORT */ … … 410 409 411 410 void flush_process(aubio_process_func_t process_func, aubio_print_func_t print){ 412 uint i,j;411 uint_t i,j; 413 412 for (i = 0; i < channels; i++) { 414 413 for (j = 0; j < obuf->length; j++) { -
examples/utils.h
rdddf1f5 r212da72 57 57 #endif 58 58 void examples_common_process(aubio_process_func_t process_func, aubio_print_func_t print); 59 void flush_process(aubio_process_func_t process_func, aubio_print_func_t print); 59 60 60 61 -
src/Makefile.am
rdddf1f5 r212da72 1 noinst_HEADERS = aubio_priv.h 1 noinst_HEADERS = \ 2 aubio_priv.h \ 3 temporal/filter_priv.h 4 2 5 pkginclude_HEADERS = aubio.h \ 3 6 types.h \ 4 7 fvec.h \ 8 lvec.h \ 5 9 cvec.h \ 6 mathutils.h \ 10 mathutils.h 11 12 pkgincludeutilsdir = $(pkgincludedir)/utils 13 pkgincludetemporaldir = $(pkgincludedir)/temporal 14 pkgincludespectraldir = $(pkgincludedir)/spectral 15 pkgincludepitchdir = $(pkgincludedir)/pitch 16 pkgincludeonsetdir = $(pkgincludedir)/onset 17 pkgincludetempodir = $(pkgincludedir)/tempo 18 19 pkgincludeutils_HEADERS = \ 7 20 utils/hist.h \ 8 utils/scale.h \ 21 utils/scale.h 22 23 pkgincludetemporal_HEADERS = \ 9 24 temporal/resample.h \ 10 25 temporal/biquad.h \ 11 26 temporal/filter.h \ 27 temporal/adesign.h \ 28 temporal/cdesign.h 29 30 pkgincludespectral_HEADERS = \ 12 31 spectral/filterbank.h \ 13 spectral/mfcc. c\32 spectral/mfcc.h \ 14 33 spectral/phasevoc.h \ 15 34 spectral/fft.h \ 16 35 spectral/tss.h \ 17 spectral/spectral_centroid.h \ 36 spectral/spectral_centroid.h 37 38 pkgincludepitch_HEADERS = \ 18 39 pitch/pitchdetection.h \ 19 40 pitch/pitchmcomb.h \ … … 21 42 pitch/pitchschmitt.h \ 22 43 pitch/pitchfcomb.h \ 23 pitch/pitchyinfft.h \ 44 pitch/pitchyinfft.h 45 46 pkgincludeonset_HEADERS = \ 24 47 onset/onset.h \ 25 48 onset/onsetdetection.h \ 26 onset/peakpick.h \ 49 onset/peakpick.h 50 51 pkgincludetempo_HEADERS = \ 27 52 tempo/tempo.h \ 28 53 tempo/beattracking.h 29 54 30 nodist_pkginclude_HEADERS = config.h31 32 55 lib_LTLIBRARIES = libaubio.la 33 libaubio_la_SOURCES = aubio.h \ 34 types.h \ 56 libaubio_la_SOURCES = \ 35 57 fvec.c \ 36 fvec.h\58 lvec.c \ 37 59 cvec.c \ 38 cvec.h \39 60 mathutils.c \ 40 mathutils.h \41 61 utils/hist.c \ 42 utils/hist.h \43 62 utils/scale.c \ 44 utils/scale.h \45 63 temporal/resample.c \ 46 temporal/resample.h \47 64 temporal/biquad.c \ 48 temporal/biquad.h \49 65 temporal/filter.c \ 50 temporal/filter.h \ 66 temporal/adesign.c \ 67 temporal/cdesign.c \ 51 68 spectral/filterbank.c \ 52 spectral/filterbank.h \53 spectral/mfcc.h \54 69 spectral/mfcc.c \ 55 70 spectral/phasevoc.c \ 56 spectral/phasevoc.h \57 71 spectral/fft.c \ 58 spectral/fft.h \59 72 spectral/tss.c \ 60 spectral/tss.h \61 73 spectral/spectral_centroid.c \ 62 spectral/spectral_centroid.h \63 74 pitch/pitchdetection.c \ 64 pitch/pitchdetection.h \65 75 pitch/pitchmcomb.c \ 66 pitch/pitchmcomb.h \67 76 pitch/pitchyin.c \ 68 pitch/pitchyin.h \69 77 pitch/pitchschmitt.c \ 70 pitch/pitchschmitt.h \71 78 pitch/pitchfcomb.c \ 72 pitch/pitchfcomb.h \73 79 pitch/pitchyinfft.c \ 74 pitch/pitchyinfft.h \75 80 onset/onset.c \ 76 onset/onset.h \77 81 onset/onsetdetection.c \ 78 onset/onsetdetection.h \79 82 onset/peakpick.c \ 80 onset/peakpick.h \81 83 tempo/tempo.c \ 82 tempo/tempo.h \ 83 tempo/beattracking.c \ 84 tempo/beattracking.h 84 tempo/beattracking.c 85 85 86 86 AM_CFLAGS = @AUBIO_CFLAGS@ @FFTWLIB_CFLAGS@ @SAMPLERATE_CFLAGS@ -
src/aubio.h
rdddf1f5 r212da72 61 61 #include "fvec.h" 62 62 #include "cvec.h" 63 #include "lvec.h" 63 64 #include "mathutils.h" 64 65 #include "utils/scale.h" … … 68 69 #include "temporal/biquad.h" 69 70 #include "temporal/filter.h" 71 #include "temporal/adesign.h" 72 #include "temporal/cdesign.h" 70 73 #include "spectral/filterbank.h" 71 74 #include "spectral/mfcc.h" -
src/aubio_priv.h
rdddf1f5 r212da72 170 170 #define ELEM_SWAP(a,b) { register smpl_t t=(a);(a)=(b);(b)=t; } 171 171 172 #define ISDENORMAL(f) f < 1.e-37 173 172 174 #define UNUSED __attribute__((unused)) 173 175 -
src/pitch/pitchdetection.c
rdddf1f5 r212da72 22 22 #include "spectral/phasevoc.h" 23 23 #include "mathutils.h" 24 #include "temporal/ filter.h"24 #include "temporal/cdesign.h" 25 25 #include "pitch/pitchmcomb.h" 26 26 #include "pitch/pitchyin.h" … … 103 103 p->fftgrain = new_cvec(bufsize, channels); 104 104 p->mcomb = new_aubio_pitchmcomb(bufsize,hopsize,channels,samplerate); 105 p->filter = new_aubio_cdsgn_filter(samplerate );105 p->filter = new_aubio_cdsgn_filter(samplerate, channels); 106 106 p->callback = aubio_pitchdetection_mcomb; 107 107 break; -
src/spectral/fft.c
rdddf1f5 r212da72 155 155 spectrum->phas[i][0] = 0.; 156 156 for (j=1; j < spectrum->length - 1; j++) { 157 if (compspec->data[i][j] == 0.) spectrum->phas[i][j] = 0; 158 else 157 159 spectrum->phas[i][j] = atan2f(compspec->data[i][compspec->length-j], 158 160 compspec->data[i][j]); -
src/temporal/filter.c
rdddf1f5 r212da72 24 24 #include "aubio_priv.h" 25 25 #include "fvec.h" 26 #include "lvec.h" 26 27 #include "mathutils.h" 27 28 #include "temporal/filter.h" 29 #include "temporal/filter_priv.h" 28 30 29 struct _aubio_filter_t {30 uint_t order;31 lsmp_t * a;32 lsmp_t * b;33 lsmp_t * y;34 lsmp_t * x;35 };36 37 /* bug: mono only */38 31 void aubio_filter_do(aubio_filter_t * f, fvec_t * in) { 39 uint_t i,j,l, order = f->order; 40 lsmp_t *x = f->x; 41 lsmp_t *y = f->y; 42 lsmp_t *a = f->a; 43 lsmp_t *b = f->b; 44 i=0;//for (i=0;i<in->channels;i++) { 45 for (j = 0; j < in->length; j++) { 46 /* new input */ 47 //AUBIO_DBG("befor %f\t", in->data[i][j]); 48 x[0] = in->data[i][j]; 49 y[0] = b[0] * x[0]; 50 for (l=1;l<order; l++) { 51 y[0] += b[l] * x[l]; 52 y[0] -= a[l] * y[l]; 53 } /* + 1e-37; for denormal ? */ 54 /* new output */ 55 in->data[i][j] = y[0]; 56 //AUBIO_DBG("after %f\n", in->data[i][j]); 57 /* store states for next sample */ 58 for (l=order-1; l>0; l--){ 59 x[l] = x[l-1]; 60 y[l] = y[l-1]; 61 } 62 } 63 /* store states for next buffer */ 64 f->x = x; 65 f->y = y; 66 //} 32 aubio_filter_do_outplace(f, in, in); 67 33 } 68 34 69 35 void aubio_filter_do_outplace(aubio_filter_t * f, fvec_t * in, fvec_t * out) { 70 36 uint_t i,j,l, order = f->order; 71 lsmp_t *x = f->x;72 lsmp_t *y = f->y;73 lsmp_t *a = f->a ;74 lsmp_t *b = f->b ;37 lsmp_t *x; 38 lsmp_t *y; 39 lsmp_t *a = f->a->data[0]; 40 lsmp_t *b = f->b->data[0]; 75 41 76 i=0; // works in mono only !!! 77 //for (i=0;i<in->channels;i++) { 78 for (j = 0; j < in->length; j++) { 79 /* new input */ 80 x[0] = in->data[i][j]; 81 y[0] = b[0] * x[0]; 82 for (l=1;l<order; l++) { 83 y[0] += b[l] * x[l]; 84 y[0] -= a[l] * y[l]; 42 for (i = 0; i < in->channels; i++) { 43 x = f->x->data[i]; 44 y = f->y->data[i]; 45 for (j = 0; j < in->length; j++) { 46 /* new input */ 47 if (ISDENORMAL(in->data[i][j])) { 48 x[0] = y[0] = 0.; 49 } else { 50 x[0] = in->data[i][j]; 51 y[0] = b[0] * x[0]; 52 for (l=1;l<order; l++) { 53 y[0] += b[l] * x[l]; 54 y[0] -= a[l] * y[l]; 55 } 56 } 57 /* new output */ 58 out->data[i][j] = y[0]; 59 /* store for next sample */ 60 for (l=order-1; l>0; l--){ 61 x[l] = x[l-1]; 62 y[l] = y[l-1]; 63 } 85 64 } 86 // + 1e-37; 87 /* new output */ 88 out->data[i][j] = y[0]; 89 /* store for next sample */ 90 for (l=order-1; l>0; l--){ 91 x[l] = x[l-1]; 92 y[l] = y[l-1]; 93 } 65 /* store for next run */ 66 f->x->data[i] = x; 67 f->y->data[i] = y; 94 68 } 95 /* store for next run */96 f->x = x;97 f->y = y;98 //}99 69 } 100 70 … … 133 103 } 134 104 135 136 aubio_filter_t * new_aubio_adsgn_filter(uint_t samplerate) { 137 aubio_filter_t * f = new_aubio_filter(samplerate, 7); 138 lsmp_t * a = f->a; 139 lsmp_t * b = f->b; 140 /* uint_t l; */ 141 /* for now, 44100, adsgn */ 142 a[0] = 1.00000000000000000000000000000000000000000000000000000; 143 a[1] = -4.01957618111583236952810693765059113502502441406250000; 144 a[2] = 6.18940644292069386267485242569819092750549316406250000; 145 a[3] = -4.45319890354411640487342083360999822616577148437500000; 146 a[4] = 1.42084294962187751565352300531230866909027099609375000; 147 a[5] = -0.14182547383030480458998567883099894970655441284179688; 148 a[6] = 0.00435117723349511334451911181986361043527722358703613; 149 b[0] = 0.25574112520425740235907596797915175557136535644531250; 150 b[1] = -0.51148225040851391653973223583307117223739624023437500; 151 b[2] = -0.25574112520426162120656954357400536537170410156250000; 152 b[3] = 1.02296450081703405032840237254276871681213378906250000; 153 b[4] = -0.25574112520426051098354491841746494174003601074218750; 154 b[5] = -0.51148225040851369449512731080176308751106262207031250; 155 b[6] = 0.25574112520425729133677350546349771320819854736328125; 156 /* DBG: filter coeffs at creation time */ 157 /* 158 for (l=0; l<f->order; l++){ 159 AUBIO_DBG("a[%d]=\t%1.16f\tb[%d]=\t%1.16f\n",l,a[l],l,b[l]); 160 } 161 */ 162 f->a = a; 163 f->b = b; 164 return f; 165 } 166 167 aubio_filter_t * new_aubio_cdsgn_filter(uint_t samplerate) { 168 aubio_filter_t * f = new_aubio_filter(samplerate, 5); 169 lsmp_t * a = f->a; 170 lsmp_t * b = f->b; 171 /* uint_t l; */ 172 /* for now, 44100, cdsgn */ 173 a[0] = 1.000000000000000000000000000000000000000000000000000000000000; 174 a[1] = -2.134674963687040794013682898366823792457580566406250000000000; 175 a[2] = 1.279333533236063358273781886964570730924606323242187500000000; 176 a[3] = -0.149559846089396208945743182994192466139793395996093750000000; 177 a[4] = 0.004908700174624848651394604104325480875559151172637939453125; 178 b[0] = 0.217008561949218803377448239189106971025466918945312500000000; 179 b[1] = -0.000000000000000222044604925031308084726333618164062500000000; 180 b[2] = -0.434017123898438272888711253472138196229934692382812500000000; 181 b[3] = 0.000000000000000402455846426619245903566479682922363281250000; 182 b[4] = 0.217008561949218969910901932962588034570217132568359375000000; 183 /* DBG: filter coeffs at creation time */ 184 /* 185 for (l=0; l<f->order; l++){ 186 AUBIO_DBG("a[%d]=\t%1.16f\tb[%d]=\t%1.16f\n",l,a[l],l,b[l]); 187 } 188 */ 189 f->a = a; 190 f->b = b; 191 return f; 192 } 193 194 aubio_filter_t * new_aubio_filter(uint_t samplerate UNUSED, uint_t order) { 105 aubio_filter_t * new_aubio_filter(uint_t samplerate UNUSED, uint_t order, uint_t channels) { 195 106 aubio_filter_t * f = AUBIO_NEW(aubio_filter_t); 196 lsmp_t * x = f->x;197 lsmp_t * y = f->y;198 lsmp_t * a = f->a;199 lsmp_t * b = f->b;200 uint_t l;107 f->x = new_lvec(order, channels); 108 f->y = new_lvec(order, channels); 109 f->a = new_lvec(order, 1); 110 f->b = new_lvec(order, 1); 111 f->a->data[0][1] = 1.; 201 112 f->order = order; 202 a = AUBIO_ARRAY(lsmp_t,f->order);203 b = AUBIO_ARRAY(lsmp_t,f->order);204 x = AUBIO_ARRAY(lsmp_t,f->order);205 y = AUBIO_ARRAY(lsmp_t,f->order);206 /* initial states to zeros */207 for (l=0; l<f->order; l++){208 x[l] = 0.;209 y[l] = 0.;210 }211 f->x = x;212 f->y = y;213 f->a = a;214 f->b = b;215 113 return f; 216 114 } -
src/temporal/filter.h
rdddf1f5 r212da72 69 69 \param samplerate signal sampling rate 70 70 \param order order of the filter (number of coefficients) 71 \param channels number of channels to allocate 71 72 72 73 */ 73 aubio_filter_t * new_aubio_filter(uint_t samplerate, uint_t order); 74 /** create a new A-design filter 75 76 \param samplerate sampling-rate of the signal to filter 77 78 */ 79 aubio_filter_t * new_aubio_adsgn_filter(uint_t samplerate); 80 /** create a new C-design filter 81 82 \param samplerate sampling-rate of the signal to filter 83 84 */ 85 aubio_filter_t * new_aubio_cdsgn_filter(uint_t samplerate); 74 aubio_filter_t * new_aubio_filter(uint_t samplerate, uint_t order, uint_t channels); 86 75 /** delete a filter object 87 76 -
swig/aubio.i
rdddf1f5 r212da72 86 86 87 87 /* filter */ 88 extern aubio_filter_t * new_aubio_filter(uint_t samplerate, uint_t order); 89 extern aubio_filter_t * new_aubio_adsgn_filter(uint_t samplerate); 90 extern aubio_filter_t * new_aubio_cdsgn_filter(uint_t samplerate); 88 extern aubio_filter_t * new_aubio_filter(uint_t samplerate, uint_t order, uint_t channels); 91 89 extern void aubio_filter_do(aubio_filter_t * b, fvec_t * in); 92 90 extern void aubio_filter_do_outplace(aubio_filter_t * b, fvec_t * in, fvec_t * out); 93 91 extern void aubio_filter_do_filtfilt(aubio_filter_t * b, fvec_t * in, fvec_t * tmp); 94 /*extern int del_aubio_filter(aubio_filter_t * b);*/ 92 extern void del_aubio_filter(aubio_filter_t * b); 93 94 extern aubio_filter_t * new_aubio_adsgn_filter(uint_t samplerate, uint_t channels); 95 extern void aubio_adsgn_filter_do(aubio_filter_t * b, fvec_t * in); 96 extern void del_aubio_adsgn_filter(aubio_filter_t * b); 97 98 extern aubio_filter_t * new_aubio_cdsgn_filter(uint_t samplerate, uint_t channels); 99 extern void aubio_cdsgn_filter_do(aubio_filter_t * b, fvec_t * in); 100 extern void del_aubio_cdsgn_filter(aubio_filter_t * b); 95 101 96 102 /* biquad */ … … 168 174 169 175 /* scale */ 170 extern aubio_scale_t * new_aubio_scale(smpl_t flow, smpl_t fhig, smpl_t ilow, smpl_t ihig 176 extern aubio_scale_t * new_aubio_scale(smpl_t flow, smpl_t fhig, smpl_t ilow, smpl_t ihig); 171 177 extern void aubio_scale_set (aubio_scale_t *s, smpl_t ilow, smpl_t ihig, smpl_t olow, smpl_t ohig); 172 178 extern void aubio_scale_do(aubio_scale_t *s, fvec_t * input); … … 214 220 aubio_pitch_schmitt, 215 221 aubio_pitch_fcomb, 216 222 aubio_pitch_yinfft 217 223 } aubio_pitchdetection_type; 218 224 … … 231 237 232 238 aubio_pitchdetection_t * new_aubio_pitchdetection(uint_t bufsize, 233 234 235 236 237 239 uint_t hopsize, 240 uint_t channels, 241 uint_t samplerate, 242 aubio_pitchdetection_type type, 243 aubio_pitchdetection_mode mode); 238 244 239 245 … … 263 269 aubio_pickpeak_t * new_aubio_peakpicker(smpl_t threshold); 264 270 uint_t aubio_peakpick_pimrt(fvec_t * DF, aubio_pickpeak_t * p); 271 uint_t aubio_peakpick_pimrt_wt( fvec_t* DF, aubio_pickpeak_t* p, smpl_t* peakval ); 265 272 smpl_t aubio_peakpick_pimrt_getval(aubio_pickpeak_t* p); 266 uint_t aubio_peakpick_pimrt_wt( fvec_t* DF, aubio_pickpeak_t* p, smpl_t* peakval );267 273 void del_aubio_peakpicker(aubio_pickpeak_t * p); 274 void aubio_peakpicker_set_threshold(aubio_pickpeak_t * p, smpl_t threshold); 275 smpl_t aubio_peakpicker_get_threshold(aubio_pickpeak_t * p); 268 276 269 277 /* transient/steady state separation */ … … 475 483 sint_t aubio_midi_player_join(aubio_midi_player_t* player); 476 484 sint_t aubio_track_send_events(aubio_track_t* track, 477 /* aubio_synth_t* synth, */478 479 485 /* aubio_synth_t* synth, */ 486 aubio_midi_player_t* player, 487 uint_t ticks); 480 488 sint_t aubio_midi_send_event(aubio_midi_player_t* player, aubio_midi_event_t* event); 481 489 -
tests/demo/plot_mfcc_filterbank.py
rdddf1f5 r212da72 5 5 import sys 6 6 7 from aubio.aubiowrapper import *7 from localaubio import * 8 8 9 9 win_size = 2048 … … 14 14 filterbank = new_aubio_filterbank_mfcc(n_filters, win_size, samplerate, 15 15 0., samplerate) 16 17 16 18 17 mfcc_filters = [] -
tests/python/examples/aubioonset.py
rdddf1f5 r212da72 1 1 from template import * 2 2 3 class aubioonset_ test_case(program_test_case):3 class aubioonset_unit(program_test_case): 4 4 5 5 import os.path … … 24 24 self.getOutput() 25 25 # only one onset in woodblock.aiff 26 assert len(str(self.output)) != 0, "no output produced with command:\n"\27 + self.command28 assert len(self.output.split('\n')) == 126 self.assertNotEqual(0, len(str(self.output)), \ 27 "no output produced with command:\n" + self.command) 28 self.assertEqual(1, len(self.output.split('\n')) ) 29 29 # onset should be at 0.00000 30 assert float(self.output.strip()) == 0.30 self.assertEqual(0, float(self.output.strip())) 31 31 32 for name in ["energy", "specdiff", "hfc", "complex", "phase", "kl", "mkl"]: 33 exec("class aubioonset_test_case_"+name+"(aubioonset_test_case):\n\ 32 list_of_onset_modes = ["energy", "specdiff", "hfc", "complex", "phase", \ 33 "kl", "mkl", "specflux"] 34 35 for name in list_of_onset_modes: 36 exec("class aubioonset_"+name+"_unit(aubioonset_unit):\n\ 34 37 options = \" -O "+name+" \"") 35 38 -
tests/python/run_all_tests
rdddf1f5 r212da72 1 1 #! /usr/bin/python 2 3 # add ${src}/python and ${src}/python/aubio/.libs to python path4 # so the script is runnable from a compiled source tree.5 import sys, os6 7 cur_dir = os.path.dirname(sys.argv[0])8 sys.path.append(os.path.join(cur_dir,'..','..','python'))9 sys.path.append(os.path.join(cur_dir,'..','..','python','aubio','.libs'))10 2 11 3 import unittest … … 15 7 return [i.split('.')[0].replace('/','.') for i in glob(path)] 16 8 17 modules_to_test = list_of_test_files('*.py') 9 modules_to_test = [] 10 modules_to_test += list_of_test_files('src/*.py') 11 modules_to_test += list_of_test_files('src/*/*.py') 18 12 modules_to_test += list_of_test_files('examples/aubio*.py') 13 modules_to_test += list_of_test_files('*.py') 19 14 20 15 if __name__ == '__main__': -
tests/python/src/cvec.py
rdddf1f5 r212da72 1 import unittest 2 3 from aubio.aubiowrapper import * 1 from template import aubio_unit_template 2 from localaubio import * 4 3 5 4 buf_size = 2048 6 5 channels = 3 7 6 8 class cvec_ test_case(unittest.TestCase):7 class cvec_unit(aubio_unit_template): 9 8 10 9 def setUp(self): -
tests/python/src/fvec.py
rdddf1f5 r212da72 1 import unittest 2 3 from aubio.aubiowrapper import * 1 from template import aubio_unit_template 2 from localaubio import * 4 3 5 4 buf_size = 2048 6 5 channels = 3 7 6 8 class fvec_ test_case(unittest.TestCase):7 class fvec_unit(aubio_unit_template): 9 8 10 9 def setUp(self): -
tests/python/src/spectral/filterbank.py
rdddf1f5 r212da72 92 92 def testmfcc_channels(self): 93 93 """ check the values of each filters in the mfcc filterbank """ 94 import os.path 94 95 self.filterbank = new_aubio_filterbank_mfcc(n_filters, win_size, samplerate, 95 96 0., samplerate) 96 97 filterbank_mfcc = [ [float(f) for f in line.strip().split()] 97 for line in open( 'filterbank_mfcc.txt').readlines()]98 for line in open(os.path.join('src','spectral','filterbank_mfcc.txt')).readlines()] 98 99 for channel in range(n_filters): 99 100 vec = aubio_filterbank_getchannel(self.filterbank,channel) -
tests/python/template.py
rdddf1f5 r212da72 1 2 1 import unittest 3 2 … … 5 4 6 5 def assertCloseEnough(self, first, second, places=5, msg=None): 7 8 9 10 11 12 13 14 15 16 17 18 6 """Fail if the two objects are unequal as determined by their 7 *relative* difference rounded to the given number of decimal places 8 (default 7) and comparing to zero. 9 """ 10 if round(first, places) == 0: 11 if round(second-first, places) != 0: 12 raise self.failureException, \ 13 (msg or '%r != %r within %r places' % (first, second, places)) 14 else: 15 if round((second-first)/first, places) != 0: 16 raise self.failureException, \ 17 (msg or '%r != %r within %r places' % (first, second, places))
Note: See TracChangeset
for help on using the changeset viewer.