shithub: leaf

Download patch

ref: 7e988acfc668efc5134163fa8da2774254ae4957
parent: bde763dda588782705c2447355de24431691a431
author: Matthew Wang <mjw7@princeton.edu>
date: Thu Feb 20 06:54:01 EST 2020

going back on perioddetection smoothing additions, don't really help

--- a/LEAF/Inc/leaf-analysis.h
+++ b/LEAF/Inc/leaf-analysis.h
@@ -217,13 +217,10 @@
         int iLast;
         int index;
         float period;
-        float smoothPeriod;
         
         uint16_t hopSize;
         uint16_t windowSize;
         uint8_t fba;
-    
-        tExpSmooth smooth;
         
         float timeConstant;
         float radius;
@@ -242,7 +239,6 @@
     
     float   tPeriodDetection_tick               (tPeriodDetection* const, float sample);
     float   tPeriodDetection_getPeriod          (tPeriodDetection* const);
-    void    tPeriodDetection_setSmoothAmount    (tPeriodDetection* const, float amount);
     void    tPeriodDetection_setHopSize         (tPeriodDetection* p, int hs);
     void    tPeriodDetection_setWindowSize      (tPeriodDetection* p, int ws);
     
--- a/LEAF/Inc/leaf-effects.h
+++ b/LEAF/Inc/leaf-effects.h
@@ -211,7 +211,6 @@
     void    tRetune_setTimeConstant (tRetune* const, float tc);
     void    tRetune_setHopSize      (tRetune* const, int hs);
     void    tRetune_setWindowSize   (tRetune* const, int ws);
-    void    tRetune_setSmoothAmount (tRetune* const, float smooth);
     float   tRetune_getInputPeriod  (tRetune* const);
     float   tRetune_getInputFreq    (tRetune* const);
     
@@ -254,7 +253,6 @@
     void    tAutotune_setTimeConstant   (tAutotune* const, float tc);
     void    tAutotune_setHopSize        (tAutotune* const, int hs);
     void    tAutotune_setWindowSize     (tAutotune* const, int ws);
-    void    tAutotune_setSmoothAmount   (tAutotune* const, float smooth);
     float   tAutotune_getInputPeriod    (tAutotune* const);
     float   tAutotune_getInputFreq      (tAutotune* const);
     
--- a/LEAF/Src/leaf-analysis.c
+++ b/LEAF/Src/leaf-analysis.c
@@ -870,8 +870,6 @@
     
     tSNAC_initToPool(&p->snac, DEFOVERLAP, mp);
     
-    tExpSmooth_initToPool(&p->smooth, 0.0f, 1.0f, mp);
-    
     p->timeConstant = DEFTIMECONSTANT;
     p->radius = expf(-1000.0f * p->hopSize * leaf.invSampleRate / p->timeConstant);
 }
@@ -883,7 +881,6 @@
     
     tEnvPD_freeFromPool(&p->env, mp);
     tSNAC_freeFromPool(&p->snac, mp);
-    tExpSmooth_freeFromPool(&p->smooth, mp);
     mpool_free(p, &m->pool);
 }
 
@@ -918,22 +915,13 @@
         if (p->lastBlock >= p->framesPerBuffer) p->lastBlock = 0;
     }
     
-    tExpSmooth_setDest(&p->smooth, p->period);
-    p->smoothPeriod = tExpSmooth_tick(&p->smooth);
-    return p->smoothPeriod;
+    return p->period;
 }
 
 float tPeriodDetection_getPeriod(tPeriodDetection* pd)
 {
     _tPeriodDetection* p = *pd;
-    return p->smoothPeriod;
-}
-
-void tPeriodDetection_setSmoothAmount(tPeriodDetection* pd, float amount)
-{
-    _tPeriodDetection* p = *pd;
-    LEAF_clip(0.0f, amount, 1.0f);
-    tExpSmooth_setFactor(&p->smooth, 1.0f - amount);
+    return p->period;
 }
 
 void tPeriodDetection_setHopSize(tPeriodDetection* pd, int hs)
--- a/LEAF/Src/leaf-effects.c
+++ b/LEAF/Src/leaf-effects.c
@@ -1096,8 +1096,7 @@
     }
     
     tPeriodDetection_initToPool(&r->pd, r->inBuffer, r->outBuffers[0], r->bufSize, r->frameSize, mp);
-    tPeriodDetection_setSmoothAmount(&r->pd, 0.0f);
-    
+
     for (int i = 0; i < r->numVoices; ++i)
     {
         tPitchShift_initToPool(&r->ps[i], &r->pd, r->outBuffers[i], r->bufSize, mp);
@@ -1207,12 +1206,6 @@
     tPeriodDetection_setWindowSize(&r->pd, r->windowSize);
 }
 
-void tRetune_setSmoothAmount(tRetune* const rt, float smooth)
-{
-    _tRetune* r = *rt;
-    tPeriodDetection_setSmoothAmount(&r->pd, smooth);
-}
-
 float tRetune_getInputPeriod(tRetune* const rt)
 {
     _tRetune* r = *rt;
@@ -1267,8 +1260,7 @@
     }
     
     tPeriodDetection_initToPool(&r->pd, r->inBuffer, r->outBuffers[0], r->bufSize, r->frameSize, mp);
-    tPeriodDetection_setSmoothAmount(&r->pd, 0.0f);
-    
+
     for (int i = 0; i < r->numVoices; ++i)
     {
         tPitchShift_initToPool(&r->ps[i], &r->pd, r->outBuffers[i], r->bufSize, mp);
@@ -1380,12 +1372,6 @@
     
     r->windowSize = ws;
     tPeriodDetection_setWindowSize(&r->pd, r->windowSize);
-}
-
-void tAutotune_setSmoothAmount(tAutotune* const rt, float smooth)
-{
-    _tAutotune* r = *rt;
-    tPeriodDetection_setSmoothAmount(&r->pd, smooth);
 }
 
 float tAutotune_getInputPeriod(tAutotune* const rt)