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