ref: e60c993bac54d14d59a2e7967f1e5fd487a523a4
parent: ed50a40430b62e7cca4f1d4efd9decafd296df77
author: Jeff Snyder <jeff@snyderphonics.com>
date: Sun Apr 14 10:31:10 EDT 2019
merged oversampler and master
--- a/LEAF/Inc/leaf-globals.h
+++ b/LEAF/Inc/leaf-globals.h
@@ -49,15 +49,14 @@
#define MPOLY_NUM_MAX_VOICES 8
#define NUM_OSC 4
#define INV_NUM_OSC (1.0f / NUM_OSC)
-#define PS_FRAME_SIZE 1024 // SNAC_FRAME_SIZE in LEAFCore.h should match (or be smaller than?) this
+#define PS_FRAME_SIZE 1024 // SNAC_FRAME_SIZE in leaf-pitch.h should match (or be smaller than?) this
#define ENV_WINDOW_SIZE 1024
#define ENV_HOP_SIZE 256
-#define NUM_KNOBS 4
#define DELAY_LENGTH 16000 // The maximum delay length of all Delay/DelayL/DelayA components.
// Feel free to change to suit memory constraints or desired delay max length / functionality.
-#define TALKBOX_BUFFER_LENGTH 1600 // Every talkbox instance introduces 5 buffers of this size
+
union unholy_t { /* a union between a float and an integer */
--- a/LEAF/Inc/leaf-utilities.h
+++ b/LEAF/Inc/leaf-utilities.h
@@ -115,6 +115,7 @@
void tReedTable_init (tReedTable* const, float offset, float slope);
void tReedTable_free (tReedTable* const);
float tReedTable_tick (tReedTable* const, float input);
+float tReedTable_tanh_tick (tReedTable* const p, float input); //tanh softclip version of reed table - replacing the hard clip in original stk code
void tReedTable_setOffset (tReedTable* const, float offset);
void tReedTable_setSlope (tReedTable* const, float slope);
--- a/LEAF/Inc/leaf-vocoder.h
+++ b/LEAF/Inc/leaf-vocoder.h
@@ -22,7 +22,7 @@
/* tTalkbox */
#define NUM_TALKBOX_PARAM 4
-#define TALKBOX_BUFFER_LENGTH 1024 //1600
+#define TALKBOX_BUFFER_LENGTH 1024 // Every talkbox instance introduces 5 buffers of this size - was originally 1600
typedef struct _tTalkbox
{
--- a/LEAF/Src/leaf-utilities.c
+++ b/LEAF/Src/leaf-utilities.c
@@ -936,6 +936,16 @@
return output;
}
+float tReedTable_tanh_tick (tReedTable* const p, float input)
+{
+ // The input is differential pressure across the reed.
+ float output = p->offset + (p->slope * input);
+
+ // If output is > 1, the reed has slammed shut and the
+ // reflection function value saturates at 1.0.
+ return tanhf(output);
+}
+
void tReedTable_setOffset (tReedTable* const p, float offset)
{
p->offset = offset;