[96fb8ad] | 1 | %module aubiowrapper |
---|
| 2 | |
---|
| 3 | %{ |
---|
| 4 | #include "aubio.h" |
---|
[740f06b] | 5 | %} |
---|
[96fb8ad] | 6 | |
---|
| 7 | /* type aliases */ |
---|
| 8 | typedef unsigned int uint_t; |
---|
| 9 | typedef int sint_t; |
---|
| 10 | typedef float smpl_t; |
---|
| 11 | |
---|
| 12 | /* fvec */ |
---|
[e5f49af] | 13 | fvec_t * new_fvec(uint_t length, uint_t channels); |
---|
| 14 | void del_fvec(fvec_t *s); |
---|
[96fb8ad] | 15 | smpl_t fvec_read_sample(fvec_t *s, uint_t channel, uint_t position); |
---|
| 16 | void fvec_write_sample(fvec_t *s, smpl_t data, uint_t channel, uint_t position); |
---|
| 17 | smpl_t * fvec_get_channel(fvec_t *s, uint_t channel); |
---|
| 18 | void fvec_put_channel(fvec_t *s, smpl_t * data, uint_t channel); |
---|
| 19 | smpl_t ** fvec_get_data(fvec_t *s); |
---|
| 20 | |
---|
| 21 | /* cvec */ |
---|
[e5f49af] | 22 | cvec_t * new_cvec(uint_t length, uint_t channels); |
---|
| 23 | void del_cvec(cvec_t *s); |
---|
| 24 | void cvec_write_norm(cvec_t *s, smpl_t data, uint_t channel, uint_t position); |
---|
| 25 | void cvec_write_phas(cvec_t *s, smpl_t data, uint_t channel, uint_t position); |
---|
| 26 | smpl_t cvec_read_norm(cvec_t *s, uint_t channel, uint_t position); |
---|
| 27 | smpl_t cvec_read_phas(cvec_t *s, uint_t channel, uint_t position); |
---|
| 28 | void cvec_put_norm_channel(cvec_t *s, smpl_t * data, uint_t channel); |
---|
| 29 | void cvec_put_phas_channel(cvec_t *s, smpl_t * data, uint_t channel); |
---|
| 30 | smpl_t * cvec_get_norm_channel(cvec_t *s, uint_t channel); |
---|
| 31 | smpl_t * cvec_get_phas_channel(cvec_t *s, uint_t channel); |
---|
| 32 | smpl_t ** cvec_get_norm(cvec_t *s); |
---|
| 33 | smpl_t ** cvec_get_phas(cvec_t *s); |
---|
[96fb8ad] | 34 | |
---|
| 35 | |
---|
| 36 | /* fft */ |
---|
[e5f49af] | 37 | aubio_fft_t * new_aubio_fft(uint_t size, uint_t channels); |
---|
| 38 | void del_aubio_fft(aubio_fft_t * s); |
---|
| 39 | void aubio_fft_do (aubio_fft_t *s, fvec_t * input, cvec_t * spectrum); |
---|
| 40 | void aubio_fft_rdo (aubio_fft_t *s, cvec_t * spectrum, fvec_t * output); |
---|
| 41 | void aubio_fft_do_complex (aubio_fft_t *s, fvec_t * input, fvec_t * compspec); |
---|
| 42 | void aubio_fft_rdo_complex (aubio_fft_t *s, fvec_t * compspec, fvec_t * output); |
---|
| 43 | void aubio_fft_get_spectrum(fvec_t * compspec, cvec_t * spectrum); |
---|
| 44 | void aubio_fft_get_realimag(cvec_t * spectrum, fvec_t * compspec); |
---|
| 45 | void aubio_fft_get_phas(fvec_t * compspec, cvec_t * spectrum); |
---|
| 46 | void aubio_fft_get_imag(cvec_t * spectrum, fvec_t * compspec); |
---|
| 47 | void aubio_fft_get_norm(fvec_t * compspec, cvec_t * spectrum); |
---|
| 48 | void aubio_fft_get_real(cvec_t * spectrum, fvec_t * compspec); |
---|
[ec10780] | 49 | |
---|
[96fb8ad] | 50 | /* filter */ |
---|
[59c046d] | 51 | aubio_filter_t * new_aubio_filter(uint_t order, uint_t channels); |
---|
[e5f49af] | 52 | void aubio_filter_do(aubio_filter_t * b, fvec_t * in); |
---|
| 53 | void aubio_filter_do_outplace(aubio_filter_t * b, fvec_t * in, fvec_t * out); |
---|
| 54 | void aubio_filter_do_filtfilt(aubio_filter_t * b, fvec_t * in, fvec_t * tmp); |
---|
| 55 | void del_aubio_filter(aubio_filter_t * b); |
---|
[4123f16] | 56 | |
---|
[68607fd] | 57 | /* a_weighting */ |
---|
[59c046d] | 58 | aubio_filter_t * new_aubio_filter_a_weighting (uint_t channels, uint_t samplerate); |
---|
| 59 | uint_t aubio_filter_set_a_weighting (aubio_filter_t * b, uint_t samplerate); |
---|
[4123f16] | 60 | |
---|
[68607fd] | 61 | /* c_weighting */ |
---|
[59c046d] | 62 | aubio_filter_t * new_aubio_filter_c_weighting (uint_t channels, uint_t samplerate); |
---|
| 63 | uint_t aubio_filter_set_c_weighting (aubio_filter_t * b, uint_t samplerate); |
---|
[96fb8ad] | 64 | |
---|
| 65 | /* biquad */ |
---|
[b01bd4a] | 66 | aubio_filter_t * new_aubio_filter_biquad(lsmp_t b1, lsmp_t b2, lsmp_t b3, lsmp_t a2, lsmp_t a3, uint_t channels); |
---|
| 67 | uint_t aubio_filter_set_biquad (aubio_filter_t * b, lsmp_t b1, lsmp_t b2, lsmp_t b3, lsmp_t a2, lsmp_t a3); |
---|
[96fb8ad] | 68 | |
---|
| 69 | /* mathutils */ |
---|
[74516f7] | 70 | fvec_t * new_aubio_window(char * wintype, uint_t size); |
---|
[28d8c4a] | 71 | smpl_t aubio_unwrap2pi (smpl_t phase); |
---|
| 72 | smpl_t aubio_bintomidi(smpl_t bin, smpl_t samplerate, smpl_t fftsize); |
---|
[79c2e52] | 73 | smpl_t aubio_miditobin(smpl_t midi, smpl_t samplerate, smpl_t fftsize); |
---|
[28d8c4a] | 74 | smpl_t aubio_bintofreq(smpl_t bin, smpl_t samplerate, smpl_t fftsize); |
---|
[79c2e52] | 75 | smpl_t aubio_freqtobin(smpl_t freq, smpl_t samplerate, smpl_t fftsize); |
---|
[28d8c4a] | 76 | smpl_t aubio_freqtomidi(smpl_t freq); |
---|
[79c2e52] | 77 | smpl_t aubio_miditofreq(smpl_t midi); |
---|
[96fb8ad] | 78 | uint_t aubio_silence_detection(fvec_t * ibuf, smpl_t threshold); |
---|
| 79 | smpl_t aubio_level_detection(fvec_t * ibuf, smpl_t threshold); |
---|
[5507e9d] | 80 | smpl_t aubio_zero_crossing_rate(fvec_t * input); |
---|
[bc4ba75] | 81 | |
---|
| 82 | /* mfcc */ |
---|
[adcf405] | 83 | aubio_mfcc_t * new_aubio_mfcc (uint_t win_s, uint_t samplerate, uint_t n_filters, uint_t n_coefs); |
---|
[bc4ba75] | 84 | void del_aubio_mfcc(aubio_mfcc_t *mf); |
---|
| 85 | void aubio_mfcc_do(aubio_mfcc_t *mf, cvec_t *in, fvec_t *out); |
---|
| 86 | |
---|
[96fb8ad] | 87 | /* resampling */ |
---|
[740f06b] | 88 | #if HAVE_SAMPLERATE |
---|
[e5f49af] | 89 | aubio_resampler_t * new_aubio_resampler(float ratio, uint_t type); |
---|
| 90 | void aubio_resampler_do (aubio_resampler_t *s, fvec_t * input, fvec_t * output); |
---|
| 91 | void del_aubio_resampler(aubio_resampler_t *s); |
---|
[740f06b] | 92 | #endif /* HAVE_SAMPLERATE */ |
---|
[96fb8ad] | 93 | |
---|
| 94 | /* pvoc */ |
---|
| 95 | aubio_pvoc_t * new_aubio_pvoc (uint_t win_s, uint_t hop_s, uint_t channels); |
---|
| 96 | void del_aubio_pvoc(aubio_pvoc_t *pv); |
---|
| 97 | void aubio_pvoc_do(aubio_pvoc_t *pv, fvec_t *in, cvec_t * fftgrain); |
---|
| 98 | void aubio_pvoc_rdo(aubio_pvoc_t *pv, cvec_t * fftgrain, fvec_t *out); |
---|
| 99 | |
---|
| 100 | /* pitch detection */ |
---|
[ca1abdd] | 101 | aubio_pitch_t *new_aubio_pitch (char *pitch_mode, |
---|
[fe163ad] | 102 | uint_t bufsize, uint_t hopsize, uint_t channels, uint_t samplerate); |
---|
[ca1abdd] | 103 | void aubio_pitch_do (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * obuf); |
---|
| 104 | uint_t aubio_pitch_set_tolerance(aubio_pitch_t *p, smpl_t thres); |
---|
| 105 | uint_t aubio_pitch_set_unit(aubio_pitch_t *p, char * pitch_unit); |
---|
| 106 | void del_aubio_pitch(aubio_pitch_t * p); |
---|
[8e8bc50] | 107 | |
---|
[740f06b] | 108 | /* tempo */ |
---|
| 109 | typedef struct _aubio_tempo_t aubio_tempo_t; |
---|
| 110 | aubio_tempo_t * new_aubio_tempo (char_t * mode, |
---|
| 111 | uint_t buf_size, uint_t hop_size, uint_t channels, uint_t samplerate); |
---|
| 112 | void aubio_tempo_do (aubio_tempo_t *o, fvec_t * input, fvec_t * tempo); |
---|
| 113 | uint_t aubio_tempo_set_silence(aubio_tempo_t * o, smpl_t silence); |
---|
| 114 | uint_t aubio_tempo_set_threshold(aubio_tempo_t * o, smpl_t threshold); |
---|
| 115 | smpl_t aubio_tempo_get_bpm(aubio_tempo_t * bt); |
---|
| 116 | smpl_t aubio_tempo_get_confidence(aubio_tempo_t * bt); |
---|
| 117 | void del_aubio_tempo(aubio_tempo_t * o); |
---|
| 118 | |
---|
| 119 | /* sndfile */ |
---|
| 120 | %{ |
---|
| 121 | #if HAVE_SNDFILE |
---|
| 122 | #include "sndfileio.h" |
---|
| 123 | %} |
---|
[e5f49af] | 124 | aubio_sndfile_t * new_aubio_sndfile_ro (const char * inputfile); |
---|
| 125 | aubio_sndfile_t * new_aubio_sndfile_wo(aubio_sndfile_t * existingfile, const char * outputname); |
---|
| 126 | void aubio_sndfile_info(aubio_sndfile_t * file); |
---|
| 127 | int aubio_sndfile_write(aubio_sndfile_t * file, int frames, fvec_t * write); |
---|
| 128 | int aubio_sndfile_read(aubio_sndfile_t * file, int frames, fvec_t * read); |
---|
| 129 | int del_aubio_sndfile(aubio_sndfile_t * file); |
---|
| 130 | uint_t aubio_sndfile_channels(aubio_sndfile_t * file); |
---|
| 131 | uint_t aubio_sndfile_samplerate(aubio_sndfile_t * file); |
---|
[740f06b] | 132 | %{ |
---|
| 133 | #endif /* HAVE_SNDFILE */ |
---|
| 134 | %} |
---|