aboutsummaryrefslogtreecommitdiff
path: root/examples/simpletest
diff options
context:
space:
mode:
authorJamie Bullock <jamie@jamiebullock.com>2014-03-11 19:27:02 +0000
committerJamie Bullock <jamie@jamiebullock.com>2014-03-11 19:27:02 +0000
commit1a10aeb992d34128acd3ff049adb0ce2677fd2a2 (patch)
tree9ec611aa9c8b6591be941655fd23077f417d291a /examples/simpletest
parent7ff52fb561fae91b83ba5b95436b38d3021a44b4 (diff)
downloadLibXtract-1a10aeb992d34128acd3ff049adb0ce2677fd2a2.tar.gz
LibXtract-1a10aeb992d34128acd3ff049adb0ce2677fd2a2.tar.bz2
LibXtract-1a10aeb992d34128acd3ff049adb0ce2677fd2a2.zip
Add MIDICENT to simpletest
Diffstat (limited to 'examples/simpletest')
-rw-r--r--examples/simpletest/simpletest.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/examples/simpletest/simpletest.c b/examples/simpletest/simpletest.c
index df068c2..50b45f8 100644
--- a/examples/simpletest/simpletest.c
+++ b/examples/simpletest/simpletest.c
@@ -96,6 +96,7 @@ int main(void)
{
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 main(void)
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 @@ int main(void)
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 */