shithub: leaf

Download patch

ref: 32b51e4078a2b84abcf5a9efbcb904b168ec1326
parent: 3c13918c1f725206e933796bf0b67e8dfe82ea40
author: mulshine <mulshine@princeton.edu>
date: Thu Feb 7 13:49:17 EST 2019

Leaf reduce.

--- a/LEAF/Inc/leaf-math.h
+++ b/LEAF/Inc/leaf-math.h
@@ -78,7 +78,7 @@
 float LEAF_shaper     (float input, float m_drive);
 float LEAF_reedTable  (float input, float offset, float slope);
     
-float LEAF_reduct (float input, int );
+float LEAF_reduct (float input, float ratio);
 float LEAF_round (float input, float rnd);
 float LEAF_bitwise_or(float input, uint32_t op);
 
--- a/LEAF/Src/leaf-math.c
+++ b/LEAF/Src/leaf-math.c
@@ -123,10 +123,11 @@
 float hold = 0.f;
 int reduct_count = 0;
 
-float LEAF_reduct (float input, int st)
+
+float LEAF_reduct (float input, float ratio)
 {
     reduct_count++;
-    if (reduct_count > st)
+    if (reduct_count > (leaf.sampleRate * (1.f - ratio)))
     {
         hold = input;
         reduct_count = 0;