feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change
on this file since bd1fa89 was
7e35b37,
checked in by Paul Brossier <piem@piem.org>, 12 years ago
|
tests/src/: improve examples
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | #include <aubio.h> |
---|
2 | #include "utils_tests.h" |
---|
3 | |
---|
4 | int main () |
---|
5 | { |
---|
6 | uint_t i, window_size = 16; // window size |
---|
7 | utils_init_random(); |
---|
8 | cvec_t * complex_vector = new_cvec (window_size); // input buffer |
---|
9 | uint_t rand_times = 4; |
---|
10 | |
---|
11 | while (rand_times -- ) { |
---|
12 | // fill with random phas and norm |
---|
13 | for ( i = 0; i < complex_vector->length; i++ ) { |
---|
14 | complex_vector->norm[i] = ( 2. / RAND_MAX * random() - 1. ); |
---|
15 | complex_vector->phas[i] = ( 2. / RAND_MAX * random() - 1. ) * M_PI; |
---|
16 | } |
---|
17 | // print the vector |
---|
18 | cvec_print(complex_vector); |
---|
19 | } |
---|
20 | |
---|
21 | // set all vector elements to `0` |
---|
22 | cvec_zeros(complex_vector); |
---|
23 | for ( i = 0; i < complex_vector->length; i++ ) { |
---|
24 | assert( complex_vector->norm[i] == 0. ); |
---|
25 | // assert( complex_vector->phas[i] == 0 ); |
---|
26 | } |
---|
27 | cvec_print(complex_vector); |
---|
28 | |
---|
29 | // set all vector elements to `1` |
---|
30 | cvec_ones(complex_vector); |
---|
31 | for ( i = 0; i < complex_vector->length; i++ ) { |
---|
32 | assert( complex_vector->norm[i] == 1. ); |
---|
33 | // assert( complex_vector->phas[i] == 0 ); |
---|
34 | } |
---|
35 | cvec_print(complex_vector); |
---|
36 | // destroy it |
---|
37 | del_cvec(complex_vector); |
---|
38 | return 0; |
---|
39 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.