shithub: leaf

Download patch

ref: 988a112df40013b5e426c4f5723d6de41114c942
parent: e28e39c0a93bee134f72005825280341e4470e35
author: mulshine <mulshine@princeton.edu>
date: Wed Jan 16 12:43:49 EST 2019

Dattorro reverb size changes smoothed out with tTapeDelay.

--- a/LEAF/Inc/leaf-delay.h
+++ b/LEAF/Inc/leaf-delay.h
@@ -140,7 +140,7 @@
 int         tTapeDelay_setDelay    (tTapeDelay*  const, float delay);
 float       tTapeDelay_getDelay    (tTapeDelay*  const);
 void        tTapeDelay_tapIn       (tTapeDelay*  const, float in, uint32_t tapDelay);
-float       tTapeDelay_tapOut      (tTapeDelay*  const, uint32_t tapDelay);
+float       tTapeDelay_tapOut      (tTapeDelay* const d, float tapDelay);
 float       tTapeDelay_addTo       (tTapeDelay*  const, float value, uint32_t tapDelay);
 float       tTapeDelay_tick        (tTapeDelay*  const, float sample);
 float       tTapeDelay_getLastOut  (tTapeDelay*  const);
--- a/LEAF/Inc/leaf-reverb.h
+++ b/LEAF/Inc/leaf-reverb.h
@@ -99,16 +99,16 @@
     f2_last;
     
     // INPUT
-    tDelayL     in_delay;
+    tTapeDelay  in_delay;
     tOnePole    in_filter;
     tAllpass    in_allpass[4];
     
     // FEEDBACK 1
     tAllpass    f1_allpass;
-    tDelayL     f1_delay_1;
+    tTapeDelay  f1_delay_1;
     tOnePole    f1_filter;
-    tDelayL     f1_delay_2;
-    tDelayL     f1_delay_3;
+    tTapeDelay  f1_delay_2;
+    tTapeDelay  f1_delay_3;
     tHighpass   f1_hp;
     
     tCycle      f1_lfo;
@@ -115,10 +115,10 @@
     
     // FEEDBACK 2
     tAllpass    f2_allpass;
-    tDelayL     f2_delay_1;
+    tTapeDelay  f2_delay_1;
     tOnePole    f2_filter;
-    tDelayL     f2_delay_2;
-    tDelayL     f2_delay_3;
+    tTapeDelay  f2_delay_2;
+    tTapeDelay  f2_delay_3;
     tHighpass   f2_hp;
     
     tCycle      f2_lfo;
--- a/LEAF/Src_cpp/leaf-delay.cpp
+++ b/LEAF/Src_cpp/leaf-delay.cpp
@@ -416,7 +416,7 @@
 {
     d->maxDelay = maxDelay;
     
-    d->delay = LEAF_clip(0.0f, delay, d->maxDelay);
+    d->delay = LEAF_clip(1.f, delay, d->maxDelay);
 
     d->buff = (float*) leaf_alloc(sizeof(float) * maxDelay);
     
@@ -430,7 +430,7 @@
     d->inPoint = 0;
     d->outPoint = 0;
     
-    tTapeDelay_setDelay(d, 1);
+    tTapeDelay_setDelay(d, 1.f);
 }
 
 void tTapeDelay_free(tTapeDelay* const d)
@@ -481,8 +481,7 @@
 
 int     tTapeDelay_setDelay (tTapeDelay* const d, float delay)
 {
-    d->delay = LEAF_clip(0.0f, delay,  d->maxDelay);
-    
+    d->delay = LEAF_clip(1.f, delay,  d->maxDelay);
     
     float outPointer = d->inPoint - d->delay;
     
--- a/LEAF/Src_cpp/leaf-reverb.cpp
+++ b/LEAF/Src_cpp/leaf-reverb.cpp
@@ -270,7 +270,7 @@
     r->t = r->size * leaf.sampleRate * 0.001f;
     
     // INPUT
-    tDelayL_init(&r->in_delay, 0.f, SAMP(200.f));
+    tTapeDelay_init(&r->in_delay, 0.f, SAMP(200.f));
     tOnePole_init(&r->in_filter, 1.f);
     
     for (int i = 0; i < 4; i++)
@@ -283,9 +283,9 @@
     tAllpass_init(&r->f1_allpass, SAMP(30.51f), SAMP(100.f)); // * r->size_max
     tAllpass_setGain(&r->f1_allpass, 0.7f);
     
-    tDelayL_init(&r->f1_delay_1, SAMP(141.69f), SAMP(200.0f) * r->size_max + 1);
-    tDelayL_init(&r->f1_delay_2, SAMP(89.24f), SAMP(100.0f) * r->size_max + 1);
-    tDelayL_init(&r->f1_delay_3, SAMP(125.f), SAMP(200.0f) * r->size_max + 1);
+    tTapeDelay_init(&r->f1_delay_1, SAMP(141.69f), SAMP(200.0f) * r->size_max + 1);
+    tTapeDelay_init(&r->f1_delay_2, SAMP(89.24f), SAMP(100.0f) * r->size_max + 1);
+    tTapeDelay_init(&r->f1_delay_3, SAMP(125.f), SAMP(200.0f) * r->size_max + 1);
     
     tOnePole_init(&r->f1_filter, 1.f);
     
@@ -298,9 +298,9 @@
     tAllpass_init(&r->f2_allpass, SAMP(22.58f), SAMP(100.f)); // * r->size_max
     tAllpass_setGain(&r->f2_allpass, 0.7f);
     
-    tDelayL_init(&r->f2_delay_1, SAMP(149.62f), SAMP(200.f) * r->size_max + 1);
-    tDelayL_init(&r->f2_delay_2, SAMP(60.48f), SAMP(100.f) * r->size_max + 1);
-    tDelayL_init(&r->f2_delay_3, SAMP(106.28f), SAMP(200.f) * r->size_max + 1);
+    tTapeDelay_init(&r->f2_delay_1, SAMP(149.62f), SAMP(200.f) * r->size_max + 1);
+    tTapeDelay_init(&r->f2_delay_2, SAMP(60.48f), SAMP(100.f) * r->size_max + 1);
+    tTapeDelay_init(&r->f2_delay_3, SAMP(106.28f), SAMP(200.f) * r->size_max + 1);
     
     tOnePole_init(&r->f2_filter, 1.f);
     
@@ -327,7 +327,7 @@
 void    tDattorro_free              (tDattorro* const r)
 {
     // INPUT
-    tDelayL_free(&r->in_delay);
+    tTapeDelay_free(&r->in_delay);
     tOnePole_free(&r->in_filter);
     
     for (int i = 0; i < 4; i++)
@@ -338,9 +338,9 @@
     // FEEDBACK 1
     tAllpass_free(&r->f1_allpass);
     
-    tDelayL_free(&r->f1_delay_1);
-    tDelayL_free(&r->f1_delay_2);
-    tDelayL_free(&r->f1_delay_3);
+    tTapeDelay_free(&r->f1_delay_1);
+    tTapeDelay_free(&r->f1_delay_2);
+    tTapeDelay_free(&r->f1_delay_3);
     
     tOnePole_free(&r->f1_filter);
     
@@ -349,9 +349,9 @@
     // FEEDBACK 2
     tAllpass_free(&r->f2_allpass);
     
-    tDelayL_free(&r->f2_delay_1);
-    tDelayL_free(&r->f2_delay_2);
-    tDelayL_free(&r->f2_delay_3);
+    tTapeDelay_free(&r->f2_delay_1);
+    tTapeDelay_free(&r->f2_delay_2);
+    tTapeDelay_free(&r->f2_delay_3);
     
     tOnePole_free(&r->f2_filter);
     
@@ -363,7 +363,7 @@
 float   tDattorro_tick              (tDattorro* const r, float input)
 {
     // INPUT
-    float in_sample = tDelayL_tick(&r->in_delay, input);
+    float in_sample = tTapeDelay_tick(&r->in_delay, input);
     
     in_sample = tOnePole_tick(&r->in_filter, in_sample);
     
@@ -379,13 +379,13 @@
     
     f1_sample = tAllpass_tick(&r->f1_allpass, f1_sample);
     
-    f1_sample = tDelayL_tick(&r->f1_delay_1, f1_sample);
+    f1_sample = tTapeDelay_tick(&r->f1_delay_1, f1_sample);
     
     f1_sample = tOnePole_tick(&r->f1_filter, f1_sample);
     
     f1_sample = f1_sample + r->f1_delay_2_last * 0.5f;
     
-    float f1_delay_2_sample = tDelayL_tick(&r->f1_delay_2, f1_sample * 0.5f);
+    float f1_delay_2_sample = tTapeDelay_tick(&r->f1_delay_2, f1_sample * 0.5f);
     
     r->f1_delay_2_last = f1_delay_2_sample;
     
@@ -395,7 +395,7 @@
     
     f1_sample *= r->feedback_gain;
     
-    r->f1_last = tDelayL_tick(&r->f1_delay_3, f1_sample);
+    r->f1_last = tTapeDelay_tick(&r->f1_delay_3, f1_sample);
     
     // FEEDBACK 2
     float f2_sample = in_sample + r->f1_last;
@@ -404,13 +404,13 @@
     
     f2_sample = tAllpass_tick(&r->f2_allpass, f2_sample);
     
-    f2_sample = tDelayL_tick(&r->f2_delay_1, f2_sample);
+    f2_sample = tTapeDelay_tick(&r->f2_delay_1, f2_sample);
     
     f2_sample = tOnePole_tick(&r->f2_filter, f2_sample);
     
     f2_sample = f2_sample + r->f2_delay_2_last * 0.5f;
     
-    float f2_delay_2_sample = tDelayL_tick(&r->f2_delay_2, f2_sample * 0.5f);
+    float f2_delay_2_sample = tTapeDelay_tick(&r->f2_delay_2, f2_sample * 0.5f);
     
     r->f2_delay_2_last = f2_delay_2_sample;
     
@@ -420,38 +420,38 @@
     
     f2_sample *= r->feedback_gain;
     
-    r->f2_last = tDelayL_tick(&r->f2_delay_3, f2_sample);
+    r->f2_last = tTapeDelay_tick(&r->f2_delay_3, f2_sample);
     
     
     // TAP OUT 1
-    f1_sample =     tDelayL_tapOut(&r->f1_delay_1, SAMP(8.9f)) +
-    tDelayL_tapOut(&r->f1_delay_1, SAMP(99.8f));
+    f1_sample =     tTapeDelay_tapOut(&r->f1_delay_1, SAMP(8.9f)) +
+    tTapeDelay_tapOut(&r->f1_delay_1, SAMP(99.8f));
     
-    f1_sample -=    tDelayL_tapOut(&r->f1_delay_2, SAMP(64.2f));
+    f1_sample -=    tTapeDelay_tapOut(&r->f1_delay_2, SAMP(64.2f));
     
-    f1_sample +=    tDelayL_tapOut(&r->f1_delay_3, SAMP(67.f));
+    f1_sample +=    tTapeDelay_tapOut(&r->f1_delay_3, SAMP(67.f));
     
-    f1_sample -=    tDelayL_tapOut(&r->f2_delay_1, SAMP(66.8f));
+    f1_sample -=    tTapeDelay_tapOut(&r->f2_delay_1, SAMP(66.8f));
     
-    f1_sample -=    tDelayL_tapOut(&r->f2_delay_2, SAMP(6.3f));
+    f1_sample -=    tTapeDelay_tapOut(&r->f2_delay_2, SAMP(6.3f));
     
-    f1_sample -=    tDelayL_tapOut(&r->f2_delay_3, SAMP(35.8f));
+    f1_sample -=    tTapeDelay_tapOut(&r->f2_delay_3, SAMP(35.8f));
     
     f1_sample *=    0.14f;
     
     // TAP OUT 2
-    f2_sample =     tDelayL_tapOut(&r->f2_delay_1, SAMP(11.8f)) +
-    tDelayL_tapOut(&r->f2_delay_1, SAMP(121.7f));
+    f2_sample =     tTapeDelay_tapOut(&r->f2_delay_1, SAMP(11.8f)) +
+    tTapeDelay_tapOut(&r->f2_delay_1, SAMP(121.7f));
     
-    f2_sample -=    tDelayL_tapOut(&r->f2_delay_2, SAMP(6.3f));
+    f2_sample -=    tTapeDelay_tapOut(&r->f2_delay_2, SAMP(6.3f));
     
-    f2_sample +=    tDelayL_tapOut(&r->f2_delay_3, SAMP(89.7f));
+    f2_sample +=    tTapeDelay_tapOut(&r->f2_delay_3, SAMP(89.7f));
     
-    f2_sample -=    tDelayL_tapOut(&r->f1_delay_1, SAMP(70.8f));
+    f2_sample -=    tTapeDelay_tapOut(&r->f1_delay_1, SAMP(70.8f));
     
-    f2_sample -=    tDelayL_tapOut(&r->f1_delay_2, SAMP(11.2f));
+    f2_sample -=    tTapeDelay_tapOut(&r->f1_delay_2, SAMP(11.2f));
     
-    f2_sample -=    tDelayL_tapOut(&r->f1_delay_3, SAMP(4.1f));
+    f2_sample -=    tTapeDelay_tapOut(&r->f1_delay_3, SAMP(4.1f));
     
     f2_sample *=    0.14f;
     
@@ -480,9 +480,9 @@
     // FEEDBACK 1
     //tAllpass_setDelay(&r->f1_allpass, SAMP(30.51f));
     
-    tDelayL_setDelay(&r->f1_delay_1, SAMP(141.69f));
-    tDelayL_setDelay(&r->f1_delay_2, SAMP(89.24f));
-    tDelayL_setDelay(&r->f1_delay_3, SAMP(125.f));
+    tTapeDelay_setDelay(&r->f1_delay_1, SAMP(141.69f));
+    tTapeDelay_setDelay(&r->f1_delay_2, SAMP(89.24f));
+    tTapeDelay_setDelay(&r->f1_delay_3, SAMP(125.f));
     
     // maybe change rate of SINE LFO's when size changes?
     
@@ -489,9 +489,9 @@
     // FEEDBACK 2
     //tAllpass_setDelay(&r->f2_allpass, SAMP(22.58f));
     
-    tDelayL_setDelay(&r->f2_delay_1, SAMP(149.62f));
-    tDelayL_setDelay(&r->f2_delay_2, SAMP(60.48f));
-    tDelayL_setDelay(&r->f2_delay_3, SAMP(106.28f));
+    tTapeDelay_setDelay(&r->f2_delay_1, SAMP(149.62f));
+    tTapeDelay_setDelay(&r->f2_delay_2, SAMP(60.48f));
+    tTapeDelay_setDelay(&r->f2_delay_3, SAMP(106.28f));
 }
 
 void    tDattorro_setInputDelay     (tDattorro* const r, float preDelay)
@@ -498,7 +498,7 @@
 {
     r->predelay = LEAF_clip(0.0f, preDelay, 200.0f);
     
-    tDelayL_setDelay(&r->in_delay, SAMP(r->predelay));
+    tTapeDelay_setDelay(&r->in_delay, SAMP(r->predelay));
 }
 
 void    tDattorro_setInputFilter    (tDattorro* const r, float freq)