aboutsummaryrefslogtreecommitdiff
path: root/src/scalar.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/scalar.c')
-rw-r--r--src/scalar.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/scalar.c b/src/scalar.c
index 2e93934..4ae3f16 100644
--- a/src/scalar.c
+++ b/src/scalar.c
@@ -983,4 +983,15 @@ int xtract_wavelet_f0(const double *data, const int N, const void *argv, double
return XTRACT_SUCCESS;
}
+int xtract_midicent(const double *data, const int N, const void *argv, double *result)
+{
+ double f0 = *(double *)argv;
+ double note = 0.0;
+
+ note = 69 + log(f0 / 440.f) * 17.31234;
+ note *= 100;
+ note = round(note);
+
+ return XTRACT_SUCCESS;
+}