source: swig/aubio.i @ 449bff6

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 449bff6 was 61139c6, checked in by Paul Brossier <piem@piem.org>, 15 years ago

swig/aubio.i: add peakpicker again, alias for char_t, include config.h for HAVE_SNDFILE

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