feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/timestretchfix/ffmpeg5
Last change
on this file since 423a427 was
099776d,
checked in by Paul Brossier <piem@piem.org>, 6 years ago
|
[tests] increase pvoc coverage
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[40536fa] | 1 | #include <aubio.h> |
---|
[437fa65] | 2 | |
---|
[158e031] | 3 | int main (void) |
---|
[6938a20] | 4 | { |
---|
| 5 | uint_t n = 6; // compute n times |
---|
| 6 | uint_t win_s = 32; // window size |
---|
| 7 | uint_t hop_s = win_s / 4; // hop size |
---|
| 8 | |
---|
| 9 | fvec_t * in = new_fvec (hop_s); // input buffer |
---|
| 10 | cvec_t * fftgrain = new_cvec (win_s); // fft norm and phase |
---|
| 11 | fvec_t * out = new_fvec (hop_s); // output buffer |
---|
| 12 | |
---|
| 13 | // allocate fft and other memory space |
---|
| 14 | aubio_pvoc_t * pv = new_aubio_pvoc(win_s,hop_s); |
---|
| 15 | |
---|
[099776d] | 16 | if (new_aubio_pvoc(win_s, 0)) return 1; |
---|
| 17 | |
---|
| 18 | if (aubio_pvoc_get_win(pv) != win_s) return 1; |
---|
| 19 | if (aubio_pvoc_get_hop(pv) != hop_s) return 1; |
---|
| 20 | |
---|
| 21 | if (aubio_pvoc_set_window(pv, "hanningz") != 0) return 1; |
---|
| 22 | |
---|
[6938a20] | 23 | // fill input with some data |
---|
[c34336e] | 24 | fvec_set_all (in, 1.); |
---|
[6938a20] | 25 | fvec_print (in); |
---|
| 26 | |
---|
| 27 | while ( n-- ) { |
---|
| 28 | // get some fresh input data |
---|
| 29 | // .. |
---|
| 30 | |
---|
| 31 | // execute phase vocoder |
---|
| 32 | aubio_pvoc_do (pv,in,fftgrain); |
---|
| 33 | |
---|
| 34 | // do something with fftgrain |
---|
| 35 | // ... |
---|
| 36 | cvec_print (fftgrain); |
---|
| 37 | |
---|
[0184994] | 38 | // optionally rebuild the signal |
---|
[6938a20] | 39 | aubio_pvoc_rdo(pv,fftgrain,out); |
---|
| 40 | |
---|
| 41 | // and do something with the result |
---|
| 42 | // ... |
---|
| 43 | fvec_print (out); |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | // clean up |
---|
| 47 | del_fvec(in); |
---|
| 48 | del_cvec(fftgrain); |
---|
| 49 | del_fvec(out); |
---|
| 50 | del_aubio_pvoc(pv); |
---|
| 51 | aubio_cleanup(); |
---|
| 52 | |
---|
| 53 | return 0; |
---|
[437fa65] | 54 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.