diff options
| author | pp <pp@455248ca-bdda-0310-9134-f4ebb693071a> | 2008-03-22 16:56:08 +0000 |
|---|---|---|
| committer | pp <pp@455248ca-bdda-0310-9134-f4ebb693071a> | 2008-03-22 16:56:08 +0000 |
| commit | c77651dcdf11427071d69821d63b8de80874b7a2 (patch) | |
| tree | 58540adff3441dd55ec36a649fcfe01f6429200a /src/lingot-core.c | |
| parent | 65d7466d6f9f44b0c7104d941b0e89fdd6938920 (diff) | |
- experimental, very simple implementation of YIN fundamental frequency estimator
git-svn-id: https://lampka.siedziba.pl:790/svn/repos/lingot-win32@309 455248ca-bdda-0310-9134-f4ebb693071a
Diffstat (limited to 'src/lingot-core.c')
| -rw-r--r-- | src/lingot-core.c | 6 |
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++) { |
