summaryrefslogtreecommitdiffhomepage
path: root/src/lingot-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lingot-core.c')
-rw-r--r--src/lingot-core.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lingot-core.c b/src/lingot-core.c
index ef101ae..5f7584c 100644
--- a/src/lingot-core.c
+++ b/src/lingot-core.c
@@ -34,6 +34,7 @@
#include "lingot-signal.h"
#include "lingot-core.h"
#include "lingot-config.h"
+#include "lingot-yin.h"
LingotCore* lingot_core_new(LingotConfig* conf) {
@@ -272,6 +273,8 @@ void lingot_core_process(LingotCore* core) {
// ------------------------------------------
//
+ if (core->conf->estimator == 1) core->freq = core->conf->sample_rate / (FLT)core->conf->oversampling / yin(core);
+
// ----------------- TRANSFORMATION TO FREQUENCY DOMAIN ----------------
FLT _1_N2 = 1.0/(core->conf->fft_size*core->conf->fft_size);
@@ -308,11 +311,14 @@ void lingot_core_process(LingotCore* core) {
+ core->fft_out[i].i*core->fft_out[i].i)*_1_N2;
# endif
+
// representable piece
memcpy(core->X, core->spd_fft,
((core->conf->fft_size > 256) ? (core->conf->fft_size >> 1) : 256)
*sizeof(FLT));
+ if (core->conf->estimator == 1 ) return;
+
// truncated 2nd derivative esteem, to enhance peaks
core->diff2_spd_fft[0] = 0.0;
for (i = 1; i < (core->conf->fft_size >> 1) - 1; i++) {