shithub: leaf

Download patch

ref: 7156be01b28b4d4c7d688277a6db209526c5b43d
parent: b464e520d4564729572649948ad1eb40c11ade97
author: Matthew Wang <mjw7@princeton.edu>
date: Tue Feb 4 10:31:46 EST 2020

shared static init functions for use in init and initToPool

--- a/LEAF/Inc/leaf-reverb.h
+++ b/LEAF/Inc/leaf-reverb.h
@@ -31,6 +31,8 @@
         
         float inv_441;
         
+        int lengths[4];
+        
         tDelay allpassDelays[2];
         tDelay combDelay;
         float allpassCoeff;
@@ -63,6 +65,8 @@
         float mix, t60;
         
         float inv_sr, inv_441;
+        
+        int lengths[15];
         
         tLinearDelay allpassDelays[8];
         tLinearDelay combDelays[6];
--- a/LEAF/Inc/leaf-sampling.h
+++ b/LEAF/Inc/leaf-sampling.h
@@ -124,8 +124,6 @@
     void    tSampler_setStart           (tSampler* const, int32_t start);
     void    tSampler_setEnd             (tSampler* const, int32_t end);
 
-    static void handleStartEndChange    (tSampler* const sp);
-
     void 	tSampler_setCrossfadeLength (tSampler* const sp, uint32_t length);
     
     void    tSampler_setRate            (tSampler* const, float rate);
--- a/LEAF/Src/leaf-analysis.c
+++ b/LEAF/Src/leaf-analysis.c
@@ -21,10 +21,9 @@
 //===========================================================================
 /* Envelope Follower */
 //===========================================================================
-
-void    tEnvelopeFollower_init(tEnvelopeFollower* const ef, float attackThreshold, float decayCoeff)
+static void    envelopefollower_init(tEnvelopeFollower* const ef, float attackThreshold, float decayCoeff)
 {
-    _tEnvelopeFollower* e = *ef = (_tEnvelopeFollower*) leaf_alloc(sizeof(_tEnvelopeFollower));
+    _tEnvelopeFollower* e = *ef;
     
     e->y = 0.0f;
     e->a_thresh = attackThreshold;
@@ -31,10 +30,15 @@
     e->d_coeff = decayCoeff;
 }
 
+void    tEnvelopeFollower_init(tEnvelopeFollower* const ef, float attackThreshold, float decayCoeff)
+{
+    *ef = (_tEnvelopeFollower*) leaf_alloc(sizeof(_tEnvelopeFollower));
+    envelopefollower_init(ef, attackThreshold, decayCoeff);
+}
+
 void tEnvelopeFollower_free(tEnvelopeFollower* const ef)
 {
     _tEnvelopeFollower* e = *ef;
-    
     leaf_free(e);
 }
 
@@ -41,11 +45,8 @@
 void    tEnvelopeFollower_initToPool    (tEnvelopeFollower* const ef, float attackThreshold, float decayCoeff, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tEnvelopeFollower* e = *ef = (_tEnvelopeFollower*) mpool_alloc(sizeof(_tEnvelopeFollower), &m->pool);
-    
-    e->y = 0.0f;
-    e->a_thresh = attackThreshold;
-    e->d_coeff = decayCoeff;
+    *ef = (_tEnvelopeFollower*) mpool_alloc(sizeof(_tEnvelopeFollower), &m->pool);
+    envelopefollower_init(ef, attackThreshold, decayCoeff);
 }
 
 void    tEnvelopeFollower_freeFromPool  (tEnvelopeFollower* const ef, tMempool* const mp)
@@ -52,7 +53,6 @@
 {
     _tMempool* m = *mp;
     _tEnvelopeFollower* e = *ef;
-    
     mpool_free(e, &m->pool);
 }
 
@@ -89,9 +89,9 @@
 //===========================================================================
 /* Power Follower */
 //===========================================================================
-void    tPowerFollower_init(tPowerFollower* const pf, float factor)
+static void    powerfollower_init(tPowerFollower* const pf, float factor)
 {
-    _tPowerFollower* p = *pf = (_tPowerFollower*) leaf_alloc(sizeof(_tPowerFollower));
+    _tPowerFollower* p = *pf;
     
     p->curr=0.0f;
     p->factor=factor;
@@ -98,10 +98,15 @@
     p->oneminusfactor=1.0f-factor;
 }
 
+void    tPowerFollower_init(tPowerFollower* const pf, float factor)
+{
+    *pf = (_tPowerFollower*) leaf_alloc(sizeof(_tPowerFollower));
+    powerfollower_init(pf, factor);
+}
+
 void tPowerFollower_free(tPowerFollower* const pf)
 {
     _tPowerFollower* p = *pf;
-    
     leaf_free(p);
 }
 
@@ -108,11 +113,8 @@
 void    tPowerFollower_initToPool   (tPowerFollower* const pf, float factor, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tPowerFollower* p = *pf = (_tPowerFollower*) mpool_alloc(sizeof(_tPowerFollower), &m->pool);
-    
-    p->curr=0.0f;
-    p->factor=factor;
-    p->oneminusfactor=1.0f-factor;
+    *pf = (_tPowerFollower*) mpool_alloc(sizeof(_tPowerFollower), &m->pool);
+    powerfollower_init(pf, factor);
 }
 
 void    tPowerFollower_freeFromPool (tPowerFollower* const pf, tMempool* const mp)
@@ -119,7 +121,6 @@
 {
     _tMempool* m = *mp;
     _tPowerFollower* p = *pf;
-    
     mpool_free(p, &m->pool);
 }
 
@@ -153,10 +154,9 @@
 //===========================================================================
 /* ---------------- env~ - simple envelope follower. ----------------- */
 //===========================================================================
-
-void tEnvPD_init(tEnvPD* const xpd, int ws, int hs, int bs)
+static void envpd_init(tEnvPD* const xpd, int ws, int hs, int bs)
 {
-    _tEnvPD* x = *xpd = (_tEnvPD*) leaf_allocAndClear(sizeof(_tEnvPD));
+    _tEnvPD* x = *xpd;
     
     int period = hs, npoints = ws;
     
@@ -196,10 +196,15 @@
     // ~ ~ ~ ~ ~ ~ ~ ~
 }
 
+void tEnvPD_init(tEnvPD* const xpd, int ws, int hs, int bs)
+{
+    *xpd = (_tEnvPD*) leaf_allocAndClear(sizeof(_tEnvPD));
+    envpd_init(xpd, ws, hs, bs);
+}
+
 void tEnvPD_free (tEnvPD* const xpd)
 {
     _tEnvPD* x = *xpd;
-    
     leaf_free(x);
 }
 
@@ -206,44 +211,8 @@
 void    tEnvPD_initToPool       (tEnvPD* const xpd, int ws, int hs, int bs, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tEnvPD* x = *xpd = (_tEnvPD*) mpool_allocAndClear(sizeof(_tEnvPD), &m->pool);
-    
-    int period = hs, npoints = ws;
-    
-    int i;
-    
-    if (npoints < 1) npoints = 1024;
-    if (period < 1) period = npoints/2;
-    if (period < npoints / MAXOVERLAP + 1)
-        period = npoints / MAXOVERLAP + 1;
-    
-    x->x_npoints = npoints;
-    x->x_phase = 0;
-    x->x_period = period;
-    
-    x->windowSize = npoints;
-    x->hopSize = period;
-    x->blockSize = bs;
-    
-    for (i = 0; i < MAXOVERLAP; i++) x->x_sumbuf[i] = 0;
-    for (i = 0; i < npoints; i++)
-        x->buf[i] = (1.0f - cosf((2 * PI * i) / npoints))/npoints;
-    for (; i < npoints+INITVSTAKEN; i++) x->buf[i] = 0;
-    
-    x->x_f = 0;
-    
-    x->x_allocforvs = INITVSTAKEN;
-    
-    // ~ ~ ~ dsp ~ ~ ~
-    if (x->x_period % x->blockSize)
-    {
-        x->x_realperiod = x->x_period + x->blockSize - (x->x_period % x->blockSize);
-    }
-    else
-    {
-        x->x_realperiod = x->x_period;
-    }
-    // ~ ~ ~ ~ ~ ~ ~ ~
+    *xpd = (_tEnvPD*) mpool_allocAndClear(sizeof(_tEnvPD), &m->pool);
+    envpd_init(xpd, ws, hs, bs);
 }
 
 void    tEnvPD_freeFromPool     (tEnvPD* const xpd, tMempool* const mp)
@@ -250,7 +219,6 @@
 {
     _tMempool* m = *mp;
     _tEnvPD* x = *xpd;
-    
     mpool_free(x, &m->pool);
 }
 
@@ -458,11 +426,9 @@
 /******************************************************************************/
 /******************************** constructor, destructor *********************/
 /******************************************************************************/
-
-
-void tSNAC_init(tSNAC* const snac, int overlaparg)
+static void snac_init(tSNAC* const snac, int overlaparg)
 {
-    _tSNAC* s = *snac = (_tSNAC*) leaf_allocAndClear(sizeof(_tSNAC));
+    _tSNAC* s = *snac;
     
     s->biasfactor = DEFBIAS;
     s->timeindex = 0;
@@ -472,13 +438,18 @@
     s->minrms = DEFMINRMS;
     s->framesize = SNAC_FRAME_SIZE;
     
+    snac_biasbuf(snac);
+    tSNAC_setOverlap(snac, overlaparg);
+}
+
+void tSNAC_init(tSNAC* const snac, int overlaparg)
+{
+    _tSNAC* s = *snac = (_tSNAC*) leaf_allocAndClear(sizeof(_tSNAC));
     s->inputbuf = (float*) leaf_allocAndClear(sizeof(float) * SNAC_FRAME_SIZE);
     s->processbuf = (float*) leaf_allocAndClear(sizeof(float) * (SNAC_FRAME_SIZE * 2));
     s->spectrumbuf = (float*) leaf_allocAndClear(sizeof(float) * (SNAC_FRAME_SIZE / 2));
     s->biasbuf = (float*) leaf_allocAndClear(sizeof(float) * SNAC_FRAME_SIZE);
-    
-    snac_biasbuf(snac);
-    tSNAC_setOverlap(snac, overlaparg);
+    snac_init(snac, overlaparg);
 }
 
 void tSNAC_free(tSNAC* const snac)
@@ -496,22 +467,11 @@
 {
     _tMempool* m = *mp;
     _tSNAC* s = *snac = (_tSNAC*) mpool_alloc(sizeof(_tSNAC), &m->pool);
-    
-    s->biasfactor = DEFBIAS;
-    s->timeindex = 0;
-    s->periodindex = 0;
-    s->periodlength = 0.;
-    s->fidelity = 0.;
-    s->minrms = DEFMINRMS;
-    s->framesize = SNAC_FRAME_SIZE;
-
     s->inputbuf = (float*) mpool_allocAndClear(sizeof(float) * SNAC_FRAME_SIZE, &m->pool);
     s->processbuf = (float*) mpool_allocAndClear(sizeof(float) * (SNAC_FRAME_SIZE * 2), &m->pool);
     s->spectrumbuf = (float*) mpool_allocAndClear(sizeof(float) * (SNAC_FRAME_SIZE / 2), &m->pool);
     s->biasbuf = (float*) mpool_allocAndClear(sizeof(float) * SNAC_FRAME_SIZE, &m->pool);
-    
-    snac_biasbuf(snac);
-    tSNAC_setOverlap(snac, overlaparg);
+    snac_init(snac, overlaparg);
 }
 
 void    tSNAC_freeFromPool  (tSNAC* const snac, tMempool* const mp)
@@ -518,7 +478,6 @@
 {
     _tMempool* m = *mp;
     _tSNAC* s = *snac;
-    
     mpool_free(s->inputbuf, &m->pool);
     mpool_free(s->processbuf, &m->pool);
     mpool_free(s->spectrumbuf, &m->pool);
@@ -838,9 +797,9 @@
 //===========================================================================
 // PERIODDETECTION
 //===========================================================================
-void    tPeriodDetection_init    (tPeriodDetection* const pd, float* in, float* out, int bufSize, int frameSize)
+static void    perioddetection_init    (tPeriodDetection* const pd, float* in, float* out, int bufSize, int frameSize)
 {
-    _tPeriodDetection* p = *pd = (_tPeriodDetection*) leaf_allocAndClear(sizeof(_tPeriodDetection));
+    _tPeriodDetection* p = *pd;
     
     p->inBuffer = in;
     p->outBuffer = out;
@@ -855,18 +814,22 @@
     p->windowSize = DEFWINDOWSIZE;
     p->fba = FBA;
     
-    tEnvPD_init(&p->env, p->windowSize, p->hopSize, p->frameSize);
-    
-    tSNAC_init(&p->snac, DEFOVERLAP);
-    
     p->timeConstant = DEFTIMECONSTANT;
     p->radius = expf(-1000.0f * p->hopSize * leaf.invSampleRate / p->timeConstant);
 }
 
+void    tPeriodDetection_init    (tPeriodDetection* const pd, float* in, float* out, int bufSize, int frameSize)
+{
+    _tPeriodDetection* p = *pd = (_tPeriodDetection*) leaf_allocAndClear(sizeof(_tPeriodDetection));
+    perioddetection_init(pd, in, out, bufSize, frameSize);
+    
+    tEnvPD_init(&p->env, p->windowSize, p->hopSize, p->frameSize);
+    tSNAC_init(&p->snac, DEFOVERLAP);
+}
+
 void tPeriodDetection_free (tPeriodDetection* const pd)
 {
     _tPeriodDetection* p = *pd;
-    
     tEnvPD_free(&p->env);
     tSNAC_free(&p->snac);
     leaf_free(p);
@@ -876,26 +839,10 @@
 {
     _tMempool* m = *mp;
     _tPeriodDetection* p = *pd = (_tPeriodDetection*) mpool_allocAndClear(sizeof(_tPeriodDetection), &m->pool);
+    perioddetection_init(pd, in, out, bufSize, frameSize);
     
-    p->inBuffer = in;
-    p->outBuffer = out;
-    p->bufSize = bufSize;
-    p->frameSize = frameSize;
-    p->framesPerBuffer = p->bufSize / p->frameSize;
-    p->curBlock = 1;
-    p->lastBlock = 0;
-    p->index = 0;
-    
-    p->hopSize = DEFHOPSIZE;
-    p->windowSize = DEFWINDOWSIZE;
-    p->fba = FBA;
-    
     tEnvPD_initToPool(&p->env, p->windowSize, p->hopSize, p->frameSize, mp);
-    
     tSNAC_initToPool(&p->snac, DEFOVERLAP, mp);
-    
-    p->timeConstant = DEFTIMECONSTANT;
-    p->radius = expf(-1000.0f * p->hopSize * leaf.invSampleRate / p->timeConstant);
 }
 
 void    tPeriodDetection_freeFromPool       (tPeriodDetection* const pd, tMempool* const mp)
@@ -902,7 +849,6 @@
 {
     _tMempool* m = *mp;
     _tPeriodDetection* p = *pd;
-    
     tEnvPD_freeFromPool(&p->env, mp);
     tSNAC_freeFromPool(&p->snac, mp);
     mpool_free(p, &m->pool);
--- a/LEAF/Src/leaf-delay.c
+++ b/LEAF/Src/leaf-delay.c
@@ -19,31 +19,31 @@
 #endif
 
 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Delay ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ //
-void    tDelay_init (tDelay* const dl, uint32_t delay, uint32_t maxDelay)
+static void    delay_init (tDelay* const dl, uint32_t delay, uint32_t maxDelay)
 {
-    _tDelay* d = *dl = (_tDelay*) leaf_alloc(sizeof(_tDelay));
+    _tDelay* d = *dl;
     
     d->maxDelay = maxDelay;
-    
     d->delay = delay;
-    
-    d->buff = (float*) leaf_alloc(sizeof(float) * maxDelay);
-    
     d->inPoint = 0;
     d->outPoint = 0;
-    
     d->lastIn = 0.0f;
     d->lastOut = 0.0f;
-    
     d->gain = 1.0f;
     
     tDelay_setDelay(dl, d->delay);
 }
 
+void    tDelay_init (tDelay* const dl, uint32_t delay, uint32_t maxDelay)
+{
+    _tDelay* d = *dl = (_tDelay*) leaf_alloc(sizeof(_tDelay));
+    d->buff = (float*) leaf_alloc(sizeof(float) * maxDelay);
+    delay_init(dl, delay, maxDelay);
+}
+
 void tDelay_free(tDelay* const dl)
 {
     _tDelay* d = *dl;
-    
     leaf_free(d->buff);
     leaf_free(d);
 }
@@ -52,22 +52,8 @@
 {
     _tMempool* m = *mp;
     _tDelay* d = *dl = (_tDelay*) mpool_alloc(sizeof(_tDelay), &m->pool);
-    
-    d->maxDelay = maxDelay;
-    
-    d->delay = delay;
-    
     d->buff = (float*) mpool_alloc(sizeof(float) * maxDelay, &m->pool);
-    
-    d->inPoint = 0;
-    d->outPoint = 0;
-    
-    d->lastIn = 0.0f;
-    d->lastOut = 0.0f;
-    
-    d->gain = 1.0f;
-    
-    tDelay_setDelay(dl, d->delay);
+    delay_init(dl, delay, maxDelay);
 }
 
 void        tDelay_freeFromPool (tDelay* const dl, tMempool* const mp)
@@ -74,7 +60,6 @@
 {
     _tMempool* m = *mp;
     _tDelay* d = *dl;
-    
     mpool_free(d->buff, &m->pool);
     mpool_free(d, &m->pool);
 }
@@ -177,23 +162,19 @@
 }
 
 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ LinearDelay ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ //
-void   tLinearDelay_init (tLinearDelay* const dl, float delay, uint32_t maxDelay)
+static void   lineardelay_init (tLinearDelay* const dl, float delay, uint32_t maxDelay)
 {
-    _tLinearDelay* d = *dl = (_tLinearDelay*) leaf_alloc(sizeof(_tLinearDelay));
+    _tLinearDelay* d = *dl;
     
     d->maxDelay = maxDelay;
-
+    
     if (delay > maxDelay)   d->delay = maxDelay;
     else if (delay < 0.0f)  d->delay = 0.0f;
     else                    d->delay = delay;
     
-    d->buff = (float*) leaf_allocAndClear(sizeof(float) * maxDelay);
-    
     d->gain = 1.0f;
-    
     d->lastIn = 0.0f;
     d->lastOut = 0.0f;
-
     d->inPoint = 0;
     d->outPoint = 0;
     
@@ -200,10 +181,16 @@
     tLinearDelay_setDelay(dl, d->delay);
 }
 
+void   tLinearDelay_init (tLinearDelay* const dl, float delay, uint32_t maxDelay)
+{
+    _tLinearDelay* d = *dl = (_tLinearDelay*) leaf_alloc(sizeof(_tLinearDelay));
+    d->buff = (float*) leaf_allocAndClear(sizeof(float) * maxDelay);
+    lineardelay_init(dl, delay, maxDelay);
+}
+
 void tLinearDelay_free(tLinearDelay* const dl)
 {
     _tLinearDelay* d = *dl;
-    
     leaf_free(d->buff);
     leaf_free(d);
 }
@@ -212,24 +199,8 @@
 {
     _tMempool* m = *mp;
     _tLinearDelay* d = *dl = (_tLinearDelay*) mpool_alloc(sizeof(_tLinearDelay), &m->pool);
-    
-    d->maxDelay = maxDelay;
-    
-    if (delay > maxDelay)   d->delay = maxDelay;
-    else if (delay < 0.0f)  d->delay = 0.0f;
-    else                    d->delay = delay;
-    
-    d->buff = (float*) mpool_alloc(sizeof(float) * maxDelay, &m->pool);
-    
-    d->gain = 1.0f;
-    
-    d->lastIn = 0.0f;
-    d->lastOut = 0.0f;
-    
-    d->inPoint = 0;
-    d->outPoint = 0;
-    
-    tLinearDelay_setDelay(dl, d->delay);
+    d->buff = (float*) mpool_allocAndClear(sizeof(float) * maxDelay, &m->pool);
+    lineardelay_init(dl, delay, maxDelay);
 }
 
 void    tLinearDelay_freeFromPool(tLinearDelay* const dl, tMempool* const mp)
@@ -236,7 +207,6 @@
 {
     _tMempool* m = *mp;
     _tLinearDelay* d = *dl;
-    
     mpool_free(d->buff, &m->pool);
     mpool_free(d, &m->pool);
 }
@@ -248,8 +218,6 @@
 	{
 		d->buff[i] = 0;
 	}
-
-
 }
 
 float   tLinearDelay_tick (tLinearDelay* const dl, float input)
@@ -393,38 +361,37 @@
 }
 
 
-
-
-
 /// Hermite Interpolated Delay
 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ LinearDelay ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ //
-void   tHermiteDelay_init (tHermiteDelay* const dl, float delay, uint32_t maxDelay)
+static void   hermitedelay_init (tHermiteDelay* const dl, float delay, uint32_t maxDelay)
 {
-	_tHermiteDelay* d = *dl = (_tHermiteDelay*) leaf_alloc(sizeof(_tHermiteDelay));
-
+    _tHermiteDelay* d = *dl;
+    
     d->maxDelay = maxDelay;
-
+    
     if (delay > maxDelay)   d->delay = maxDelay;
     else if (delay < 0.0f)  d->delay = 0.0f;
     else                    d->delay = delay;
 
-    d->buff = (float*) leaf_alloc(sizeof(float) * maxDelay);
-
     d->gain = 1.0f;
-
     d->lastIn = 0.0f;
     d->lastOut = 0.0f;
-
     d->inPoint = 0;
     d->outPoint = 0;
-
+    
     tHermiteDelay_setDelay(dl, d->delay);
 }
 
+void   tHermiteDelay_init (tHermiteDelay* const dl, float delay, uint32_t maxDelay)
+{
+	_tHermiteDelay* d = *dl = (_tHermiteDelay*) leaf_alloc(sizeof(_tHermiteDelay));
+    d->buff = (float*) leaf_alloc(sizeof(float) * maxDelay);
+    hermitedelay_init(dl, delay, maxDelay);
+}
+
 void tHermiteDelay_free(tHermiteDelay* const dl)
 {
 	_tHermiteDelay* d = *dl;
-
     leaf_free(d->buff);
     leaf_free(d);
 }
@@ -433,24 +400,8 @@
 {
     _tMempool* m = *mp;
     _tHermiteDelay* d = *dl = (_tHermiteDelay*) mpool_alloc(sizeof(_tHermiteDelay), &m->pool);
-
-    d->maxDelay = maxDelay;
-
-    if (delay > maxDelay)   d->delay = maxDelay;
-    else if (delay < 0.0f)  d->delay = 0.0f;
-    else                    d->delay = delay;
-
     d->buff = (float*) mpool_alloc(sizeof(float) * maxDelay, &m->pool);
-
-    d->gain = 1.0f;
-
-    d->lastIn = 0.0f;
-    d->lastOut = 0.0f;
-
-    d->inPoint = 0;
-    d->outPoint = 0;
-
-    tHermiteDelay_setDelay(dl, d->delay);
+    hermitedelay_init(dl, delay, maxDelay);
 }
 
 void    tHermiteDelay_freeFromPool(tHermiteDelay* const dl, tMempool* const mp)
@@ -457,7 +408,6 @@
 {
     _tMempool* m = *mp;
     _tHermiteDelay* d = *dl;
-
     mpool_free(d->buff, &m->pool);
     mpool_free(d, &m->pool);
 }
@@ -470,8 +420,6 @@
 	{
 		d->buff[i] = 0;
 	}
-
-
 }
 
 float   tHermiteDelay_tick (tHermiteDelay* const dl, float input)
@@ -616,14 +564,10 @@
     return d->gain;
 }
 
-
-
-
-
 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ AllpassDelay ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ //
-void  tAllpassDelay_init (tAllpassDelay* const dl, float delay, uint32_t maxDelay)
+static void  allpass_init (tAllpassDelay* const dl, float delay, uint32_t maxDelay)
 {
-    _tAllpassDelay* d = *dl = (_tAllpassDelay*) leaf_alloc(sizeof(_tAllpassDelay));
+    _tAllpassDelay* d = *dl;
     
     d->maxDelay = maxDelay;
     
@@ -631,25 +575,25 @@
     else if (delay < 0.0f)  d->delay = 0.0f;
     else                    d->delay = delay;
     
-    d->buff = (float*) leaf_alloc(sizeof(float) * maxDelay);
-    
     d->gain = 1.0f;
-    
     d->lastIn = 0.0f;
     d->lastOut = 0.0f;
-    
     d->inPoint = 0;
     d->outPoint = 0;
-    
     tAllpassDelay_setDelay(dl, d->delay);
-    
     d->apInput = 0.0f;
 }
 
+void  tAllpassDelay_init (tAllpassDelay* const dl, float delay, uint32_t maxDelay)
+{
+    _tAllpassDelay* d = *dl = (_tAllpassDelay*) leaf_alloc(sizeof(_tAllpassDelay));
+    d->buff = (float*) leaf_alloc(sizeof(float) * maxDelay);
+    allpass_init(dl, delay, maxDelay);
+}
+
 void tAllpassDelay_free(tAllpassDelay* const dl)
 {
     _tAllpassDelay* d = *dl;
-    
     leaf_free(d->buff);
     leaf_free(d);
 }
@@ -658,26 +602,8 @@
 {
     _tMempool* m = *mp;
     _tAllpassDelay* d = *dl = (_tAllpassDelay*) mpool_alloc(sizeof(_tAllpassDelay), &m->pool);
-    
-    d->maxDelay = maxDelay;
-    
-    if (delay > maxDelay)   d->delay = maxDelay;
-    else if (delay < 0.0f)  d->delay = 0.0f;
-    else                    d->delay = delay;
-    
     d->buff = (float*) mpool_alloc(sizeof(float) * maxDelay, &m->pool);
-    
-    d->gain = 1.0f;
-    
-    d->lastIn = 0.0f;
-    d->lastOut = 0.0f;
-    
-    d->inPoint = 0;
-    d->outPoint = 0;
-    
-    tAllpassDelay_setDelay(dl, d->delay);
-    
-    d->apInput = 0.0f;
+    allpass_init(dl, delay, maxDelay);
 }
 
 void    tAllpassDelay_freeFromPool(tAllpassDelay* const dl, tMempool* const mp)
@@ -684,7 +610,6 @@
 {
     _tMempool* m = *mp;
     _tAllpassDelay* d = *dl;
-    
     mpool_free(d->buff, &m->pool);
     mpool_free(d, &m->pool);
 }
@@ -815,19 +740,14 @@
 }
 
 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ TapeDelay ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ //
-void   tTapeDelay_init (tTapeDelay* const dl, float delay, uint32_t maxDelay)
+static void   tapedelay_init (tTapeDelay* const dl, float delay, uint32_t maxDelay)
 {
-    _tTapeDelay* d = *dl = (_tTapeDelay*) leaf_alloc(sizeof(_tTapeDelay));
+    _tTapeDelay* d = *dl;
     
     d->maxDelay = maxDelay;
-
-    d->buff = (float*) leaf_alloc(sizeof(float) * maxDelay);
-    
     d->gain = 1.0f;
-    
     d->lastIn = 0.0f;
     d->lastOut = 0.0f;
-    
     d->idx = 0.0f;
     d->inc = 1.0f;
     d->inPoint = 0;
@@ -835,10 +755,16 @@
     tTapeDelay_setDelay(dl, delay);
 }
 
+void   tTapeDelay_init (tTapeDelay* const dl, float delay, uint32_t maxDelay)
+{
+    _tTapeDelay* d = *dl = (_tTapeDelay*) leaf_alloc(sizeof(_tTapeDelay));
+    d->buff = (float*) leaf_alloc(sizeof(float) * maxDelay);
+    tapedelay_init(dl, delay, maxDelay);
+}
+
 void tTapeDelay_free(tTapeDelay* const dl)
 {
     _tTapeDelay* d = *dl;
-    
     leaf_free(d->buff);
     leaf_free(d);
 }
@@ -847,21 +773,8 @@
 {
     _tMempool* m = *mp;
     _tTapeDelay* d = *dl = (_tTapeDelay*) mpool_alloc(sizeof(_tTapeDelay), &m->pool);
-    
-    d->maxDelay = maxDelay;
-    
     d->buff = (float*) mpool_alloc(sizeof(float) * maxDelay, &m->pool);
-    
-    d->gain = 1.0f;
-    
-    d->lastIn = 0.0f;
-    d->lastOut = 0.0f;
-    
-    d->idx = 0.0f;
-    d->inc = 1.0f;
-    d->inPoint = 0;
-    
-    tTapeDelay_setDelay(dl, delay);
+    tapedelay_init(dl, delay, maxDelay);
 }
 
 void    tTapeDelay_freeFromPool(tTapeDelay* const dl, tMempool* const mp)
@@ -868,7 +781,6 @@
 {
     _tMempool* m = *mp;
     _tTapeDelay* d = *dl;
-    
     mpool_free(d->buff, &m->pool);
     mpool_free(d, &m->pool);
 }
@@ -902,8 +814,8 @@
     
     if (d->idx >= d->maxDelay) d->idx = 0.0f;
 
-    if (d->lastOut)
-    return d->lastOut;
+    if (d->lastOut) return d->lastOut;
+    else return 0.0f;
 }
 
 void  tTapeDelay_incrementInPoint(tTapeDelay* const dl)
--- a/LEAF/Src/leaf-distortion.c
+++ b/LEAF/Src/leaf-distortion.c
@@ -25,10 +25,9 @@
 // Sample-Rate reducer
 //============================================================================================================
 
-
-void tSampleReducer_init(tSampleReducer* const sr)
+static void samplereducer_init(tSampleReducer* const sr)
 {
-    _tSampleReducer* s = *sr = (_tSampleReducer*) leaf_alloc(sizeof(_tSampleReducer));
+    _tSampleReducer* s = *sr;
     
     s->invRatio = 1.0f;
     s->hold = 0.0f;
@@ -35,10 +34,15 @@
     s->count = 0;
 }
 
+void tSampleReducer_init(tSampleReducer* const sr)
+{
+    *sr = (_tSampleReducer*) leaf_alloc(sizeof(_tSampleReducer));
+    samplereducer_init(sr);
+}
+
 void    tSampleReducer_free    (tSampleReducer* const sr)
 {
     _tSampleReducer* s = *sr;
-    
     leaf_free(s);
 }
 
@@ -45,11 +49,8 @@
 void    tSampleReducer_initToPool   (tSampleReducer* const sr, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tSampleReducer* s = *sr = (_tSampleReducer*) mpool_alloc(sizeof(_tSampleReducer), &m->pool);
-    
-    s->invRatio = 1.0f;
-    s->hold = 0.0f;
-    s->count = 0;
+    *sr = (_tSampleReducer*) mpool_alloc(sizeof(_tSampleReducer), &m->pool);
+    samplereducer_init(sr);
 }
 
 void    tSampleReducer_freeFromPool (tSampleReducer* const sr, tMempool* const mp)
@@ -56,7 +57,6 @@
 {
     _tMempool* m = *mp;
     _tSampleReducer* s = *sr;
-    
     mpool_free(s, &m->pool);
 }
 
@@ -85,10 +85,9 @@
 //============================================================================================================
 // Oversampler
 //============================================================================================================
-// Latency is equal to the phase length (numTaps / ratio)
-void tOversampler_init(tOversampler* const osr, int ratio, oBool extraQuality)
+static void oversampler_init(tOversampler* const osr, int ratio, oBool extraQuality)
 {
-    _tOversampler* os = *osr = (_tOversampler*) leaf_alloc(sizeof(_tOversampler));
+    _tOversampler* os = *osr;
     
     uint8_t offset = 0;
     if (extraQuality) offset = 6;
@@ -100,6 +99,17 @@
         os->numTaps = firNumTaps[idx];
         os->phaseLength = os->numTaps / os->ratio;
         os->pCoeffs = (float*) firCoeffs[idx];
+    }
+}
+
+// Latency is equal to the phase length (numTaps / ratio)
+void tOversampler_init(tOversampler* const osr, int ratio, oBool extraQuality)
+{
+    _tOversampler* os = *osr = (_tOversampler*) leaf_alloc(sizeof(_tOversampler));
+    oversampler_init(osr, ratio, extraQuality);
+    if (ratio == 2 || ratio == 4  ||
+        ratio == 8 || ratio == 16 ||
+        ratio == 32 || ratio == 64) {
         os->upState = leaf_alloc(sizeof(float) * os->numTaps * 2);
         os->downState = leaf_alloc(sizeof(float) * os->numTaps * 2);
     }
@@ -108,7 +118,6 @@
 void tOversampler_free(tOversampler* const osr)
 {
     _tOversampler* os = *osr;
-    
     leaf_free(os->upState);
     leaf_free(os->downState);
     leaf_free(os);
@@ -118,17 +127,10 @@
 {
     _tMempool* m = *mp;
     _tOversampler* os = *osr = (_tOversampler*) mpool_alloc(sizeof(_tOversampler), &m->pool);
-    
-    uint8_t offset = 0;
-    if (extraQuality) offset = 6;
+    oversampler_init(osr, ratio, extraQuality);
     if (ratio == 2 || ratio == 4  ||
         ratio == 8 || ratio == 16 ||
         ratio == 32 || ratio == 64) {
-        os->ratio = ratio;
-        int idx = (int)(log2f(os->ratio))-1+offset;
-        os->numTaps = firNumTaps[idx];
-        os->phaseLength = os->numTaps / os->ratio;
-        os->pCoeffs = (float*) firCoeffs[idx];
         os->upState = mpool_alloc(sizeof(float) * os->numTaps * 2, &m->pool);
         os->downState = mpool_alloc(sizeof(float) * os->numTaps * 2, &m->pool);
     }
@@ -138,7 +140,6 @@
 {
     _tMempool* m = *mp;
     _tOversampler* os = *osr;
-    
     mpool_free(os->upState, &m->pool);
     mpool_free(os->downState, &m->pool);
     mpool_free(os, &m->pool);
@@ -346,39 +347,40 @@
 //============================================================================================================
 // WAVEFOLDER
 //============================================================================================================
-
-
 //from the paper: Virtual Analog Model of the Lockhart Wavefolder
 //by Fabián Esqueda, Henri Pöntynen, Julian D. Parker and Stefan Bilbao
-
-void tLockhartWavefolder_init(tLockhartWavefolder* const wf)
+static void lockhartwavefolder_init(tLockhartWavefolder* const wf)
 {
-    _tLockhartWavefolder* w = *wf = (_tLockhartWavefolder*) leaf_alloc(sizeof(_tLockhartWavefolder));
+    _tLockhartWavefolder* w = *wf;
     
     w->Ln1 = 0.0;
     w->Fn1 = 0.0;
     w->xn1 = 0.0f;
-
+    
     w->RL = 7.5e3;
     w->R = 15e3;
     w->VT = 26e-3;
     w->Is = 10e-16;
-
+    
     w->a = 2.0*w->RL/w->R;
     w->b = (w->R+2.0*w->RL)/(w->VT*w->R);
     w->d = (w->RL*w->Is)/w->VT;
     w->half_a = 0.5 * w->a;
     w->longthing = (0.5*w->VT/w->b);
-
-
+    
     // Antialiasing error threshold
     w->thresh = 10e-10;
 }
 
+void tLockhartWavefolder_init(tLockhartWavefolder* const wf)
+{
+    *wf = (_tLockhartWavefolder*) leaf_alloc(sizeof(_tLockhartWavefolder));
+    lockhartwavefolder_init(wf);
+}
+
 void tLockhartWavefolder_free(tLockhartWavefolder* const wf)
 {
     _tLockhartWavefolder* w = *wf;
-    
     leaf_free(w);
 }
 
@@ -385,26 +387,8 @@
 void    tLockhartWavefolder_initToPool   (tLockhartWavefolder* const wf, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tLockhartWavefolder* w = *wf = (_tLockhartWavefolder*) mpool_alloc(sizeof(_tLockhartWavefolder), &m->pool);
-    
-    w->Ln1 = 0.0;
-    w->Fn1 = 0.0;
-    w->xn1 = 0.0f;
-    
-    w->RL = 7.5e3;
-    w->R = 15e3;
-    w->VT = 26e-3;
-    w->Is = 10e-16;
-    
-    w->a = 2.0*w->RL/w->R;
-    w->b = (w->R+2.0*w->RL)/(w->VT*w->R);
-    w->d = (w->RL*w->Is)/w->VT;
-    w->half_a = 0.5 * w->a;
-    w->longthing = (0.5*w->VT/w->b);
-    
-    
-    // Antialiasing error threshold
-    w->thresh = 10e-10;
+    *wf = (_tLockhartWavefolder*) mpool_alloc(sizeof(_tLockhartWavefolder), &m->pool);
+    lockhartwavefolder_init(wf);
 }
 
 void    tLockhartWavefolder_freeFromPool (tLockhartWavefolder* const wf, tMempool* const mp)
@@ -411,7 +395,6 @@
 {
     _tMempool* m = *mp;
     _tLockhartWavefolder* w = *wf;
-    
     mpool_free(w, &m->pool);
 }
 
@@ -488,19 +471,24 @@
 // CRUSHER
 //============================================================================================================
 #define SCALAR 5000.f
-
-void    tCrusher_init    (tCrusher* const cr)
+static void    crusher_init    (tCrusher* const cr)
 {
-    _tCrusher* c = *cr = (_tCrusher*) leaf_alloc(sizeof(_tCrusher));
+    _tCrusher* c = *cr;
     
     c->op = 4;
     c->div = SCALAR;
     c->rnd = 0.25f;
     c->srr = 0.25f;
-    tSampleReducer_init(&c->sReducer);
     c->gain = (c->div / SCALAR) * 0.7f + 0.3f;
 }
 
+void    tCrusher_init    (tCrusher* const cr)
+{
+    _tCrusher* c = *cr = (_tCrusher*) leaf_alloc(sizeof(_tCrusher));
+    crusher_init(cr);
+    tSampleReducer_init(&c->sReducer);
+}
+
 void    tCrusher_free    (tCrusher* const cr)
 {
     _tCrusher* c = *cr;
@@ -512,13 +500,8 @@
 {
     _tMempool* m = *mp;
     _tCrusher* c = *cr = (_tCrusher*) mpool_alloc(sizeof(_tCrusher), &m->pool);
-    
-    c->op = 4;
-    c->div = SCALAR;
-    c->rnd = 0.25f;
-    c->srr = 0.25f;
+    crusher_init(cr);
     tSampleReducer_initToPool(&c->sReducer, mp);
-    c->gain = (c->div / SCALAR) * 0.7f + 0.3f;
 }
 
 void    tCrusher_freeFromPool (tCrusher* const cr, tMempool* const mp)
--- a/LEAF/Src/leaf-dynamics.c
+++ b/LEAF/Src/leaf-dynamics.c
@@ -19,31 +19,9 @@
 //==============================================================================
 
 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Compressor ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ //
-
-/*
- tCompressor*    tCompressorInit(int tauAttack, int tauRelease)
- {
- tCompressor* c = &leaf.tCompressorRegistry[leaf.registryIndex[T_COMPRESSOR]++];
- 
- c->tauAttack = tauAttack;
- c->tauRelease = tauRelease;
- 
- c->x_G[0] = 0.0f, c->x_G[1] = 0.0f,
- c->y_G[0] = 0.0f, c->y_G[1] = 0.0f,
- c->x_T[0] = 0.0f, c->x_T[1] = 0.0f,
- c->y_T[0] = 0.0f, c->y_T[1] = 0.0f;
- 
- c->T = 0.0f; // Threshold
- c->R = 1.0f; // compression Ratio
- c->M = 0.0f; // decibel Make-up gain
- c->W = 0.0f; // decibel Width of knee transition
- 
- return c;
- }
- */
-void    tCompressor_init(tCompressor* const comp)
+static void    compressor_init(tCompressor* const comp)
 {
-    _tCompressor* c = *comp = (_tCompressor*) leaf_alloc(sizeof(_tCompressor));
+    _tCompressor* c = *comp;
     
     c->tauAttack = 100;
     c->tauRelease = 100;
@@ -56,10 +34,15 @@
     c->W = 1.0f; // decibel Make-up gain
 }
 
+void    tCompressor_init(tCompressor* const comp)
+{
+    *comp = (_tCompressor*) leaf_alloc(sizeof(_tCompressor));
+    compressor_init(comp);
+}
+
 void tCompressor_free(tCompressor* const comp)
 {
     _tCompressor* c = *comp;
-    
     leaf_free(c);
 }
 
@@ -66,17 +49,8 @@
 void    tCompressor_initToPool  (tCompressor* const comp, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tCompressor* c = *comp = (_tCompressor*) mpool_alloc(sizeof(_tCompressor), &m->pool);
-    
-    c->tauAttack = 100;
-    c->tauRelease = 100;
-    
-    c->isActive = OFALSE;
-    
-    c->T = 0.0f; // Threshold
-    c->R = 0.5f; // compression Ratio
-    c->M = 3.0f; // decibel Width of knee transition
-    c->W = 1.0f; // decibel Make-up gain
+    *comp = (_tCompressor*) mpool_alloc(sizeof(_tCompressor), &m->pool);
+    compressor_init(comp);
 }
 
 void    tCompressor_freeFromPool(tCompressor* const comp, tMempool* const mp)
@@ -83,7 +57,6 @@
 {
     _tMempool* m = *mp;
     _tCompressor* c = *comp;
-    
     mpool_free(c, &m->pool);
 }
 
@@ -137,22 +110,26 @@
 }
 
 /* Feedback Leveler */
-
-void    tFeedbackLeveler_init(tFeedbackLeveler* const fb, float targetLevel, float factor, float strength, int mode)
+static void    feedbackleveler_init(tFeedbackLeveler* const fb, float targetLevel, float factor, float strength, int mode)
 {
-    _tFeedbackLeveler* p = *fb = (_tFeedbackLeveler*) leaf_alloc(sizeof(_tFeedbackLeveler));
+    _tFeedbackLeveler* p = *fb;
     
     p->curr=0.0f;
     p->targetLevel=targetLevel;
-    tPowerFollower_init(&p->pwrFlw,factor);
     p->mode=mode;
     p->strength=strength;
 }
 
+void    tFeedbackLeveler_init(tFeedbackLeveler* const fb, float targetLevel, float factor, float strength, int mode)
+{
+    _tFeedbackLeveler* p = *fb = (_tFeedbackLeveler*) leaf_alloc(sizeof(_tFeedbackLeveler));
+    feedbackleveler_init(fb, targetLevel, factor, strength, mode);
+    tPowerFollower_init(&p->pwrFlw,factor);
+}
+
 void tFeedbackLeveler_free(tFeedbackLeveler* const fb)
 {
     _tFeedbackLeveler* p = *fb;
-    
     tPowerFollower_free(&p->pwrFlw);
     leaf_free(p);
 }
@@ -161,12 +138,8 @@
 {
     _tMempool* m = *mp;
     _tFeedbackLeveler* p = *fb = (_tFeedbackLeveler*) mpool_alloc(sizeof(_tFeedbackLeveler), &m->pool);
-    
-    p->curr=0.0f;
-    p->targetLevel=targetLevel;
-    tPowerFollower_initToPool(&p->pwrFlw,factor, mp);
-    p->mode=mode;
-    p->strength=strength;
+    feedbackleveler_init(fb, targetLevel, factor, strength, mode);
+    tPowerFollower_init(&p->pwrFlw,factor);
 }
 
 void    tFeedbackLeveler_freeFromPool   (tFeedbackLeveler* const fb, tMempool* const mp)
@@ -173,7 +146,6 @@
 {
     _tMempool* m = *mp;
     _tFeedbackLeveler* p = *fb;
-    
     tPowerFollower_freeFromPool(&p->pwrFlw, mp);
     mpool_free(p, &m->pool);
 }
--- a/LEAF/Src/leaf-effects.c
+++ b/LEAF/Src/leaf-effects.c
@@ -18,17 +18,13 @@
 
 #endif
 
-
-
 //============================================================================================================
 // TALKBOX
 //============================================================================================================
-
-void tTalkbox_init(tTalkbox* const voc, int bufsize)
+static void talkbox_init(tTalkbox* const voc, int bufsize)
 {
+    _tTalkbox* v = *voc;
     
-    _tTalkbox* v = *voc = (_tTalkbox*) leaf_alloc(sizeof(_tTalkbox));
-    
     v->param[0] = 0.5f;  //wet
     v->param[1] = 0.0f;  //dry
     v->param[2] = 0; // Swap
@@ -36,26 +32,29 @@
     
     v->bufsize = bufsize;
     
-    v->car0 =   (float*) leaf_alloc(sizeof(float) * v->bufsize);
-    v->car1 =   (float*) leaf_alloc(sizeof(float) * v->bufsize);
-    v->window = (float*) leaf_alloc(sizeof(float) * v->bufsize);
-    v->buf0 =   (float*) leaf_alloc(sizeof(float) * v->bufsize);
-    v->buf1 =   (float*) leaf_alloc(sizeof(float) * v->bufsize);
-    
     tTalkbox_update(voc);
     tTalkbox_suspend(voc);
 }
 
+void tTalkbox_init(tTalkbox* const voc, int bufsize)
+{
+    _tTalkbox* v = *voc = (_tTalkbox*) leaf_alloc(sizeof(_tTalkbox));
+    v->car0 =   (float*) leaf_alloc(sizeof(float) * bufsize);
+    v->car1 =   (float*) leaf_alloc(sizeof(float) * bufsize);
+    v->window = (float*) leaf_alloc(sizeof(float) * bufsize);
+    v->buf0 =   (float*) leaf_alloc(sizeof(float) * bufsize);
+    v->buf1 =   (float*) leaf_alloc(sizeof(float) * bufsize);
+    talkbox_init(voc, bufsize);
+}
+
 void tTalkbox_free(tTalkbox* const voc)
 {
     _tTalkbox* v = *voc;
-    
     leaf_free(v->buf1);
     leaf_free(v->buf0);
     leaf_free(v->window);
     leaf_free(v->car1);
     leaf_free(v->car0);
-    
     leaf_free(v);
 }
 
@@ -63,22 +62,12 @@
 {
     _tMempool* m = *mp;
     _tTalkbox* v = *voc = (_tTalkbox*) mpool_alloc(sizeof(_tTalkbox), &m->pool);
-    
-    v->param[0] = 0.5f;  //wet
-    v->param[1] = 0.0f;  //dry
-    v->param[2] = 0; // Swap
-    v->param[3] = 1.0f;  //quality
-    
-    v->bufsize = bufsize;
-    
-    v->car0 =   (float*) mpool_alloc(sizeof(float) * v->bufsize, &m->pool);
-    v->car1 =   (float*) mpool_alloc(sizeof(float) * v->bufsize, &m->pool);
-    v->window = (float*) mpool_alloc(sizeof(float) * v->bufsize, &m->pool);
-    v->buf0 =   (float*) mpool_alloc(sizeof(float) * v->bufsize, &m->pool);
-    v->buf1 =   (float*) mpool_alloc(sizeof(float) * v->bufsize, &m->pool);
-    
-    tTalkbox_update(voc);
-    tTalkbox_suspend(voc);
+    v->car0 =   (float*) mpool_alloc(sizeof(float) * bufsize, &m->pool);
+    v->car1 =   (float*) mpool_alloc(sizeof(float) * bufsize, &m->pool);
+    v->window = (float*) mpool_alloc(sizeof(float) * bufsize, &m->pool);
+    v->buf0 =   (float*) mpool_alloc(sizeof(float) * bufsize, &m->pool);
+    v->buf1 =   (float*) mpool_alloc(sizeof(float) * bufsize, &m->pool);
+    talkbox_init(voc, bufsize);
 }
 
 void    tTalkbox_freeFromPool   (tTalkbox* const voc, tMempool* const mp)
@@ -85,13 +74,11 @@
 {
     _tMempool* m = *mp;
     _tTalkbox* v = *voc;
-    
     mpool_free(v->buf1, &m->pool);
     mpool_free(v->buf0, &m->pool);
     mpool_free(v->window, &m->pool);
     mpool_free(v->car1, &m->pool);
     mpool_free(v->car0, &m->pool);
-    
     mpool_free(v, &m->pool);
 }
 
@@ -279,9 +266,9 @@
 // VOCODER
 //============================================================================================================
 
-void   tVocoder_init        (tVocoder* const voc)
+static void   vocoder_init        (tVocoder* const voc)
 {
-    _tVocoder* v = *voc = (_tVocoder*) leaf_alloc(sizeof(_tVocoder));
+    _tVocoder* v = *voc;
     
     v->param[0] = 0.33f;  //input select
     v->param[1] = 0.50f;  //output dB
@@ -295,10 +282,15 @@
     tVocoder_update(voc);
 }
 
+void   tVocoder_init        (tVocoder* const voc)
+{
+    *voc = (_tVocoder*) leaf_alloc(sizeof(_tVocoder));
+    vocoder_init(voc);
+}
+
 void tVocoder_free (tVocoder* const voc)
 {
     _tVocoder* v = *voc;
-    
     leaf_free(v);
 }
 
@@ -305,18 +297,8 @@
 void    tVocoder_initToPool     (tVocoder* const voc, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tVocoder* v = *voc = (_tVocoder*) mpool_alloc(sizeof(_tVocoder), &m->pool);
-    
-    v->param[0] = 0.33f;  //input select
-    v->param[1] = 0.50f;  //output dB
-    v->param[2] = 0.40f;  //hi thru
-    v->param[3] = 0.40f;  //hi band
-    v->param[4] = 0.16f;  //envelope
-    v->param[5] = 0.55f;  //filter q
-    v->param[6] = 0.6667f;//freq range
-    v->param[7] = 0.33f;  //num bands
-    
-    tVocoder_update(voc);
+    *voc = (_tVocoder*) mpool_alloc(sizeof(_tVocoder), &m->pool);
+    vocoder_init(voc);
 }
 
 void    tVocoder_freeFromPool   (tVocoder* const voc, tMempool* const mp)
@@ -323,7 +305,6 @@
 {
     _tMempool* m = *mp;
     _tVocoder* v = *voc;
-    
     mpool_free(v, &m->pool);
 }
 
@@ -873,9 +854,9 @@
     return (p->fba == 0 && (p->max > 60 && p->deltamax > 6)) ? 1 : 0;
 }
 
-void tPitchShift_init (tPitchShift* const psr, tPeriodDetection* pd, float* out, int bufSize)
+static void pitchshift_init (tPitchShift* const psr, tPeriodDetection* pd, float* out, int bufSize)
 {
-    _tPitchShift* ps = *psr = (_tPitchShift*) leaf_allocAndClear(sizeof(_tPitchShift));
+    _tPitchShift* ps = *psr;
     _tPeriodDetection* p = *pd;
     
     ps->p = pd;
@@ -889,17 +870,20 @@
     ps->index = 0;
     ps->pitchFactor = 1.0f;
     
+    tSOLAD_setPitchFactor(&ps->sola, DEFPITCHRATIO);
+}
+
+void tPitchShift_init (tPitchShift* const psr, tPeriodDetection* pd, float* out, int bufSize)
+{
+    _tPitchShift* ps = *psr = (_tPitchShift*) leaf_allocAndClear(sizeof(_tPitchShift));
     tSOLAD_init(&ps->sola);
-    
     tHighpass_init(&ps->hp, HPFREQ);
-    
-    tSOLAD_setPitchFactor(&ps->sola, DEFPITCHRATIO);
+    pitchshift_init(psr, pd, out, bufSize);
 }
 
 void tPitchShift_free(tPitchShift* const psr)
 {
     _tPitchShift* ps = *psr;
-    
     tSOLAD_free(&ps->sola);
     tHighpass_free(&ps->hp);
     leaf_free(ps);
@@ -908,27 +892,10 @@
 void    tPitchShift_initToPool      (tPitchShift* const psr, tPeriodDetection* const pd, float* out, int bufSize, tMempool* const mp)
 {
     _tMempool* m = *mp;
-
     _tPitchShift* ps = *psr = (_tPitchShift*) mpool_allocAndClear(sizeof(_tPitchShift), &m->pool);
-
-    _tPeriodDetection* p = *pd;
-    
-    ps->p = pd;
-    
-    ps->outBuffer = out;
-    ps->bufSize = bufSize;
-    ps->frameSize = p->frameSize;
-    ps->framesPerBuffer = ps->bufSize / ps->frameSize;
-    ps->curBlock = 1;
-    ps->lastBlock = 0;
-    ps->index = 0;
-    ps->pitchFactor = 1.0f;
-    
     tSOLAD_initToPool(&ps->sola, mp);
-    
     tHighpass_initToPool(&ps->hp, HPFREQ, mp);
-    
-    tSOLAD_setPitchFactor(&ps->sola, DEFPITCHRATIO);
+    pitchshift_init(psr, pd, out, bufSize);
 }
 
 void    tPitchShift_freeFromPool    (tPitchShift* const psr, tMempool* const mp)
@@ -935,7 +902,6 @@
 {
     _tMempool* m = *mp;
     _tPitchShift* ps = *psr;
-    
     tSOLAD_freeFromPool(&ps->sola, mp);
     tHighpass_freeFromPool(&ps->hp, mp);
     mpool_free(ps, &m->pool);
@@ -1057,8 +1023,7 @@
 //============================================================================================================
 // RETUNE
 //============================================================================================================
-
-void tRetune_init(tRetune* const rt, int numVoices, int bufSize, int frameSize)
+static void retune_init(tRetune* const rt, int numVoices, int bufSize, int frameSize)
 {
     _tRetune* r = *rt = (_tRetune*) leaf_allocAndClear(sizeof(_tRetune));
     
@@ -1065,10 +1030,7 @@
     r->bufSize = bufSize;
     r->frameSize = frameSize;
     r->numVoices = numVoices;
-    
-    r->inBuffer = (float*) leaf_allocAndClear(sizeof(float) * r->bufSize);
-    r->outBuffers = (float**) leaf_allocAndClear(sizeof(float*) * r->numVoices);
-    
+
     r->hopSize = DEFHOPSIZE;
     r->windowSize = DEFWINDOWSIZE;
     r->fba = FBA;
@@ -1075,7 +1037,16 @@
     tRetune_setTimeConstant(rt, DEFTIMECONSTANT);
     
     r->inputPeriod = 0.0f;
+}
+
+void tRetune_init(tRetune* const rt, int numVoices, int bufSize, int frameSize)
+{
+    _tRetune* r = *rt = (_tRetune*) leaf_allocAndClear(sizeof(_tRetune));
+    retune_init(rt, numVoices, bufSize, frameSize);
     
+    r->inBuffer = (float*) leaf_allocAndClear(sizeof(float) * r->bufSize);
+    r->outBuffers = (float**) leaf_allocAndClear(sizeof(float*) * r->numVoices);
+    
     r->ps = (tPitchShift*) leaf_allocAndClear(sizeof(tPitchShift) * r->numVoices);
     r->pitchFactor = (float*) leaf_allocAndClear(sizeof(float) * r->numVoices);
     r->tickOutput = (float*) leaf_allocAndClear(sizeof(float) * r->numVoices);
@@ -1095,7 +1066,6 @@
 void tRetune_free(tRetune* const rt)
 {
     _tRetune* r = *rt;
-    
     tPeriodDetection_free(&r->pd);
     for (int i = 0; i < r->numVoices; ++i)
     {
@@ -1114,20 +1084,10 @@
 {
     _tMempool* m = *mp;
     _tRetune* r = *rt = (_tRetune*) mpool_alloc(sizeof(_tRetune), &m->pool);
+    retune_init(rt, numVoices, bufSize, frameSize);
     
-    r->bufSize = bufSize;
-    r->frameSize = frameSize;
-    r->numVoices = numVoices;
-    
     r->inBuffer = (float*) mpool_allocAndClear(sizeof(float) * r->bufSize, &m->pool);
     r->outBuffers = (float**) mpool_allocAndClear(sizeof(float*) * r->numVoices, &m->pool);
-    
-    r->hopSize = DEFHOPSIZE;
-    r->windowSize = DEFWINDOWSIZE;
-    r->fba = FBA;
-    tRetune_setTimeConstant(rt, DEFTIMECONSTANT);
-    
-    r->inputPeriod = 0.0f;
 
     r->ps = (tPitchShift*) mpool_allocAndClear(sizeof(tPitchShift) * r->numVoices, &m->pool);
     r->pitchFactor = (float*) mpool_allocAndClear(sizeof(float) * r->numVoices, &m->pool);
@@ -1149,7 +1109,6 @@
 {
     _tMempool* m = *mp;
     _tRetune* r = *rt;
-    
     tPeriodDetection_freeFromPool(&r->pd, mp);
     for (int i = 0; i < r->numVoices; ++i)
     {
@@ -1203,8 +1162,6 @@
         r->outBuffers[i] = (float*) leaf_alloc(sizeof(float) * r->bufSize);
         tPitchShift_init(&r->ps[i], &r->pd, r->outBuffers[i], r->bufSize);
     }
-    
-    
 }
 
 void tRetune_setPitchFactors(tRetune* const rt, float pf)
@@ -1268,24 +1225,30 @@
 // AUTOTUNE
 //============================================================================================================
 
-void tAutotune_init(tAutotune* const rt, int numVoices, int bufSize, int frameSize)
+void autotune_init(tAutotune* const rt, int numVoices, int bufSize, int frameSize)
 {
-    _tAutotune* r = *rt = (_tAutotune*) leaf_alloc(sizeof(_tAutotune));
+    _tAutotune* r = *rt;
     
     r->bufSize = bufSize;
     r->frameSize = frameSize;
     r->numVoices = numVoices;
     
-    r->inBuffer = (float*) leaf_alloc(sizeof(float) * r->bufSize);
-    r->outBuffers = (float**) leaf_alloc(sizeof(float*) * r->numVoices);
-    
     r->hopSize = DEFHOPSIZE;
     r->windowSize = DEFWINDOWSIZE;
     r->fba = FBA;
     tAutotune_setTimeConstant(rt, DEFTIMECONSTANT);
+
+    r->inputPeriod = 0.0f;
+}
+
+void tAutotune_init(tAutotune* const rt, int numVoices, int bufSize, int frameSize)
+{
+    _tAutotune* r = *rt = (_tAutotune*) leaf_alloc(sizeof(_tAutotune));
+    autotune_init(rt, numVoices, bufSize, frameSize);
     
-    
-    
+    r->inBuffer = (float*) leaf_alloc(sizeof(float) * r->bufSize);
+    r->outBuffers = (float**) leaf_alloc(sizeof(float*) * r->numVoices);
+
     r->ps = (tPitchShift*) leaf_alloc(sizeof(tPitchShift) * r->numVoices);
     r->freq = (float*) leaf_alloc(sizeof(float) * r->numVoices);
     r->tickOutput = (float*) leaf_alloc(sizeof(float) * r->numVoices);
@@ -1300,14 +1263,11 @@
     {
         tPitchShift_init(&r->ps[i], &r->pd, r->outBuffers[i], r->bufSize);
     }
-    
-    r->inputPeriod = 0.0f;
 }
 
 void tAutotune_free(tAutotune* const rt)
 {
     _tAutotune* r = *rt;
-    
     tPeriodDetection_free(&r->pd);
     for (int i = 0; i < r->numVoices; ++i)
     {
@@ -1326,21 +1286,11 @@
 {
     _tMempool* m = *mp;
     _tAutotune* r = *rt = (_tAutotune*) mpool_alloc(sizeof(_tAutotune), &m->pool);
-    
-    r->bufSize = bufSize;
-    r->frameSize = frameSize;
-    r->numVoices = numVoices;
-    
+    autotune_init(rt, numVoices, bufSize, frameSize);
+
     r->inBuffer = (float*) mpool_alloc(sizeof(float) * r->bufSize, &m->pool);
     r->outBuffers = (float**) mpool_alloc(sizeof(float*) * r->numVoices, &m->pool);
-    
-    r->hopSize = DEFHOPSIZE;
-    r->windowSize = DEFWINDOWSIZE;
-    r->fba = FBA;
-    tAutotune_setTimeConstant(rt, DEFTIMECONSTANT);
-    
-    
-    
+
     r->ps = (tPitchShift*) mpool_alloc(sizeof(tPitchShift) * r->numVoices, &m->pool);
     r->freq = (float*) mpool_alloc(sizeof(float) * r->numVoices, &m->pool);
     r->tickOutput = (float*) mpool_alloc(sizeof(float) * r->numVoices, &m->pool);
@@ -1355,8 +1305,6 @@
     {
         tPitchShift_initToPool(&r->ps[i], &r->pd, r->outBuffers[i], r->bufSize, mp);
     }
-    
-    r->inputPeriod = 0.0f;
 }
 
 void    tAutotune_freeFromPool      (tAutotune* const rt, tMempool* const mp)
@@ -1363,7 +1311,6 @@
 {
     _tMempool* m = *mp;
     _tAutotune* r = *rt;
-    
     tPeriodDetection_freeFromPool(&r->pd, mp);
     for (int i = 0; i < r->numVoices; ++i)
     {
@@ -1421,8 +1368,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)
@@ -1484,12 +1429,28 @@
 // FORMANTSHIFTER
 //============================================================================================================
 // algorithm from Tom Baran's autotalent code.
+static void formantshifter_init(tFormantShifter* const fsr, int order)
+{
+    _tFormantShifter* fs = *fsr;
+    
+    fs->ford = order;
+    fs->falph = powf(0.001f, 40.0f * leaf.invSampleRate);
+    fs->flamb = -(0.8517f*sqrtf(atanf(0.06583f*leaf.sampleRate))-0.1916f);
+    fs->fhp = 0.0f;
+    fs->flp = 0.0f;
+    fs->flpa = powf(0.001f, 10.0f * leaf.invSampleRate);
+    fs->fmute = 1.0f;
+    fs->fmutealph = powf(0.001f, 0.5f * leaf.invSampleRate);
+    fs->cbi = 0;
+    fs->intensity = 1.0f;
+    fs->invIntensity = 1.0f;
+}
 
 void tFormantShifter_init(tFormantShifter* const fsr, int order)
 {
     _tFormantShifter* fs = *fsr = (_tFormantShifter*) leaf_alloc(sizeof(_tFormantShifter));
+    formantshifter_init(fsr, order);
     
-    fs->ford = order;
     fs->fk = (float*) leaf_allocAndClear(sizeof(float) * fs->ford);
     fs->fb = (float*) leaf_allocAndClear(sizeof(float) * fs->ford);
     fs->fc = (float*) leaf_allocAndClear(sizeof(float) * fs->ford);
@@ -1500,16 +1461,6 @@
     fs->ftvec = (float*) leaf_allocAndClear(sizeof(float) * fs->ford);
     fs->fbuff = (float*) leaf_allocAndClear(sizeof(float*) * fs->ford);
 
-    fs->falph = powf(0.001f, 40.0f * leaf.invSampleRate);
-    fs->flamb = -(0.8517f*sqrtf(atanf(0.06583f*leaf.sampleRate))-0.1916f);
-    fs->fhp = 0.0f;
-    fs->flp = 0.0f;
-    fs->flpa = powf(0.001f, 10.0f * leaf.invSampleRate);
-    fs->fmute = 1.0f;
-    fs->fmutealph = powf(0.001f, 0.5f * leaf.invSampleRate);
-    fs->cbi = 0;
-    fs->intensity = 1.0f;
-	fs->invIntensity = 1.0f;
 	tHighpass_init(&fs->hp, 10.0f);
 	tHighpass_init(&fs->hp2, 10.0f);
 	tFeedbackLeveler_init(&fs->fbl1, 0.99f, 0.005f, 0.125f, 0);
@@ -1540,8 +1491,8 @@
 {
     _tMempool* m = *mp;
     _tFormantShifter* fs = *fsr = (_tFormantShifter*) mpool_alloc(sizeof(_tFormantShifter), &m->pool);
+    formantshifter_init(fsr, order);
     
-    fs->ford = order;
     fs->fk = (float*) mpool_allocAndClear(sizeof(float) * fs->ford, &m->pool);
     fs->fb = (float*) mpool_allocAndClear(sizeof(float) * fs->ford, &m->pool);
     fs->fc = (float*) mpool_allocAndClear(sizeof(float) * fs->ford, &m->pool);
@@ -1550,20 +1501,8 @@
     fs->fsig = (float*) mpool_allocAndClear(sizeof(float) * fs->ford, &m->pool);
     fs->fsmooth = (float*) mpool_allocAndClear(sizeof(float) * fs->ford, &m->pool);
     fs->ftvec = (float*) mpool_allocAndClear(sizeof(float) * fs->ford, &m->pool);
-    
     fs->fbuff = (float*) mpool_allocAndClear(sizeof(float*) * fs->ford, &m->pool);
-
     
-    fs->falph = powf(0.001f, 10.0f * leaf.invSampleRate);
-    fs->flamb = -(0.8517f*sqrtf(atanf(0.06583f*leaf.sampleRate))-0.1916f);
-    fs->fhp = 0.0f;
-    fs->flp = 0.0f;
-    fs->flpa = powf(0.001f, 10.0f * leaf.invSampleRate);
-    fs->fmute = 1.0f;
-    fs->fmutealph = powf(0.001f, 1.0f * leaf.invSampleRate);
-    fs->cbi = 0;
-    fs->intensity = 1.0f;
-    fs->invIntensity = 1.0f;
     tHighpass_initToPool(&fs->hp, 20.0f, mp);
     tHighpass_initToPool(&fs->hp2, 20.0f, mp);
     tFeedbackLeveler_initToPool(&fs->fbl1, 0.8f, .005f, 0.125, 1, mp);
--- a/LEAF/Src/leaf-electrical.c
+++ b/LEAF/Src/leaf-electrical.c
@@ -167,7 +167,6 @@
 void tWDF_init(tWDF* const wdf, WDFComponentType type, float value, tWDF* const rL, tWDF* const rR)
 {
     *wdf = (_tWDF*) leaf_alloc(sizeof(_tWDF));
-    
     wdf_init(wdf, type, value, rL, rR);
 }
 
@@ -174,7 +173,6 @@
 void tWDF_free(tWDF* const wdf)
 {
     _tWDF* r = *wdf;
-    
     leaf_free(r);
 }
 
@@ -182,7 +180,6 @@
 {
     _tMempool* m = *mp;
     *wdf = (_tWDF*) mpool_alloc(sizeof(_tWDF), &m->pool);
-    
     wdf_init(wdf, type, value, rL, rR);
 }
 
@@ -190,7 +187,6 @@
 {
     _tMempool* m = *mp;
     _tWDF* r = *wdf;
-    
     mpool_free(r, &m->pool);
 }
 
--- a/LEAF/Src/leaf-envelopes.c
+++ b/LEAF/Src/leaf-envelopes.c
@@ -24,9 +24,9 @@
 #endif
 
 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Envelope ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ //
-void    tEnvelope_init(tEnvelope* const envlp, float attack, float decay, oBool loop)
+static void    envelope_init(tEnvelope* const envlp, float attack, float decay, oBool loop)
 {
-    _tEnvelope* env = *envlp = (_tEnvelope*) leaf_alloc(sizeof(_tEnvelope));
+    _tEnvelope* env = *envlp;
     
     env->exp_buff = exp_decay;
     env->inc_buff = attack_decay_inc;
@@ -64,6 +64,12 @@
     env->rampInc = env->inc_buff[rampIndex];
 }
 
+void    tEnvelope_init(tEnvelope* const envlp, float attack, float decay, oBool loop)
+{
+    *envlp = (_tEnvelope*) leaf_alloc(sizeof(_tEnvelope));
+    envelope_init(envlp, attack, decay, loop);
+}
+
 void tEnvelope_free(tEnvelope* const envlp)
 {
     _tEnvelope* env = *envlp;
@@ -73,42 +79,8 @@
 void    tEnvelope_initToPool    (tEnvelope* const envlp, float attack, float decay, oBool loop, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tEnvelope* env = *envlp = (_tEnvelope*) mpool_alloc(sizeof(_tEnvelope), &m->pool);
-    
-    env->exp_buff = exp_decay;
-    env->inc_buff = attack_decay_inc;
-    env->buff_size = sizeof(exp_decay);
-    
-    env->loop = loop;
-    
-    if (attack > 8192.0f)
-        attack = 8192.0f;
-    if (attack < 0.0f)
-        attack = 0.0f;
-    
-    if (decay > 8192.0f)
-        decay = 8192.0f;
-    if (decay < 0.0f)
-        decay = 0.0f;
-    
-    int16_t attackIndex = ((int16_t)(attack * 8.0f))-1;
-    int16_t decayIndex = ((int16_t)(decay * 8.0f))-1;
-    int16_t rampIndex = ((int16_t)(2.0f * 8.0f))-1;
-    
-    if (attackIndex < 0)
-        attackIndex = 0;
-    if (decayIndex < 0)
-        decayIndex = 0;
-    if (rampIndex < 0)
-        rampIndex = 0;
-    
-    env->inRamp = OFALSE;
-    env->inAttack = OFALSE;
-    env->inDecay = OFALSE;
-    
-    env->attackInc = env->inc_buff[attackIndex];
-    env->decayInc = env->inc_buff[decayIndex];
-    env->rampInc = env->inc_buff[rampIndex];
+    *envlp = (_tEnvelope*) mpool_alloc(sizeof(_tEnvelope), &m->pool);
+    envelope_init(envlp, attack, decay, loop);
 }
 
 void    tEnvelope_freeFromPool  (tEnvelope* const envlp, tMempool* const mp)
@@ -254,9 +226,9 @@
 }
 
 /* ADSR */
-void    tADSR_init(tADSR* const adsrenv, float attack, float decay, float sustain, float release)
+static void    adsr_init(tADSR* const adsrenv, float attack, float decay, float sustain, float release)
 {
-    _tADSR* adsr = *adsrenv = (_tADSR*) leaf_alloc(sizeof(_tADSR));
+    _tADSR* adsr = *adsrenv;
     
     adsr->exp_buff = exp_decay;
     adsr->inc_buff = attack_decay_inc;
@@ -310,10 +282,16 @@
     adsr->rampInc = adsr->inc_buff[rampIndex];
 }
 
+
+void    tADSR_init(tADSR* const adsrenv, float attack, float decay, float sustain, float release)
+{
+    _tADSR* adsr = *adsrenv = (_tADSR*) leaf_alloc(sizeof(_tADSR));
+    adsr_init(adsrenv, attack, decay, sustain, release);
+}
+
 void tADSR_free(tADSR* const adsrenv)
 {
     _tADSR* adsr = *adsrenv;
-    
     leaf_free(adsr);
 }
 
@@ -320,58 +298,8 @@
 void    tADSR_initToPool    (tADSR* const adsrenv, float attack, float decay, float sustain, float release, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tADSR* adsr = *adsrenv = (_tADSR*) mpool_alloc(sizeof(_tADSR), &m->pool);
-    
-    adsr->exp_buff = exp_decay;
-    adsr->inc_buff = attack_decay_inc;
-    adsr->buff_size = sizeof(exp_decay);
-    
-    if (attack > 8192.0f)
-        attack = 8192.0f;
-    if (attack < 0.0f)
-        attack = 0.0f;
-    
-    if (decay > 8192.0f)
-        decay = 8192.0f;
-    if (decay < 0.0f)
-        decay = 0.0f;
-    
-    if (sustain > 1.0f)
-        sustain = 1.0f;
-    if (sustain < 0.0f)
-        sustain = 0.0f;
-    
-    if (release > 8192.0f)
-        release = 8192.0f;
-    if (release < 0.0f)
-        release = 0.0f;
-    
-    int16_t attackIndex = ((int16_t)(attack * 8.0f))-1;
-    int16_t decayIndex = ((int16_t)(decay * 8.0f))-1;
-    int16_t releaseIndex = ((int16_t)(release * 8.0f))-1;
-    int16_t rampIndex = ((int16_t)(2.0f * 8.0f))-1;
-    
-    if (attackIndex < 0)
-        attackIndex = 0;
-    if (decayIndex < 0)
-        decayIndex = 0;
-    if (releaseIndex < 0)
-        releaseIndex = 0;
-    if (rampIndex < 0)
-        rampIndex = 0;
-    
-    adsr->inRamp = OFALSE;
-    adsr->inAttack = OFALSE;
-    adsr->inDecay = OFALSE;
-    adsr->inSustain = OFALSE;
-    adsr->inRelease = OFALSE;
-    
-    adsr->sustain = sustain;
-    
-    adsr->attackInc = adsr->inc_buff[attackIndex];
-    adsr->decayInc = adsr->inc_buff[decayIndex];
-    adsr->releaseInc = adsr->inc_buff[releaseIndex];
-    adsr->rampInc = adsr->inc_buff[rampIndex];
+    *adsrenv = (_tADSR*) mpool_alloc(sizeof(_tADSR), &m->pool);
+    adsr_init(adsrenv, attack, decay, sustain, release);
 }
 
 void    tADSR_freeFromPool  (tADSR* const adsrenv, tMempool* const mp)
@@ -378,7 +306,6 @@
 {
     _tMempool* m = *mp;
     _tADSR* adsr = *adsrenv;
-    
     mpool_free(adsr, &m->pool);
 }
 
@@ -562,12 +489,12 @@
 }
 
 /* Ramp */
-void    tRamp_init(tRamp* const r, float time, int samples_per_tick)
+static void    ramp_init(tRamp* const r, float time, int samples_per_tick)
 {
-    _tRamp* ramp = *r = (_tRamp*) leaf_alloc(sizeof(_tRamp));
+    _tRamp* ramp = *r;
     
     ramp->inv_sr_ms = 1.0f/(leaf.sampleRate*0.001f);
-	ramp->minimum_time = ramp->inv_sr_ms * samples_per_tick;
+    ramp->minimum_time = ramp->inv_sr_ms * samples_per_tick;
     ramp->curr = 0.0f;
     ramp->dest = 0.0f;
     
@@ -584,10 +511,15 @@
     ramp->inc = ((ramp->dest - ramp->curr) / ramp->time * ramp->inv_sr_ms) * (float)ramp->samples_per_tick;
 }
 
+void    tRamp_init(tRamp* const r, float time, int samples_per_tick)
+{
+    *r = (_tRamp*) leaf_alloc(sizeof(_tRamp));
+    ramp_init(r, time, samples_per_tick);
+}
+
 void tRamp_free(tRamp* const r)
 {
     _tRamp* ramp = *r;
-    
     leaf_free(ramp);
 }
 
@@ -594,24 +526,8 @@
 void    tRamp_initToPool    (tRamp* const r, float time, int samples_per_tick, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tRamp* ramp = *r = (_tRamp*) mpool_alloc(sizeof(_tRamp), &m->pool);
-    
-    ramp->inv_sr_ms = 1.0f/(leaf.sampleRate*0.001f);
-    ramp->minimum_time = ramp->inv_sr_ms * samples_per_tick;
-    ramp->curr = 0.0f;
-    ramp->dest = 0.0f;
-    
-    if (time < ramp->minimum_time)
-    {
-        ramp->time = ramp->minimum_time;
-    }
-    else
-    {
-        ramp->time = time;
-    }
-    
-    ramp->samples_per_tick = samples_per_tick;
-    ramp->inc = ((ramp->dest - ramp->curr) / ramp->time * ramp->inv_sr_ms) * (float)ramp->samples_per_tick;
+    *r = (_tRamp*) mpool_alloc(sizeof(_tRamp), &m->pool);
+    ramp_init(r, time, samples_per_tick);
 }
 
 void    tRamp_freeFromPool  (tRamp* const r, tMempool* const mp)
@@ -618,7 +534,6 @@
 {
     _tMempool* m = *mp;
     _tRamp* ramp = *r;
-    
     mpool_free(ramp, &m->pool);
 }
 
@@ -684,22 +599,27 @@
 
 
 /* Exponential Smoother */
+static void    expsmooth_init(tExpSmooth* const expsmooth, float val, float factor)
+{    // factor is usually a value between 0 and 0.1. Lower value is slower. 0.01 for example gives you a smoothing time of about 10ms
+    _tExpSmooth* smooth = *expsmooth;
+    
+    smooth->curr=val;
+    smooth->dest=val;
+    if (factor<0) factor=0;
+    if (factor>1) factor=1;
+    smooth->factor=factor;
+    smooth->oneminusfactor=1.0f-factor;
+}
+
 void    tExpSmooth_init(tExpSmooth* const expsmooth, float val, float factor)
 {	// factor is usually a value between 0 and 0.1. Lower value is slower. 0.01 for example gives you a smoothing time of about 10ms
-    _tExpSmooth* smooth = *expsmooth = (_tExpSmooth*) leaf_alloc(sizeof(_tExpSmooth));
-    
-	smooth->curr=val;
-	smooth->dest=val;
-	if (factor<0) factor=0;
-	if (factor>1) factor=1;
-	smooth->factor=factor;
-	smooth->oneminusfactor=1.0f-factor;
+    *expsmooth = (_tExpSmooth*) leaf_alloc(sizeof(_tExpSmooth));
+    expsmooth_init(expsmooth, val, factor);
 }
 
 void tExpSmooth_free(tExpSmooth* const expsmooth)
 {
     _tExpSmooth* smooth = *expsmooth;
-    
     leaf_free(smooth);
 }
 
@@ -706,14 +626,8 @@
 void    tExpSmooth_initToPool   (tExpSmooth* const expsmooth, float val, float factor, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tExpSmooth* smooth = *expsmooth = (_tExpSmooth*) mpool_alloc(sizeof(_tExpSmooth), &m->pool);
-    
-    smooth->curr=val;
-    smooth->dest=val;
-    if (factor<0) factor=0;
-    if (factor>1) factor=1;
-    smooth->factor=factor;
-    smooth->oneminusfactor=1.0f-factor;
+    *expsmooth = (_tExpSmooth*) mpool_alloc(sizeof(_tExpSmooth), &m->pool);
+    expsmooth_init(expsmooth, val, factor);
 }
 
 void    tExpSmooth_freeFromPool (tExpSmooth* const expsmooth, tMempool* const mp)
@@ -720,7 +634,6 @@
 {
     _tMempool* m = *mp;
     _tExpSmooth* smooth = *expsmooth;
-    
     mpool_free(smooth, &m->pool);
 }
 
--- a/LEAF/Src/leaf-filters.c
+++ b/LEAF/Src/leaf-filters.c
@@ -21,21 +21,23 @@
 #endif
 
 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ OnePole Filter ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ //
-void    tAllpass_init(tAllpass* const ft, float initDelay, uint32_t maxDelay)
+static void    allpass_init(tAllpass* const ft, float initDelay, uint32_t maxDelay)
 {
-    _tAllpass* f = *ft = (_tAllpass*) leaf_alloc(sizeof(_tAllpass));
-    
+    _tAllpass* f = *ft;
     f->gain = 0.7f;
-    
     f->lastOut = 0.0f;
-    
+}
+
+void    tAllpass_init(tAllpass* const ft, float initDelay, uint32_t maxDelay)
+{
+    _tAllpass* f = *ft = (_tAllpass*) leaf_alloc(sizeof(_tAllpass));
     tLinearDelay_init(&f->delay, initDelay, maxDelay);
+    allpass_init(ft, initDelay, maxDelay);
 }
 
 void tAllpass_free(tAllpass* const ft)
 {
     _tAllpass* f = *ft;
-    
     tLinearDelay_free(&f->delay);
     leaf_free(f);
 }
@@ -44,12 +46,8 @@
 {
     _tMempool* m = *mp;
     _tAllpass* f = *ft = (_tAllpass*) mpool_alloc(sizeof(_tAllpass), &m->pool);
-    
-    f->gain = 0.7f;
-    
-    f->lastOut = 0.0f;
-    
     tLinearDelay_initToPool(&f->delay, initDelay, maxDelay, mp);
+    allpass_init(ft, initDelay, maxDelay);
 }
 
 void    tAllpass_freeFromPool   (tAllpass* const ft, tMempool* const mp)
@@ -56,7 +54,6 @@
 {
     _tMempool* m = *mp;
     _tAllpass* f = *ft;
-    
     tLinearDelay_freeFromPool(&f->delay, mp);
     mpool_free(f, &m->pool);
 }
@@ -89,9 +86,9 @@
 }
 
 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ OnePole Filter ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ //
-void    tOnePole_init(tOnePole* const ft, float freq)
+static void    onepole_init(tOnePole* const ft, float freq)
 {
-    _tOnePole* f = *ft = (_tOnePole*) leaf_alloc(sizeof(_tOnePole));
+    _tOnePole* f = *ft;
     
     f->gain = 1.0f;
     f->a0 = 1.0;
@@ -102,10 +99,15 @@
     f->lastOut = 0.0f;
 }
 
+void    tOnePole_init(tOnePole* const ft, float freq)
+{
+    *ft = (_tOnePole*) leaf_alloc(sizeof(_tOnePole));
+    onepole_init(ft, freq);
+}
+
 void    tOnePole_free(tOnePole* const ft)
 {
     _tOnePole* f = *ft;
-    
     leaf_free(f);
 }
 
@@ -112,15 +114,8 @@
 void    tOnePole_initToPool     (tOnePole* const ft, float freq, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tOnePole* f = *ft = (_tOnePole*) mpool_alloc(sizeof(_tOnePole), &m->pool);
-    
-    f->gain = 1.0f;
-    f->a0 = 1.0;
-    
-    tOnePole_setFreq(ft, freq);
-    
-    f->lastIn = 0.0f;
-    f->lastOut = 0.0f;
+    *ft = (_tOnePole*) mpool_alloc(sizeof(_tOnePole), &m->pool);
+    onepole_init(ft, freq);
 }
 
 void    tOnePole_freeFromPool   (tOnePole* const ft, tMempool* const mp)
@@ -127,7 +122,6 @@
 {
     _tMempool* m = *mp;
     _tOnePole* f = *ft;
-    
     mpool_free(f, &m->pool);
 }
 
@@ -193,9 +187,9 @@
 }
 
 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ TwoPole Filter ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ //
-void    tTwoPole_init(tTwoPole* const ft)
+static void    twopole_init(tTwoPole* const ft)
 {
-    _tTwoPole* f = *ft = (_tTwoPole*) leaf_alloc(sizeof(_tTwoPole));
+    _tTwoPole* f = *ft;
     
     f->gain = 1.0f;
     f->a0 = 1.0;
@@ -205,10 +199,15 @@
     f->lastOut[1] = 0.0f;
 }
 
+void    tTwoPole_init(tTwoPole* const ft)
+{
+    *ft = (_tTwoPole*) leaf_alloc(sizeof(_tTwoPole));
+    twopole_init(ft);
+}
+
 void    tTwoPole_free(tTwoPole* const ft)
 {
     _tTwoPole* f = *ft;
-    
     leaf_free(f);
 }
 
@@ -215,14 +214,8 @@
 void    tTwoPole_initToPool     (tTwoPole* const ft, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tTwoPole* f = *ft = (_tTwoPole*) mpool_alloc(sizeof(_tTwoPole), &m->pool);
-    
-    f->gain = 1.0f;
-    f->a0 = 1.0;
-    f->b0 = 1.0;
-    
-    f->lastOut[0] = 0.0f;
-    f->lastOut[1] = 0.0f;
+    *ft = (_tTwoPole*) mpool_alloc(sizeof(_tTwoPole), &m->pool);
+    twopole_init(ft);
 }
 
 void    tTwoPole_freeFromPool   (tTwoPole* const ft, tMempool* const mp)
@@ -229,7 +222,6 @@
 {
     _tMempool* m = *mp;
     _tTwoPole* f = *ft;
-    
     mpool_free(f, &m->pool);
 }
 
@@ -321,9 +313,9 @@
 }
 
 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ OneZero Filter ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ //
-void    tOneZero_init(tOneZero* const ft, float theZero)
+static void    onezero_init(tOneZero* const ft, float theZero)
 {
-    _tOneZero* f = *ft = (_tOneZero*) leaf_alloc(sizeof(_tOneZero));
+    _tOneZero* f = *ft;
     
     f->gain = 1.0f;
     f->lastIn = 0.0f;
@@ -331,10 +323,15 @@
     tOneZero_setZero(ft, theZero);
 }
 
+void    tOneZero_init(tOneZero* const ft, float theZero)
+{
+    *ft = (_tOneZero*) leaf_alloc(sizeof(_tOneZero));
+    onezero_init(ft, theZero);
+}
+
 void    tOneZero_free(tOneZero* const ft)
 {
     _tOneZero* f = *ft;
-    
     leaf_free(f);
 }
 
@@ -341,12 +338,8 @@
 void    tOneZero_initToPool     (tOneZero* const ft, float theZero, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tOneZero* f = *ft = (_tOneZero*) mpool_alloc(sizeof(_tOneZero), &m->pool);
-    
-    f->gain = 1.0f;
-    f->lastIn = 0.0f;
-    f->lastOut = 0.0f;
-    tOneZero_setZero(ft, theZero);
+    *ft = (_tOneZero*) mpool_alloc(sizeof(_tOneZero), &m->pool);
+    onezero_init(ft, theZero);
 }
 
 void    tOneZero_freeFromPool   (tOneZero* const ft, tMempool* const mp)
@@ -353,7 +346,6 @@
 {
     _tMempool* m = *mp;
     _tOneZero* f = *ft;
-    
     mpool_free(f, &m->pool);
 }
 
@@ -437,9 +429,9 @@
 }
 
 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ TwoZero Filter ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ //
-void    tTwoZero_init(tTwoZero* const ft)
+static void    twozero_init(tTwoZero* const ft)
 {
-    _tTwoZero* f = *ft = (_tTwoZero*) leaf_alloc(sizeof(_tTwoZero));
+    _tTwoZero* f = *ft;
     
     f->gain = 1.0f;
     f->lastIn[0] = 0.0f;
@@ -446,10 +438,15 @@
     f->lastIn[1] = 0.0f;
 }
 
+void    tTwoZero_init(tTwoZero* const ft)
+{
+    *ft = (_tTwoZero*) leaf_alloc(sizeof(_tTwoZero));
+    twozero_init(ft);
+}
+
 void    tTwoZero_free(tTwoZero* const ft)
 {
     _tTwoZero* f = *ft;
-    
     leaf_free(f);
 }
 
@@ -456,11 +453,8 @@
 void    tTwoZero_initToPool     (tTwoZero* const ft, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tTwoZero* f = *ft = (_tTwoZero*) mpool_alloc(sizeof(_tTwoZero), &m->pool);
-    
-    f->gain = 1.0f;
-    f->lastIn[0] = 0.0f;
-    f->lastIn[1] = 0.0f;
+    *ft = (_tTwoZero*) mpool_alloc(sizeof(_tTwoZero), &m->pool);
+    twozero_init(ft);
 }
 
 void    tTwoZero_freeFromPool   (tTwoZero* const ft, tMempool* const mp)
@@ -467,7 +461,6 @@
 {
     _tMempool* m = *mp;
     _tTwoZero* f = *ft;
-    
     mpool_free(f, &m->pool);
 }
 
@@ -542,9 +535,9 @@
 }
 
 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ PoleZero Filter ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ //
-void   tPoleZero_init(tPoleZero* const pzf)
+static void   polezero_init(tPoleZero* const pzf)
 {
-    _tPoleZero* f = *pzf = (_tPoleZero*) leaf_alloc(sizeof(_tPoleZero));
+    _tPoleZero* f = *pzf;
     
     f->gain = 1.0f;
     f->b0 = 1.0;
@@ -554,10 +547,15 @@
     f->lastOut = 0.0f;
 }
 
+void   tPoleZero_init(tPoleZero* const pzf)
+{
+    *pzf = (_tPoleZero*) leaf_alloc(sizeof(_tPoleZero));
+    polezero_init(pzf);
+}
+
 void   tPoleZero_free(tPoleZero* const pzf)
 {
     _tPoleZero* f = *pzf;
-    
     leaf_free(f);
 }
 
@@ -565,13 +563,7 @@
 {
     _tMempool* m = *mp;
     _tPoleZero* f = *pzf = (_tPoleZero*) mpool_alloc(sizeof(_tPoleZero), &m->pool);
-    
-    f->gain = 1.0f;
-    f->b0 = 1.0;
-    f->a0 = 1.0;
-    
-    f->lastIn = 0.0f;
-    f->lastOut = 0.0f;
+    polezero_init(pzf);
 }
 
 void    tPoleZero_freeFromPool      (tPoleZero* const pzf, tMempool* const mp)
@@ -578,7 +570,6 @@
 {
     _tMempool* m = *mp;
     _tPoleZero* f = *pzf;
-    
     mpool_free(f, &m->pool);
 }
 
@@ -670,9 +661,9 @@
 }
 
 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ BiQuad Filter ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ //
-void    tBiQuad_init(tBiQuad* const ft)
+static void    biquad_init(tBiQuad* const ft)
 {
-    _tBiQuad* f = *ft = (_tBiQuad*) leaf_alloc(sizeof(_tBiQuad));
+    _tBiQuad* f = *ft;
     
     f->gain = 1.0f;
     
@@ -685,10 +676,15 @@
     f->lastOut[1] = 0.0f;
 }
 
+void    tBiQuad_init(tBiQuad* const ft)
+{
+    *ft = (_tBiQuad*) leaf_alloc(sizeof(_tBiQuad));
+    biquad_init(ft);
+}
+
 void    tBiQuad_free(tBiQuad* const ft)
 {
     _tBiQuad* f = *ft;
-    
     leaf_free(f);
 }
 
@@ -695,17 +691,8 @@
 void    tBiQuad_initToPool     (tBiQuad* const ft, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tBiQuad* f = *ft = (_tBiQuad*) mpool_alloc(sizeof(_tBiQuad), &m->pool);
-    
-    f->gain = 1.0f;
-    
-    f->b0 = 0.0f;
-    f->a0 = 0.0f;
-    
-    f->lastIn[0] = 0.0f;
-    f->lastIn[1] = 0.0f;
-    f->lastOut[0] = 0.0f;
-    f->lastOut[1] = 0.0f;
+    *ft = (_tBiQuad*) mpool_alloc(sizeof(_tBiQuad), &m->pool);
+    biquad_init(ft);
 }
 
 void    tBiQuad_freeFromPool   (tBiQuad* const ft, tMempool* const mp)
@@ -712,7 +699,6 @@
 {
     _tMempool* m = *mp;
     _tBiQuad* f = *ft;
-    
     mpool_free(f, &m->pool);
 }
 
@@ -841,9 +827,9 @@
 
 // Less efficient, more accurate version of SVF, in which cutoff frequency is taken as floating point Hz value and tanf
 // is calculated when frequency changes.
-void tSVF_init(tSVF* const svff, SVFType type, float freq, float Q)
+static void svf_init(tSVF* const svff, SVFType type, float freq, float Q)
 {
-    _tSVF* svf = *svff = (_tSVF*) leaf_alloc(sizeof(_tSVF));
+    _tSVF* svf = *svff;
     
     svf->type = type;
     
@@ -857,10 +843,15 @@
     svf->a3 = svf->g*svf->a2;
 }
 
+void tSVF_init(tSVF* const svff, SVFType type, float freq, float Q)
+{
+    *svff = (_tSVF*) leaf_alloc(sizeof(_tSVF));
+    svf_init(svff, type, freq, Q);
+}
+
 void tSVF_free(tSVF* const svff)
 {
     _tSVF* svf = *svff;
-    
     leaf_free(svf);
 }
 
@@ -867,18 +858,8 @@
 void    tSVF_initToPool     (tSVF* const svff, SVFType type, float freq, float Q, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tSVF* svf = *svff = (_tSVF*) mpool_alloc(sizeof(_tSVF), &m->pool);
-    
-    svf->type = type;
-    
-    svf->ic1eq = 0;
-    svf->ic2eq = 0;
-    
-    svf->g = tanf(PI * freq * leaf.invSampleRate);
-    svf->k = 1.0f/Q;
-    svf->a1 = 1.0f/(1.0f + svf->g * (svf->g + svf->k));
-    svf->a2 = svf->g*svf->a1;
-    svf->a3 = svf->g*svf->a2;
+    *svff = (_tSVF*) mpool_alloc(sizeof(_tSVF), &m->pool);
+    svf_init(svff, type, freq, Q);
 }
 
 void    tSVF_freeFromPool   (tSVF* const svff, tMempool* const mp)
@@ -930,9 +911,9 @@
 }
 
 // Efficient version of tSVF where frequency is set based on 12-bit integer input for lookup in tanh wavetable.
-void   tEfficientSVF_init(tEfficientSVF* const svff, SVFType type, uint16_t input, float Q)
+static void   efficientsvf_init(tEfficientSVF* const svff, SVFType type, uint16_t input, float Q)
 {
-    _tEfficientSVF* svf = *svff = (_tEfficientSVF*) leaf_alloc(sizeof(_tEfficientSVF));
+    _tEfficientSVF* svf = *svff;
     
     svf->type = type;
     
@@ -946,10 +927,15 @@
     svf->a3 = svf->g*svf->a2;
 }
 
+void   tEfficientSVF_init(tEfficientSVF* const svff, SVFType type, uint16_t input, float Q)
+{
+    *svff = (_tEfficientSVF*) leaf_alloc(sizeof(_tEfficientSVF));
+    efficientsvf_init(svff, type, input, Q);
+}
+
 void tEfficientSVF_free(tEfficientSVF* const svff)
 {
     _tEfficientSVF* svf = *svff;
-    
     leaf_free(svf);
 }
 
@@ -956,18 +942,8 @@
 void    tEfficientSVF_initToPool    (tEfficientSVF* const svff, SVFType type, uint16_t input, float Q, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tEfficientSVF* svf = *svff = (_tEfficientSVF*) mpool_alloc(sizeof(_tEfficientSVF), &m->pool);
-    
-    svf->type = type;
-    
-    svf->ic1eq = 0;
-    svf->ic2eq = 0;
-    
-    svf->g = filtertan[input];
-    svf->k = 1.0f/Q;
-    svf->a1 = 1.0f/(1.0f+svf->g*(svf->g+svf->k));
-    svf->a2 = svf->g*svf->a1;
-    svf->a3 = svf->g*svf->a2;
+    *svff = (_tEfficientSVF*) mpool_alloc(sizeof(_tEfficientSVF), &m->pool);
+    efficientsvf_init(svff, type, input, Q);
 }
 
 void    tEfficientSVF_freeFromPool  (tEfficientSVF* const svff, tMempool* const mp)
@@ -974,7 +950,6 @@
 {
     _tMempool* m = *mp;
     _tEfficientSVF* svf = *svff;
-    
     mpool_free(svf, &m->pool);
 }
 
@@ -1019,21 +994,25 @@
 }
 
 /* Highpass */
-void    tHighpass_init(tHighpass* const ft, float freq)
+static void    highpass_init(tHighpass* const ft, float freq)
 {
-    _tHighpass* f = *ft = (_tHighpass*) leaf_alloc(sizeof(_tHighpass));
+    _tHighpass* f = *ft;
     
     f->R = (1.0f - (freq * leaf.twoPiTimesInvSampleRate));
     f->ys = 0.0f;
     f->xs = 0.0f;
-    
     f->frequency = freq;
 }
 
+void    tHighpass_init(tHighpass* const ft, float freq)
+{
+    *ft = (_tHighpass*) leaf_alloc(sizeof(_tHighpass));
+    highpass_init(ft, freq);
+}
+
 void    tHighpass_free(tHighpass* const ft)
 {
     _tHighpass* f = *ft;
-    
     leaf_free(f);
 }
 
@@ -1040,13 +1019,8 @@
 void    tHighpass_initToPool    (tHighpass* const ft, float freq, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tHighpass* f = *ft = (_tHighpass*) mpool_allocAndClear(sizeof(_tHighpass), &m->pool);
-    
-    f->R = (1.0f - (freq * leaf.twoPiTimesInvSampleRate));
-    f->ys = 0.0f;
-    f->xs = 0.0f;
-    
-    f->frequency = freq;
+    *ft = (_tHighpass*) mpool_allocAndClear(sizeof(_tHighpass), &m->pool);
+    highpass_init(ft, freq);
 }
 
 void    tHighpass_freeFromPool  (tHighpass* const ft, tMempool* const mp)
@@ -1053,7 +1027,6 @@
 {
     _tMempool* m = *mp;
     _tHighpass* f = *ft;
-    
     mpool_free(f, &m->pool);
 }
 
@@ -1086,22 +1059,27 @@
     f->R = (1.0f-((f->frequency * 2.0f * 3.14f) * leaf.invSampleRate));
 }
 
-void tButterworth_init(tButterworth* const ft, int N, float f1, float f2)
+///////////////////////////////////////////////////////////////////////
+static void butterworth_init(tButterworth* const ft, int N, float f1, float f2)
 {
-    _tButterworth* f = *ft = (_tButterworth*) leaf_alloc(sizeof(_tButterworth));
+    _tButterworth* f = *ft;
     
     f->f1 = f1;
     f->f2 = f2;
     f->gain = 1.0f;
-    
     f->N = N;
     
     if (f->N > NUM_SVF_BW) f->N = NUM_SVF_BW;
-    
-    for(int i = 0; i < N/2; ++i)
+}
+
+void tButterworth_init(tButterworth* const ft, int N, float f1, float f2)
+{
+    _tButterworth* f = *ft = (_tButterworth*) leaf_alloc(sizeof(_tButterworth));
+    butterworth_init(ft, N, f1, f2);
+    for(int i = 0; i < f->N/2; ++i)
     {
-        tSVF_init(&f->low[i], SVFTypeHighpass, f1, 0.5f/cosf((1.0f+2.0f*i)*PI/(2*N)));
-        tSVF_init(&f->high[i], SVFTypeLowpass, f2, 0.5f/cosf((1.0f+2.0f*i)*PI/(2*N)));
+        tSVF_init(&f->low[i], SVFTypeHighpass, f->f1, 0.5f/cosf((1.0f+2.0f*i)*PI/(2*f->N)));
+        tSVF_init(&f->high[i], SVFTypeLowpass, f->f2, 0.5f/cosf((1.0f+2.0f*i)*PI/(2*f->N)));
     }
 }
 
@@ -1108,13 +1086,11 @@
 void tButterworth_free(tButterworth* const ft)
 {
     _tButterworth* f = *ft;
-    
     for(int i = 0; i < f->N/2; ++i)
     {
         tSVF_free(&f->low[i]);
         tSVF_free(&f->high[i]);
     }
-    
     leaf_free(f);
 }
 
@@ -1122,19 +1098,11 @@
 {
     _tMempool* m = *mp;
     _tButterworth* f = *ft = (_tButterworth*) mpool_alloc(sizeof(_tButterworth), &m->pool);
-    
-    f->f1 = f1;
-    f->f2 = f2;
-    f->gain = 1.0f;
-    
-    f->N = N;
-    
-    if (f->N > NUM_SVF_BW) f->N = NUM_SVF_BW;
-    
-    for(int i = 0; i < N/2; ++i)
+    butterworth_init(ft, N, f1, f2);
+    for(int i = 0; i < f->N/2; ++i)
     {
-        tSVF_initToPool(&f->low[i], SVFTypeHighpass, f1, 0.5f/cosf((1.0f+2.0f*i)*PI/(2*N)), mp);
-        tSVF_initToPool(&f->high[i], SVFTypeLowpass, f2, 0.5f/cosf((1.0f+2.0f*i)*PI/(2*N)), mp);
+        tSVF_initToPool(&f->low[i], SVFTypeHighpass, f->f1, 0.5f/cosf((1.0f+2.0f*i)*PI/(2*f->N)), mp);
+        tSVF_initToPool(&f->high[i], SVFTypeLowpass, f->f2, 0.5f/cosf((1.0f+2.0f*i)*PI/(2*f->N)), mp);
     }
 }
 
@@ -1142,13 +1110,11 @@
 {
     _tMempool* m = *mp;
     _tButterworth* f = *ft;
-    
     for(int i = 0; i < f->N/2; ++i)
     {
         tSVF_freeFromPool(&f->low[i], mp);
         tSVF_freeFromPool(&f->high[i], mp);
     }
-    
     mpool_free(f, &m->pool);
 }
 
@@ -1193,20 +1159,26 @@
     }
 }
 
-void	tFIR_init(tFIR* const firf, float* coeffs, int numTaps)
+////////////////////////////////////////////////////////////////////
+static void    fir_init(tFIR* const firf, float* coeffs, int numTaps)
 {
-    _tFIR* fir = *firf = (_tFIR*) leaf_alloc(sizeof(_tFIR));
+    _tFIR* fir = *firf;
     
     fir->numTaps = numTaps;
     fir->coeff = coeffs;
-    fir->past = (float*)leaf_alloc(sizeof(float) * fir->numTaps);
     for (int i = 0; i < fir->numTaps; ++i) fir->past[i] = 0.0f;
 }
 
+void	tFIR_init(tFIR* const firf, float* coeffs, int numTaps)
+{
+    _tFIR* fir = *firf = (_tFIR*) leaf_alloc(sizeof(_tFIR));
+    fir->past = (float*)leaf_alloc(sizeof(float) * numTaps);
+    fir_init(firf, coeffs, numTaps);
+}
+
 void    tFIR_free(tFIR* const firf)
 {
     _tFIR* fir = *firf;
-    
     leaf_free(fir->past);
     leaf_free(fir);
 }
@@ -1215,11 +1187,8 @@
 {
     _tMempool* m = *mp;
     _tFIR* fir = *firf = (_tFIR*) mpool_alloc(sizeof(_tFIR), &m->pool);
-    
-    fir->numTaps = numTaps;
-    fir->coeff = coeffs;
-    fir->past = (float*) mpool_alloc(sizeof(float) * fir->numTaps, &m->pool);
-    for (int i = 0; i < fir->numTaps; ++i) fir->past[i] = 0.0f;
+    fir->past = (float*) mpool_alloc(sizeof(float) * numTaps, &m->pool);
+    fir_init(firf, coeffs, numTaps);
 }
 
 void    tFIR_freeFromPool   (tFIR* const firf, tMempool* const mp)
@@ -1226,7 +1195,6 @@
 {
     _tMempool* m = *mp;
     _tFIR* fir = *firf;
-    
     mpool_free(fir->past, &m->pool);
     mpool_free(fir, &m->pool);
 }
--- a/LEAF/Src/leaf-instruments.c
+++ b/LEAF/Src/leaf-instruments.c
@@ -17,34 +17,35 @@
 #endif
 
 // ----------------- COWBELL ----------------------------//
+static void cowbell_init(t808Cowbell* const cowbellInst, int useStick)
+{
+    _t808Cowbell* cowbell = *cowbellInst;
 
+    tSquare_setFreq(&cowbell->p[0], 540.0f);
+    tSquare_setFreq(&cowbell->p[1], 1.48148f * 540.0f);
+    
+    cowbell->oscMix = 0.5f;
+    cowbell->useStick = useStick;
+}
+
 void t808Cowbell_init(t808Cowbell* const cowbellInst, int useStick)
 {
     _t808Cowbell* cowbell = *cowbellInst = (_t808Cowbell*) leaf_alloc(sizeof(_t808Cowbell));
     
     tSquare_init(&cowbell->p[0]);
-    tSquare_setFreq(&cowbell->p[0], 540.0f);
-    
     tSquare_init(&cowbell->p[1]);
-    tSquare_setFreq(&cowbell->p[1], 1.48148f * 540.0f);
-    
-    cowbell->oscMix = 0.5f;
-    
+
     tSVF_init(&cowbell->bandpassOsc, SVFTypeBandpass, 2500, 1.0f);
-    
     tSVF_init(&cowbell->bandpassStick, SVFTypeBandpass, 1800, 1.0f);
     
     tEnvelope_init(&cowbell->envGain, 5.0f, 100.0f, OFALSE);
-    
     tEnvelope_init(&cowbell->envFilter, 5.0, 100.0f, OFALSE);
     
     tHighpass_init(&cowbell->highpass, 1000.0f);
-    
     tNoise_init(&cowbell->stick, WhiteNoise);
-    
     tEnvelope_init(&cowbell->envStick, 5.0f, 5.0f, 0);
     
-    cowbell->useStick = useStick;
+    cowbell_init(cowbellInst, useStick);
 }
 
 void t808Cowebell_free(t808Cowbell* const cowbellInst)
@@ -69,28 +70,19 @@
     _t808Cowbell* cowbell = *cowbellInst = (_t808Cowbell*) mpool_alloc(sizeof(_t808Cowbell), &m->pool);
     
     tSquare_initToPool(&cowbell->p[0], mp);
-    tSquare_setFreq(&cowbell->p[0], 540.0f);
-    
     tSquare_initToPool(&cowbell->p[1], mp);
-    tSquare_setFreq(&cowbell->p[1], 1.48148f * 540.0f);
-    
-    cowbell->oscMix = 0.5f;
-    
+
     tSVF_initToPool(&cowbell->bandpassOsc, SVFTypeBandpass, 2500, 1.0f, mp);
-    
     tSVF_initToPool(&cowbell->bandpassStick, SVFTypeBandpass, 1800, 1.0f, mp);
     
     tEnvelope_initToPool(&cowbell->envGain, 5.0f, 100.0f, OFALSE, mp);
-    
     tEnvelope_initToPool(&cowbell->envFilter, 5.0, 100.0f, OFALSE, mp);
     
     tHighpass_initToPool(&cowbell->highpass, 1000.0f, mp);
-    
     tNoise_initToPool(&cowbell->stick, WhiteNoise, mp);
-    
     tEnvelope_initToPool(&cowbell->envStick, 5.0f, 5.0f, 0, mp);
-    
-    cowbell->useStick = useStick;
+
+    cowbell_init(cowbellInst, useStick);
 }
 
 void        t808Cowbell_freeFromPool    (t808Cowbell* const cowbellInst, tMempool* const mp)
@@ -182,6 +174,20 @@
 }
 
 // ----------------- HIHAT ----------------------------//
+static void hihat_init(t808Hihat* const hihatInst)
+{
+    _t808Hihat* hihat = *hihatInst;
+    
+    hihat->freq = 40.0f;
+    hihat->stretch = 0.0f;
+    
+    tSquare_setFreq(&hihat->p[0], 2.0f * hihat->freq);
+    tSquare_setFreq(&hihat->p[1], 3.00f * hihat->freq);
+    tSquare_setFreq(&hihat->p[2], 4.16f * hihat->freq);
+    tSquare_setFreq(&hihat->p[3], 5.43f * hihat->freq);
+    tSquare_setFreq(&hihat->p[4], 6.79f * hihat->freq);
+    tSquare_setFreq(&hihat->p[5], 8.21f * hihat->freq);
+}
 
 void t808Hihat_init(t808Hihat* const hihatInst)
 {
@@ -202,18 +208,9 @@
     tEnvelope_init(&hihat->envGain, 0.0f, 50.0f, OFALSE);
     tEnvelope_init(&hihat->envStick, 0.0f, 7.0f, OFALSE);
     
-    
     tHighpass_init(&hihat->highpass, 7000.0f);
     
-    hihat->freq = 40.0f;
-    hihat->stretch = 0.0f;
-    
-    tSquare_setFreq(&hihat->p[0], 2.0f * hihat->freq);
-    tSquare_setFreq(&hihat->p[1], 3.00f * hihat->freq);
-    tSquare_setFreq(&hihat->p[2], 4.16f * hihat->freq);
-    tSquare_setFreq(&hihat->p[3], 5.43f * hihat->freq);
-    tSquare_setFreq(&hihat->p[4], 6.79f * hihat->freq);
-    tSquare_setFreq(&hihat->p[5], 8.21f * hihat->freq);
+    hihat_init(hihatInst);
 }
 
 void t808Hihat_free(t808Hihat* const hihatInst)
@@ -258,19 +255,10 @@
     
     tEnvelope_initToPool(&hihat->envGain, 0.0f, 50.0f, OFALSE, mp);
     tEnvelope_initToPool(&hihat->envStick, 0.0f, 7.0f, OFALSE, mp);
-    
-    
+
     tHighpass_initToPool(&hihat->highpass, 7000.0f, mp);
     
-    hihat->freq = 40.0f;
-    hihat->stretch = 0.0f;
-    
-    tSquare_setFreq(&hihat->p[0], 2.0f * hihat->freq);
-    tSquare_setFreq(&hihat->p[1], 3.00f * hihat->freq);
-    tSquare_setFreq(&hihat->p[2], 4.16f * hihat->freq);
-    tSquare_setFreq(&hihat->p[3], 5.43f * hihat->freq);
-    tSquare_setFreq(&hihat->p[4], 6.79f * hihat->freq);
-    tSquare_setFreq(&hihat->p[5], 8.21f * hihat->freq);
+    hihat_init(hihatInst);
 }
 
 void    t808Hihat_freeFromPool  (t808Hihat* const hihatInst, tMempool* const mp)
@@ -401,33 +389,39 @@
 }
 
 // ----------------- SNARE ----------------------------//
+static void snare_init(t808Snare* const snareInst)
+{
+    _t808Snare* snare = *snareInst;
+    
+    float ratio[2] = {1.0, 1.5};
+    for (int i = 0; i < 2; i++)
+    {
+        tTriangle_setFreq(&snare->tone[i], ratio[i] * 400.0f);
+        snare->toneGain[i] = 0.5f;
+    }
+    snare->tone1Freq = ratio[0] * 100.0f;
+    snare->tone2Freq = ratio[1] * 100.0f;
+    snare->noiseFilterFreq = 3000.0f;
+    snare->noiseGain = 1.0f;
+}
 
 void t808Snare_init(t808Snare* const snareInst)
 {
     _t808Snare* snare = *snareInst = (_t808Snare*) leaf_alloc(sizeof(_t808Snare));
     
-    float ratio[2] = {1.0, 1.5};
     for (int i = 0; i < 2; i++)
     {
         tTriangle_init(&snare->tone[i]);
-        
-        tTriangle_setFreq(&snare->tone[i], ratio[i] * 400.0f);
         tSVF_init(&snare->toneLowpass[i], SVFTypeLowpass, 4000, 1.0f);
         tEnvelope_init(&snare->toneEnvOsc[i], 0.0f, 50.0f, OFALSE);
         tEnvelope_init(&snare->toneEnvGain[i], 1.0f, 150.0f, OFALSE);
         tEnvelope_init(&snare->toneEnvFilter[i], 1.0f, 2000.0f, OFALSE);
-        
-        snare->toneGain[i] = 0.5f;
     }
-    
-    snare->tone1Freq = ratio[0] * 100.0f;
-    snare->tone2Freq = ratio[1] * 100.0f;
-    snare->noiseFilterFreq = 3000.0f;
     tNoise_init(&snare->noiseOsc, WhiteNoise);
     tSVF_init(&snare->noiseLowpass, SVFTypeLowpass, 12000.0f, 0.8f);
     tEnvelope_init(&snare->noiseEnvGain, 0.0f, 100.0f, OFALSE);
     tEnvelope_init(&snare->noiseEnvFilter, 0.0f, 1000.0f, OFALSE);
-    snare->noiseGain = 1.0f;
+    snare_init(snareInst);
 }
 
 void        t808Snare_free                  (t808Snare* const snareInst)
@@ -455,29 +449,20 @@
 {
     _tMempool* m = *mp;
     _t808Snare* snare = *snareInst = (_t808Snare*) mpool_alloc(sizeof(_t808Snare), &m->pool);
-    
-    float ratio[2] = {1.0, 1.5};
+
     for (int i = 0; i < 2; i++)
     {
         tTriangle_initToPool(&snare->tone[i], mp);
-        
-        tTriangle_setFreq(&snare->tone[i], ratio[i] * 400.0f);
         tSVF_initToPool(&snare->toneLowpass[i], SVFTypeLowpass, 4000, 1.0f, mp);
         tEnvelope_initToPool(&snare->toneEnvOsc[i], 0.0f, 50.0f, OFALSE, mp);
         tEnvelope_initToPool(&snare->toneEnvGain[i], 1.0f, 150.0f, OFALSE, mp);
         tEnvelope_initToPool(&snare->toneEnvFilter[i], 1.0f, 2000.0f, OFALSE, mp);
-        
-        snare->toneGain[i] = 0.5f;
     }
-    
-    snare->tone1Freq = ratio[0] * 100.0f;
-    snare->tone2Freq = ratio[1] * 100.0f;
-    snare->noiseFilterFreq = 3000.0f;
     tNoise_initToPool(&snare->noiseOsc, WhiteNoise, mp);
     tSVF_initToPool(&snare->noiseLowpass, SVFTypeLowpass, 12000.0f, 0.8f, mp);
     tEnvelope_initToPool(&snare->noiseEnvGain, 0.0f, 100.0f, OFALSE, mp);
     tEnvelope_initToPool(&snare->noiseEnvFilter, 0.0f, 1000.0f, OFALSE, mp);
-    snare->noiseGain = 1.0f;
+    snare_init(snareInst);
 }
 
 void    t808Snare_freeFromPool  (t808Snare* const snareInst, tMempool* const mp)
@@ -592,16 +577,22 @@
 }
 
 // ----------------- KICK ----------------------------//
+static void kick_init   (t808Kick* const kickInst)
+{
+    _t808Kick* kick = *kickInst;
 
+    tCycle_setFreq(&kick->tone, 50.0f);
+    kick->toneInitialFreq = 40.0f;
+    kick->sighAmountInHz = 7.0f;
+    kick->chirpRatioMinusOne = 3.3f;
+    kick->noiseGain = 0.3f;
+}
+
 void        t808Kick_init        			(t808Kick* const kickInst)
 {
     _t808Kick* kick = *kickInst = (_t808Kick*) leaf_alloc(sizeof(_t808Kick));
     
 	tCycle_init(&kick->tone);
-	kick->toneInitialFreq = 40.0f;
-	kick->sighAmountInHz = 7.0f;
-	kick->chirpRatioMinusOne = 3.3f;
-	tCycle_setFreq(&kick->tone, 50.0f);
 	tSVF_init(&kick->toneLowpass, SVFTypeLowpass, 2000.0f, 0.5f);
 	tEnvelope_init(&kick->toneEnvOscChirp, 0.0f, 20.0f, OFALSE);
 	tEnvelope_init(&kick->toneEnvOscSigh, 0.0f, 2500.0f, OFALSE);
@@ -608,7 +599,7 @@
 	tEnvelope_init(&kick->toneEnvGain, 0.0f, 800.0f, OFALSE);
 	tNoise_init(&kick->noiseOsc, PinkNoise);
 	tEnvelope_init(&kick->noiseEnvGain, 0.0f, 1.0f, OFALSE);
-	kick->noiseGain = 0.3f;
+    kick_init(kickInst);
 }
 
 void        t808Kick_free                  (t808Kick* const kickInst)
@@ -632,10 +623,6 @@
     _t808Kick* kick = *kickInst = (_t808Kick*) mpool_alloc(sizeof(_t808Kick), &m->pool);
     
     tCycle_initToPool(&kick->tone, mp);
-    kick->toneInitialFreq = 40.0f;
-    kick->sighAmountInHz = 7.0f;
-    kick->chirpRatioMinusOne = 3.3f;
-    tCycle_setFreq(&kick->tone, 50.0f);
     tSVF_initToPool(&kick->toneLowpass, SVFTypeLowpass, 2000.0f, 0.5f, mp);
     tEnvelope_initToPool(&kick->toneEnvOscChirp, 0.0f, 20.0f, OFALSE, mp);
     tEnvelope_initToPool(&kick->toneEnvOscSigh, 0.0f, 2500.0f, OFALSE, mp);
@@ -642,7 +629,7 @@
     tEnvelope_initToPool(&kick->toneEnvGain, 0.0f, 800.0f, OFALSE, mp);
     tNoise_initToPool(&kick->noiseOsc, PinkNoise, mp);
     tEnvelope_initToPool(&kick->noiseEnvGain, 0.0f, 1.0f, OFALSE, mp);
-    kick->noiseGain = 0.3f;
+    kick_init(kickInst);
 }
 
 void    t808Kick_freeFromPool   (t808Kick* const kickInst, tMempool* const mp)
--- a/LEAF/Src/leaf-mempool.c
+++ b/LEAF/Src/leaf-mempool.c
@@ -360,17 +360,21 @@
 	//TODO: we should set up some kind of leaf_error method that reaches user space to notify library users of things that failed.
 }
 
-void tMempool_init(tMempool* const mp, char* memory, size_t size)
+static void mempool_init(tMempool* const mp, char* memory, size_t size)
 {
-    _tMempool* m = *mp = (_tMempool*) leaf_alloc(sizeof(_tMempool));
-    
+    _tMempool* m = *mp;
     mpool_create (memory, size, &m->pool);
 }
 
+void tMempool_init(tMempool* const mp, char* memory, size_t size)
+{
+    *mp = (_tMempool*) leaf_alloc(sizeof(_tMempool));
+    mempool_init(mp, memory, size);
+}
+
 void tMempool_free(tMempool* const mp)
 {
     _tMempool* m = *mp;
-    
     leaf_free(m);
 }
 
@@ -377,9 +381,8 @@
 void    tMempool_initToPool     (tMempool* const mp, char* memory, size_t size, tMempool* const mem)
 {
     _tMempool* mm = *mem;
-    _tMempool* m = *mp = (_tMempool*) mpool_alloc(sizeof(_tMempool), &mm->pool);
-    
-    mpool_create (memory, size, &m->pool);
+    *mp = (_tMempool*) mpool_alloc(sizeof(_tMempool), &mm->pool);
+    mempool_init(mp, memory, size);
 }
 
 void    tMempool_freeFromPool   (tMempool* const mp, tMempool* const mem)
@@ -386,6 +389,5 @@
 {
     _tMempool* mm = *mem;
     _tMempool* m = *mp;
-    
     mpool_free(m, &mm->pool);
 }
--- a/LEAF/Src/leaf-midi.c
+++ b/LEAF/Src/leaf-midi.c
@@ -19,10 +19,9 @@
 //====================================================================================
 /* Stack */
 //====================================================================================
-
-void tStack_init(tStack* const stack)
+static void stack_init(tStack* const stack)
 {
-    _tStack* ns = *stack = (_tStack*) leaf_alloc(sizeof(_tStack));
+    _tStack* ns = *stack;
     
     ns->ordered = OFALSE;
     ns->size = 0;
@@ -32,10 +31,15 @@
     for (int i = 0; i < STACK_SIZE; i++) ns->data[i] = -1;
 }
 
+void tStack_init(tStack* const stack)
+{
+    *stack = (_tStack*) leaf_alloc(sizeof(_tStack));
+    stack_init(stack);
+}
+
 void tStack_free(tStack* const stack)
 {
     _tStack* ns = *stack;
-    
     leaf_free(ns);
 }
 
@@ -42,14 +46,8 @@
 void    tStack_initToPool           (tStack* const stack, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tStack* ns = *stack = (_tStack*) mpool_alloc(sizeof(_tStack), &m->pool);
-    
-    ns->ordered = OFALSE;
-    ns->size = 0;
-    ns->pos = 0;
-    ns->capacity = STACK_SIZE;
-    
-    for (int i = 0; i < STACK_SIZE; i++) ns->data[i] = -1;
+    *stack = (_tStack*) mpool_alloc(sizeof(_tStack), &m->pool);
+    stack_init(stack);
 }
 
 void    tStack_freeFromPool         (tStack* const stack, tMempool* const mp)
@@ -56,7 +54,6 @@
 {
     _tMempool* m = *mp;
     _tStack* ns = *stack;
-    
     mpool_free(ns, &m->pool);
 }
 
@@ -270,9 +267,9 @@
 
 
 // POLY
-void tPoly_init(tPoly* const polyh, int maxNumVoices)
+static void poly_init(tPoly* const polyh, int maxNumVoices)
 {
-    _tPoly* poly = *polyh = (_tPoly*) leaf_alloc(sizeof(_tPoly));
+    _tPoly* poly = *polyh;
     
     poly->numVoices = maxNumVoices;
     poly->maxNumVoices = maxNumVoices;
@@ -292,6 +289,24 @@
     
     poly->glideTime = 5.0f;
     
+    for (int i = 0; i < poly->maxNumVoices; ++i)
+    {
+        poly->voices[i][0] = -1;
+        poly->firstReceived[i] = OFALSE;
+    }
+    poly->pitchBend = 0.0f;
+    poly->pitchGlideIsActive = OFALSE;
+}
+
+void tPoly_init(tPoly* const polyh, int maxNumVoices)
+{
+    _tPoly* poly = *polyh = (_tPoly*) leaf_alloc(sizeof(_tPoly));
+    for (int i = 0; i < maxNumVoices; ++i)
+    {
+        poly->voices[i] = (int*) leaf_alloc(sizeof(int) * 2);
+    }
+    poly_init(polyh, maxNumVoices);
+    
     poly->ramps = (tRamp*) leaf_alloc(sizeof(tRamp) * poly->maxNumVoices);
     poly->rampVals = (float*) leaf_alloc(sizeof(float) * poly->maxNumVoices);
     poly->firstReceived = (oBool*) leaf_alloc(sizeof(oBool) * poly->maxNumVoices);
@@ -299,20 +314,11 @@
     
     for (int i = 0; i < poly->maxNumVoices; ++i)
     {
-        poly->voices[i] = (int*) leaf_alloc(sizeof(int) * 2);
-        poly->voices[i][0] = -1;
-        poly->firstReceived[i] = OFALSE;
-        
         tRamp_init(&poly->ramps[i], poly->glideTime, 1);
     }
-    
-    poly->pitchBend = 0.0f;
-    
     tRamp_init(&poly->pitchBendRamp, 1.0f, 1);
     tStack_init(&poly->stack);
     tStack_init(&poly->orderStack);
-    
-    poly->pitchGlideIsActive = OFALSE;
 }
 
 void tPoly_free(tPoly* const polyh)
@@ -340,25 +346,12 @@
 {
     _tMempool* m = *mp;
     _tPoly* poly = *polyh = (_tPoly*) mpool_alloc(sizeof(_tPoly), &m->pool);
-    
-    poly->numVoices = maxNumVoices;
-    poly->maxNumVoices = maxNumVoices;
-    poly->lastVoiceToChange = 0;
-    
-    // Arp mode stuff
-    poly->currentVoice = 0;
-    poly->maxLength = 128;
-    poly->currentNote = -1;
-    
-    //default learned CCs and notes are just the CCs 1-128 - notes are skipped
-    for (int i = 0; i < 128; i++)
+    for (int i = 0; i < maxNumVoices; ++i)
     {
-        poly->notes[i][0] = 0;
-        poly->notes[i][1] = -1;
+        poly->voices[i] = (int*) mpool_alloc(sizeof(int) * 2, &m->pool);
     }
+    poly_init(polyh, maxNumVoices);
     
-    poly->glideTime = 5.0f;
-    
     poly->ramps = (tRamp*) mpool_alloc(sizeof(tRamp) * poly->maxNumVoices, &m->pool);
     poly->rampVals = (float*) mpool_alloc(sizeof(float) * poly->maxNumVoices, &m->pool);
     poly->firstReceived = (oBool*) mpool_alloc(sizeof(oBool) * poly->maxNumVoices, &m->pool);
@@ -366,20 +359,11 @@
     
     for (int i = 0; i < poly->maxNumVoices; ++i)
     {
-        poly->voices[i] = (int*) mpool_alloc(sizeof(int) * 2, &m->pool);
-        poly->voices[i][0] = -1;
-        poly->firstReceived[i] = OFALSE;
-        
         tRamp_initToPool(&poly->ramps[i], poly->glideTime, 1, mp);
     }
-    
-    poly->pitchBend = 0.0f;
-    
     tRamp_initToPool(&poly->pitchBendRamp, 1.0f, 1, mp);
     tStack_initToPool(&poly->stack, mp);
     tStack_initToPool(&poly->orderStack, mp);
-    
-    poly->pitchGlideIsActive = OFALSE;
 }
 
 void    tPoly_freeFromPool  (tPoly* const polyh, tMempool* const mp)
--- a/LEAF/Src/leaf-oscillators.c
+++ b/LEAF/Src/leaf-oscillators.c
@@ -19,18 +19,22 @@
 #endif
 
 // Cycle
-void    tCycle_init(tCycle* const cy)
+static void    cycle_init(tCycle* const cy)
 {
-    _tCycle* c = *cy = (_tCycle*) leaf_alloc(sizeof(_tCycle));
-    
+    _tCycle* c = *cy;
     c->inc      =  0.0f;
     c->phase    =  0.0f;
 }
 
+void    tCycle_init(tCycle* const cy)
+{
+    *cy = (_tCycle*) leaf_alloc(sizeof(_tCycle));
+    cycle_init(cy);
+}
+
 void    tCycle_free(tCycle* const cy)
 {
     _tCycle* c = *cy;
-    
     leaf_free(c);
 }
 
@@ -37,10 +41,8 @@
 void    tCycle_initToPool   (tCycle* const cy, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tCycle* c = *cy = (_tCycle*) mpool_alloc(sizeof(_tCycle), &m->pool);
-    
-    c->inc      =  0.0f;
-    c->phase    =  0.0f;
+    *cy = (_tCycle*) mpool_alloc(sizeof(_tCycle), &m->pool);
+    cycle_init(cy);
 }
 
 void    tCycle_freeFromPool (tCycle* const cy, tMempool* const mp)
@@ -47,7 +49,6 @@
 {
     _tMempool* m = *mp;
     _tCycle* c = *cy;
-    
     mpool_free(c, &m->pool);
 }
 
@@ -90,18 +91,22 @@
 
 //========================================================================
 /* Triangle */
-void   tTriangle_init(tTriangle* const cy)
+static void   triangle_init(tTriangle* const cy)
 {
-    _tTriangle* c = *cy = (_tTriangle*) leaf_alloc(sizeof(_tTriangle));
-    
+    _tTriangle* c = *cy;
     c->inc      =  0.0f;
     c->phase    =  0.0f;
 }
 
+void   tTriangle_init(tTriangle* const cy)
+{
+    *cy = (_tTriangle*) leaf_alloc(sizeof(_tTriangle));
+    triangle_init(cy);
+}
+
 void   tTriangle_free(tTriangle* const cy)
 {
     _tTriangle* c = *cy;
-    
     leaf_free(c);
 }
 
@@ -108,10 +113,8 @@
 void    tTriangle_initToPool    (tTriangle* const cy, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tTriangle* c = *cy = (_tTriangle*) mpool_alloc(sizeof(_tTriangle), &m->pool);
-    
-    c->inc      =  0.0f;
-    c->phase    =  0.0f;
+    *cy = (_tTriangle*) mpool_alloc(sizeof(_tTriangle), &m->pool);
+    triangle_init(cy);
 }
 
 void    tTriangle_freeFromPool  (tTriangle* const cy, tMempool* const mp)
@@ -118,7 +121,6 @@
 {
     _tMempool* m = *mp;
     _tTriangle* c = *cy;
-    
     mpool_free(c, &m->pool);
 }
 
@@ -221,18 +223,22 @@
 
 //========================================================================
 /* Square */
-void   tSquare_init(tSquare* const cy)
+static void   square_init(tSquare* const cy)
 {
-    _tSquare* c = *cy = (_tSquare*) leaf_alloc(sizeof(_tSquare));
-    
+    _tSquare* c = *cy;
     c->inc      =  0.0f;
     c->phase    =  0.0f;
 }
 
+void   tSquare_init(tSquare* const cy)
+{
+    *cy = (_tSquare*) leaf_alloc(sizeof(_tSquare));
+    square_init(cy);
+}
+
 void   tSquare_free(tSquare* const cy)
 {
     _tSquare* c = *cy;
-    
     leaf_free(c);
 }
 
@@ -239,10 +245,8 @@
 void    tSquare_initToPool  (tSquare* const cy, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tSquare* c = *cy = (_tSquare*) mpool_alloc(sizeof(_tSquare), &m->pool);
-    
-    c->inc      =  0.0f;
-    c->phase    =  0.0f;
+    *cy = (_tSquare*) mpool_alloc(sizeof(_tSquare), &m->pool);
+    square_init(cy);
 }
 
 void    tSquare_freeFromPool(tSquare* const cy, tMempool* const mp)
@@ -249,7 +253,6 @@
 {
     _tMempool* m = *mp;
     _tSquare* c = *cy;
-    
     mpool_free(c, &m->pool);
 }
 
@@ -350,18 +353,22 @@
 
 //=====================================================================
 // Sawtooth
-void    tSawtooth_init(tSawtooth* const cy)
+static void    sawtooth_init(tSawtooth* const cy)
 {
-    _tSawtooth* c = *cy = (_tSawtooth*) leaf_alloc(sizeof(_tSawtooth));
-    
+    _tSawtooth* c = *cy;
     c->inc      = 0.0f;
     c->phase    = 0.0f;
 }
 
+void    tSawtooth_init(tSawtooth* const cy)
+{
+    *cy = (_tSawtooth*) leaf_alloc(sizeof(_tSawtooth));
+    sawtooth_init(cy);
+}
+
 void    tSawtooth_free(tSawtooth* const cy)
 {
     _tSawtooth* c = *cy;
-    
     leaf_free(c);
 }
 
@@ -368,10 +375,8 @@
 void    tSawtooth_initToPool    (tSawtooth* const cy, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tSawtooth* c = *cy = (_tSawtooth*) mpool_alloc(sizeof(_tSawtooth), &m->pool);
-    
-    c->inc      = 0.0f;
-    c->phase    = 0.0f;
+    *cy = (_tSawtooth*) mpool_alloc(sizeof(_tSawtooth), &m->pool);
+    sawtooth_init(cy);
 }
 
 void    tSawtooth_freeFromPool  (tSawtooth* const cy, tMempool* const mp)
@@ -378,7 +383,6 @@
 {
     _tMempool* m = *mp;
     _tSawtooth* c = *cy;
-    
     mpool_free(c, &m->pool);
 }
 
@@ -480,25 +484,22 @@
 
 //========================================================================
 /* Phasor */
-void     tPhasorSampleRateChanged (tPhasor* const ph)
+static void    phasor_init(tPhasor* const ph)
 {
     _tPhasor* p = *ph;
-    
-    p->inc = p->freq * leaf.invSampleRate;
-};
+    p->phase = 0.0f;
+    p->inc = 0.0f;
+}
 
 void    tPhasor_init(tPhasor* const ph)
 {
-    _tPhasor* p = *ph = (_tPhasor*) leaf_alloc(sizeof(_tPhasor));
-    
-    p->phase = 0.0f;
-    p->inc = 0.0f;
+    *ph = (_tPhasor*) leaf_alloc(sizeof(_tPhasor));
+    phasor_init(ph);
 }
 
 void    tPhasor_free(tPhasor* const ph)
 {
     _tPhasor* p = *ph;
-    
     leaf_free(p);
 }
 
@@ -505,10 +506,8 @@
 void    tPhasor_initToPool  (tPhasor* const ph, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tPhasor* p = *ph = (_tPhasor*) mpool_alloc(sizeof(_tPhasor), &m->pool);
-    
-    p->phase = 0.0f;
-    p->inc = 0.0f;
+    *ph = (_tPhasor*) mpool_alloc(sizeof(_tPhasor), &m->pool);
+    phasor_init(ph);
 }
 
 void    tPhasor_freeFromPool(tPhasor* const ph, tMempool* const mp)
@@ -515,7 +514,6 @@
 {
     _tMempool* m = *mp;
     _tPhasor* p = *ph;
-    
     mpool_free(p, &m->pool);
 }
 
@@ -543,18 +541,22 @@
 }
 
 /* Noise */
-void    tNoise_init(tNoise* const ns, NoiseType type)
+static void    noise_init(tNoise* const ns, NoiseType type)
 {
-    _tNoise* n = *ns = (_tNoise*) leaf_alloc(sizeof(_tNoise));
-    
+    _tNoise* n = *ns;
     n->type = type;
     n->rand = leaf.random;
 }
 
+void    tNoise_init(tNoise* const ns, NoiseType type)
+{
+    *ns = (_tNoise*) leaf_alloc(sizeof(_tNoise));
+    noise_init(ns, type);
+}
+
 void    tNoise_free(tNoise* const ns)
 {
     _tNoise* n = *ns;
-    
     leaf_free(n);
 }
 
@@ -561,10 +563,8 @@
 void    tNoise_initToPool   (tNoise* const ns, NoiseType type, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tNoise* n = *ns = (_tNoise*) mpool_alloc(sizeof(_tNoise), &m->pool);
-    
-    n->type = type;
-    n->rand = leaf.random;
+    *ns = (_tNoise*) mpool_alloc(sizeof(_tNoise), &m->pool);
+    noise_init(ns, type);
 }
 
 void    tNoise_freeFromPool (tNoise* const ns, tMempool* const mp)
@@ -571,7 +571,6 @@
 {
     _tMempool* m = *mp;
     _tNoise* n = *ns;
-    
     mpool_free(n, &m->pool);
 }
 
@@ -596,20 +595,18 @@
     }
 }
 
-//=================================================================================
-/* Neuron */
-
-void     tNeuronSampleRateChanged(tNeuron* nr)
+void     tPhasorSampleRateChanged (tPhasor* const ph)
 {
+    _tPhasor* p = *ph;
     
+    p->inc = p->freq * leaf.invSampleRate;
 }
 
-void    tNeuron_init(tNeuron* const nr)
+//=================================================================================
+/* Neuron */
+static void    neuron_init(tNeuron* const nr)
 {
-    _tNeuron* n = *nr = (_tNeuron*) leaf_alloc(sizeof(_tNeuron));
-    
-    tPoleZero_init(&n->f);
-    
+    _tNeuron* n = *nr;
     tPoleZero_setBlockZero(&n->f, 0.99f);
     
     n->timeStep = 1.0f / 50.0f;
@@ -635,10 +632,16 @@
     n->rate[2] = n->gL/n->C;
 }
 
+void    tNeuron_init(tNeuron* const nr)
+{
+    _tNeuron* n = *nr = (_tNeuron*) leaf_alloc(sizeof(_tNeuron));
+    tPoleZero_init(&n->f);
+    neuron_init(nr);
+}
+
 void    tNeuron_free(tNeuron* const nr)
 {
     _tNeuron* n = *nr;
-    
     tPoleZero_free(&n->f);
     leaf_free(n);
 }
@@ -647,32 +650,8 @@
 {
     _tMempool* m = *mp;
     _tNeuron* n = *nr = (_tNeuron*) mpool_alloc(sizeof(_tNeuron), &m->pool);
-    
     tPoleZero_initToPool(&n->f, mp);
-    
-    tPoleZero_setBlockZero(&n->f, 0.99f);
-    
-    n->timeStep = 1.0f / 50.0f;
-    
-    n->current = 0.0f; // 100.0f for sound
-    n->voltage = 0.0f;
-    
-    n->mode = NeuronNormal;
-    
-    n->P[0] = 0.0f;
-    n->P[1] = 0.0f;
-    n->P[2] = 1.0f;
-    
-    n->V[0] = -12.0f;
-    n->V[1] = 115.0f;
-    n->V[2] = 10.613f;
-    
-    n->gK = 36.0f;
-    n->gN = 120.0f;
-    n->gL = 0.3f;
-    n->C = 1.0f;
-    
-    n->rate[2] = n->gL/n->C;
+    neuron_init(nr);
 }
 
 void    tNeuron_freeFromPool(tNeuron* const nr, tMempool* const mp)
@@ -850,4 +829,9 @@
 {
     _tNeuron* n = *nr;
     n->current = current;
+}
+
+void     tNeuronSampleRateChanged(tNeuron* nr)
+{
+    
 }
--- a/LEAF/Src/leaf-physical.c
+++ b/LEAF/Src/leaf-physical.c
@@ -17,21 +17,25 @@
 #endif
 
 /* ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ tPluck ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ */
-void    tPluck_init         (tPluck* const pl, float lowestFrequency)
+static void    pluck_init         (tPluck* const pl, float lowestFrequency)
 {
-    _tPluck* p = *pl = (_tPluck*) leaf_alloc(sizeof(_tPluck));
+    _tPluck* p = *pl;
     
     if ( lowestFrequency <= 0.0f )  lowestFrequency = 10.0f;
-    
+
+    tPluck_setFrequency(pl, 220.0f);
+}
+
+void    tPluck_init         (tPluck* const pl, float lowestFrequency)
+{
+    _tPluck* p = *pl = (_tPluck*) leaf_alloc(sizeof(_tPluck));
+
     tNoise_init(&p->noise, WhiteNoise);
-    
     tOnePole_init(&p->pickFilter, 0.0f);
-    
     tOneZero_init(&p->loopFilter, 0.0f);
-    
     tAllpassDelay_init(&p->delayLine, 0.0f, leaf.sampleRate * 2);
     
-    tPluck_setFrequency(pl, 220.0f);
+    pluck_init(pl, lowestFrequency);
 }
 
 void tPluck_free (tPluck* const pl)
@@ -51,17 +55,12 @@
     _tMempool* m = *mp;
     _tPluck* p = *pl = (_tPluck*) mpool_alloc(sizeof(_tPluck), &m->pool);
     
-    if ( lowestFrequency <= 0.0f )  lowestFrequency = 10.0f;
-    
     tNoise_initToPool(&p->noise, WhiteNoise, mp);
-    
     tOnePole_initToPool(&p->pickFilter, 0.0f, mp);
-    
     tOneZero_initToPool(&p->loopFilter, 0.0f, mp);
-    
     tAllpassDelay_initToPool(&p->delayLine, 0.0f, leaf.sampleRate * 2, mp);
     
-    tPluck_setFrequency(pl, 220.0f);
+    pluck_init(pl, lowestFrequency);
 }
 
 void    tPluck_freeFromPool  (tPluck* const pl, tMempool* const mp)
@@ -155,18 +154,29 @@
 }
 
 /* ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ tKarplusStrong ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ */
-void    tKarplusStrong_init (tKarplusStrong* const pl, float lowestFrequency)
+static void    karplusstrong_init (tKarplusStrong* const pl, float lowestFrequency)
 {
-    _tKarplusStrong* p = *pl = (_tKarplusStrong*) leaf_alloc(sizeof(_tKarplusStrong));
+    _tKarplusStrong* p = *pl;
     
     if ( lowestFrequency <= 0.0f )  lowestFrequency = 8.0f;
     
-    tAllpassDelay_init(&p->delayLine, 0.0f, leaf.sampleRate * 2);
+    p->pluckAmplitude = 0.3f;
+    p->pickupPosition = 0.4f;
+    
+    p->stretching = 0.9999f;
+    p->baseLoopGain = 0.995f;
+    p->loopGain = 0.999f;
+    
+    tKarplusStrong_setFrequency( pl, 220.0f );
+}
 
+void    tKarplusStrong_init (tKarplusStrong* const pl, float lowestFrequency)
+{
+    _tKarplusStrong* p = *pl = (_tKarplusStrong*) leaf_alloc(sizeof(_tKarplusStrong));
+
+    tAllpassDelay_init(&p->delayLine, 0.0f, leaf.sampleRate * 2);
     tLinearDelay_init(&p->combDelay, 0.0f, leaf.sampleRate * 2);
-    
     tOneZero_init(&p->filter, 0.0f);
-    
     tNoise_init(&p->noise, WhiteNoise);
     
     for (int i = 0; i < 4; i++)
@@ -174,14 +184,7 @@
         tBiQuad_init(&p->biquad[i]);
     }
     
-    p->pluckAmplitude = 0.3f;
-    p->pickupPosition = 0.4f;
-    
-    p->stretching = 0.9999f;
-    p->baseLoopGain = 0.995f;
-    p->loopGain = 0.999f;
-    
-    tKarplusStrong_setFrequency( pl, 220.0f );
+    karplusstrong_init(pl, lowestFrequency);
 }
 
 void tKarplusStrong_free (tKarplusStrong* const pl)
@@ -205,15 +208,10 @@
 {
     _tMempool* m = *mp;
     _tKarplusStrong* p = *pl = (_tKarplusStrong*) mpool_alloc(sizeof(_tKarplusStrong), &m->pool);
-    
-    if ( lowestFrequency <= 0.0f )  lowestFrequency = 8.0f;
-    
+ 
     tAllpassDelay_initToPool(&p->delayLine, 0.0f, leaf.sampleRate * 2, mp);
-    
     tLinearDelay_initToPool(&p->combDelay, 0.0f, leaf.sampleRate * 2, mp);
-    
     tOneZero_initToPool(&p->filter, 0.0f, mp);
-    
     tNoise_initToPool(&p->noise, WhiteNoise, mp);
     
     for (int i = 0; i < 4; i++)
@@ -221,14 +219,7 @@
         tBiQuad_initToPool(&p->biquad[i], mp);
     }
     
-    p->pluckAmplitude = 0.3f;
-    p->pickupPosition = 0.4f;
-    
-    p->stretching = 0.9999f;
-    p->baseLoopGain = 0.995f;
-    p->loopGain = 0.999f;
-    
-    tKarplusStrong_setFrequency( pl, 220.0f );
+    karplusstrong_init(pl, lowestFrequency);
 }
 
 void    tKarplusStrong_freeFromPool (tKarplusStrong* const pl, tMempool* const mp)
@@ -405,6 +396,17 @@
 }
 
 /* Simple Living String*/
+static void    simplelivingstring_init(tSimpleLivingString* const pl, float freq, float dampFreq,
+                                 float decay, float targetLev, float levSmoothFactor,
+                                 float levStrength, int levMode)
+{
+    _tSimpleLivingString* p = *pl;
+    
+    p->curr=0.0f;
+    p->decay=decay;
+    p->levMode=levMode;
+    tSimpleLivingString_setFreq(pl, freq);
+}
 
 void    tSimpleLivingString_init(tSimpleLivingString* const pl, float freq, float dampFreq,
                                  float decay, float targetLev, float levSmoothFactor,
@@ -412,15 +414,13 @@
 {
     _tSimpleLivingString* p = *pl = (_tSimpleLivingString*) leaf_alloc(sizeof(_tSimpleLivingString));
     
-    p->curr=0.0f;
     tExpSmooth_init(&p->wlSmooth, leaf.sampleRate/freq, 0.01); // smoother for string wavelength (not freq, to avoid expensive divisions)
-    tSimpleLivingString_setFreq(pl, freq);
     tLinearDelay_init(&p->delayLine,p->waveLengthInSamples, 2400);
     tOnePole_init(&p->bridgeFilter, dampFreq);
     tHighpass_init(&p->DCblocker,13);
-    p->decay=decay;
     tFeedbackLeveler_init(&p->fbLev, targetLev, levSmoothFactor, levStrength, levMode);
-    p->levMode=levMode;
+    
+    simplelivingstring_init(pl, freq, dampFreq, decay, targetLev, levSmoothFactor, levStrength, levMode);
 }
 
 void tSimpleLivingString_free(tSimpleLivingString* const pl)
@@ -442,16 +442,14 @@
 {
     _tMempool* m = *mp;
     _tSimpleLivingString* p = *pl = (_tSimpleLivingString*) mpool_alloc(sizeof(_tSimpleLivingString), &m->pool);
-    
-    p->curr=0.0f;
+
     tExpSmooth_initToPool(&p->wlSmooth, leaf.sampleRate/freq, 0.01, mp); // smoother for string wavelength (not freq, to avoid expensive divisions)
-    tSimpleLivingString_setFreq(pl, freq);
     tLinearDelay_initToPool(&p->delayLine,p->waveLengthInSamples, 2400, mp);
     tOnePole_initToPool(&p->bridgeFilter, dampFreq, mp);
     tHighpass_initToPool(&p->DCblocker,13, mp);
-    p->decay=decay;
     tFeedbackLeveler_initToPool(&p->fbLev, targetLev, levSmoothFactor, levStrength, levMode, mp);
-    p->levMode=levMode;
+    
+    simplelivingstring_init(pl, freq, dampFreq, decay, targetLev, levSmoothFactor, levStrength, levMode);
 }
 
 void    tSimpleLivingString_freeFromPool    (tSimpleLivingString* const pl, tMempool* const mp)
@@ -544,6 +542,22 @@
 }
 
 /* Living String*/
+static void    livingstring_init(tLivingString* const pl, float freq, float pickPos, float prepIndex,
+                           float dampFreq, float decay, float targetLev, float levSmoothFactor,
+                           float levStrength, int levMode)
+{
+    _tLivingString* p = *pl;
+    
+    p->curr=0.0f;
+    p->freq = freq;
+    p->prepIndex = prepIndex;
+    p->dampFreq = dampFreq;
+    p->decay = decay;
+    p->prepIndex = prepIndex;
+    p->levMode = levMode;
+    tLivingString_setFreq(pl, freq);
+    tLivingString_setPickPos(pl, pickPos);
+}
 
 void    tLivingString_init(tLivingString* const pl, float freq, float pickPos, float prepIndex,
                            float dampFreq, float decay, float targetLev, float levSmoothFactor,
@@ -550,19 +564,13 @@
                            float levStrength, int levMode)
 {
     _tLivingString* p = *pl = (_tLivingString*) leaf_alloc(sizeof(_tLivingString));
-    
-    p->curr=0.0f;
+
     tExpSmooth_init(&p->wlSmooth, leaf.sampleRate/freq, 0.01); // smoother for string wavelength (not freq, to avoid expensive divisions)
-    tLivingString_setFreq(pl, freq);
-    p->freq = freq;
     tExpSmooth_init(&p->ppSmooth, pickPos, 0.01); // smoother for pick position
-    tLivingString_setPickPos(pl, pickPos);
-    p->prepIndex=prepIndex;
     tLinearDelay_init(&p->delLF,p->waveLengthInSamples, 2400);
     tLinearDelay_init(&p->delUF,p->waveLengthInSamples, 2400);
     tLinearDelay_init(&p->delUB,p->waveLengthInSamples, 2400);
     tLinearDelay_init(&p->delLB,p->waveLengthInSamples, 2400);
-    p->dampFreq = dampFreq;
     tOnePole_init(&p->bridgeFilter, dampFreq);
     tOnePole_init(&p->nutFilter, dampFreq);
     tOnePole_init(&p->prepFilterU, dampFreq);
@@ -569,11 +577,10 @@
     tOnePole_init(&p->prepFilterL, dampFreq);
     tHighpass_init(&p->DCblockerU,13);
     tHighpass_init(&p->DCblockerL,13);
-    p->decay=decay;
-    p->prepIndex = prepIndex;
     tFeedbackLeveler_init(&p->fbLevU, targetLev, levSmoothFactor, levStrength, levMode);
     tFeedbackLeveler_init(&p->fbLevL, targetLev, levSmoothFactor, levStrength, levMode);
-    p->levMode=levMode;
+    
+    livingstring_init(pl, freq, pickPos, prepIndex, dampFreq, decay, targetLev, levSmoothFactor, levStrength, levMode);
 }
 
 void tLivingString_free(tLivingString* const pl)
@@ -605,18 +612,12 @@
     _tMempool* m = *mp;
     _tLivingString* p = *pl = (_tLivingString*) mpool_alloc(sizeof(_tLivingString), &m->pool);
     
-    p->curr=0.0f;
     tExpSmooth_initToPool(&p->wlSmooth, leaf.sampleRate/freq, 0.01, mp); // smoother for string wavelength (not freq, to avoid expensive divisions)
-    tLivingString_setFreq(pl, freq);
-    p->freq = freq;
     tExpSmooth_initToPool(&p->ppSmooth, pickPos, 0.01, mp); // smoother for pick position
-    tLivingString_setPickPos(pl, pickPos);
-    p->prepIndex=prepIndex;
     tLinearDelay_initToPool(&p->delLF,p->waveLengthInSamples, 2400, mp);
     tLinearDelay_initToPool(&p->delUF,p->waveLengthInSamples, 2400, mp);
     tLinearDelay_initToPool(&p->delUB,p->waveLengthInSamples, 2400, mp);
     tLinearDelay_initToPool(&p->delLB,p->waveLengthInSamples, 2400, mp);
-    p->dampFreq = dampFreq;
     tOnePole_initToPool(&p->bridgeFilter, dampFreq, mp);
     tOnePole_initToPool(&p->nutFilter, dampFreq, mp);
     tOnePole_initToPool(&p->prepFilterU, dampFreq, mp);
@@ -623,11 +624,10 @@
     tOnePole_initToPool(&p->prepFilterL, dampFreq, mp);
     tHighpass_initToPool(&p->DCblockerU,13, mp);
     tHighpass_initToPool(&p->DCblockerL,13, mp);
-    p->decay=decay;
-    p->prepIndex = prepIndex;
     tFeedbackLeveler_initToPool(&p->fbLevU, targetLev, levSmoothFactor, levStrength, levMode, mp);
     tFeedbackLeveler_initToPool(&p->fbLevL, targetLev, levSmoothFactor, levStrength, levMode, mp);
-    p->levMode=levMode;
+   
+    livingstring_init(pl, freq, pickPos, prepIndex, dampFreq, decay, targetLev, levSmoothFactor, levStrength, levMode);
 }
 
 void    tLivingString_freeFromPool  (tLivingString* const pl, tMempool* const mp)
@@ -776,19 +776,22 @@
 
 ///Reed Table model
 //default values from STK are 0.6 offset and -0.8 slope
+static void    reedtable_init      (tReedTable* const pm, float offset, float slope)
+{
+    _tReedTable* p = *pm;
+    p->offset = offset;
+    p->slope = slope;
+}
 
 void    tReedTable_init      (tReedTable* const pm, float offset, float slope)
 {
     _tReedTable* p = *pm = (_tReedTable*) leaf_alloc(sizeof(_tReedTable));
-    
-    p->offset = offset;
-    p->slope = slope;
+    reedtable_init(pm, offset, slope);
 }
 
 void    tReedTable_free      (tReedTable* const pm)
 {
     _tReedTable* p = *pm;
-    
     leaf_free(p);
 }
 
@@ -796,9 +799,7 @@
 {
     _tMempool* m = *mp;
     _tReedTable* p = *pm = (_tReedTable*) mpool_alloc(sizeof(_tReedTable), &m->pool);
-    
-    p->offset = offset;
-    p->slope = slope;
+    reedtable_init(pm, offset, slope);
 }
 
 void    tReedTable_freeFromPool (tReedTable* const pm, tMempool* const mp)
@@ -805,7 +806,6 @@
 {
     _tMempool* m = *mp;
     _tReedTable* p = *pm;
-    
     mpool_free(p, &m->pool);
 }
 
--- a/LEAF/Src/leaf-reverb.c
+++ b/LEAF/Src/leaf-reverb.c
@@ -19,15 +19,19 @@
 #endif
 
 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ PRCReverb ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ //
-void    tPRCReverb_init(tPRCReverb* const rev, float t60)
+static void    prcreverb_init(tPRCReverb* const rev, float t60)
 {
-    _tPRCReverb* r = *rev = (_tPRCReverb*) leaf_alloc(sizeof(_tPRCReverb));
+    _tPRCReverb* r = *rev;
     
     if (t60 <= 0.0f) t60 = 0.001f;
     
     r->inv_441 = 1.0f/44100.0f;
     
-    int lengths[4] = { 341, 613, 1557, 2137 }; // Delay lengths for 44100 Hz sample rate.
+    // Delay lengths for 44100 Hz sample rate.
+    r->lengths[0] = 341;
+    r->lengths[1] = 613;
+    r->lengths[2] = 1557;
+    r->lengths[3] = 2137;
     double scaler = leaf.sampleRate * r->inv_441;
     
     int delay, i;
@@ -35,20 +39,16 @@
     {
         for (i=0; i<4; i++)
         {
-            delay = (int) scaler * lengths[i];
+            delay = (int) scaler * r->lengths[i];
             
             if ( (delay & 1) == 0)          delay++;
             
             while ( !LEAF_isPrime(delay) )  delay += 2;
             
-            lengths[i] = delay;
+            r->lengths[i] = delay;
         }
     }
     
-    tDelay_init(&r->allpassDelays[0], lengths[0], lengths[0] * 2);
-    tDelay_init(&r->allpassDelays[1], lengths[1], lengths[1] * 2);
-    tDelay_init(&r->combDelay, lengths[2], lengths[2] * 2);
-    
     tPRCReverb_setT60(rev, t60);
     
     r->allpassCoeff = 0.7f;
@@ -55,10 +55,18 @@
     r->mix = 0.5f;
 }
 
+void    tPRCReverb_init(tPRCReverb* const rev, float t60)
+{
+    _tPRCReverb* r = *rev = (_tPRCReverb*) leaf_alloc(sizeof(_tPRCReverb));
+    prcreverb_init(rev, t60);
+    tDelay_init(&r->allpassDelays[0], r->lengths[0], r->lengths[0] * 2);
+    tDelay_init(&r->allpassDelays[1], r->lengths[1], r->lengths[1] * 2);
+    tDelay_init(&r->combDelay, r->lengths[2], r->lengths[2] * 2);
+}
+
 void tPRCReverb_free(tPRCReverb* const rev)
 {
     _tPRCReverb* r = *rev;
-    
     tDelay_free(&r->allpassDelays[0]);
     tDelay_free(&r->allpassDelays[1]);
     tDelay_free(&r->combDelay);
@@ -69,37 +77,10 @@
 {
     _tMempool* m = *mp;
     _tPRCReverb* r = *rev = (_tPRCReverb*) mpool_alloc(sizeof(_tPRCReverb), &m->pool);
-    
-    if (t60 <= 0.0f) t60 = 0.001f;
-    
-    r->inv_441 = 1.0f/44100.0f;
-    
-    int lengths[4] = { 341, 613, 1557, 2137 }; // Delay lengths for 44100 Hz sample rate.
-    double scaler = leaf.sampleRate * r->inv_441;
-    
-    int delay, i;
-    if (scaler != 1.0f)
-    {
-        for (i=0; i<4; i++)
-        {
-            delay = (int) scaler * lengths[i];
-            
-            if ( (delay & 1) == 0)          delay++;
-            
-            while ( !LEAF_isPrime(delay) )  delay += 2;
-            
-            lengths[i] = delay;
-        }
-    }
-    
-    tDelay_initToPool(&r->allpassDelays[0], lengths[0], lengths[0] * 2, mp);
-    tDelay_initToPool(&r->allpassDelays[1], lengths[1], lengths[1] * 2, mp);
-    tDelay_initToPool(&r->combDelay, lengths[2], lengths[2] * 2, mp);
-    
-    tPRCReverb_setT60(rev, t60);
-    
-    r->allpassCoeff = 0.7f;
-    r->mix = 0.5f;
+    prcreverb_init(rev, t60);
+    tDelay_initToPool(&r->allpassDelays[0], r->lengths[0], r->lengths[0] * 2, mp);
+    tDelay_initToPool(&r->allpassDelays[1], r->lengths[1], r->lengths[1] * 2, mp);
+    tDelay_initToPool(&r->combDelay, r->lengths[2], r->lengths[2] * 2, mp);
 }
 
 void    tPRCReverb_freeFromPool (tPRCReverb* const rev, tMempool* const mp)
@@ -106,7 +87,6 @@
 {
     _tMempool* m = *mp;
     _tPRCReverb* r = *rev;
-    
     tDelay_freeFromPool(&r->allpassDelays[0], mp);
     tDelay_freeFromPool(&r->allpassDelays[1], mp);
     tDelay_freeFromPool(&r->combDelay, mp);
@@ -172,62 +152,64 @@
 }
 
 /* ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ NReverb ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ */
-void    tNReverb_init(tNReverb* const rev, float t60)
+static void    nreverb_init(tNReverb* const rev, float t60)
 {
-    _tNReverb* r = *rev = (_tNReverb*) leaf_alloc(sizeof(_tNReverb));
+    _tNReverb* r = *rev;
     
     if (t60 <= 0.0f) t60 = 0.001f;
     
     r->inv_441 = 1.0f/44100.0f;
     
-    int lengths[15] = {1433, 1601, 1867, 2053, 2251, 2399, 347, 113, 37, 59, 53, 43, 37, 29, 19}; // Delay lengths for 44100 Hz sample rate.
+    int l[15] = {1433, 1601, 1867, 2053, 2251, 2399, 347, 113, 37, 59, 53, 43, 37, 29, 19}; // Delay lengths for 44100 Hz sample rate.
+    for (int i = 0; i < 15; i++) r->lengths[i] = l[i];
     double scaler = leaf.sampleRate / 25641.0f;
     
     int delay, i;
-    
     for (i=0; i < 15; i++)
     {
-        delay = (int) scaler * lengths[i];
+        delay = (int) scaler * r->lengths[i];
         if ( (delay & 1) == 0)
             delay++;
         while ( !LEAF_isPrime(delay) )
             delay += 2;
-        lengths[i] = delay;
+        r->lengths[i] = delay;
     }
     
-    for ( i=0; i<6; i++ )
-    {
-    	tLinearDelay_init(&r->combDelays[i], lengths[i], lengths[i] * 2.0f);
-    	tLinearDelay_clear(&r->combDelays[i]);
-        r->combCoeffs[i] = pow(10.0, (-3 * lengths[i] * leaf.invSampleRate / t60));
-    }
+    tNReverb_setT60(rev, t60);
+    r->allpassCoeff = 0.7f;
+    r->mix = 0.3f;
     
-    for ( i=0; i<8; i++ )
+    for (int i = 0; i < 6; i++)
     {
-    	tLinearDelay_init(&r->allpassDelays[i], lengths[i+6], lengths[i+6] * 2.0f);
-    	tLinearDelay_clear(&r->allpassDelays[i]);
+        r->combCoeffs[i] = pow(10.0, (-3 * r->lengths[i] * leaf.invSampleRate / t60));
     }
+}
 
-    
-    tNReverb_setT60(rev, t60);
-    r->allpassCoeff = 0.7f;
-    r->mix = 0.3f;
+void    tNReverb_init(tNReverb* const rev, float t60)
+{
+    _tNReverb* r = *rev = (_tNReverb*) leaf_alloc(sizeof(_tNReverb));
+    nreverb_init(rev, t60);
+    for (int i = 0; i < 6; i++)
+    {
+    	tLinearDelay_init(&r->combDelays[i], r->lengths[i], r->lengths[i] * 2.0f);
+    }
+    for (int i = 0; i < 8; i++)
+    {
+    	tLinearDelay_init(&r->allpassDelays[i], r->lengths[i+6], r->lengths[i+6] * 2.0f);
+    }
 }
 
 void    tNReverb_free(tNReverb* const rev)
 {
     _tNReverb* r = *rev;
-    
     for (int i = 0; i < 6; i++)
     {
     	tLinearDelay_free(&r->combDelays[i]);
     }
-    
     for (int i = 0; i < 8; i++)
     {
     	tLinearDelay_free(&r->allpassDelays[i]);
     }
-    
     leaf_free(r);
 }
 
@@ -235,41 +217,15 @@
 {
     _tMempool* m = *mp;
     _tNReverb* r = *rev = (_tNReverb*) mpool_alloc(sizeof(_tNReverb), &m->pool);
-    
-    if (t60 <= 0.0f) t60 = 0.001f;
-    
-    r->inv_441 = 1.0f/44100.0f;
-    
-    int lengths[15] = {1433, 1601, 1867, 2053, 2251, 2399, 347, 113, 37, 59, 53, 43, 37, 29, 19}; // Delay lengths for 44100 Hz sample rate.
-    double scaler = leaf.sampleRate / 25641.0f;
-    
-    int delay, i;
-    
-    for (i=0; i < 15; i++)
+    nreverb_init(rev, t60);
+    for (int i = 0; i < 6; i++)
     {
-        delay = (int) scaler * lengths[i];
-        if ( (delay & 1) == 0)
-            delay++;
-        while ( !LEAF_isPrime(delay) )
-            delay += 2;
-        lengths[i] = delay;
+        tLinearDelay_initToPool(&r->combDelays[i], r->lengths[i], r->lengths[i] * 2.0f, mp);
     }
-    
-    for ( i=0; i<6; i++ )
+    for (int i = 0; i < 8; i++)
     {
-        tLinearDelay_initToPool(&r->combDelays[i], lengths[i], lengths[i] * 2.0f, mp);
-        r->combCoeffs[i] = pow(10.0, (-3 * lengths[i] * leaf.invSampleRate / t60));
+        tLinearDelay_initToPool(&r->allpassDelays[i], r->lengths[i+6], r->lengths[i+6] * 2.0f, mp);
     }
-    
-    for ( i=0; i<8; i++ )
-    {
-        tLinearDelay_initToPool(&r->allpassDelays[i], lengths[i+6], lengths[i+6] * 2.0f, mp);
-    }
-    
-    
-    tNReverb_setT60(rev, t60);
-    r->allpassCoeff = 0.7f;
-    r->mix = 0.3f;
 }
 
 void    tNReverb_freeFromPool   (tNReverb* const rev, tMempool* const mp)
@@ -276,17 +232,14 @@
 {
     _tMempool* m = *mp;
     _tNReverb* r = *rev;
-    
     for (int i = 0; i < 6; i++)
     {
         tLinearDelay_freeFromPool(&r->combDelays[i], mp);
     }
-    
     for (int i = 0; i < 8; i++)
     {
         tLinearDelay_freeFromPool(&r->allpassDelays[i], mp);
     }
-    
     mpool_free(r, &m->pool);
 }
 
@@ -430,10 +383,9 @@
 float       in_allpass_delays[4] = { 4.771f, 3.595f, 12.73f, 9.307f };
 float       in_allpass_gains[4] = { 0.75f, 0.75f, 0.625f, 0.625f };
 
-
-void    tDattorroReverb_init              (tDattorroReverb* const rev)
+static void    dattorroreverb_init              (tDattorroReverb* const rev)
 {
-    _tDattorroReverb* r = *rev = (_tDattorroReverb*) leaf_alloc(sizeof(_tDattorroReverb));
+    _tDattorroReverb* r = *rev;
     
     r->size_max = 2.0f;
     r->size = 1.f;
@@ -440,6 +392,32 @@
     r->t = r->size * leaf.sampleRate * 0.001f;
     r->frozen = 0;
     // INPUT
+    for (int i = 0; i < 4; i++)
+    {
+        tAllpass_setGain(&r->in_allpass[i], in_allpass_gains[i]);
+    }
+    
+    // FEEDBACK 1
+    tAllpass_setGain(&r->f1_allpass, 0.7f);
+    tCycle_setFreq(&r->f1_lfo, 0.1f);
+    
+    // FEEDBACK 2
+    tAllpass_setGain(&r->f2_allpass, 0.7f);
+    tCycle_setFreq(&r->f2_lfo, 0.07f);
+    
+    // PARAMETERS
+    tDattorroReverb_setMix(rev, 0.5f);
+    tDattorroReverb_setInputDelay(rev,  0.f);
+    tDattorroReverb_setInputFilter(rev, 10000.f);
+    tDattorroReverb_setFeedbackFilter(rev, 5000.f);
+    tDattorroReverb_setFeedbackGain(rev, 0.4f);
+}
+
+void    tDattorroReverb_init              (tDattorroReverb* const rev)
+{
+    _tDattorroReverb* r = *rev = (_tDattorroReverb*) leaf_alloc(sizeof(_tDattorroReverb));
+    float size_max = 2.0f;
+    // INPUT
     tTapeDelay_init(&r->in_delay, 0.f, SAMP(200.f));
     tOnePole_init(&r->in_filter, 1.f);
     
@@ -446,16 +424,14 @@
     for (int i = 0; i < 4; i++)
     {
         tAllpass_init(&r->in_allpass[i], SAMP(in_allpass_delays[i]), SAMP(20.f)); // * r->size_max
-        tAllpass_setGain(&r->in_allpass[i], in_allpass_gains[i]);
     }
     
     // FEEDBACK 1
     tAllpass_init(&r->f1_allpass, SAMP(30.51f), SAMP(100.f)); // * r->size_max
-    tAllpass_setGain(&r->f1_allpass, 0.7f);
     
-    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);
+    tTapeDelay_init(&r->f1_delay_1, SAMP(141.69f), SAMP(200.0f) * size_max + 1);
+    tTapeDelay_init(&r->f1_delay_2, SAMP(89.24f), SAMP(100.0f) * size_max + 1);
+    tTapeDelay_init(&r->f1_delay_3, SAMP(125.f), SAMP(200.0f) * size_max + 1);
     
     tOnePole_init(&r->f1_filter, 1.f);
     
@@ -462,15 +438,13 @@
     tHighpass_init(&r->f1_hp, 20.f);
     
     tCycle_init(&r->f1_lfo);
-    tCycle_setFreq(&r->f1_lfo, 0.1f);
     
     // FEEDBACK 2
     tAllpass_init(&r->f2_allpass, SAMP(22.58f), SAMP(100.f)); // * r->size_max
-    tAllpass_setGain(&r->f2_allpass, 0.7f);
     
-    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);
+    tTapeDelay_init(&r->f2_delay_1, SAMP(149.62f), SAMP(200.f) * size_max + 1);
+    tTapeDelay_init(&r->f2_delay_2, SAMP(60.48f), SAMP(100.f) * size_max + 1);
+    tTapeDelay_init(&r->f2_delay_3, SAMP(106.28f), SAMP(200.f) * size_max + 1);
     
     tOnePole_init(&r->f2_filter, 1.f);
     
@@ -477,19 +451,8 @@
     tHighpass_init(&r->f2_hp, 20.f);
     
     tCycle_init(&r->f2_lfo);
-    tCycle_setFreq(&r->f2_lfo, 0.07f);
     
-    
-    // PARAMETERS
-    tDattorroReverb_setMix(rev, 0.5f);
-    
-    tDattorroReverb_setInputDelay(rev,  0.f);
-    
-    tDattorroReverb_setInputFilter(rev, 10000.f);
-    
-    tDattorroReverb_setFeedbackFilter(rev, 5000.f);
-    
-    tDattorroReverb_setFeedbackGain(rev, 0.4f);
+    dattorroreverb_init(rev);
 }
 
 void    tDattorroReverb_free              (tDattorroReverb* const rev)
@@ -538,11 +501,7 @@
 {
     _tMempool* m = *mp;
     _tDattorroReverb* r = *rev = (_tDattorroReverb*) mpool_alloc(sizeof(_tDattorroReverb), &m->pool);
-    
-    r->size_max = 2.0f;
-    r->size = 1.f;
-    r->t = r->size * leaf.sampleRate * 0.001f;
-    r->frozen = 0;
+    float size_max = 2.0f;
     // INPUT
     tTapeDelay_initToPool(&r->in_delay, 0.f, SAMP(200.f), mp);
     tOnePole_initToPool(&r->in_filter, 1.f, mp);
@@ -550,16 +509,14 @@
     for (int i = 0; i < 4; i++)
     {
         tAllpass_initToPool(&r->in_allpass[i], SAMP(in_allpass_delays[i]), SAMP(20.f), mp); // * r->size_max
-        tAllpass_setGain(&r->in_allpass[i], in_allpass_gains[i]);
     }
     
     // FEEDBACK 1
     tAllpass_initToPool(&r->f1_allpass, SAMP(30.51f), SAMP(100.f), mp); // * r->size_max
-    tAllpass_setGain(&r->f1_allpass, 0.7f);
     
-    tTapeDelay_initToPool(&r->f1_delay_1, SAMP(141.69f), SAMP(200.0f) * r->size_max + 1, mp);
-    tTapeDelay_initToPool(&r->f1_delay_2, SAMP(89.24f), SAMP(100.0f) * r->size_max + 1, mp);
-    tTapeDelay_initToPool(&r->f1_delay_3, SAMP(125.f), SAMP(200.0f) * r->size_max + 1, mp);
+    tTapeDelay_initToPool(&r->f1_delay_1, SAMP(141.69f), SAMP(200.0f) * size_max + 1, mp);
+    tTapeDelay_initToPool(&r->f1_delay_2, SAMP(89.24f), SAMP(100.0f) * size_max + 1, mp);
+    tTapeDelay_initToPool(&r->f1_delay_3, SAMP(125.f), SAMP(200.0f) * size_max + 1, mp);
     
     tOnePole_initToPool(&r->f1_filter, 1.f, mp);
     
@@ -566,15 +523,13 @@
     tHighpass_initToPool(&r->f1_hp, 20.f, mp);
     
     tCycle_initToPool(&r->f1_lfo, mp);
-    tCycle_setFreq(&r->f1_lfo, 0.1f);
     
     // FEEDBACK 2
     tAllpass_initToPool(&r->f2_allpass, SAMP(22.58f), SAMP(100.f), mp); // * r->size_max
-    tAllpass_setGain(&r->f2_allpass, 0.7f);
     
-    tTapeDelay_initToPool(&r->f2_delay_1, SAMP(149.62f), SAMP(200.f) * r->size_max + 1, mp);
-    tTapeDelay_initToPool(&r->f2_delay_2, SAMP(60.48f), SAMP(100.f) * r->size_max + 1, mp);
-    tTapeDelay_initToPool(&r->f2_delay_3, SAMP(106.28f), SAMP(200.f) * r->size_max + 1, mp);
+    tTapeDelay_initToPool(&r->f2_delay_1, SAMP(149.62f), SAMP(200.f) * size_max + 1, mp);
+    tTapeDelay_initToPool(&r->f2_delay_2, SAMP(60.48f), SAMP(100.f) * size_max + 1, mp);
+    tTapeDelay_initToPool(&r->f2_delay_3, SAMP(106.28f), SAMP(200.f) * size_max + 1, mp);
     
     tOnePole_initToPool(&r->f2_filter, 1.f, mp);
     
@@ -581,19 +536,8 @@
     tHighpass_initToPool(&r->f2_hp, 20.f, mp);
     
     tCycle_initToPool(&r->f2_lfo, mp);
-    tCycle_setFreq(&r->f2_lfo, 0.07f);
     
-    
-    // PARAMETERS
-    tDattorroReverb_setMix(rev, 0.5f);
-    
-    tDattorroReverb_setInputDelay(rev,  0.f);
-    
-    tDattorroReverb_setInputFilter(rev, 10000.f);
-    
-    tDattorroReverb_setFeedbackFilter(rev, 5000.f);
-    
-    tDattorroReverb_setFeedbackGain(rev, 0.4f);
+    dattorroreverb_init(rev);
 }
 
 void    tDattorroReverb_freeFromPool      (tDattorroReverb* const rev, tMempool* const mp)
--- a/LEAF/Src/leaf-sampling.c
+++ b/LEAF/Src/leaf-sampling.c
@@ -23,13 +23,9 @@
 #endif
 
 //==============================================================================
-
-void  tBuffer_init (tBuffer* const sb, uint32_t length)
+static void  buffer_init (tBuffer* const sb, uint32_t length)
 {
-    _tBuffer* s = *sb = (_tBuffer*) leaf_alloc(sizeof(_tBuffer));
-    
-    s->buff = (float*) leaf_alloc( sizeof(float) * length);
-    
+    _tBuffer* s = *sb;
     s->bufferLength = length;
     s->recordedLength = 0;
     s->active = 0;
@@ -37,10 +33,16 @@
     s->mode = RecordOneShot;
 }
 
+void  tBuffer_init (tBuffer* const sb, uint32_t length)
+{
+    _tBuffer* s = *sb = (_tBuffer*) leaf_alloc(sizeof(_tBuffer));
+    buffer_init(sb, length);
+    s->buff = (float*) leaf_alloc( sizeof(float) * length);
+}
+
 void  tBuffer_free (tBuffer* const sb)
 {
     _tBuffer* s = *sb;
-    
     leaf_free(s->buff);
     leaf_free(s);
 }
@@ -49,13 +51,8 @@
 {
     _tMempool* m = *mp;
     _tBuffer* s = *sb = (_tBuffer*) mpool_alloc(sizeof(_tBuffer), &m->pool);
-    
+    buffer_init(sb, length);
     s->buff = (float*) mpool_alloc( sizeof(float) * length, &m->pool);
-    
-    s->bufferLength = length;
-    s->recordedLength = 0;
-    s->idx = 0;
-    s->mode = RecordOneShot;
 }
 
 void  tBuffer_freeFromPool (tBuffer* const sb, tMempool* const mp)
@@ -62,7 +59,6 @@
 {
     _tMempool* m = *mp;
     _tBuffer* s = *sb;
-
     mpool_free(s->buff, &m->pool);
     mpool_free(s, &m->pool);
 }
@@ -162,9 +158,9 @@
 
 static void attemptStartEndChange(tSampler* const sp);
 
-void tSampler_init(tSampler* const sp, tBuffer* const b)
+static void sampler_init(tSampler* const sp, tBuffer* const b)
 {
-    _tSampler* p = *sp = (_tSampler*) leaf_alloc(sizeof(_tSampler));
+    _tSampler* p = *sp;
     _tBuffer* s = *b;
     
     p->samp = s;
@@ -188,7 +184,6 @@
     
     p->cfxlen = 500; // default 300 sample crossfade
     
-    tRamp_init(&p->gain, 7.0f, 1);
     tRamp_setVal(&p->gain, 0.f);
     
     p->targetstart = -1;
@@ -195,12 +190,34 @@
     p->targetend = -1;
 }
 
+void tSampler_init(tSampler* const sp, tBuffer* const b)
+{
+    _tSampler* p = *sp = (_tSampler*) leaf_alloc(sizeof(_tSampler));
+    tRamp_init(&p->gain, 7.0f, 1);
+    sampler_init(sp, b);
+}
+
 void tSampler_free         (tSampler* const sp)
 {
     _tSampler* p = *sp;
     tRamp_free(&p->gain);
-    
     leaf_free(p);
+}
+
+void tSampler_initToPool    (tSampler* const sp, tBuffer* const b, tMempool* mp)
+{
+    _tMempool* m = *mp;
+    _tSampler* p = *sp = (_tSampler*) mpool_alloc(sizeof(_tSampler), &m->pool);
+    tRamp_initToPool(&p->gain, 7.0f, 1, mp);
+    sampler_init(sp, b);
+}
+
+void tSampler_freeFromPool  (tSampler* const sp, tMempool* mp)
+{
+    _tMempool* m = *mp;
+    _tSampler* p = *sp;
+    tRamp_freeFromPool(&p->gain, mp);
+    mpool_free(p, &m->pool);
 }
 
 void tSampler_setSample (tSampler* const sp, tBuffer* const b)
--- a/LEAF_JUCEPlugin/Source/MyTest.cpp
+++ b/LEAF_JUCEPlugin/Source/MyTest.cpp
@@ -46,7 +46,7 @@
     tSVF_init(&bp1, SVFTypeBandpass, 100, 4.0f);
     tSVF_init(&bp2, SVFTypeBandpass, 1000, 4.0f);
     
-    tFormantShifter_init(&fs, 2048, 20);
+    tFormantShifter_init(&fs, 20);
     
     // Init and set record
     tBuffer_init (&buff, leaf.sampleRate); // init, 1 second buffer