shithub: leaf

Download patch

ref: b48e5eb9db10d682829e6953b75f8b111bdbf292
parent: debdbb428d99c40ca143dc6d475d13d3e6f05d61
author: spiricom <jeff@snyderphonics.com>
date: Sun Feb 21 18:58:18 EST 2021

tLivingString2 tweaks

--- a/leaf/Src/leaf-distortion.c
+++ b/leaf/Src/leaf-distortion.c
@@ -318,7 +318,7 @@
     else if (ratio == 2 || ratio == 4  || ratio == 8 ||
         ratio == 16 || ratio == 32 || ratio == 64)
     {
-        os->ratio = os->maxRatio;
+        os->ratio = os->ratio;
         int idx = (int)(log2f(os->ratio))-1+os->offset;
         os->numTaps = __leaf_tablesize_firNumTaps[idx];
         os->phaseLength = os->numTaps / os->ratio;
--- a/leaf/Src/leaf-physical.c
+++ b/leaf/Src/leaf-physical.c
@@ -682,7 +682,7 @@
     LEAF* leaf = p->mempool->leaf;
 
     p->curr=0.0f;
-    tExpSmooth_initToPool(&p->wlSmooth, leaf->sampleRate/freq, 0.01f, mp); // smoother for string wavelength (not freq, to avoid expensive divisions)
+    tExpSmooth_initToPool(&p->wlSmooth, leaf->sampleRate/freq, 0.1f, mp); // smoother for string wavelength (not freq, to avoid expensive divisions)
     tLivingString2_setFreq(pl, freq);
     p->freq = freq;
     p->prepPos = prepPos;
@@ -691,7 +691,7 @@
     tExpSmooth_initToPool(&p->puSmooth, pickupPos, 0.01f, mp); // smoother for pickup position
     tLivingString2_setPickPos(pl, pickPos);
     tLivingString2_setPrepPos(pl, prepPos);
-    p->prepIndex=prepIndex;
+    p->prepIndex = prepIndex;
     p->pickupPos = pickupPos;
     tHermiteDelay_initToPool(&p->delLF,p->waveLengthInSamples, 2400, mp);
     tHermiteDelay_initToPool(&p->delUF,p->waveLengthInSamples, 2400, mp);
@@ -745,6 +745,7 @@
     LEAF* leaf = p->mempool->leaf;
     if (freq<20.f) freq=20.f;
     else if (freq>10000.f) freq=10000.f;
+    freq = freq*2;
     p->freq = freq;
     p->waveLengthInSamples = (leaf->sampleRate/freq) - 1;
     tExpSmooth_setDest(&p->wlSmooth, p->waveLengthInSamples);
@@ -754,6 +755,7 @@
 {
     _tLivingString2* p = *pl;
     LEAF* leaf = p->mempool->leaf;
+    waveLength = waveLength * 0.5f;
     if (waveLength<4.8f) waveLength=4.8f;
     else if (waveLength>2400.f) waveLength=2400.f;
     p->waveLengthInSamples = waveLength - 1;
@@ -926,13 +928,13 @@
     tHermiteDelay_setDelay(&p->delUF, upLen);
     tHermiteDelay_setDelay(&p->delUB, upLen);
 
-    /*
-    uint pickupPosInt;
+    
+    uint32_t pickupPosInt;
     float pickupOut = 0.0f;
-    if (pickupPos < 0.9f)
+    if (p->pickupPos < 0.98f)
     {
-        float fullPickupPos = (pickupPos*upLen);
-        pickupPosInt = (uint) fullPickupPos;
+        float fullPickupPos = (p->pickupPos*upLen);
+        pickupPosInt = (uint32_t) fullPickupPos;
         float pickupPosFloat = fullPickupPos - pickupPosInt;
         if (pickupPosInt == 0)
         {
@@ -939,14 +941,14 @@
             pickupPosInt = 1;
         }
         pickupOut = tHermiteDelay_tapOutInterpolated(&p->delUF, pickupPosInt, pickupPosFloat);
-        pickupOut += tHermiteDelay_tapOutInterpolated(&p->delUB, (uint) (upLen - pickupPosInt), pickupPosFloat);
+        pickupOut += tHermiteDelay_tapOutInterpolated(&p->delUB, (uint32_t) (upLen - pickupPosInt), pickupPosFloat);
         p->curr = pickupOut;
     }
     else
-    */
-    //{
+    
+    {
         p->curr = fromBridge;
-    //}
+    }
 
     //p->curr = fromBridge;
     //p->curr += fromNut;