shithub: leaf

Download patch

ref: bde763dda588782705c2447355de24431691a431
parent: bfd2c2b02f47612ce82a70fd668847a239760f07
author: Matthew Wang <mjw7@princeton.edu>
date: Thu Feb 20 06:35:17 EST 2020

add smoothing setters to retune and autotune

--- a/LEAF/Inc/leaf-effects.h
+++ b/LEAF/Inc/leaf-effects.h
@@ -211,6 +211,7 @@
     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);
     
@@ -253,6 +254,7 @@
     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-effects.c
+++ b/LEAF/Src/leaf-effects.c
@@ -1207,6 +1207,12 @@
     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;
@@ -1261,7 +1267,7 @@
     }
     
     tPeriodDetection_initToPool(&r->pd, r->inBuffer, r->outBuffers[0], r->bufSize, r->frameSize, mp);
-    tPeriodDetection_setSmoothAmount(&r->pd, 0.5f);
+    tPeriodDetection_setSmoothAmount(&r->pd, 0.0f);
     
     for (int i = 0; i < r->numVoices; ++i)
     {
@@ -1333,8 +1339,6 @@
         r->outBuffers[i] = (float*) leaf_alloc(sizeof(float) * r->bufSize);
         tPitchShift_init(&r->ps[i], &r->pd, r->outBuffers[i], r->bufSize);
     }
-    
-    
 }
 
 void tAutotune_setFreqs(tAutotune* const rt, float f)
@@ -1376,6 +1380,12 @@
     
     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)