ref: e66fa0c4a525ab592cae11a2f593d1b7d579f7cb
parent: 5386dfb1fece3a9bf3aa36f474a6b863239e701d
author: Davis Polito <davispolito1@gmail.com>
date: Sun Jul 24 08:48:56 EDT 2022
Add LEAF_generate_table_skew_non_sym
--- a/leaf/Inc/leaf-math.h
+++ b/leaf/Inc/leaf-math.h
@@ -175,7 +175,7 @@
//0.001 base gives a good curve that goes from 1 to near zero
//1000 gives a good curve from -1.0 to 0.0
void LEAF_generate_exp(float* buffer, float base, float start, float end, float offset, int size);
-
+ void LEAF_generate_table_skew_non_sym(float* buffer, float start, float end, float center, int size);
void LEAF_generate_atodb(float* buffer, int size);
void LEAF_generate_atodbPositiveClipped(float* buffer, float lowerThreshold, float range, int size);
--- a/leaf/Src/leaf-math.c
+++ b/leaf/Src/leaf-math.c
@@ -565,6 +565,22 @@
}
}
+//0.001 base gives a good curve that goes from 1 to near zero
+void LEAF_generate_table_skew_non_sym(float* buffer, float start, float end, float center, int size)
+{
+ float skew = logf (0.5f) / logf ((center - start) / (end - start));
+ float increment = (end - start) / (float)size;
+ float x = start;
+ float proportion = 0;
+ for (int i = 0; i < size; i++)
+ {
+ proportion = expf (logf (x) / skew);
+ buffer[i] = start + (end - start) * proportion;
+ x += increment;
+ }
+}
+
+
void LEAF_generate_atodb(float* buffer, int size)
{
float increment = 1.0f / (float)size;