shithub: leaf

Download patch

ref: d4b85ad07b1f1b47ffcddd59b7fb9fb943609ca4
parent: a8831f4d0fc4666d80e73b886ab2e60d176bb4a2
author: Matthew Wang <Matthew@nat-oitwireless-inside-vapornet100-10-9-8-255.princeton.edu>
date: Mon Aug 26 13:42:40 EDT 2019

working oversampler

--- a/LEAF/Inc/leaf-filter.h
+++ b/LEAF/Inc/leaf-filter.h
@@ -289,17 +289,16 @@
 void        tButterworth_setFreqs   (tButterworth* const, float f1, float f2);
 
 //==============================================================================
-    
-#define NUM_TAPS 29
+
 typedef struct _tFIR
 {
-    float past[NUM_TAPS];
-
+    float* past;
     float* coeff;
+    int numTaps;
 
 } tFIR;
 
-void        tFIR_init       (tFIR* const, float* coeffs);
+void        tFIR_init       (tFIR* const, float* coeffs, int numTaps);
 void        tFIR_free       (tFIR* const);
 
 float       tFIR_tick       (tFIR* const, float input);
--- a/LEAF/Inc/leaf-oversampler.h
+++ b/LEAF/Inc/leaf-oversampler.h
@@ -24,14 +24,19 @@
 
 typedef struct _tOversampler
 {
-    tFIR firUp;
-    tFIR firDown;
+//    tFIR firUp;
+//    tFIR firDown;
     int ratio;
+    float* pCoeffs;
+    float* upState;
+    float* downState;
+    int numTaps;
+    int phaseLength;
 } tOversampler;
 
 void        tOversampler_init(tOversampler* const, int order, oBool extraQuality);
 void        tOversampler_upsample(tOversampler* const, float input, float* output);
-float       tOversampler_downsample(tOversampler* const, float* input);
+    float       tOversampler_downsample(tOversampler *const os, float* input);
 float       tOversampler_tick(tOversampler* const, float input, float (*effectTick)(float));
 
 //==============================================================================
--- a/LEAF/Inc/leaf-tables.h
+++ b/LEAF/Inc/leaf-tables.h
@@ -37,6 +37,7 @@
     
 #define COEFFS_SIZE 32
 extern const float* firCoeffs[COEFFS_SIZE];
+extern const float firNumTaps[COEFFS_SIZE];
 extern const float fir2XLow[32];
 extern const float fir4XLow[64];
 extern const float fir8XLow[64];
@@ -45,8 +46,8 @@
 extern const float fir64XLow[256];
 extern const float fir2XHigh[128];
 extern const float fir4XHigh[256];
-extern const float fir8XHigh[281];
-extern const float fir16XHigh[507];
+extern const float fir8XHigh[256];
+extern const float fir16XHigh[512];
 extern const float fir32XHigh[512];
 extern const float fir64XHigh[1024];
 
--- a/LEAF/Src/leaf-filter.c
+++ b/LEAF/Src/leaf-filter.c
@@ -820,16 +820,18 @@
     return 0;
 }
 
-void	tFIR_init(tFIR* const fir, float* coeffs){
+void	tFIR_init(tFIR* const fir, float* coeffs, int numTaps){
 	fir->coeff = coeffs;
-	for (int i = 0; i < NUM_TAPS; ++i) fir->past[i] = 0.0f;
+    fir->numTaps = numTaps;
+    fir->past = (float*)leaf_alloc(sizeof(float) * fir->numTaps);
+    for (int i = 0; i < fir->numTaps; ++i) fir->past[i] = 0.0f;
 }
 
 float	tFIR_tick(tFIR* const fir, float input){
 	fir->past[0] = input;
 	float y = 0.0f;
-	for (int i = 0; i < NUM_TAPS; ++i) y += fir->past[i]*fir->coeff[i];
-	for (int i = NUM_TAPS-1; i > 0; --i) fir->past[i] = fir->past[i-1];
+	for (int i = 0; i < fir->numTaps; ++i) y += fir->past[i]*fir->coeff[i];
+	for (int i = fir->numTaps-1; i > 0; --i) fir->past[i] = fir->past[i-1];
 	return y;
 }
 
--- a/LEAF/Src/leaf-mempool.c
+++ b/LEAF/Src/leaf-mempool.c
@@ -121,6 +121,7 @@
 
 void* leaf_alloc(size_t size)
 {
+    //printf("alloc %i\n", size);
 	void* block = mpool_alloc(size, &leaf_pool);
 
 	if (block == NULL) leaf_mempool_overrun();
--- a/LEAF/Src/leaf-oscillator.c
+++ b/LEAF/Src/leaf-oscillator.c
@@ -619,7 +619,7 @@
 
 float   tNoise_tick(tNoise* const n)
 {
-    float rand = n->rand();
+    float rand = (n->rand() * 2.0f) - 1.0f;
     
     if (n->type == PinkNoise)
     {
--- a/LEAF/Src/leaf-oversampler.c
+++ b/LEAF/Src/leaf-oversampler.c
@@ -27,65 +27,198 @@
         ratio == 8 || ratio == 16 ||
         ratio == 32 || ratio == 64) {
         os->ratio = ratio;
-        tFIR_init(&os->firUp, firCoeffs[(int)(os->ratio*0.5f)-1+offset]);
-        tFIR_init(&os->firDown, firCoeffs[(int)(os->ratio*0.5f)-1+offset]);
+        int idx = (int)(log2f(os->ratio))-1+offset;
+        os->numTaps = firNumTaps[idx];
+        os->phaseLength = os->numTaps / os->ratio;
+        os->pCoeffs = firCoeffs[idx];
+        os->upState = leaf_alloc(sizeof(float) * os->phaseLength);
+        os->downState = leaf_alloc(sizeof(float) * os->phaseLength);
     }
 }
 
-void tOversampler_upsample(tOversampler* const os, float input, float* output)
+float tOversampler_tick(tOversampler* const os, float input, float (*effectTick)(float))
 {
-    output[0] = input;
+    float buf[os->ratio];
+    
+    tOversampler_upsample(os, input, buf);
+    
     for (int i = 0; i < os->ratio; ++i) {
-        if (i > 0) output[i] = 0;
-        output[i] = tFIR_tick(&os->firUp, output[i]);
+        buf[i] = effectTick(buf[i]);
     }
+    
+    return tOversampler_downsample(os, buf);
 }
 
-float tOversampler_downsample(tOversampler* const os, float* input)
+// From CMSIS DSP Library
+void tOversampler_upsample(tOversampler* const os, float input, float* output)
 {
-    float output = tFIR_tick(&os->firDown, input[0]);
-    for (int i = 1; i < os->ratio; ++i) {
-        tFIR_tick(&os->firDown, input[i]);
+    float *pState = os->upState;                 /* State pointer */
+    const float *pCoeffs = os->pCoeffs;               /* Coefficient pointer */
+    float *pStateCur;
+    float *ptr1;                               /* Temporary pointer for state buffer */
+    const float *ptr2;                               /* Temporary pointer for coefficient buffer */
+    float sum0;                                /* Accumulators */
+    uint32_t i, tapCnt;                    /* Loop counters */
+    uint32_t phaseLen = os->phaseLength;            /* Length of each polyphase filter component */
+    uint32_t j;
+    
+    /* os->pState buffer contains previous frame (phaseLen - 1) samples */
+    /* pStateCur points to the location where the new input data should be written */
+    pStateCur = os->upState + (phaseLen - 1U);
+    
+    /* Copy new input sample into the state buffer */
+    *pStateCur = input;
+    
+    /* Address modifier index of coefficient buffer */
+    j = 1U;
+    
+    /* Loop over the Interpolation factor. */
+    i = os->ratio;
+    
+    while (i > 0U)
+    {
+        /* Set accumulator to zero */
+        sum0 = 0.0f;
+        
+        /* Initialize state pointer */
+        ptr1 = pState;
+        
+        /* Initialize coefficient pointer */
+        ptr2 = pCoeffs + (os->ratio - j);
+        
+        /* Loop over the polyPhase length.
+         Repeat until we've computed numTaps-(4*os->L) coefficients. */
+        
+        /* Initialize tapCnt with number of samples */
+        tapCnt = phaseLen;
+        
+        while (tapCnt > 0U)
+        {
+            /* Perform the multiply-accumulate */
+            sum0 += *ptr1++ * *ptr2;
+            
+            /* Upsampling is done by stuffing L-1 zeros between each sample.
+             * So instead of multiplying zeros with coefficients,
+             * Increment the coefficient pointer by interpolation factor times. */
+            ptr2 += os->ratio;
+            
+            /* Decrement loop counter */
+            tapCnt--;
+        }
+        
+        /* The result is in the accumulator, store in the destination buffer. */
+        *output++ = sum0 * os->ratio;
+        
+        /* Increment the address modifier index of coefficient buffer */
+        j++;
+        
+        /* Decrement the loop counter */
+        i--;
     }
-    return output;
+    
+    /* Advance the state pointer by 1
+     * to process the next group of interpolation factor number samples */
+    pState = pState + 1;
+    
+    /* Processing is complete.
+     Now copy the last phaseLen - 1 samples to the satrt of the state buffer.
+     This prepares the state buffer for the next function call. */
+    
+    /* Points to the start of the state buffer */
+    pStateCur = os->upState;
+
+    /* Initialize tapCnt with number of samples */
+    tapCnt = (phaseLen - 1U);
+    
+    /* Copy data */
+    while (tapCnt > 0U)
+    {
+        *pStateCur++ = *pState++;
+        
+        /* Decrement loop counter */
+        tapCnt--;
+    }
 }
 
-float tOversampler_tick(tOversampler* const os, float input, float (*effectTick)(float))
+// From CMSIS DSP Library
+float tOversampler_downsample(tOversampler *const os, float* input)
 {
-    float buf[os->ratio];
+    float *pState = os->downState;                 /* State pointer */
+    const float *pCoeffs = os->pCoeffs;               /* Coefficient pointer */
+    float *pStateCur;                          /* Points to the current sample of the state */
+    float *px0;                                /* Temporary pointer for state buffer */
+    const float *pb;                                 /* Temporary pointer for coefficient buffer */
+    float x0, c0;                              /* Temporary variables to hold state and coefficient values */
+    float acc0;                                /* Accumulator */
+    uint32_t numTaps = os->numTaps;                 /* Number of filter coefficients in the filter */
+    uint32_t i, tapCnt;
+    float output;
     
-    tOversampler_upsample(os, input, buf);
+    /* os->pState buffer contains previous frame (numTaps - 1) samples */
+    /* pStateCur points to the location where the new input data should be written */
+    pStateCur = os->downState + (numTaps - 1U);
     
-    for (int i = 0; i < os->ratio; ++i) {
-        buf[i] = effectTick(buf[i]);
+    /* Copy decimation factor number of new input samples into the state buffer */
+    i = os->ratio;
+    
+    do
+    {
+        *pStateCur++ = *input++;
+        
+    } while (--i);
+    
+    /* Set accumulator to zero */
+    acc0 = 0.0f;
+    
+    /* Initialize state pointer */
+    px0 = pState;
+    
+    /* Initialize coeff pointer */
+    pb = pCoeffs;
+    
+    /* Initialize tapCnt with number of taps */
+    tapCnt = numTaps;
+    
+    while (tapCnt > 0U)
+    {
+        /* Read coefficients */
+        c0 = *pb++;
+        
+        /* Fetch 1 state variable */
+        x0 = *px0++;
+        
+        /* Perform the multiply-accumulate */
+        acc0 += x0 * c0;
+        
+        /* Decrement loop counter */
+        tapCnt--;
     }
     
-    return tOversampler_downsample(os, buf);
+    /* Advance the state pointer by the decimation factor
+     * to process the next group of decimation factor number samples */
+    pState = pState + os->ratio;
     
-//    float samples[os->ratio];
-//    samples[0] = input;
-//    for (int i = 1; i < os->ratio; ++i) {
-//        samples[i]= 0.f;
-//    }
-//
-//    int whichFilter = 0;
-//    int i = 0;
-//    int j = 0;
-//    for (; i < os->order; ++i) {
-//        for (; j < exp2(i+1); j += os->order-i) {
-//            samples[j] = tFIR_tick(&os->filters[whichFilter], samples[j]);
-//        }
-//        whichFilter++;
-//    }
-//
-//    for (int s = 0; s < os->ratio; ++s) {
-//        samples[s] = effectTick(samples[s]);
-//    }
-//
-//    for (; i >= 0; --i) {
-//        for (; j >= 0; j -= os->order-i) {
-//            samples[j] = tFIR_tick(&os->filters[whichFilter], samples[j]);
-//        }
-//        whichFilter++;
-//    }
+    /* The result is in the accumulator, store in the destination buffer. */
+    output = acc0;
+    
+    /* Processing is complete.
+     Now copy the last numTaps - 1 samples to the satrt of the state buffer.
+     This prepares the state buffer for the next function call. */
+    
+    /* Points to the start of the state buffer */
+    pStateCur = os->downState;
+    
+    /* Initialize tapCnt with number of taps */
+    tapCnt = (numTaps - 1U);
+    
+    /* Copy data */
+    while (tapCnt > 0U)
+    {
+        *pStateCur++ = *pState++;
+        
+        /* Decrement loop counter */
+        tapCnt--;
+    }
+    
+    return output;
 }
--- a/LEAF/Src/leaf-tables.c
+++ b/LEAF/Src/leaf-tables.c
@@ -33,10 +33,11 @@
 7,    0.005089107569792517,    0.004931017978539705,    0.00477464934326076,    0.004620059305184111,    0.004467271202856345,    0.004316384032044447,    0.004167535061341574,    0.004020837780560375,    0.003876285696289593,    0.00373401564369845,    0.003594116005810746,    0.00345667963318062,    0.0033216131163189126,    0.0031892620828723227,    0.003059760096689252,    0.0029332425986383416,    0.0028092893752555753,    0.0026886907797787993,    0.0025707750602413674,    0.0024546715656463027,    0.002324224442263978,    0.0022249923434846707,    0.002115750178775707,    0.0020102102191501834,    0.0019074086707092258,    0.0018082288964809644,    0.0017113538530254156,    0.0016175658016292192,    0.0015269066196715306,    0.0014394035452673572,    0.0013547197757430203,    0.0012730564419046215,    0.0011944092399743605,    0.0011188000414977899,    0.001046184181770156,    0.000976697360607544,    0.0009103261049980538,    0.00084702149975344,    0.0007867375202056556,    0.0007295120216703175,    0.00067534060229161,    0.0006241866818625697,    0.0005760959724897604,    0.0005311398297784606,    0.0004893648798719514,    0.00045068714217736007,    0.00041517688767673063,    0.0003828493219762104,    0.0003537347795633787,    0.0003276748319944884,    0.00030498547559247845,    0.0002857208679875607,    0.0002699368701027846,    0.0002570861260137623,    0.0002481761013286244,    0.00024263723882202515,    0.00024079274850113426,    -0.007573012406345277
 };
 
-4388,    -0.00041922406056782083,    0.0012010034203710784,    0.0006552234666252462,    -0.0007096577214822187,    -0.0006850628390191059,    0.00032465365599127654,    0.0005862297350582802,    -0.00006832501012358436,    -0.0004344444061086839,    -0.00007473591299809917,    0.00027753923597010266,    0.00012753607518766694,    -0.0001504708418330321,    -0.00012648324239817438,    0.00006083206665324362,    0.0000961395818492714,    -0.00001118322316939516,    -0.00006163665493961978,    -0.000011636477685383897,    0.00003091988960026406,    0.000014692437654954816,    -0.000012481751035611902,    -0.000011653029986124283,    0.0000017841093721093506,    0.000005239591854415941,    5.807441351521463e-7,    -0.00000213110629785921,    -0.00000136947295895967,    -2.84059575423864e-7
+4388,    -0.00041922406056782083,    0.0012010034203710784,    0.0006552234666252462,    -0.0007096577214822187,    -0.0006850628390191059,    0.00032465365599127654,    0.0005862297350582802,    -0.00006832501012358436,    -0.0004344444061086839,    -0.00007473591299809917,    0.00027753923597010266,    0.00012753607518766694,    -0.0001504708418330321,    -0.00012648324239817438,    0.00006083206665324362,    0.0000961395818492714,    -0.00001118322316939516,    -0.00006163665493961978,    -0.000011636477685383897,    0.00003091988960026406,    0.000014692437654954816,    -0.000012481751035611902,    -0.000011653029986124283,    0.0000017841093721093506,    0.000005239591854415941,    5.807441351521463e-7,    -0.00000213110629785921,    -0.00000136947295895967,    -2.84059575423864e-7
 1779,    -0.03735668670551693,    -0.0005458966005379449,    0.0578178869957579,    0.12496957303698586,    0.18372600900451644,    0.21795911568314993,    0.21795911568314993,    0.18372600900451644,    0.12496957303698586,    0.0578178869957579,    -0.0005458966005379449,    -0.03735668670551693,    -0.04790631293501779,    -0.036160130412882435,    -0.01233979307221452,    0.011414259133477645,    0.02555053211054643,    0.026109899142542758,    0.01526523041211863,    -0.0005292356782833587,    -0.013786276388279539,    -0.019193722858760427,    -0.015510462180576574,    -0.00554207852540761,    0.0055655403444453775,    0.012810645017913123,    0.013466881500422878,    0.007998600315936934,    -0.0004986705357686102,    -0.007935453568187856,    -0.011124936147882954,    -0.00908888688929085,    -0.003263596560752136,    0.003376641721920036,    0.00778770755309392,    0.008213402548972962,    0.004842595616255233,    -0.0004583930086451031,    -0.0051353491910507984,    -0.0071497618238720055,    -0.005843180111542266,    -0.0021053850268023615,    0.002164099554982996,    0.004999101428335298,    0.005254266475282044,    0.003046185830666762,    -0.0004124431830693066,    -0.0034548726172607498,    -0.004750945120551563,    -0.003874469283244301,    -0.001415068708295585,    0.0013786588356217962,    0.003219398725098763,    0.0033649169125380706,    0.0019025392919524162,    -0.0003642960983689493,    -0.0023436048910665127,    -0.00317200799245191,    -0.0025836938014065975,    -0.0009743823002432432,    0.000837174097496827,    0.0020180799074488486,    0.0020968295391595774,    0.0011425257824338887,    -0.00031822317984990035,    -0.0015812527530506791,    -0.0020995520812018714,    -0.0017133793271509106,    -0.0006853292543951153,    0.0004602570434921762,    0.0011981314765901019,    0.0012391753523202087,    0.0006358082850902164,    -0.00027554321698262794,    -0.0010555177901930952,    -0.001368894036877941,    -0.0011250441730682327,    -0.0004919858457618222,    0.00020580176646200433,    0.0006504775398685704,    0.0006717577010285365,    0.00030790928383371996,    -0.00023554905807185743,    -0.0006955854650565154,    -0.0008768456304295432,    -0.0007303801286775824,    -0.0003593242009009715,    0.00004577001768172358,    0.0003015617300329922,    0.00031390651451180623,    0.00010787721721971545,    -0.0001968527747134386,    -0.00045235278384860993,    -0.000550680089032831,    -0.0004679330143401381,    -0.00026298229853436046,    -0.000041503003504151876,    0.00009819903503597289,    0.00010675981100488967,    2.4069038430437714e-7,    -0.00015737268974254042,    -0.00028781004597914193,    -0.00033660459070401045,    -0.00029242213522170924,    -0.0001870435534541462,    -0.00007376494795165521,    -0.000001824861163195929,    0.000005858218684625342,    -0.00004241909459592675,    -0.00011458014625437172,    -0.0001738448733058993,    -0.00019443471041769651,    -0.00017229784061896603,    -0.00012208654155480072,    -0.00006864404983689099,    -0.00003337527183661095,    -0.000026338754429996997,    -0.000043204247279965386,    -0.000070350790919461,    -0.00009207287115371104,    -0.00009817726370665003,    -0.00008704299086494871,    -0.00006494904958257674,    -0.00004148092321827023,    -0.000024937785475375726,    -0.000018929805847104457,    -0.000021726870316473222,    -0.000028580071407296435,    -0.00003356141383522181,    -0.00003403970018224806,    -0.000028297461945285203,    -0.000020341389435584184,    -0.000010486216859223391,    -0.000005005316694254475
-,    -0.03735668670551693,    -0.0005458966005379449,    0.0578178869957579,    0.12496957303698586,    0.18372600900451644,    0.21795911568314993,    0.21795911568314993,    0.18372600900451644,    0.12496957303698586,    0.0578178869957579,    -0.0005458966005379449,    -0.03735668670551693,    -0.04790631293501779,    -0.036160130412882435,    -0.01233979307221452,    0.011414259133477645,    0.02555053211054643,    0.026109899142542758,    0.01526523041211863,    -0.0005292356782833587,    -0.013786276388279539,    -0.019193722858760427,    -0.015510462180576574,    -0.00554207852540761,    0.0055655403444453775,    0.012810645017913123,    0.013466881500422878,    0.007998600315936934,    -0.0004986705357686102,    -0.007935453568187856,    -0.011124936147882954,    -0.00908888688929085,    -0.003263596560752136,    0.003376641721920036,    0.00778770755309392,    0.008213402548972962,    0.004842595616255233,    -0.0004583930086451031,    -0.0051353491910507984,    -0.0071497618238720055,    -0.005843180111542266,    -0.0021053850268023615,    0.002164099554982996,    0.004999101428335298,    0.005254266475282044,    0.003046185830666762,    -0.0004124431830693066,    -0.0034548726172607498,    -0.004750945120551563,    -0.003874469283244301,    -0.001415068708295585,    0.0013786588356217962,    0.003219398725098763,    0.0033649169125380706,    0.0019025392919524162,    -0.0003642960983689493,    -0.0023436048910665127,    -0.00317200799245191,    -0.0025836938014065975,    -0.0009743823002432432,    0.000837174097496827,    0.0020180799074488486,    0.0020968295391595774,    0.0011425257824338887,    -0.00031822317984990035,    -0.0015812527530506791,    -0.0020995520812018714,    -0.0017133793271509106,    -0.0006853292543951153,    0.0004602570434921762,    0.0011981314765901019,    0.0012391753523202087,    0.0006358082850902164,    -0.00027554321698262794,    -0.0010555177901930952,    -0.001368894036877941,    -0.0011250441730682327,    -0.0004919858457618222,    0.00020580176646200433,    0.0006504775398685704,    0.0006717577010285365,    0.00030790928383371996,    -0.00023554905807185743,    -0.0006955854650565154,    -0.0008768456304295432,    -0.0007303801286775824,    -0.0003593242009009715,    0.00004577001768172358,    0.0003015617300329922,    0.00031390651451180623,    0.00010787721721971545,    -0.0001968527747134386,    -0.00045235278384860993,    -0.000550680089032831,    -0.0004679330143401381,    -0.00026298229853436046,    -0.000041503003504151876,    0.00009819903503597289,    0.00010675981100488967,    2.4069038430437714e-7,    -0.00015737268974254042,    -0.00028781004597914193,    -0.00033660459070401045,    -0.00029242213522170924,    -0.0001870435534541462,    -0.00007376494795165521,    -0.000001824861163195929,    0.000005858218684625342,    -0.00004241909459592675,    -0.00011458014625437172,    -0.0001738448733058993,    -0.00019443471041769651,    -0.00017229784061896603,    -0.00012208654155480072,    -0.00006864404983689099,    -0.00003337527183661095,    -0.000026338754429996997,    -0.000043204247279965386,    -0.000070350790919461,    -0.00009207287115371104,    -0.00009817726370665003,    -0.00008704299086494871,    -0.00006494904958257674,    -0.00004148092321827023,    -0.000024937785475375726,    -0.000018929805847104457,    -0.000021726870316473222,    -0.000028580071407296435,    -0.00003356141383522181,    -0.00003403970018224806,    -0.000028297461945285203,    -0.000020341389435584184,    -0.000010486216859223391,    -0.000005005316694254475
+,    -0.03735668670551693,    -0.0005458966005379449,    0.0578178869957579,    0.12496957303698586,    0.18372600900451644,    0.21795911568314993,    0.21795911568314993,    0.18372600900451644,    0.12496957303698586,    0.0578178869957579,    -0.0005458966005379449,    -0.03735668670551693,    -0.04790631293501779,    -0.036160130412882435,    -0.01233979307221452,    0.011414259133477645,    0.02555053211054643,    0.026109899142542758,    0.01526523041211863,    -0.0005292356782833587,    -0.013786276388279539,    -0.019193722858760427,    -0.015510462180576574,    -0.00554207852540761,    0.0055655403444453775,    0.012810645017913123,    0.013466881500422878,    0.007998600315936934,    -0.0004986705357686102,    -0.007935453568187856,    -0.011124936147882954,    -0.00908888688929085,    -0.003263596560752136,    0.003376641721920036,    0.00778770755309392,    0.008213402548972962,    0.004842595616255233,    -0.0004583930086451031,    -0.0051353491910507984,    -0.0071497618238720055,    -0.005843180111542266,    -0.0021053850268023615,    0.002164099554982996,    0.004999101428335298,    0.005254266475282044,    0.003046185830666762,    -0.0004124431830693066,    -0.0034548726172607498,    -0.004750945120551563,    -0.003874469283244301,    -0.001415068708295585,    0.0013786588356217962,    0.003219398725098763,    0.0033649169125380706,    0.0019025392919524162,    -0.0003642960983689493,    -0.0023436048910665127,    -0.00317200799245191,    -0.0025836938014065975,    -0.0009743823002432432,    0.000837174097496827,    0.0020180799074488486,    0.0020968295391595774,    0.0011425257824338887,    -0.00031822317984990035,    -0.0015812527530506791,    -0.0020995520812018714,    -0.0017133793271509106,    -0.0006853292543951153,    0.0004602570434921762,    0.0011981314765901019,    0.0012391753523202087,    0.0006358082850902164,    -0.00027554321698262794,    -0.0010555177901930952,    -0.001368894036877941,    -0.0011250441730682327,    -0.0004919858457618222,    0.00020580176646200433,    0.0006504775398685704,    0.0006717577010285365,    0.00030790928383371996,    -0.00023554905807185743,    -0.0006955854650565154,    -0.0008768456304295432,    -0.0007303801286775824,    -0.0003593242009009715,    0.00004577001768172358,    0.0003015617300329922,    0.00031390651451180623,    0.00010787721721971545,    -0.0001968527747134386,    -0.00045235278384860993,    -0.000550680089032831,    -0.0004679330143401381,    -0.00026298229853436046,    -0.000041503003504151876,    0.00009819903503597289,    0.00010675981100488967,    2.4069038430437714e-7,    -0.00015737268974254042,    -0.00028781004597914193,    -0.00033660459070401045,    -0.00029242213522170924,    -0.0001870435534541462,    -0.00007376494795165521,    -0.000001824861163195929,    0.000005858218684625342,    -0.00004241909459592675,    -0.00011458014625437172,    -0.0001738448733058993,    -0.00019443471041769651,    -0.00017229784061896603,    -0.00012208654155480072,    -0.00006864404983689099,    -0.00003337527183661095,    -0.000026338754429996997,    -0.000043204247279965386,    -0.000070350790919461,    -0.00009207287115371104,    -0.00009817726370665003,    -0.00008704299086494871,    -0.00006494904958257674,    -0.00004148092321827023,    -0.000024937785475375726,    -0.000018929805847104457,    -0.000021726870316473222,    -0.000028580071407296435,    -0.00003356141383522181,    -0.00003403970018224806,    -0.000028297461945285203,    -0.000020341389435584184,    -0.000010486216859223391,    -0.000005005316694254475
 6827,    -0.00007808540302029911,    -0.00006694410044638306,    -0.000048272991834249023,    -0.000022428220677001062,    0.00000945519618350689,    0.00004543933131195438,    0.00008284463647997294,    0.00011839421808937768,    0.0001484453939861778,    0.00016930196836844217,    0.00017757068005525774,    0.0001705551281856014,    0.0001466259260978121,    0.00010554953654423453,    0.000048713986255269035,    -0.00002076914916642107,    -0.00009812670772817325,    -0.00017715913233461153,    -0.0002506512893134693,    -0.00031094020467360364,    -0.00035060341921983105,    -0.00036321457599195286,    -0.000344097253126408,    -0.0002910035300654813,    -0.00020463863066340804,    -0.0000889596462925044,    0.0000488065342129464,    0.00019846344507950818,    0.0003474719185455316,    0.0004818774216658429,    0.0005874831782969511,    0.0006511821678893009,    0.0006623328402563043,    0.0006140516294678713,    0.0005042852156009971,    0.00033653370625019924,    0.00012011888794986249,    -0.00013008025896695598,    -0.0003944482469328303,    -0.0006499992351713145,    -0.0008721981757872817,    -0.0010371241058790954,    -0.0011237848293952834,    -0.001116390991413482,    -0.001006354290932797,    -0.0007938015361709206,    -0.0004884092949725727,    -0.00010941224635219784,    0.00031528775696513877,    0.0007509162059373942,    0.0011584361578093477,    0.0014977980668289563,    0.0017315832835398534,    0.0018287320452685962,    0.001768008710143546,    0.001540856733253093,    0.0011533207915249972,    0.0006267723261937353,    -0.000002730837064573008,    -0.000686507599139094,    -0.001366668704322837,    -0.0019806797805119046,    -0.002466740486722005,    -0.0027695470996196084,    -0.002845938634535671,    -0.0026698805672307046,    -0.0022363009289308334,    -0.0015632638676050168,    -0.0006922721287036599,    0.0003136767188792293,    0.0013740390681091675,    0.00239668755753389,    0.003285389650049797,    0.003948233176598269,    0.004306356542469053,    0.004302187126891144,    0.003906381571148949,    0.0031227586280687734,    0.0019906312316864162,    0.0005841127698488963,    -0.000991773612225015,    -0.0026080684279961796,    -0.004121541638039505,    -0.005386397411897306,    -0.006267130625938093,    -0.006651482916115235,    -0.006462364294177974,    -0.0056676073466073755,    -0.004286536029155119,    -0.00239254903212187,    -0.00011119032068043591,    0.0023864763663203046,    0.004894953723490399,    0.007189250895714774,    0.009042714283589649,    0.010246422161232217,    0.010628697324455047,    0.010073084289140301,    0.00853325380877814,    0.006043384248100991,    0.002722900135231063,    -0.0012251912233039515,    -0.00552263664478698,    -0.009830708703730309,    -0.013770652449236885,    -0.016948562423166388,    -0.018983038365521697,    -0.019533674199849648,    -0.018328285730983804,    -0.015186786196633398,    -0.010039790159071691,    -0.0029403540852480344,    0.005932283582188087,    0.016277538632752685,    0.02768684678656681,    0.03966488477882676,    0.05165737483789425,    0.06308368436467467,    0.07337205172778682,    0.08199503223813394,    0.08850270507176243,    0.09255131664236119,    0.09392532916601987,    0.09255131664236119,    0.08850270507176243,    0.08199503223813394,    0.07337205172778682,    0.06308368436467467,    0.05165737483789425,    0.03966488477882676,    0.02768684678656681,    0.016277538632752685,    0.005932283582188087,    -0.0029403540852480344,    -0.010039790159071691,    -0.015186786196633398,    -0.018328285730983804,    -0.019533674199849648,    -0.018983038365521697,    -0.016948562423166388,    -0.013770652449236885,    -0.009830708703730309,    -0.00552263664478698,    -0.0012251912233039515,    0.002722900135231063,    0.006043384248100991,    0.00853325380877814,    0.010073084289140301,    0.010628697324455047,    0.010246422161232217,    0.009042714283589649,    0.007189250895714774,    0.004894953723490399,    0.0023864763663203046,    -0.00011119032068043591,    -0.00239254903212187,    -0.004286536029155119,    -0.00
\ No newline at end of file
+05,    -0.0004962768841556523,    -0.0005966792410792791,    -0.0006363992327126103,    -0.0006072812580573203,    -0.0005078006712943802,    -0.00034391453642163835,    -0.0001291740152058233,    0.00011608199926386939,    0.0003663883172395964,    0.0005935643814352129,    0.0007697197860148682,    0.0008705060394986916,    0.0008782421413312541,    0.0007845404678866458,    0.0005921472961030223,    0.0003155390021514345,    -0.00001975662025403667,    -0.0003792242746719516,    -0.0007226903878816747,    -0.0010085916592065419,    -0.0011987843551975912,    -0.0012633390417589486,    -0.0011847927602402282,    -0.0009612078105002279,    -0.000607656728473499,    -0.00015580100244720835,    0.0003485912201162041,    0.0008499567444557006,    0.0012888238057625968,    0.0016085750487669262,    0.0017624573232133487,    0.0017198572703654494,    0.0014712649629561752,    0.0010309092850789008,    0.0004369297346610886,    -0.0002514846038907312,    -0.0009595058667715721,    -0.0016045955886596882,    -0.002105611566700304,    -0.002392827139552557,    -0.0024168530933362325,    -0.00215621955374809,    -0.0016217376891380843,    -0.0008577023023227786,    0.00006118480472750677,    0.0010364584424907685,    0.001956049351551786,    0.002706696800527712,    0.00318733017834542,    0.003322096376141488,    0.0030709922507173265,    0.0024373280210738995,    0.0014701293295941087,    0.0002616176696267551,    -0.0010608870493178752,    -0.002347699681593795,    -0.0034429894732297774,    -0.004203029219555798,    -0.00451398893736866,    -0.004307677839041472,    -0.0035726927213363046,    -0.0023597776381211666,    -0.0007800969761600126,    0.00100380173046076,    0.0027935634872831047,    0.0043761562977185555,    0.005547954061740437,    0.006139532362567163,    0.006038187372164252,    0.005205193104614497,    0.003685832364921369,    0.001610065959141185,    -0.000816509624547802,    -0.003331179568244694,    -0.005640769473740277,    -0.007453565321222198,    -0.008513609412918493,    -0.008633348531283494,    -0.0077207439401804495,    -0.005797651634024999,    -0.003006470630061831,    0.00039645931697321107,    0.004060688288708085,    0.007573881722373314,    0.010503477916637444,    0.012443852783009171,    0.013064660267980682,    0.012154652149365373,    0.009656403107118496,    0.005687627159122434,    0.000545686660735971,    -0.0053060804504155646,    -0.011269885881064536,    -0.016661104177372186,    -0.02076782817847515,    -0.022917127850131423,    -0.022542073972735464,    -0.01924294503235089,    -0.012836088871532723,    -0.0033855865368634104,    0.008786222880026725,    0.023111259021133423,    0.038810833745067747,    0.05495087979175688,    0.0705128544598909,    0.08447430461530625,    0.0958915908436123,    0.10397774191970133,    0.10816816138474043,    0.10816816138474043,    0.10397774191970133,    0.0958915908436123,    0.08447430461530625,    0.0705128544598909,    0.05495087979175688,    0.038810833745067747,    0.023111259021133423,    0.008786222880026725,    -0.0033855865368634104,    -0.012836088871532723,    -0.01924294503235089,    -0.022542073972735464,    -0.022917127850131423,    -0.02076782817847515,    -0.016661104177372186,    -0.011269885881064536,    -0.0053060804504155646,    0.000545686660735971,    0.005687627159122434,    0.009656403107118496,    0.012154652149365373,    0.013064660267980682,    0.012443852783009171,    0.010503477916637444,    0.007573881722373314,    0.004060688288708085,    0.00039645931697321107,    -0.003006470630061831,    -0.005797651634024999,    -0.0077207439401804495,    -0.008633348531283494,    -0.008513609412918493,    -0.007453565321222198,    -0.005640769473740277,    -0.003331179568244694,    -0.000816509624547802,    0.001610065959141185,    0.003685832364921369,    0.005205193104614497,    0.006038187372164252,    0.006139532362567163,    0.005547954061740437,    0.0043761562977185555,    0.0027935634872831047,    0.00100380173046076,    -0.0007800969761600126,    -0.0023597776381211666,    -0.0035726927213363046,    -0.0043076778390
\ No newline at end of file
 ,    -0.00007808540302029911,    -0.00006694410044638306,    -0.000048272991834249023,    -0.000022428220677001062,    0.00000945519618350689,    0.00004543933131195438,    0.00008284463647997294,    0.00011839421808937768,    0.0001484453939861778,    0.00016930196836844217,    0.00017757068005525774,    0.0001705551281856014,    0.0001466259260978121,    0.00010554953654423453,    0.000048713986255269035,    -0.00002076914916642107,    -0.00009812670772817325,    -0.00017715913233461153,    -0.0002506512893134693,    -0.00031094020467360364,    -0.00035060341921983105,    -0.00036321457599195286,    -0.000344097253126408,    -0.0002910035300654813,    -0.00020463863066340804,    -0.0000889596462925044,    0.0000488065342129464,    0.00019846344507950818,    0.0003474719185455316,    0.0004818774216658429,    0.0005874831782969511,    0.0006511821678893009,    0.0006623328402563043,    0.0006140516294678713,    0.0005042852156009971,    0.00033653370625019924,    0.00012011888794986249,    -0.00013008025896695598,    -0.0003944482469328303,    -0.0006499992351713145,    -0.0008721981757872817,    -0.0010371241058790954,    -0.0011237848293952834,    -0.001116390991413482,    -0.001006354290932797,    -0.0007938015361709206,    -0.0004884092949725727,    -0.00010941224635219784,    0.00031528775696513877,    0.0007509162059373942,    0.0011584361578093477,    0.0014977980668289563,    0.0017315832835398534,    0.0018287320452685962,    0.001768008710143546,    0.001540856733253093,    0.0011533207915249972,    0.0006267723261937353,    -0.000002730837064573008,    -0.000686507599139094,    -0.001366668704322837,    -0.0019806797805119046,    -0.002466740486722005,    -0.0027695470996196084,    -0.002845938634535671,    -0.0026698805672307046,    -0.0022363009289308334,    -0.0015632638676050168,    -0.0006922721287036599,    0.0003136767188792293,    0.0013740390681091675,    0.00239668755753389,    0.003285389650049797,    0.003948233176598269,    0.004306356542469053,    0.004302187126891144,    0.003906381571148949,    0.0031227586280687734,    0.0019906312316864162,    0.0005841127698488963,    -0.000991773612225015,    -0.0026080684279961796,    -0.004121541638039505,    -0.005386397411897306,    -0.006267130625938093,    -0.006651482916115235,    -0.006462364294177974,    -0.0056676073466073755,    -0.004286536029155119,    -0.00239254903212187,    -0.00011119032068043591,    0.0023864763663203046,    0.004894953723490399,    0.007189250895714774,    0.009042714283589649,    0.010246422161232217,    0.010628697324455047,    0.010073084289140301,    0.00853325380877814,    0.006043384248100991,    0.002722900135231063,    -0.0012251912233039515,    -0.00552263664478698,    -0.009830708703730309,    -0.013770652449236885,    -0.016948562423166388,    -0.018983038365521697,    -0.019533674199849648,    -0.018328285730983804,    -0.015186786196633398,    -0.010039790159071691,    -0.0029403540852480344,    0.005932283582188087,    0.016277538632752685,    0.02768684678656681,    0.03966488477882676,    0.05165737483789425,    0.06308368436467467,    0.07337205172778682,    0.08199503223813394,    0.08850270507176243,    0.09255131664236119,    0.09392532916601987,    0.09255131664236119,    0.08850270507176243,    0.08199503223813394,    0.07337205172778682,    0.06308368436467467,    0.05165737483789425,    0.03966488477882676,    0.02768684678656681,    0.016277538632752685,    0.005932283582188087,    -0.0029403540852480344,    -0.010039790159071691,    -0.015186786196633398,    -0.018328285730983804,    -0.019533674199849648,    -0.018983038365521697,    -0.016948562423166388,    -0.013770652449236885,    -0.009830708703730309,    -0.00552263664478698,    -0.0012251912233039515,    0.002722900135231063,    0.006043384248100991,    0.00853325380877814,    0.010073084289140301,    0.010628697324455047,    0.010246422161232217,    0.009042714283589649,    0.007189250895714774,    0.004894953723490399,    0.0023864763663203046,    -0.00011119032068043591,    -0.00239254903212187,    -0.004286536029155119,    -0.005667
\ No newline at end of file
 };
 const float fir16XHigh[507] = {    0.000011223639487175034,    0.00003389476132831667,    0.00001565142600136805,    0.000029785565597257123,    0.000033019509640348576,    0.000040890011095128895,    0.000047645976665165004,    0.00005519205648330811,    0.00006263088530625951,    0.00007004411185309244,    0.0000771324566916655,    0.00008371202601526943,    0.00008954131982464572,    0.00009438985590103045,    0.00009802251663221825,    0.00010021766977046484,    0.00010077099406228367,    0.00009950354997327299,    0.00009626859110453859,    0.0000909600537916604,    0.00008352242039123624,    0.00007395372186247605,    0.00006231047583453306,    0.00004871192585529492,    0.00003334356571983411,    0.00001645471256452401,    -0.0000016413555153330923,    -0.000020575227175562262,    -0.00003992062913931496,    -0.00005920706964218722,    -0.00007793217485231889,    -0.00009557112119831485,    -0.00011158939070902697,    -0.00012545892879240573,    -0.00013667294731229326,    -0.00014476758540289084,    -0.00014932995769211714,    -0.000150018341895562,    -0.000146580744606288,    -0.00013886259748780043,    -0.0001268190446981172,    -0.00011052388056271511,    -0.00009017969193987633,    -0.00006611465374230917,    -0.000038782938435978234,    -0.00000876133822602926,    0.000023260672340825108,    0.00005649687929971302,    0.00009007562653717549,    0.00012306759645970273,    0.00015449607180095516,    0.00018338444785875874,    0.00020875809537386906,    0.00022969849532759564,    0.0002453517770850021,    0.0002549809478537094,    0.00025796163603291,    0.0002538462848586374,    0.00024234944561075662,    0.00022339916263349984,    0.00019711586457920054,    0.00016386029242954867,    0.00012419676704937842,    0.00007891531672131619,    0.000029009383738234164,    -0.000024342137184611088,    -0.00007979314435225464,    -0.0001358730574519546,    -0.00019100097583334814,    -0.00024355965476127581,    -0.00029190178936381293,    -0.0003344302124498643,    -0.00036962883770277297,    -0.00039611560711705693,    -0.00041269318701138354,    -0.0004183852499507708,    -0.00041249179821738956,    -0.0003945978397052112,    -0.0003646302532886169,    -0.00032285416030081534,    -0.00026988665242490956,    -0.00020671246100372262,    -0.00013464208918430477,    -0.000055323215412330015,    0.00002931794922226709,    0.0001171052743416949,    0.00020566413994787955,    0.00029249350400491035,    0.0003750141208561986,    0.0004506599119959301,    0.0005169373619811267,    0.0005715117180256151,    0.00061228349091545,    0.0006374453128719119,    0.0006455721137885246,    0.0006356604875175356,    0.0006071799378206807,    0.0005601252062773255,    0.000495014311378991,    0.0004129206109785137,    0.0003154557316698014,    0.0002047389778021251,    0.00008337898885071015,    -0.00004560145744141743,    -0.00017883039809039755,    -0.00031265217157122984,    -0.00044325463590371946,    -0.0005667417231840965,    -0.0006792584632287428,    -0.000777109165785064,    -0.0008568591271101397,    -0.0009154512320146708,    -0.0009503207712198178,    -0.0009594657179665852,    -0.0009415565364645168,    -0.0008959867862209759,    -0.0008229173935989571,    -0.0007233199648734618,    -0.0005989694888112213,    -0.00045242654474226385,    -0.0002869988301907985,    -0.00010668059721194097,    0.00008395295226827905,    0.00027983393647885,    0.00047553907439135357,    0.0006654397745486944,    0.000843843754949596,    0.0010051567950007032,    0.00114407065509444,    0.001255698377647631,    0.0013357463876968929,    0.001380669423474658,    0.0013877913695961909,    0.001355419634589166,    0.0012829347392002784,    0.001170857079703668,    0.0010208587539186904,    0.0008357711398553729,    0.00061955643126457,    0.0003772148219011147,    0.00011469799913757213,    -0.00016123053388576708,    -0.00044315432978481455,    -0.0007232052543806719,    -0.0009932645781534457,    -0.0012451786011040068,    -0.0014710139934164534,    -0.0016632810310614461,    -0.0018151715774975129,    -0.00192076844077557,    -0.0019752631247
\ No newline at end of file
@@ -44,6 +45,8 @@
     -0.00000876133822602926,    0.000023260672340825108,    0.00005649687929971302,    0.00009007562653717549,    0.00012306759645970273,    0.00015449607180095516,    0.00018338444785875874,    0.00020875809537386906,    0.00022969849532759564,    0.0002453517770850021,    0.0002549809478537094,    0.00025796163603291,    0.0002538462848586374,    0.00024234944561075662,    0.00022339916263349984,    0.00019711586457920054,    0.00016386029242954867,    0.00012419676704937842,    0.00007891531672131619,    0.000029009383738234164,    -0.000024342137184611088,    -0.00007979314435225464,    -0.0001358730574519546,    -0.00019100097583334814,    -0.00024355965476127581,    -0.00029190178936381293,    -0.0003344302124498643,    -0.00036962883770277297,    -0.00039611560711705693,    -0.00041269318701138354,    -0.0004183852499507708,    -0.00041249179821738956,    -0.0003945978397052112,    -0.0003646302532886169,    -0.00032285416030081534,    -0.00026988665242490956,    -0.00020671246100372262,    -0.00013464208918430477,    -0.000055323215412330015,    0.00002931794922226709,    0.0001171052743416949,    0.00020566413994787955,    0.00029249350400491035,    0.0003750141208561986,    0.0004506599119959301,    0.0005169373619811267,    0.0005715117180256151,    0.00061228349091545,    0.0006374453128719119,    0.0006455721137885246,    0.0006356604875175356,    0.0006071799378206807,    0.0005601252062773255,    0.000495014311378991,    0.0004129206109785137,    0.0003154557316698014,    0.0002047389778021251,    0.00008337898885071015,    -0.00004560145744141743,    -0.00017883039809039755,    -0.00031265217157122984,    -0.00044325463590371946,    -0.0005667417231840965,    -0.0006792584632287428,    -0.000777109165785064,    -0.0008568591271101397,    -0.0009154512320146708,    -0.0009503207712198178,    -0.0009594657179665852,    -0.0009415565364645168,    -0.0008959867862209759,    -0.0008229173935989571,    -0.0007233199648734618,    -0.0005989694888112213,    -0.00045242654474226385,    -0.0002869988301907985,    -0.00010668059721194097,    0.00008395295226827905,    0.00027983393647885,    0.00047553907439135357,    0.0006654397745486944,    0.000843843754949596,    0.0010051567950007032,    0.00114407065509444,    0.001255698377647631,    0.0013357463876968929,    0.001380669423474658,    0.0013877913695961909,    0.001355419634589166,    0.0012829347392002784,    0.001170857079703668,    0.0010208587539186904,    0.0008357711398553729,    0.00061955643126457,    0.0003772148219011147,    0.00011469799913757213,    -0.00016123053388576708,    -0.00044315432978481455,    -0.0007232052543806719,    -0.0009932645781534457,    -0.0012451786011040068,    -0.0014710139934164534,    -0.0016632810310614461,    -0.0018151715774975129,    -0.00192076844077557,    -0.0019752631247864864,    -0.001975134453443597,    -0.0019182895067395296,    -0.0018041876320646774,    -0.001633913423352424,    -0.0014102152408968088,    -0.001137471712692101,    -0.0008216330718947789,    -0.00047011532069230985,    -0.00009163860692195964,    0.000303959375080359,    0.0007059826944723511,    0.0011031322000193775,    0.0014838230983794044,    0.0018364968859816949,    0.002149959028270332,    0.0024137017159986582,    0.002618226673952322,    0.0027553645300578185,    0.0028185632193391155,    0.0028031399386233232,    0.002706467328171449,    0.0025281269906890775,    0.002270010778971365,    0.0019363836007384424,    0.0015338268915202368,    0.0010711414888523287,    0.0005591670516309547,    0.00001060247047841419,    -0.0005602987374387867,    -0.0011380941283709622,    -0.0017065439770515773,    -0.0022489925020944468,    -0.002748834879937373,    -0.0031900292357864976,    -0.003557551903204754,    -0.0038378055902346464,    -0.004019111046679251,    -0.004092137488933285,    -0.004050192623721161,    -0.0038895301449116456,    -0.003609639243260837,    -0.0032133304296573786,    -0.00270677748493009,    -0.002099568363742687,    -0.0014045297042921403,    -0.0006374761750023702,    0.00018300348309551812,    0.001036003435024269
\ No newline at end of file
 };
 const float fir32XHigh[512] = {    0.00001695726883388158,    0.000007675466747345142,    0.000009369969074343828,    0.000011279085806814155,    0.000013415806582636418,    0.00001579269222570207,    0.000018421887123570193,    0.00002131472780344219,    0.000024481596821410856,    0.000027931521966672674,    0.00003167253546774698,    0.00003571156802204514,    0.00004005385180859527,    0.00004470260388316558,    0.00004965901316017587,    0.00005492204008152043,    0.00006048845305842843,    0.00006635289665744708,    0.00007250665288501187,    0.0000789384885513108,    0.00008563367774264342,    0.00009257537368625661,    0.00009974252621593992,    0.00010711124658254552,    0.00011465337570751053,    0.00012233800287448705,    0.0001301305708291957,    0.00013799197926318244,    0.00014587929227876596,    0.00015374657372226684,    0.000161543746522965,    0.0001692168951984779,    0.00017670780599526637,    0.0001839550739841348,    0.00019089427588832468,    0.00019745677767765902,    0.00020357062514912954,    0.00020916210971675997,    0.0002141545274069432,    0.00021846768000518762,    0.00022202071352577454,    0.00022473075934779818,    0.00022651220405928228,    0.00022728022159501112,    0.0002269491553453425,    0.00022543136577234978,    0.00022264296187547415,    0.0002184968451898252,    0.00021291103136150344,    0.00020580302601570826,    0.00019709428929377538,    0.00018670887176183611,    0.00017457550213741742,    0.00016062706678436397,    0.0001448013951907719,    0.0001270421247034733,    0.00010729940118257597,    0.00008553038364340326,    0.00006169965119086659,    0.00003577991793585758,    0.000007752990690551504,    -0.000022389783957090243,    -0.00005464753929697829,    -0.00008900834335751579,    -0.0001254499161703673,    -0.00016393632811230729,    -0.0002044234554405178,    -0.00024684930385593585,    -0.000291146274450184,    -0.0003372278537321366,    -0.00038499799259658716,    -0.00043434821843157495,    -0.0004851539797413716,    -0.000537279458928773,    -0.0005905762825387684,    -0.0006448805823763886,    -0.0007000164290861944,    -0.0007557967574505448,    -0.0008120214850938284,    -0.0008684784362018723,    -0.000924945795118327,    -0.0009811922513964621,    -0.0010369764412132298,    -0.0010920476659586364,    -0.0011461469777671403,    -0.0011990092591572569,    -0.0012503626824092186,    -0.001299930348337511,    -0.0013474327014007098,    -0.0013925895075579725,    -0.0014351200205514354,    -0.0014747442974922531,    -0.0015111829899403478,    -0.0015441601544571469,    -0.0015734040663474662,    -0.0015986504297413274,    -0.0016196438588602622,    -0.0016361410571864347,    -0.0016479110521030553,    -0.0016547353303458935,    -0.0016564077630374632,    -0.0016527363435263026,    -0.0016435483225404998,    -0.0016286956518505767,    -0.0016080553748913375,    -0.0015815237521207347,    -0.0015490117157615478,    -0.0015104528831698094,    -0.001465823165002548,    -0.0014151394219170251,    -0.001358416974565312,    -0.0012956736049528927,    -0.0012270686956067616,    -0.001152656073186285,    -0.0010726190880063075,    -0.0009871267066080157,    -0.0008963952696138223,    -0.0008006703533508123,    -0.0007002299686741377,    -0.0005953836139186328,    -0.0004864723381871633,    -0.0003738679720682553,    -0.00025797228061734796,    -0.00013921599931306062,    -0.000018057446410729332,    0.00010501885598494471,    0.00022950336047164354,    0.00035486342787289485,    0.00048054572124056215,    0.0006059774135387564,    0.0007305691337782367,    0.0008537161333655127,    0.0009748030963864794,    0.0010932046990955392,    0.0012082904750566619,    0.0013194249851955161,    0.0014259733376771368,    0.001527303743896754,    0.0016227897956312704,    0.001711814456379326,    0.0017937737205012431,    0.0018680795987737412,    0.0019341641568400244,    0.0019914815935822066,    0.002039512595508008,    0.0020777684004774366,    0.002105792845115274,    0.002123165845077641,    0.0021295078285898787,    0.002124481676328226,    0.0021077949476114846,    0.0020792
\ No newline at end of file
+1898154916056,    0.000050727732077616854,    0.00022654511040849531,    0.0004055654685261572,    0.0005829725151929097,    0.0007539299891718014,    0.0009136968081628693,    0.001057727366040496,    0.0011817838315511687,    0.0012820768752281682,    0.0013553936088779655,    0.0013991567634035874,    0.0014114626691980761,    0.0013911994521601603,    0.001338158623469115,    0.0012529312652788224,    0.0011368782078168052,    0.0009924227419316402,    0.0008225367782712132,    0.0006311126153653432,    0.000422596130820185,    0.00020202566973633374,    -0.000025140126274052846,    -0.00025314012889659734,    -0.00047605825978268214,    -0.0006879757889763613,    -0.0008831265836660278,    -0.001056052961049124,    -0.0012017570118505278,    -0.0013158443800074546,    -0.0013946550179738235,    -0.00143537714856422,    -0.0014361430413177665,    -0.0013961025273104373,    -0.0013154698934900741,    -0.0011955448624625515,    -0.001038705445344848,    -0.000848370211905452,    -0.0006289357238567322,    -0.00038567726087640876,    -0.00012464084542349136,    0.00014751424024790855,    0.00042365555592108265,    0.000696381707633601,    0.0009581911739190034,    0.0012016945125591883,    0.0014198129038021875,    0.0016059677163340854,    0.0017542822302381216,    0.0018597489437935104,    0.0019183843680031518,    0.001927370582069373,    0.0018851569558006424,    0.0017915316423764106,    0.0016476681649469273,    0.001456129721890939,    0.0012208322294896099,    0.0009469770920907817,    0.0006409478559993642,    0.0003101659717946291,    -0.00003708137047780295,    -0.0003918367361265021,    -0.0007446984520565823,    -0.0010860619549777095,    -0.0014063764577860907,    -0.001696397687712767,    -0.0019474488265779002,    -0.002151669227747982,    -0.002302249012563522,    -0.0023936395957784356,    -0.0024217386080201218,    -0.002384046464152241,    -0.0022797724899456247,    -0.0021099040224506474,    -0.0018772300452061593,    -0.001586318069799396,    -0.0012434422926464283,    -0.0008564627353582099,    -0.0004346583284416864,    0.000011483258960353713,    0.0004705125435918996,    0.0009302983176219571,    0.0013783347882871506,    0.0018020649278141442,    0.002189218072448032,    0.002528151228372692,    0.0028081778185230755,    0.0030198855690580883,    0.0031554218226391927,    0.0032087539967944043,    0.003175891861997494,    0.003055052047477484,    0.0028467769761391067,    0.0025539826540715814,    0.0021819611806385975,    0.00173831289146853,    0.0012328190076443134,    0.0006772405314859651,    0.0000850660373523537,    -0.0005287869617277397,    -0.001148321137491392,    -0.0017568578913237647,    -0.002337465469832778,    -0.0028733927792042916,    -0.0033485134261990474,    -0.0037477874636434095,    -0.004057705229541436,    -0.0042666789949867895,    -0.004365411194693107,    -0.004347246153946479,    -0.0042084293493284755,    -0.003948276264434998,    -0.0035693427342337308,    -0.003077468630328199,    -0.002481682761858642,    -0.0017941893541420268,    -0.0010300505400156208,    -0.00020699101191350578,    0.0006550244158311212,    0.0015341931983222652,    0.002407385154286287,    0.0032506853111441327,    0.004039981949981368,    0.004751579445675196,    0.0053628234864281235,    0.0058527242916193226,    0.006202559568610708,    0.006396443797782178,    0.006421849969755556,    0.006270068071543294,    0.005936587372391708,    0.0054213915962429745,    0.004729156264045173,    0.0038693427245538904,    0.0028561826064778697,    0.0017085458613360902,    0.0004497040612160084,    -0.0008930343940838381,    -0.002288760766598498,    -0.0037035572532650445,    -0.005101096327651239,    -0.006443406350064504,    -0.007691613708744422,    -0.008806783345605503,    -0.009750779708566895,    -0.010487104621962649,    -0.010981761556592558,    -0.011204077521465777,    -0.01112745993022714,    -0.010730106123767362,    -0.009995629398181848,    -0.008913569832214968,    -0.007479799008370572,    -0.005696809921316997,    -0.0035738648415050284,    -0.0011270001382152866,    0.00162110
\ No newline at end of file
+};
 444785875874,    0.00020875809537386906,    0.00022969849532759564,    0.0002453517770850021,    0.0002549809478537094,    0.00025796163603291,    0.0002538462848586374,    0.00024234944561075662,    0.00022339916263349984,    0.00019711586457920054,    0.00016386029242954867,    0.00012419676704937842,    0.00007891531672131619,    0.000029009383738234164,    -0.000024342137184611088,    -0.00007979314435225464,    -0.0001358730574519546,    -0.00019100097583334814,    -0.00024355965476127581,    -0.00029190178936381293,    -0.0003344302124498643,    -0.00036962883770277297,    -0.00039611560711705693,    -0.00041269318701138354,    -0.0004183852499507708,    -0.00041249179821738956,    -0.0003945978397052112,    -0.0003646302532886169,    -0.00032285416030081534,    -0.00026988665242490956,    -0.00020671246100372262,    -0.00013464208918430477,    -0.000055323215412330015,    0.00002931794922226709,    0.0001171052743416949,    0.00020566413994787955,    0.00029249350400491035,    0.0003750141208561986,    0.0004506599119959301,    0.0005169373619811267,    0.0005715117180256151,    0.00061228349091545,    0.0006374453128719119,    0.0006455721137885246,    0.0006356604875175356,    0.0006071799378206807,    0.0005601252062773255,    0.000495014311378991,    0.0004129206109785137,    0.0003154557316698014,    0.0002047389778021251,    0.00008337898885071015,    -0.00004560145744141743,    -0.00017883039809039755,    -0.00031265217157122984,    -0.00044325463590371946,    -0.0005667417231840965,    -0.0006792584632287428,    -0.000777109165785064,    -0.0008568591271101397,    -0.0009154512320146708,    -0.0009503207712198178,    -0.0009594657179665852,    -0.0009415565364645168,    -0.0008959867862209759,    -0.0008229173935989571,    -0.0007233199648734618,    -0.0005989694888112213,    -0.00045242654474226385,    -0.0002869988301907985,    -0.00010668059721194097,    0.00008395295226827905,    0.00027983393647885,    0.00047553907439135357,    0.0006654397745486944,    0.000843843754949596,    0.0010051567950007032,    0.00114407065509444,    0.001255698377647631,    0.0013357463876968929,    0.001380669423474658,    0.0013877913695961909,    0.001355419634589166,    0.0012829347392002784,    0.001170857079703668,    0.0010208587539186904,    0.0008357711398553729,    0.00061955643126457,    0.0003772148219011147,    0.00011469799913757213,    -0.00016123053388576708,    -0.00044315432978481455,    -0.0007232052543806719,    -0.0009932645781534457,    -0.0012451786011040068,    -0.0014710139934164534,    -0.0016632810310614461,    -0.0018151715774975129,    -0.00192076844077557,    -0.0019752631247864864,    -0.001975134453443597,    -0.0019182895067395296,    -0.0018041876320646774,    -0.001633913423352424,    -0.0014102152408968088,    -0.001137471712692101,    -0.0008216330718947789,    -0.00047011532069230985,    -0.00009163860692195964,    0.000303959375080359,    0.0007059826944723511,    0.0011031322000193775,    0.0014838230983794044,    0.0018364968859816949,    0.002149959028270332,    0.0024137017159986582,    0.002618226673952322,    0.0027553645300578185,    0.0028185632193391155,    0.0028031399386233232,    0.002706467328171449,    0.0025281269906890775,    0.002270010778971365,    0.0019363836007384424,    0.0015338268915202368,    0.0010711414888523287,    0.0005591670516309547,    0.00001060247047841419,    -0.0005602987374387867,    -0.0011380941283709622,    -0.0017065439770515773,    -0.0022489925020944468,    -0.002748834879937373,    -0.0031900292357864976,    -0.003557551903204754,    -0.0038378055902346464,    -0.004019111046679251,    -0.004092137488933285,    -0.004050192623721161,    -0.0038895301449116456,    -0.003609639243260837,    -0.0032133304296573786,    -0.00270677748493009,    -0.002099568363742687,    -0.0014045297042921403,    -0.0006374761750023702,    0.00018300348309551812,    0.001036003435024269,    0.0018988018625642805,    0.002747304702323304,    0.0035567334141860967,    0.004302253788255174,    0.0049595751407287515,    0.0055057423147163425,    0.00591974033132566
\ No newline at end of file
 };
 const float fir32XHigh[512] = {    0.00001695726883388158,    0.000007675466747345142,    0.000009369969074343828,    0.000011279085806814155,    0.000013415806582636418,    0.00001579269222570207,    0.000018421887123570193,    0.00002131472780344219,    0.000024481596821410856,    0.000027931521966672674,    0.00003167253546774698,    0.00003571156802204514,    0.00004005385180859527,    0.00004470260388316558,    0.00004965901316017587,    0.00005492204008152043,    0.00006048845305842843,    0.00006635289665744708,    0.00007250665288501187,    0.0000789384885513108,    0.00008563367774264342,    0.00009257537368625661,    0.00009974252621593992,    0.00010711124658254552,    0.00011465337570751053,    0.00012233800287448705,    0.0001301305708291957,    0.00013799197926318244,    0.00014587929227876596,    0.00015374657372226684,    0.000161543746522965,    0.0001692168951984779,    0.00017670780599526637,    0.0001839550739841348,    0.00019089427588832468,    0.00019745677767765902,    0.00020357062514912954,    0.00020916210971675997,    0.0002141545274069432,    0.00021846768000518762,    0.00022202071352577454,    0.00022473075934779818,    0.00022651220405928228,    0.00022728022159501112,    0.0002269491553453425,    0.00022543136577234978,    0.00022264296187547415,    0.0002184968451898252,    0.00021291103136150344,    0.00020580302601570826,    0.00019709428929377538,    0.00018670887176183611,    0.00017457550213741742,    0.00016062706678436397,    0.0001448013951907719,    0.0001270421247034733,    0.00010729940118257597,    0.00008553038364340326,    0.00006169965119086659,    0.00003577991793585758,    0.000007752990690551504,    -0.000022389783957090243,    -0.00005464753929697829,    -0.00008900834335751579,    -0.0001254499161703673,    -0.00016393632811230729,    -0.0002044234554405178,    -0.00024684930385593585,    -0.000291146274450184,    -0.0003372278537321366,    -0.00038499799259658716,    -0.00043434821843157495,    -0.0004851539797413716,    -0.000537279458928773,    -0.0005905762825387684,    -0.0006448805823763886,    -0.0007000164290861944,    -0.0007557967574505448,    -0.0008120214850938284,    -0.0008684784362018723,    -0.000924945795118327,    -0.0009811922513964621,    -0.0010369764412132298,    -0.0010920476659586364,    -0.0011461469777671403,    -0.0011990092591572569,    -0.0012503626824092186,    -0.001299930348337511,    -0.0013474327014007098,    -0.0013925895075579725,    -0.0014351200205514354,    -0.0014747442974922531,    -0.0015111829899403478,    -0.0015441601544571469,    -0.0015734040663474662,    -0.0015986504297413274,    -0.0016196438588602622,    -0.0016361410571864347,    -0.0016479110521030553,    -0.0016547353303458935,    -0.0016564077630374632,    -0.0016527363435263026,    -0.0016435483225404998,    -0.0016286956518505767,    -0.0016080553748913375,    -0.0015815237521207347,    -0.0015490117157615478,    -0.0015104528831698094,    -0.001465823165002548,    -0.0014151394219170251,    -0.001358416974565312,    -0.0012956736049528927,    -0.0012270686956067616,    -0.001152656073186285,    -0.0010726190880063075,    -0.0009871267066080157,    -0.0008963952696138223,    -0.0008006703533508123,    -0.0007002299686741377,    -0.0005953836139186328,    -0.0004864723381871633,    -0.0003738679720682553,    -0.00025797228061734796,    -0.00013921599931306062,    -0.000018057446410729332,    0.00010501885598494471,    0.00022950336047164354,    0.00035486342787289485,    0.00048054572124056215,    0.0006059774135387564,    0.0007305691337782367,    0.0008537161333655127,    0.0009748030963864794,    0.0010932046990955392,    0.0012082904750566619,    0.0013194249851955161,    0.0014259733376771368,    0.001527303743896754,    0.0016227897956312704,    0.001711814456379326,    0.0017937737205012431,    0.0018680795987737412,    0.0019341641568400244,    0.0019914815935822066,    0.002039512595508008,    0.0020777684004774366,    0.002105792845115274,    0.002123165845077641,    0.0021295078285898787,    0.002124481676328226,    0.0021077949476114846,    0.0020792
\ No newline at end of file
--- a/LEAF_JUCEPlugin/Source/LEAFLink.cpp
+++ b/LEAF_JUCEPlugin/Source/LEAFLink.cpp
@@ -15,11 +15,12 @@
 
 std::vector<juce::String> cButtonNames =  std::vector<juce::String>
 {
-    "record"
+    
 };
 
 std::vector<juce::String> cSliderNames =  std::vector<juce::String>
 {
+    "on/off",
     "mod freq",
     "mod depth"
 };
--- a/LEAF_JUCEPlugin/Source/MyTest.cpp
+++ b/LEAF_JUCEPlugin/Source/MyTest.cpp
@@ -19,18 +19,20 @@
 tOversampler os;
 tNoise noise;
 tCycle sine;
+tFIR filter;
 
 float gain;
+bool buttonState;
+int ratio = 16;
 
 void    LEAFTest_init            (float sampleRate, int blockSize)
 {
     LEAF_init(sampleRate, blockSize, &getRandomFloat);
     
-    tOversampler_init(&os, 2, OFALSE);
+    tOversampler_init(&os, ratio, OTRUE);
     tNoise_init(&noise, WhiteNoise);
     tCycle_init(&sine);
     tCycle_setFreq(&sine, 220);
-    
     leaf_pool_report();
 }
 
@@ -41,11 +43,20 @@
 float   LEAFTest_tick            (float input)
 {
     float sample = tCycle_tick(&sine);
+    float output[ratio];
     
-    //sample *= gain*10.0f;
-    
-    sample *= tOversampler_tick(&os, sample, nothing);
-    
+    if (buttonState) {
+        tOversampler_upsample(&os, sample, output);
+        for (int i = 0; i < ratio; ++i) {
+            output[i] *= gain*10.0f;
+            output[i] = LEAF_clip(-1.0f, output[i], 1.0f);
+        }
+        sample = tOversampler_downsample(&os, output);
+    }
+    else {
+        sample *= gain*10.0f;
+        sample = LEAF_clip(-1.0f, sample, 1.0f);
+    }
     return sample * gain;
 }
 
@@ -54,13 +65,13 @@
 bool lastState = false, lastPlayState = false;
 void    LEAFTest_block           (void)
 {
-    float val = getSliderValue("mod freq");
     
-    float freq = 200 + 1000 * val;
+    buttonState = getSliderValue("on/off") > 0.5 ? true : false;
     
-    tCycle_setFreq(&sine, freq);
+    float val = getSliderValue("mod freq");
     
-    DBG("mod freq: " + String(freq));
+    float freq = 200 + 20000 * val;
+    tCycle_setFreq(&sine, freq);
     
     val = getSliderValue("mod depth");
     
--- a/LEAF_JUCEPlugin/Source/PluginProcessor.cpp
+++ b/LEAF_JUCEPlugin/Source/PluginProcessor.cpp
@@ -21,7 +21,7 @@
 {
     // Make sure that before the constructor has finished, you've set the
     // editor's size to whatever you need it to be.
-    setSize (750, 600);
+    setSize (600, 400);
     
     addAndMakeVisible(uicomponent);
 }