Mercurial > hg > libxtract
changeset 207:5357a64124f1
Add MIDICENT to simpletest
author | Jamie Bullock <jamie@jamiebullock.com> |
---|---|
date | Tue, 11 Mar 2014 19:27:02 +0000 |
parents | c6488df9e5c0 |
children | d85e4b9aeb82 |
files | examples/simpletest/simpletest.c |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/examples/simpletest/simpletest.c Tue Mar 11 18:16:12 2014 +0000 +++ b/examples/simpletest/simpletest.c Tue Mar 11 19:27:02 2014 +0000 @@ -96,6 +96,7 @@ { double mean = 0.0; double f0 = 0.0; + double midicents = 0.0; double flux = 0.0; double centroid = 0.0; double lowest = 0.0; @@ -113,7 +114,9 @@ int rv = XTRACT_SUCCESS; xtract_mel_filter mel_filters; - fill_wavetable(344.53125f, NOISE); // 344.53125f = 128 samples @ 44100 Hz + // fill_wavetable(344.53125f, NOISE); // 344.53125f = 128 samples @ 44100 Hz + fill_wavetable(344.53125f, SINE); // 344.53125f = 128 samples @ 44100 Hz + /* print_wavetable(); */ @@ -122,6 +125,10 @@ xtract[XTRACT_WAVELET_F0](wavetable, BLOCKSIZE, &samplerate, &f0); printf("\nF0: %f\n", f0); + /* get the F0 as a MIDI note */ + xtract[XTRACT_MIDICENT](NULL, 0, &f0, &midicents); + printf("\nMIDI cents: %f\n", midicents); + /* get the mean of the input */ xtract[XTRACT_MEAN](wavetable, BLOCKSIZE, NULL, &mean); printf("\nInput mean = %.2f\n\n", mean); /* We expect this to be zero for a square wave */