shithub: leaf

Download patch

ref: 4c8de0f3852178244ffaef00f6b411c8d1b8c5e2
parent: 23656d71aa2efc07bc509af95d3ecc18542a7ec5
author: Matthew Wang <mjw7@princeton.edu>
date: Fri Jan 29 09:00:53 EST 2021

reorganizing and renaming adsrs and compactwavetable objects; ADSR4 -> ADSRT, ADSR3 -> ADSRS, ADSR2 deleted, CompactWaveX -> WaveXS

--- a/TestPlugin/Source/MyTest.cpp
+++ b/TestPlugin/Source/MyTest.cpp
@@ -32,7 +32,7 @@
 tButterworth bw;
 
 tWaveTable wt;
-tCompactWaveTable cwt;
+tWaveTableS cwt;
 tWaveSynth ws;
 
 tBuffer samp;
@@ -64,7 +64,7 @@
     LEAF_init(&leaf, sampleRate, blockSize, memory, MSIZE, &getRandomFloat);
     
 //    tWaveTable_init(&wt, __leaf_table_sawtooth[0], 2048, 10000.f, &leaf);
-//    tCompactWaveTable_init(&cwt, __leaf_table_sawtooth[0], 2048, 10000.f, &leaf);
+//    tWaveTableS_init(&cwt, __leaf_table_sawtooth[0], 2048, 10000.f, &leaf);
     
     tMBTriangle_init(&btri, &leaf);
     tMBPulse_init(&bpulse, &leaf);
@@ -118,7 +118,7 @@
     tMBPulse_setFreq(&bpulse, val * 160000.f - 80000.0f);
     tMBSaw_setFreq(&bsaw, val * 10000.f);
 //    tWaveTable_setFreq(&wt, val * 160000.f - 80000.0f);
-//    tCompactWaveTable_setFreq(&cwt, val * 10000.);
+//    tWaveTableS_setFreq(&cwt, val * 10000.);
     tWaveSynth_setFreq(&ws, 0, val * 10000.f);
 //    tRetune_tuneVoice(&retune, 0, val * 3.0f + 0.5f);
 //    tSimpleRetune_tuneVoice(&sretune, 0, 300);
--- a/leaf/Inc/leaf-envelopes.h
+++ b/leaf/Inc/leaf-envelopes.h
@@ -281,152 +281,153 @@
     // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
     
     /*!
-     @defgroup tasdr2 tADSR2
+     @defgroup tadsrt tADSRT
      @ingroup envelopes
      @brief
      @{
      
-     @fn void    tADSR2_init          (tADSR2* const, float attack, float decay, float sustain, float release, LEAF* const leaf)
-     @brief Initialize a tADSR2 to the default mempool of a LEAF instance.
-     @param adsr A pointer to the tADSR2 to initialize.
+     @fn void    tADSRT_init          (tADSRT* const, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize, LEAF* const leaf)
+     @brief Initialize a tADSRT to the default mempool of a LEAF instance.
+     @param adsr A pointer to the tADSRT to initialize.
      @param leaf A pointer to the leaf instance.
      
-     @fn void    tADSR2_initToPool    (tADSR2* const, float attack, float decay, float sustain, float release, tMempool* const)
-     @brief Initialize a tADSR2 to a specified mempool.
-     @param adsr A pointer to the tADSR2 to initialize.
+     @fn void    tADSRT_initToPool    (tADSRT* const, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize, tMempool* const)
+     @brief Initialize a tADSRT to a specified mempool.
+     @param adsr A pointer to the tADSRT to initialize.
      @param mempool A pointer to the tMempool to use.
      
-     @fn void    tADSR2_free          (tADSR2* const)
-     @brief Free a tADSR2 from its mempool.
-     @param adsr A pointer to the tADSR2 to free.
+     @fn void    tADSRT_free          (tADSRT* const)
+     @brief Free a tADSRT from its mempool.
+     @param adsr A pointer to the tADSRT to free.
      
-     @fn float   tADSR2_tick          (tADSR2* const)
+     @fn float   tADSRT_tick          (tADSRT* const)
      @brief
-     @param adsr A pointer to the relevant tADSR2.
-      
-     @fn void    tADSR2_setAttack     (tADSR2* const, float attack)
+     @param adsr A pointer to the relevant tADSRT.
+     
+     @fn float   tADSRT_tickNoInterp  (tADSRT* const adsrenv)
      @brief
-     @param adsr A pointer to the relevant tADSR2.
+     @param adsr A pointer to the relevant tADSRT.
      
-     @fn void    tADSR2_setDecay      (tADSR2* const, float decay)
+     @fn void    tADSRT_setAttack     (tADSRT* const, float attack)
      @brief
-     @param adsr A pointer to the relevant tADSR2.
+     @param adsr A pointer to the relevant tADSRT.
      
-     @fn void    tADSR2_setSustain    (tADSR2* const, float sustain)
+     @fn void    tADSRT_setDecay      (tADSRT* const, float decay)
      @brief
-     @param adsr A pointer to the relevant tADSR2.
+     @param adsr A pointer to the relevant tADSRT.
      
-     @fn void    tADSR2_setRelease    (tADSR2* const, float release)
+     @fn void    tADSRT_setSustain    (tADSRT* const, float sustain)
      @brief
-     @param adsr A pointer to the relevant tADSR2.
+     @param adsr A pointer to the relevant tADSRT.
      
-     @fn void    tADSR2_setLeakFactor (tADSR2* const, float leakFactor)
+     @fn void    tADSRT_setRelease    (tADSRT* const, float release)
      @brief
-     @param adsr A pointer to the relevant tADSR2.
+     @param adsr A pointer to the relevant tADSRT.
      
-     @fn void    tADSR2_on            (tADSR2* const, float velocity)
+     @fn void    tADSRT_setLeakFactor (tADSRT* const, float leakFactor)
      @brief
-     @param adsr A pointer to the relevant tADSR2.
+     @param adsr A pointer to the relevant tADSRT.
      
-     @fn void    tADSR2_off           (tADSR2* const)
+     @fn void    tADSRT_on            (tADSRT* const, float velocity)
      @brief
-     @param adsr A pointer to the relevant tADSR2.
+     @param adsr A pointer to the relevant tADSRT.
      
+     @fn void    tADSRT_off           (tADSRT* const)
+     @brief
+     @param adsr A pointer to the relevant tADSRT.
+     
      @} */
     
-    typedef struct _tADSR2
+    typedef struct _tADSRT
     {
         
         tMempool mempool;
-        float sampleRateInMs;
-        float attack;
-        float decay;
-        float release;
-        float attackLambda;
-        float decayLambda;
-        float releaseLambda;
-        float sustain;
-        float leakGain;
+        const float *exp_buff;
+        uint32_t buff_size;
+        uint32_t buff_sizeMinusOne;
+        float bufferSizeDividedBySampleRateInMs;
+        float next;
+        
+        float attackInc, decayInc, releaseInc, rampInc;
+        
+        uint32_t whichStage;
+        
+        float sustain, gain, rampPeak, releasePeak;
+        
+        float attackPhase, decayPhase, releasePhase, rampPhase;
+        
         float leakFactor;
-        float targetGainSquared;
-        float factor;
-        float oneMinusFactor;
-        float gain;
-        uint8_t attacking;
-        uint8_t gate;
-        float env;
-        float envTarget;
-    } _tADSR2;
+    } _tADSRT;
     
-    typedef _tADSR2* tADSR2;
+    typedef _tADSRT* tADSRT;
     
-    void    tADSR2_init          (tADSR2* const, float attack, float decay, float sustain, float release, LEAF* const leaf);
-    void    tADSR2_initToPool    (tADSR2* const, float attack, float decay, float sustain, float release, tMempool* const);
-    void    tADSR2_free          (tADSR2* const);
+    void    tADSRT_init          (tADSRT* const, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize, LEAF* const leaf);
+    void    tADSRT_initToPool    (tADSRT* const, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize, tMempool* const);
+    void    tADSRT_free          (tADSRT* const);
     
-    float   tADSR2_tick          (tADSR2* const);
-    void    tADSR2_setAttack     (tADSR2* const, float attack);
-    void    tADSR2_setDecay      (tADSR2* const, float decay);
-    void    tADSR2_setSustain    (tADSR2* const, float sustain);
-    void    tADSR2_setRelease    (tADSR2* const, float release);
-    void    tADSR2_setLeakFactor (tADSR2* const, float leakFactor);
-    void    tADSR2_on            (tADSR2* const, float velocity);
-    void    tADSR2_off           (tADSR2* const);
+    float   tADSRT_tick          (tADSRT* const);
+    float   tADSRT_tickNoInterp  (tADSRT* const adsrenv);
+    void    tADSRT_setAttack     (tADSRT* const, float attack);
+    void    tADSRT_setDecay      (tADSRT* const, float decay);
+    void    tADSRT_setSustain    (tADSRT* const, float sustain);
+    void    tADSRT_setRelease    (tADSRT* const, float release);
+    void    tADSRT_setLeakFactor (tADSRT* const, float leakFactor);
+    void    tADSRT_on            (tADSRT* const, float velocity);
+    void    tADSRT_off           (tADSRT* const);
     
-    
     // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
     
     /*!
-     @defgroup tadsr3 tADSR3
+     @defgroup tadsrs tADSRS
      @ingroup envelopes
      @brief
      @{
      
-     @fn void    tADSR3_init          (tADSR3* const, float attack, float decay, float sustain, float release, LEAF* const leaf)
-     @brief Initialize a tADSR3 to the default mempool of a LEAF instance.
-     @param adsr A pointer to the tADSR3 to initialize.
+     @fn void    tADSRS_init          (tADSRS* const, float attack, float decay, float sustain, float release, LEAF* const leaf)
+     @brief Initialize a tADSRS to the default mempool of a LEAF instance.
+     @param adsr A pointer to the tADSRS to initialize.
      @param leaf A pointer to the leaf instance.
      
-     @fn void    tADSR3_initToPool    (tADSR3* const, float attack, float decay, float sustain, float release, tMempool* const)
-     @brief Initialize a tADSR3 to a specified mempool.
-     @param adsr A pointer to the tADSR3 to initialize.
+     @fn void    tADSRS_initToPool    (tADSRS* const, float attack, float decay, float sustain, float release, tMempool* const)
+     @brief Initialize a tADSRS to a specified mempool.
+     @param adsr A pointer to the tADSRS to initialize.
      @param mempool A pointer to the tMempool to use.
      
-     @fn void    tADSR3_free          (tADSR3* const)
-     @brief Free a tADSR3 from its mempool.
-     @param adsr A pointer to the tADSR3 to free.
+     @fn void    tADSRS_free          (tADSRS* const)
+     @brief Free a tADSRS from its mempool.
+     @param adsr A pointer to the tADSRS to free.
      
-     @fn float   tADSR3_tick          (tADSR3* const)
+     @fn float   tADSRS_tick          (tADSRS* const)
      @brief
-     @param adsr A pointer to the relevant tADSR3.
+     @param adsr A pointer to the relevant tADSRS.
      
-     @fn void    tADSR3_setAttack     (tADSR3* const, float attack)
+     @fn void    tADSRS_setAttack     (tADSRS* const, float attack)
      @brief
-     @param adsr A pointer to the relevant tADSR3.
+     @param adsr A pointer to the relevant tADSRS.
      
-     @fn void    tADSR3_setDecay      (tADSR3* const, float decay)
+     @fn void    tADSRS_setDecay      (tADSRS* const, float decay)
      @brief
-     @param adsr A pointer to the relevant tADSR3.
+     @param adsr A pointer to the relevant tADSRS.
      
-     @fn void    tADSR3_setSustain    (tADSR3* const, float sustain)
+     @fn void    tADSRS_setSustain    (tADSRS* const, float sustain)
      @brief
-     @param adsr A pointer to the relevant tADSR3.
+     @param adsr A pointer to the relevant tADSRS.
      
-     @fn void    tADSR3_setRelease    (tADSR3* const, float release)
+     @fn void    tADSRS_setRelease    (tADSRS* const, float release)
      @brief
-     @param adsr A pointer to the relevant tADSR3.
+     @param adsr A pointer to the relevant tADSRS.
      
-     @fn void    tADSR3_setLeakFactor (tADSR3* const, float leakFactor)
+     @fn void    tADSRS_setLeakFactor (tADSRS* const, float leakFactor)
      @brief
-     @param adsr A pointer to the relevant tADSR3.
+     @param adsr A pointer to the relevant tADSRS.
      
-     @fn void    tADSR3_on            (tADSR3* const, float velocity)
+     @fn void    tADSRS_on            (tADSRS* const, float velocity)
      @brief
-     @param adsr A pointer to the relevant tADSR3.
+     @param adsr A pointer to the relevant tADSRS.
      
-     @fn void    tADSR3_off           (tADSR3* const)
+     @fn void    tADSRS_off           (tADSRS* const)
      @brief
-     @param adsr A pointer to the relevant tADSR3.
+     @param adsr A pointer to the relevant tADSRS.
      
      @} */
     
@@ -439,7 +440,7 @@
         env_ramp
     };
     
-    typedef struct _tADSR3
+    typedef struct _tADSRS
     {
         
         tMempool mempool;
@@ -464,119 +465,22 @@
         float oneMinusFactor;
         float gain;
         
-    } _tADSR3;
+    } _tADSRS;
     
-    typedef _tADSR3* tADSR3;
+    typedef _tADSRS* tADSRS;
     
-    void    tADSR3_init          (tADSR3* const, float attack, float decay, float sustain, float release, LEAF* const leaf);
-    void    tADSR3_initToPool    (tADSR3* const, float attack, float decay, float sustain, float release, tMempool* const);
-    void    tADSR3_free          (tADSR3* const);
+    void    tADSRS_init          (tADSRS* const, float attack, float decay, float sustain, float release, LEAF* const leaf);
+    void    tADSRS_initToPool    (tADSRS* const, float attack, float decay, float sustain, float release, tMempool* const);
+    void    tADSRS_free          (tADSRS* const);
     
-    float   tADSR3_tick          (tADSR3* const);
-    void    tADSR3_setAttack     (tADSR3* const, float attack);
-    void    tADSR3_setDecay      (tADSR3* const, float decay);
-    void    tADSR3_setSustain    (tADSR3* const, float sustain);
-    void    tADSR3_setRelease    (tADSR3* const, float release);
-    void    tADSR3_setLeakFactor (tADSR3* const, float leakFactor);
-    void    tADSR3_on            (tADSR3* const, float velocity);
-    void    tADSR3_off           (tADSR3* const);
-    
-    // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
-    
-    /*!
-     @defgroup tadsr4 tADSR4
-     @ingroup envelopes
-     @brief
-     @{
-     
-     @fn void    tADSR4_init          (tADSR4* const, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize, LEAF* const leaf)
-     @brief Initialize a tADSR4 to the default mempool of a LEAF instance.
-     @param adsr A pointer to the tADSR4 to initialize.
-     @param leaf A pointer to the leaf instance.
-     
-     @fn void    tADSR4_initToPool    (tADSR4* const, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize, tMempool* const)
-     @brief Initialize a tADSR4 to a specified mempool.
-     @param adsr A pointer to the tADSR4 to initialize.
-     @param mempool A pointer to the tMempool to use.
-     
-     @fn void    tADSR4_free          (tADSR4* const)
-     @brief Free a tADSR4 from its mempool.
-     @param adsr A pointer to the tADSR4 to free.
-     
-     @fn float   tADSR4_tick          (tADSR4* const)
-     @brief
-     @param adsr A pointer to the relevant tADSR4.
-     
-     @fn float   tADSR4_tickNoInterp  (tADSR4* const adsrenv)
-     @brief
-     @param adsr A pointer to the relevant tADSR4.
-     
-     @fn void    tADSR4_setAttack     (tADSR4* const, float attack)
-     @brief
-     @param adsr A pointer to the relevant tADSR4.
-     
-     @fn void    tADSR4_setDecay      (tADSR4* const, float decay)
-     @brief
-     @param adsr A pointer to the relevant tADSR4.
-     
-     @fn void    tADSR4_setSustain    (tADSR4* const, float sustain)
-     @brief
-     @param adsr A pointer to the relevant tADSR4.
-     
-     @fn void    tADSR4_setRelease    (tADSR4* const, float release)
-     @brief
-     @param adsr A pointer to the relevant tADSR4.
-     
-     @fn void    tADSR4_setLeakFactor (tADSR4* const, float leakFactor)
-     @brief
-     @param adsr A pointer to the relevant tADSR4.
-     
-     @fn void    tADSR4_on            (tADSR4* const, float velocity)
-     @brief
-     @param adsr A pointer to the relevant tADSR4.
-     
-     @fn void    tADSR4_off           (tADSR4* const)
-     @brief
-     @param adsr A pointer to the relevant tADSR4.
-     
-     @} */
-    
-    typedef struct _tADSR4
-    {
-        
-        tMempool mempool;
-        const float *exp_buff;
-        uint32_t buff_size;
-        uint32_t buff_sizeMinusOne;
-        float bufferSizeDividedBySampleRateInMs;
-        float next;
-        
-        float attackInc, decayInc, releaseInc, rampInc;
-        
-        uint32_t whichStage;
-        
-        float sustain, gain, rampPeak, releasePeak;
-        
-        float attackPhase, decayPhase, releasePhase, rampPhase;
-        
-        float leakFactor;
-    } _tADSR4;
-    
-    typedef _tADSR4* tADSR4;
-    
-    void    tADSR4_init          (tADSR4* const, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize, LEAF* const leaf);
-    void    tADSR4_initToPool    (tADSR4* const, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize, tMempool* const);
-    void    tADSR4_free          (tADSR4* const);
-    
-    float   tADSR4_tick          (tADSR4* const);
-    float   tADSR4_tickNoInterp  (tADSR4* const adsrenv);
-    void    tADSR4_setAttack     (tADSR4* const, float attack);
-    void    tADSR4_setDecay      (tADSR4* const, float decay);
-    void    tADSR4_setSustain    (tADSR4* const, float sustain);
-    void    tADSR4_setRelease    (tADSR4* const, float release);
-    void    tADSR4_setLeakFactor (tADSR4* const, float leakFactor);
-    void    tADSR4_on            (tADSR4* const, float velocity);
-    void    tADSR4_off           (tADSR4* const);
+    float   tADSRS_tick          (tADSRS* const);
+    void    tADSRS_setAttack     (tADSRS* const, float attack);
+    void    tADSRS_setDecay      (tADSRS* const, float decay);
+    void    tADSRS_setSustain    (tADSRS* const, float sustain);
+    void    tADSRS_setRelease    (tADSRS* const, float release);
+    void    tADSRS_setLeakFactor (tADSRS* const, float leakFactor);
+    void    tADSRS_on            (tADSRS* const, float velocity);
+    void    tADSRS_off           (tADSRS* const);
     
     // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
     
--- a/leaf/Inc/leaf-oscillators.h
+++ b/leaf/Inc/leaf-oscillators.h
@@ -1015,7 +1015,7 @@
     //==============================================================================
     
     /*!
-     @defgroup twaveset tWaveSynth
+     @defgroup twavesynth tWaveSynth
      @ingroup oscillators
      @brief Set of anti-aliased wavetable oscillators that can be faded between.
      @{
@@ -1091,34 +1091,34 @@
     //==============================================================================
     
     /*!
-     @defgroup tcompactwavetable tCompactWaveTable
+     @defgroup ttwavetables tWaveTableS
      @ingroup oscillators
      @brief A more space-efficient anti-aliased wavetable generator than tWaveTable but with slightly worse fidelity.
      @{
      
-     @fn void    tCompactWaveTable_init  (tCompactWaveTable* const osc, float* table, int size, float maxFreq, LEAF* const leaf)
-     @brief Initialize a tCompactWaveTable to the default mempool of a LEAF instance.
-     @param osc A pointer to the tCompactWaveTable to initialize.
+     @fn void    tWaveTableS_init  (tWaveTableS* const osc, float* table, int size, float maxFreq, LEAF* const leaf)
+     @brief Initialize a tWaveTableS to the default mempool of a LEAF instance.
+     @param osc A pointer to the tWaveTableS to initialize.
      @param table A pointer to the wavetable data.
      @param size The number of samples in the wavetable.
      @param maxFreq The maximum expected frequency of the oscillator. The higher this is, the more memory will be needed.
      @param leaf A pointer to the leaf instance.
      
-     @fn void    tCompactWaveTable_initToPool   (tCompactWaveTable* const osc, float* table, int size, float maxFreq, tMempool* const mempool)
-     @brief Initialize a tCompactWaveTable to a specified mempool.
-     @param osc A pointer to the tCompactWaveTable to initialize.
+     @fn void    tWaveTableS_initToPool   (tWaveTableS* const osc, float* table, int size, float maxFreq, tMempool* const mempool)
+     @brief Initialize a tWaveTableS to a specified mempool.
+     @param osc A pointer to the tWaveTableS to initialize.
      @param table A pointer to the wavetable data.
      @param size The number of samples in the wave table.
      @param maxFreq The maximum expected frequency of the oscillator. The higher this is, the more memory will be needed.
      @param mempool A pointer to the tMempool to use.
      
-     @fn void    tCompactWaveTable_free         (tCompactWaveTable* const osc)
-     @brief Free a tCompactWaveTable from its mempool.
-     @param osc A pointer to the tCompactWaveTable to free.
+     @fn void    tWaveTableS_free         (tWaveTableS* const osc)
+     @brief Free a tWaveTableS from its mempool.
+     @param osc A pointer to the tWaveTableS to free.
      
      @} */
     
-    typedef struct _tCompactWaveTable
+    typedef struct _tWaveTableS
     {
         tMempool mempool;
         
@@ -1129,56 +1129,56 @@
         tButterworth bl;
         float dsBuffer[2];
         tOversampler ds;
-    } _tCompactWaveTable;
+    } _tWaveTableS;
     
-    typedef _tCompactWaveTable* tCompactWaveTable;
+    typedef _tWaveTableS* tWaveTableS;
     
-    void    tCompactWaveTable_init(tCompactWaveTable* const osc, float* table, int size, float maxFreq, LEAF* const leaf);
-    void    tCompactWaveTable_initToPool(tCompactWaveTable* const osc, float* table, int size, float maxFreq, tMempool* const mempool);
-    void    tCompactWaveTable_free(tCompactWaveTable* const osc);
+    void    tWaveTableS_init(tWaveTableS* const osc, float* table, int size, float maxFreq, LEAF* const leaf);
+    void    tWaveTableS_initToPool(tWaveTableS* const osc, float* table, int size, float maxFreq, tMempool* const mempool);
+    void    tWaveTableS_free(tWaveTableS* const osc);
     
     /*!
-     @defgroup tcompactwaveosc tCompactWaveOsc
+     @defgroup twaveoscs tWaveOscS
      @ingroup oscillators
      @brief A more space-efficient anti-aliased wavetable oscillator than tWaveOsc but with slightly worse fidelity.
      @{
      
-     @fn void   tCompactWaveOsc_init  (tCompactWaveOsc* const osc, float* table, int size, float maxFreq, LEAF* const leaf)
-     @brief Initialize a tCompactWaveOsc to the default mempool of a LEAF instance.
-     @param osc A pointer to the tCompactWaveOsc to initialize.
+     @fn void   tWaveOscS_init  (tWaveOscS* const osc, float* table, int size, float maxFreq, LEAF* const leaf)
+     @brief Initialize a tWaveOscS to the default mempool of a LEAF instance.
+     @param osc A pointer to the tWaveOscS to initialize.
      @param table A pointer to the wavetable data.
      @param size The number of samples in the wavetable.
      @param maxFreq The maximum expected frequency of the oscillator. The higher this is, the more memory will be needed.
      @param leaf A pointer to the leaf instance.
      
-     @fn void   tCompactWaveOsc_initToPool   (tCompactWaveOsc* const osc, float* table, int size, float maxFreq, tMempool* const mempool)
-     @brief Initialize a tCompactWaveOsc to a specified mempool.
-     @param osc A pointer to the tCompactWaveOsc to initialize.
+     @fn void   tWaveOscS_initToPool   (tWaveOscS* const osc, float* table, int size, float maxFreq, tMempool* const mempool)
+     @brief Initialize a tWaveOscS to a specified mempool.
+     @param osc A pointer to the tWaveOscS to initialize.
      @param table A pointer to the wavetable data.
      @param size The number of samples in the wave table.
      @param maxFreq The maximum expected frequency of the oscillator. The higher this is, the more memory will be needed.
      @param mempool A pointer to the tMempool to use.
      
-     @fn void   tCompactWaveOsc_free         (tCompactWaveOsc* const osc)
-     @brief Free a tCompactWaveOsc from its mempool.
-     @param osc A pointer to the tCompactWaveOsc to free.
+     @fn void   tWaveOscS_free         (tWaveOscS* const osc)
+     @brief Free a tWaveOscS from its mempool.
+     @param osc A pointer to the tWaveOscS to free.
      
-     @fn float  tCompactWaveOsc_tick         (tCompactWaveOsc* const osc)
-     @brief Tick a tCompactWaveOsc oscillator.
-     @param osc A pointer to the relevant tCompactWaveOsc.
+     @fn float  tWaveOscS_tick         (tWaveOscS* const osc)
+     @brief Tick a tWaveOscS oscillator.
+     @param osc A pointer to the relevant tWaveOscS.
      @return The ticked sample as a float from -1 to 1.
      
-     @fn void   tCompactWaveOsc_setFreq      (tCompactWaveOsc* const osc, float freq)
-     @brief Set the frequency of a tCompactWaveOsc oscillator.
-     @param osc A pointer to the relevant tCompactWaveOsc.
+     @fn void   tWaveOscS_setFreq      (tWaveOscS* const osc, float freq)
+     @brief Set the frequency of a tWaveOscS oscillator.
+     @param osc A pointer to the relevant tWaveOscS.
      @param freq The frequency to set the oscillator to.
      
      @} */
     
-    typedef struct _tCompactWaveOsc
+    typedef struct _tWaveOscS
     {
         tMempool mempool;
-        tCompactWaveTable table;
+        tWaveTableS table;
         float inc, freq;
         float phase;
         float phaseOffset;
@@ -1185,30 +1185,30 @@
         int oct;
         float w;
         float aa;
-    } _tCompactWaveOsc;
+    } _tWaveOscS;
     
-    typedef _tCompactWaveOsc* tCompactWaveOsc;
+    typedef _tWaveOscS* tWaveOscS;
     
-    void    tCompactWaveOsc_init(tCompactWaveOsc* const osc, tCompactWaveTable* const table, LEAF* const leaf);
-    void    tCompactWaveOsc_initToPool(tCompactWaveOsc* const osc, tCompactWaveTable* const table, tMempool* const mempool);
-    void    tCompactWaveOsc_free(tCompactWaveOsc* const osc);
+    void    tWaveOscS_init(tWaveOscS* const osc, tWaveTableS* const table, LEAF* const leaf);
+    void    tWaveOscS_initToPool(tWaveOscS* const osc, tWaveTableS* const table, tMempool* const mempool);
+    void    tWaveOscS_free(tWaveOscS* const osc);
     
-    float   tCompactWaveOsc_tick(tCompactWaveOsc* const osc);
-    void    tCompactWaveOsc_setFreq(tCompactWaveOsc* const osc, float freq);
-    void    tCompactWaveOsc_setAntiAliasing(tCompactWaveOsc* const osc, float aa);
-    void    tCompactWaveOsc_setPhaseOffset(tCompactWaveOsc* const osc, float phase);
+    float   tWaveOscS_tick(tWaveOscS* const osc);
+    void    tWaveOscS_setFreq(tWaveOscS* const osc, float freq);
+    void    tWaveOscS_setAntiAliasing(tWaveOscS* const osc, float aa);
+    void    tWaveOscS_setPhaseOffset(tWaveOscS* const osc, float phase);
     
     //==============================================================================
     
     /*!
-     @defgroup tCompactWaveset tCompactWaveSynth
+     @defgroup twavesynths tWaveSynthS
      @ingroup oscillators
      @brief Set of anti-aliased wavetable oscillators that can be faded between.
      @{
      
-     @fn void    tCompactWaveSynth_init(tWaveSynth* const osc, const float** tables, int n, int size, float maxFreq, LEAF* const leaf)
-     @brief Initialize a tCompactWaveSynth to the default mempool of a LEAF instance.
-     @param osc A pointer to the tCompactWaveSynth to initialize.
+     @fn void    tWaveSynthS_init(tWaveSynth* const osc, const float** tables, int n, int size, float maxFreq, LEAF* const leaf)
+     @brief Initialize a tWaveSynthS to the default mempool of a LEAF instance.
+     @param osc A pointer to the tWaveSynthS to initialize.
      @param tables An array of pointers to wavetable data.
      @param n The number of wavetables.
      @param size The number of samples in each of the wavetables.
@@ -1215,9 +1215,9 @@
      @param maxFreq The maximum expected frequency of the oscillator. The higher this is, the more memory will be needed.
      @param leaf A pointer to the leaf instance.
      
-     @fn void  tCompactWaveSynth_initToPool(tWaveSynth* const osc, const float** tables, int n, int size, float maxFreq, tMempool* const mempool)
-     @brief Initialize a tCompactWaveSynth to a specified mempool.
-     @param osc A pointer to the tCompactWaveTable to initialize.
+     @fn void  tWaveSynthS_initToPool(tWaveSynth* const osc, const float** tables, int n, int size, float maxFreq, tMempool* const mempool)
+     @brief Initialize a tWaveSynthS to a specified mempool.
+     @param osc A pointer to the tWaveTableS to initialize.
      @param tables An array of pointers to wavetable data.
      @param n The number of wavetables.
      @param size The number of samples in each of the wavetables.
@@ -1224,55 +1224,55 @@
      @param maxFreq The maximum expected frequency of the oscillator. The higher this is, the more memory will be needed.
      @param mempool A pointer to the tMempool to use.
      
-     @fn void    tCompactWaveSynth_free         (tWaveSynth* const osc)
-     @brief Free a tCompactWaveSynth from its mempool.
-     @param osc A pointer to the tCompactWaveSynth to free.
+     @fn void    tWaveSynthS_free         (tWaveSynth* const osc)
+     @brief Free a tWaveSynthS from its mempool.
+     @param osc A pointer to the tWaveSynthS to free.
      
-     @fn float   tCompactWaveSynth_tick         (tWaveSynth* const osc)
-     @brief Tick a tCompactWaveSynth oscillator.
-     @param osc A pointer to the relevant tCompactWaveSynth.
+     @fn float   tWaveSynthS_tick         (tWaveSynth* const osc)
+     @brief Tick a tWaveSynthS oscillator.
+     @param osc A pointer to the relevant tWaveSynthS.
      @return The ticked sample as a float from -1 to 1.
      
-     @fn void    tCompactWaveSynth_setFreq      (tWaveSynth* const osc, float freq)
-     @brief Set the frequency of a tCompactWaveSynth oscillator.
-     @param osc A pointer to the relevant tCompactWaveSynth.
+     @fn void    tWaveSynthS_setFreq      (tWaveSynth* const osc, float freq)
+     @brief Set the frequency of a tWaveSynthS oscillator.
+     @param osc A pointer to the relevant tWaveSynthS.
      @param freq The frequency to set the oscillator to.
      
-     @fn void    tCompactWaveSynth_setIndex(tWaveSynth* const osc, float index)
+     @fn void    tWaveSynthS_setIndex(tWaveSynth* const osc, float index)
      @brief Set the output index of the wavetable set.
      @param index The new index from 0.0 to 1.0 as a smooth fade from the first wavetable in the set to the last.
      
      @} */
     
-    typedef struct _tCompactWaveSynth
+    typedef struct _tWaveSynthS
     {
         tMempool mempool;
         
-        tCompactWaveTable* tables;
-        tCompactWaveOsc** oscs;
+        tWaveTableS* tables;
+        tWaveOscS** oscs;
         int numTables;
         int numVoices;
         float* g;
         float index;
         float maxFreq;
-    } _tCompactWaveSynth;
+    } _tWaveSynthS;
     
-    typedef _tCompactWaveSynth* tCompactWaveSynth;
+    typedef _tWaveSynthS* tWaveSynthS;
     
-    void    tCompactWaveSynth_init(tCompactWaveSynth* const osc, int numVoices, float** tables, int* sizes,
+    void    tWaveSynthS_init(tWaveSynthS* const osc, int numVoices, float** tables, int* sizes,
                                    int numTables, float maxFreq, LEAF* const leaf);
-    void    tCompactWaveSynth_initToPool(tCompactWaveSynth* const osc, int numVoices, float** tables, int* sizes,
+    void    tWaveSynthS_initToPool(tWaveSynthS* const osc, int numVoices, float** tables, int* sizes,
                                          int numTables, float maxFreq, tMempool* const mempool);
-    void    tCompactWaveSynth_free(tCompactWaveSynth* const osc);
+    void    tWaveSynthS_free(tWaveSynthS* const osc);
     
-    float   tCompactWaveSynth_tick(tCompactWaveSynth* const osc);
-    float   tCompactWaveSynth_tickVoice(tCompactWaveSynth* const cy, int voice);
-    void    tCompactWaveSynth_setFreq(tCompactWaveSynth* const osc, int voice, float freq);
-    void    tCompactWaveSynth_setAntiAliasing(tCompactWaveSynth* const osc, float aa);
-    void    tCompactWaveSynth_setIndex(tCompactWaveSynth* const osc, float index);
-    void    tCompactWaveSynth_setIndexGain(tCompactWaveSynth* const osc, int i, float gain);
-    void    tCompactWaveSynth_setIndexPhase(tCompactWaveSynth* const osc, int i, float phase);
-//    void    tCompactWaveSynth_setIndexTable(tCompactWaveSynth* const osc, int i, float* table, int size);
+    float   tWaveSynthS_tick(tWaveSynthS* const osc);
+    float   tWaveSynthS_tickVoice(tWaveSynthS* const cy, int voice);
+    void    tWaveSynthS_setFreq(tWaveSynthS* const osc, int voice, float freq);
+    void    tWaveSynthS_setAntiAliasing(tWaveSynthS* const osc, float aa);
+    void    tWaveSynthS_setIndex(tWaveSynthS* const osc, float index);
+    void    tWaveSynthS_setIndexGain(tWaveSynthS* const osc, int i, float gain);
+    void    tWaveSynthS_setIndexPhase(tWaveSynthS* const osc, int i, float phase);
+//    void    tWaveSynthS_setIndexTable(tWaveSynthS* const osc, int i, float* table, int size);
     
 #ifdef __cplusplus
 }
--- a/leaf/Inc/leaf-sampling.h
+++ b/leaf/Inc/leaf-sampling.h
@@ -391,7 +391,7 @@
     
     
     /*!
-     @defgroup tMBSampler tMBSampler
+     @defgroup tmbsampler tMBSampler
      @ingroup sampling
      @brief Loopable input sampler using minBLEP to remove discontinuities.
      @{
--- a/leaf/Src/leaf-envelopes.c
+++ b/leaf/Src/leaf-envelopes.c
@@ -486,165 +486,6 @@
 #endif // LEAF_INCLUDE_ADSR_TABLES
 
 
-
-/* ADSR 2*/
-//This one is adapted from the VCV Rack code
-//-JS
-
-
-
-const float ADSR2_MIN_TIME = 1e-3f;
-const float ADSR2_INV_MIN_TIME = 1000.0f;
-const float ADSR2_MAX_TIME = 10.f;
-const float ADSR2_LAMBDA_BASE = 10000.0f;
-
-
-void    tADSR2_init(tADSR2* const adsrenv, float attack, float decay, float sustain, float release, LEAF* const leaf)
-{
-    tADSR2_initToPool(adsrenv, attack, decay, sustain, release, &leaf->mempool);
-}
-
-void    tADSR2_initToPool    (tADSR2* const adsrenv, float attack, float decay, float sustain, float release, tMempool* const mp)
-{
-    _tMempool* m = *mp;
-    _tADSR2* adsr = *adsrenv = (_tADSR2*) mpool_alloc(sizeof(_tADSR2), m);
-    adsr->mempool = m;
-    
-    LEAF* leaf = adsr->mempool->leaf;
-    
-    adsr->sampleRateInMs = leaf->sampleRate * 0.001f;
-    adsr->attack = LEAF_clip(0.0f, attack * 0.001f, 1.0f);
-    adsr->attackLambda = powf(ADSR2_LAMBDA_BASE, -adsr->attack) * ADSR2_INV_MIN_TIME;
-
-
-    adsr->decay = LEAF_clip(0.0f, decay * 0.001f, 1.0f);
-    adsr->decayLambda = powf(ADSR2_LAMBDA_BASE, -adsr->decay) * ADSR2_INV_MIN_TIME;
-
-
-    adsr->sustain= sustain;
-
-
-    adsr->release = LEAF_clip(0.0f, release * 0.001f, 1.0f);
-    adsr->releaseLambda = powf(ADSR2_LAMBDA_BASE, -adsr->release) * ADSR2_INV_MIN_TIME;
-
-    adsr->attacking = 0;
-    adsr->gate = 0;
-    adsr->gain = 1.0f;
-    adsr->targetGainSquared = 1.0f;
-    adsr->factor = 0.01f;
-    adsr->oneMinusFactor = 0.99f;
-    adsr->env = 0.0f;
-    adsr->leakFactor = 1.0f;
-}
-
-void    tADSR2_free  (tADSR2* const adsrenv)
-{
-    _tADSR2* adsr = *adsrenv;
-    mpool_free((char*)adsr, adsr->mempool);
-}
-
-void     tADSR2_setAttack(tADSR2* const adsrenv, float attack)
-{
-    _tADSR2* adsr = *adsrenv;
-    adsr->attack = LEAF_clip(0.0f, attack * 0.001f, 1.0f);
-    adsr->attackLambda = fastPowf(ADSR2_LAMBDA_BASE, -adsr->attack) * ADSR2_INV_MIN_TIME;
-
-}
-
-void     tADSR2_setDecay(tADSR2* const adsrenv, float decay)
-{
-    _tADSR2* adsr = *adsrenv;
-    adsr->decay = LEAF_clip(0.0f, decay * 0.001f, 1.0f);
-    adsr->decayLambda = fastPowf(ADSR2_LAMBDA_BASE, -adsr->decay) * ADSR2_INV_MIN_TIME;
-
-}
-
-void     tADSR2_setSustain(tADSR2* const adsrenv, float sustain)
-{
-    _tADSR2* adsr = *adsrenv;
-    adsr->sustain = sustain;
-
-    if (adsr->gate)
-    {
-        if (adsr->attacking == 0)
-        {
-            adsr->envTarget = sustain;
-        }
-    }
-}
-
-void     tADSR2_setRelease(tADSR2* const adsrenv, float release)
-{
-    _tADSR2* adsr = *adsrenv;
-    adsr->release = LEAF_clip(0.0f, release * 0.001f, 1.0f);
-    adsr->releaseLambda = fastPowf(ADSR2_LAMBDA_BASE, -adsr->release) * ADSR2_INV_MIN_TIME;
-}
-
-// 0.999999 is slow leak, 0.9 is fast leak
-void     tADSR2_setLeakFactor(tADSR2* const adsrenv, float leakFactor)
-{
-    _tADSR2* adsr = *adsrenv;
-
-    adsr->leakFactor = leakFactor;
-}
-
-void tADSR2_on(tADSR2* const adsrenv, float velocity)
-{
-    _tADSR2* adsr = *adsrenv;
-    adsr->targetGainSquared = velocity * velocity;
-    adsr->envTarget = 1.2f;
-    adsr->leakGain = 1.0f;
-    adsr->gate = 1;
-    adsr->attacking = 1;
-}
-
-void tADSR2_off(tADSR2* const adsrenv)
-{
-    _tADSR2* adsr = *adsrenv;
-    adsr->gate = 0;
-    adsr->envTarget = 0.0f;
-}
-
-float   tADSR2_tick(tADSR2* const adsrenv)
-{
-    _tADSR2* adsr = *adsrenv;
-    LEAF* leaf = adsr->mempool->leaf;
-    
-    float lambda;
-
-    if (adsr->gate)
-    {
-        if (adsr->attacking)
-        {
-            lambda = adsr->attackLambda;
-        }
-        else
-        {
-            lambda = adsr->decayLambda;
-        }
-    }
-    else
-    {
-        lambda = adsr->releaseLambda;
-    }
-
-
-    // Adjust env
-    adsr->env += (adsr->envTarget - adsr->env) * lambda * leaf->invSampleRate;
-
-    // Turn off attacking state if envelope is HIGH
-    if (adsr->env >= 1.0f)
-    {
-        adsr->attacking = 0;
-        adsr->envTarget = adsr->sustain;
-    }
-
-    //smooth the gain value   -- this is not ideal, a retrigger while the envelope is still going with a new gain will cause a jump, although it will be smoothed quickly. Maybe doing the math so the range is computed based on the gain rather than 0.->1. is preferable? But that's harder to get the exponential curve right without a lookup.
-    adsr->gain = ((adsr->factor*adsr->targetGainSquared)+(adsr->oneMinusFactor*adsr->gain));
-    adsr->leakGain *= adsr->leakFactor;
-    return adsr->env * adsr->gain * adsr->leakGain;
-}
-
 /* ADSR 3*/
 //This one doesn't use any lookup table - by Nigel Redmon from his blog. Thanks, Nigel!
 //-JS
@@ -655,15 +496,15 @@
 }
 
 
-void    tADSR3_init(tADSR3* const adsrenv, float attack, float decay, float sustain, float release, LEAF* const leaf)
+void    tADSRS_init(tADSRS* const adsrenv, float attack, float decay, float sustain, float release, LEAF* const leaf)
 {
-    tADSR3_initToPool(adsrenv, attack, decay, sustain, release, &leaf->mempool);
+    tADSRS_initToPool(adsrenv, attack, decay, sustain, release, &leaf->mempool);
 }
 
-void    tADSR3_initToPool    (tADSR3* const adsrenv, float attack, float decay, float sustain, float release, tMempool* const mp)
+void    tADSRS_initToPool    (tADSRS* const adsrenv, float attack, float decay, float sustain, float release, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tADSR3* adsr = *adsrenv = (_tADSR3*) mpool_alloc(sizeof(_tADSR3), m);
+    _tADSRS* adsr = *adsrenv = (_tADSRS*) mpool_alloc(sizeof(_tADSRS), m);
     adsr->mempool = m;
     
     LEAF* leaf = adsr->mempool->leaf;
@@ -695,15 +536,15 @@
     adsr->leakFactor = 1.0f;
 }
 
-void    tADSR3_free  (tADSR3* const adsrenv)
+void    tADSRS_free  (tADSRS* const adsrenv)
 {
-    _tADSR3* adsr = *adsrenv;
+    _tADSRS* adsr = *adsrenv;
     mpool_free((char*)adsr, adsr->mempool);
 }
 
-void     tADSR3_setAttack(tADSR3* const adsrenv, float attack)
+void     tADSRS_setAttack(tADSRS* const adsrenv, float attack)
 {
-    _tADSR3* adsr = *adsrenv;
+    _tADSRS* adsr = *adsrenv;
 
     adsr->attackRate = attack * adsr->sampleRateInMs;
     adsr->attackCoef = calcADSR3Coef(adsr->attackRate, adsr->targetRatioA);
@@ -710,9 +551,9 @@
     adsr->attackBase = (1.0f + adsr->targetRatioA) * (1.0f - adsr->attackCoef);
 }
 
-void     tADSR3_setDecay(tADSR3* const adsrenv, float decay)
+void     tADSRS_setDecay(tADSRS* const adsrenv, float decay)
 {
-    _tADSR3* adsr = *adsrenv;
+    _tADSRS* adsr = *adsrenv;
 
     adsr->decayRate = decay * adsr->sampleRateInMs;
     adsr->decayCoef = calcADSR3Coef(adsr->decayRate,adsr-> targetRatioDR);
@@ -719,17 +560,17 @@
     adsr->decayBase = (adsr->sustainLevel - adsr->targetRatioDR) * (1.0f - adsr->decayCoef);
 }
 
-void     tADSR3_setSustain(tADSR3* const adsrenv, float sustain)
+void     tADSRS_setSustain(tADSRS* const adsrenv, float sustain)
 {
-    _tADSR3* adsr = *adsrenv;
+    _tADSRS* adsr = *adsrenv;
 
     adsr->sustainLevel = sustain;
     adsr->decayBase = (adsr->sustainLevel - adsr->targetRatioDR) * (1.0f - adsr->decayCoef);
 }
 
-void     tADSR3_setRelease(tADSR3* const adsrenv, float release)
+void     tADSRS_setRelease(tADSRS* const adsrenv, float release)
 {
-    _tADSR3* adsr = *adsrenv;
+    _tADSRS* adsr = *adsrenv;
 
     adsr->releaseRate = release * adsr->sampleRateInMs;
     adsr->releaseCoef = calcADSR3Coef(adsr->releaseRate, (float)adsr->targetRatioDR);
@@ -737,23 +578,23 @@
 }
 
 // 0.999999 is slow leak, 0.9 is fast leak
-void     tADSR3_setLeakFactor(tADSR3* const adsrenv, float leakFactor)
+void     tADSRS_setLeakFactor(tADSRS* const adsrenv, float leakFactor)
 {
-    _tADSR3* adsr = *adsrenv;
+    _tADSRS* adsr = *adsrenv;
 
     adsr->leakFactor = leakFactor;
 }
 
-void tADSR3_on(tADSR3* const adsrenv, float velocity)
+void tADSRS_on(tADSRS* const adsrenv, float velocity)
 {
-    _tADSR3* adsr = *adsrenv;
+    _tADSRS* adsr = *adsrenv;
     adsr->state = env_attack;
     adsr->targetGainSquared = velocity * velocity;
 }
 
-void tADSR3_off(tADSR3* const adsrenv)
+void tADSRS_off(tADSRS* const adsrenv)
 {
-    _tADSR3* adsr = *adsrenv;
+    _tADSRS* adsr = *adsrenv;
 
     if (adsr->state != env_idle)
     {
@@ -761,9 +602,9 @@
     }
 }
 
-float   tADSR3_tick(tADSR3* const adsrenv)
+float   tADSRS_tick(tADSRS* const adsrenv)
 {
-    _tADSR3* adsr = *adsrenv;
+    _tADSRS* adsr = *adsrenv;
 
 
     switch (adsr->state) {
@@ -803,17 +644,17 @@
 
 /* ADSR 4 */ // new version of our original table-based ADSR but with the table passed in by the user
 // use this if the size of the big ADSR tables is too much.
-void    tADSR4_init    (tADSR4* const adsrenv, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize, LEAF* const leaf)
+void    tADSRT_init    (tADSRT* const adsrenv, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize, LEAF* const leaf)
 {
-    tADSR4_initToPool    (adsrenv, attack, decay, sustain, release, expBuffer, bufferSize, &leaf->mempool);
+    tADSRT_initToPool    (adsrenv, attack, decay, sustain, release, expBuffer, bufferSize, &leaf->mempool);
 }
 
 //initialize with an exponential function that decays -- i.e. a call to LEAF_generate_exp(expBuffer, 0.001f, 0.0f, 1.0f, -0.0008f, EXP_BUFFER_SIZE);
 //times are in ms
-void    tADSR4_initToPool    (tADSR4* const adsrenv, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize, tMempool* const mp)
+void    tADSRT_initToPool    (tADSRT* const adsrenv, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tADSR4* adsr = *adsrenv = (_tADSR4*) mpool_alloc(sizeof(_tADSR4), m);
+    _tADSRT* adsr = *adsrenv = (_tADSRT*) mpool_alloc(sizeof(_tADSRT), m);
     adsr->mempool = m;
     
     LEAF* leaf = adsr->mempool->leaf;
@@ -852,15 +693,15 @@
     adsr->leakFactor = 1.0f;
 }
 
-void    tADSR4_free  (tADSR4* const adsrenv)
+void    tADSRT_free  (tADSRT* const adsrenv)
 {
-    _tADSR4* adsr = *adsrenv;
+    _tADSRT* adsr = *adsrenv;
     mpool_free((char*)adsr, adsr->mempool);
 }
 
-void     tADSR4_setAttack(tADSR4* const adsrenv, float attack)
+void     tADSRT_setAttack(tADSRT* const adsrenv, float attack)
 {
-    _tADSR4* adsr = *adsrenv;
+    _tADSRT* adsr = *adsrenv;
 
     if (attack < 0.0f)
     {
@@ -870,9 +711,9 @@
     adsr->attackInc = adsr->bufferSizeDividedBySampleRateInMs / attack;
 }
 
-void     tADSR4_setDecay(tADSR4* const adsrenv, float decay)
+void     tADSRT_setDecay(tADSRT* const adsrenv, float decay)
 {
-    _tADSR4* adsr = *adsrenv;
+    _tADSRT* adsr = *adsrenv;
 
     if (decay < 0.0f)
     {
@@ -881,9 +722,9 @@
     adsr->decayInc = adsr->bufferSizeDividedBySampleRateInMs / decay;
 }
 
-void     tADSR4_setSustain(tADSR4* const adsrenv, float sustain)
+void     tADSRT_setSustain(tADSRT* const adsrenv, float sustain)
 {
-    _tADSR4* adsr = *adsrenv;
+    _tADSRT* adsr = *adsrenv;
 
     if (sustain > 1.0f)      adsr->sustain = 1.0f;
     else if (sustain < 0.0f) adsr->sustain = 0.0f;
@@ -890,9 +731,9 @@
     else                     adsr->sustain = sustain;
 }
 
-void     tADSR4_setRelease(tADSR4* const adsrenv, float release)
+void     tADSRT_setRelease(tADSRT* const adsrenv, float release)
 {
-    _tADSR4* adsr = *adsrenv;
+    _tADSRT* adsr = *adsrenv;
 
     if (release < 0.0f)
     {
@@ -902,17 +743,17 @@
 }
 
 // 0.999999 is slow leak, 0.9 is fast leak
-void     tADSR4_setLeakFactor(tADSR4* const adsrenv, float leakFactor)
+void     tADSRT_setLeakFactor(tADSRT* const adsrenv, float leakFactor)
 {
-    _tADSR4* adsr = *adsrenv;
+    _tADSRT* adsr = *adsrenv;
 
 
     adsr->leakFactor = leakFactor;
 }
 
-void tADSR4_on(tADSR4* const adsrenv, float velocity)
+void tADSRT_on(tADSRT* const adsrenv, float velocity)
 {
-    _tADSR4* adsr = *adsrenv;
+    _tADSRT* adsr = *adsrenv;
 
     if (adsr->whichStage != env_idle) // In case ADSR retriggered while it is still happening.
     {
@@ -931,9 +772,9 @@
     adsr->gain = velocity;
 }
 
-void tADSR4_off(tADSR4* const adsrenv)
+void tADSRT_off(tADSRT* const adsrenv)
 {
-    _tADSR4* adsr = *adsrenv;
+    _tADSRT* adsr = *adsrenv;
 
     if (adsr->whichStage == env_idle)
     {
@@ -946,9 +787,9 @@
     }
 }
 
-float   tADSR4_tick(tADSR4* const adsrenv)
+float   tADSRT_tick(tADSRT* const adsrenv)
 {
-    _tADSR4* adsr = *adsrenv;
+    _tADSRT* adsr = *adsrenv;
 
     switch (adsr->whichStage)
     {
@@ -1071,9 +912,9 @@
     return adsr->next;
 }
 
-float   tADSR4_tickNoInterp(tADSR4* const adsrenv)
+float   tADSRT_tickNoInterp(tADSRT* const adsrenv)
 {
-    _tADSR4* adsr = *adsrenv;
+    _tADSRT* adsr = *adsrenv;
 
     switch (adsr->whichStage)
     {
--- a/leaf/Src/leaf-oscillators.c
+++ b/leaf/Src/leaf-oscillators.c
@@ -2055,15 +2055,15 @@
 //=======================================================================================
 //=======================================================================================
 
-void tCompactWaveTable_init(tCompactWaveTable* const cy, float* table, int size, float maxFreq, LEAF* const leaf)
+void tWaveTableS_init(tWaveTableS* const cy, float* table, int size, float maxFreq, LEAF* const leaf)
 {
-    tCompactWaveTable_initToPool(cy, table, size, maxFreq, &leaf->mempool);
+    tWaveTableS_initToPool(cy, table, size, maxFreq, &leaf->mempool);
 }
 
-void tCompactWaveTable_initToPool(tCompactWaveTable* const cy, float* table, int size, float maxFreq, tMempool* const mp)
+void tWaveTableS_initToPool(tWaveTableS* const cy, float* table, int size, float maxFreq, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tCompactWaveTable* c = *cy = (_tCompactWaveTable*) mpool_alloc(sizeof(_tCompactWaveTable), m);
+    _tWaveTableS* c = *cy = (_tWaveTableS*) mpool_alloc(sizeof(_tWaveTableS), m);
     c->mempool = m;
     
     // Determine base frequency
@@ -2117,9 +2117,9 @@
     tButterworth_free(&c->bl);
 }
 
-void    tCompactWaveTable_free(tCompactWaveTable* const cy)
+void    tWaveTableS_free(tWaveTableS* const cy)
 {
-    _tCompactWaveTable* c = *cy;
+    _tWaveTableS* c = *cy;
     
     for (int t = 0; t < c->numTables; ++t)
     {
@@ -2133,15 +2133,15 @@
 //================================================================================================
 //================================================================================================
 
-void tCompactWaveOsc_init(tCompactWaveOsc* const cy, tCompactWaveTable* const table, LEAF* const leaf)
+void tWaveOscS_init(tWaveOscS* const cy, tWaveTableS* const table, LEAF* const leaf)
 {
-    tCompactWaveOsc_initToPool(cy, table, &leaf->mempool);
+    tWaveOscS_initToPool(cy, table, &leaf->mempool);
 }
 
-void tCompactWaveOsc_initToPool(tCompactWaveOsc* const cy, tCompactWaveTable* const table, tMempool* const mp)
+void tWaveOscS_initToPool(tWaveOscS* const cy, tWaveTableS* const table, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tCompactWaveOsc* c = *cy = (_tCompactWaveOsc*) mpool_alloc(sizeof(_tCompactWaveOsc), m);
+    _tWaveOscS* c = *cy = (_tWaveOscS*) mpool_alloc(sizeof(_tWaveOscS), m);
     c->mempool = m;
     
     c->inc = 0.0f;
@@ -2149,18 +2149,18 @@
     c->phaseOffset = 0.0f;
     c->aa = 0.5f;
     
-    tCompactWaveOsc_setFreq(cy, 220);
+    tWaveOscS_setFreq(cy, 220);
 }
 
-void tCompactWaveOsc_free(tCompactWaveOsc* const cy)
+void tWaveOscS_free(tWaveOscS* const cy)
 {
-    _tCompactWaveOsc* c = *cy;
+    _tWaveOscS* c = *cy;
     mpool_free((char*)c, c->mempool);
 }
 
-float tCompactWaveOsc_tick(tCompactWaveOsc* const cy)
+float tWaveOscS_tick(tWaveOscS* const cy)
 {
-    _tCompactWaveOsc* c = *cy;
+    _tWaveOscS* c = *cy;
     
     float temp;
     int idx;
@@ -2198,9 +2198,9 @@
     return oct0 + (oct1 - oct0) * c->w;
 }
 
-void tCompactWaveOsc_setFreq(tCompactWaveOsc* const cy, float freq)
+void tWaveOscS_setFreq(tWaveOscS* const cy, float freq)
 {
-    _tCompactWaveOsc* c = *cy;
+    _tWaveOscS* c = *cy;
     
     LEAF* leaf = c->mempool->leaf;
     
@@ -2220,16 +2220,16 @@
     if (c->oct >= c->table->numTables - 1) c->oct = c->table->numTables - 2;
 }
 
-void tCompactWaveOsc_setAntiAliasing(tCompactWaveOsc* const cy, float aa)
+void tWaveOscS_setAntiAliasing(tWaveOscS* const cy, float aa)
 {
-    _tCompactWaveOsc* c = *cy;
+    _tWaveOscS* c = *cy;
     c->aa = aa;
-    tCompactWaveOsc_setFreq(cy, c->freq);
+    tWaveOscS_setFreq(cy, c->freq);
 }
 
-void tCompactWaveOsc_setPhaseOffset(tCompactWaveOsc* const cy, float phase)
+void tWaveOscS_setPhaseOffset(tWaveOscS* const cy, float phase)
 {
-    _tCompactWaveOsc* c = *cy;
+    _tWaveOscS* c = *cy;
     c->phaseOffset = phase - (int)phase;
 }
 
@@ -2236,17 +2236,17 @@
 //================================================================================================
 //================================================================================================
 
-void tCompactWaveSynth_init(tCompactWaveSynth* const cy, int numVoices, float** tables, int* sizes,
+void tWaveSynthS_init(tWaveSynthS* const cy, int numVoices, float** tables, int* sizes,
                             int numTables, float maxFreq, LEAF* const leaf)
 {
-    tCompactWaveSynth_initToPool(cy, numVoices, tables, sizes, numTables, maxFreq, &leaf->mempool);
+    tWaveSynthS_initToPool(cy, numVoices, tables, sizes, numTables, maxFreq, &leaf->mempool);
 }
 
-void tCompactWaveSynth_initToPool(tCompactWaveSynth* const cy, int numVoices, float** tables, int* sizes,
+void tWaveSynthS_initToPool(tWaveSynthS* const cy, int numVoices, float** tables, int* sizes,
                                   int numTables, float maxFreq, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tCompactWaveSynth* c = *cy = (_tCompactWaveSynth*) mpool_alloc(sizeof(_tCompactWaveSynth), m);
+    _tWaveSynthS* c = *cy = (_tWaveSynthS*) mpool_alloc(sizeof(_tWaveSynthS), m);
     c->mempool = m;
     
     c->numTables = 0;
@@ -2255,8 +2255,8 @@
         if (sizes[t] > 0) c->numTables++;
     }
     
-    c->tables = (tCompactWaveTable*) mpool_alloc(sizeof(tCompactWaveTable) * c->numTables, m);
-    c->oscs = (tCompactWaveOsc**) mpool_alloc(sizeof(tCompactWaveOsc*) * c->numTables, m);
+    c->tables = (tWaveTableS*) mpool_alloc(sizeof(tWaveTableS) * c->numTables, m);
+    c->oscs = (tWaveOscS**) mpool_alloc(sizeof(tWaveOscS*) * c->numTables, m);
     
     c->numVoices = numVoices;
     
@@ -2265,9 +2265,9 @@
     {
         if (sizes[t] > 0)
         {
-            tCompactWaveTable_initToPool(&c->tables[i], tables[t], sizes[t], maxFreq, mp);
-            c->oscs[i] = (tCompactWaveOsc*) mpool_alloc(sizeof(tCompactWaveOsc) * c->numVoices, m);
-            for (int v = 0; v < c->numVoices; ++v) tCompactWaveOsc_initToPool(&c->oscs[i][v], &c->tables[i], mp);
+            tWaveTableS_initToPool(&c->tables[i], tables[t], sizes[t], maxFreq, mp);
+            c->oscs[i] = (tWaveOscS*) mpool_alloc(sizeof(tWaveOscS) * c->numVoices, m);
+            for (int v = 0; v < c->numVoices; ++v) tWaveOscS_initToPool(&c->oscs[i][v], &c->tables[i], mp);
             i++;
         }
     }
@@ -2279,14 +2279,14 @@
     c->maxFreq = maxFreq;
 }
 
-void tCompactWaveSynth_free(tCompactWaveSynth* const cy)
+void tWaveSynthS_free(tWaveSynthS* const cy)
 {
-    _tCompactWaveSynth* c = *cy;
+    _tWaveSynthS* c = *cy;
     
     for (int i = 0; i < c->numTables; ++i)
     {
-        tCompactWaveTable_free(&c->tables[i]);
-        for (int v = 0; v < c->numVoices; ++v) tCompactWaveOsc_free(&c->oscs[i][v]);
+        tWaveTableS_free(&c->tables[i]);
+        for (int v = 0; v < c->numVoices; ++v) tWaveOscS_free(&c->oscs[i][v]);
         mpool_free((char*)c->oscs[i], c->mempool);
     }
     mpool_free((char*)c->g, c->mempool);
@@ -2295,9 +2295,9 @@
     mpool_free((char*)c, c->mempool);
 }
 
-float tCompactWaveSynth_tick(tCompactWaveSynth* const cy)
+float tWaveSynthS_tick(tWaveSynthS* const cy)
 {
-    _tCompactWaveSynth* c = *cy;
+    _tWaveSynthS* c = *cy;
     
     float f = c->index * (c->numTables - 1);
     
@@ -2310,7 +2310,7 @@
     for (int t = 0; t < c->numTables; ++t)
     {
         float s0 = 0.f;
-        for (int v = 0; v < c->numVoices; ++v) s0 += tCompactWaveOsc_tick(&c->oscs[t][v]);
+        for (int v = 0; v < c->numVoices; ++v) s0 += tWaveOscS_tick(&c->oscs[t][v]);
         if (t == o1) s1 = s0 * c->g[t];
         if (t == o2) s2 = s0 * c->g[t];
     }
@@ -2319,9 +2319,9 @@
     return s1 + (s2 - s1) * mix;
 }
 
-float tCompactWaveSynth_tickVoice(tCompactWaveSynth* const cy, int voice)
+float tWaveSynthS_tickVoice(tWaveSynthS* const cy, int voice)
 {
-    _tCompactWaveSynth* c = *cy;
+    _tWaveSynthS* c = *cy;
     
     float f = c->index * (c->numTables - 1);
     
@@ -2334,7 +2334,7 @@
     for (int t = 0; t < c->numTables; ++t)
     {
         // Should we tick every voice anyway to preserve relative phases?
-        float s0 = tCompactWaveOsc_tick(&c->oscs[t][voice]);
+        float s0 = tWaveOscS_tick(&c->oscs[t][voice]);
         if (t == o1) s1 = s0 * c->g[t];
         if (t == o2) s2 = s0 * c->g[t];
     }
@@ -2343,58 +2343,58 @@
     return s1 + (s2 - s1) * mix;
 }
 
-void tCompactWaveSynth_setFreq(tCompactWaveSynth* const cy, int voice, float freq)
+void tWaveSynthS_setFreq(tWaveSynthS* const cy, int voice, float freq)
 {
-    _tCompactWaveSynth* c = *cy;
+    _tWaveSynthS* c = *cy;
     for (int t = 0; t < c->numTables; ++t)
     {
-        tCompactWaveOsc_setFreq(&c->oscs[t][voice], freq);
+        tWaveOscS_setFreq(&c->oscs[t][voice], freq);
     }
 }
 
-void tCompactWaveSynth_setAntiAliasing(tCompactWaveSynth* const cy, float aa)
+void tWaveSynthS_setAntiAliasing(tWaveSynthS* const cy, float aa)
 {
-    _tCompactWaveSynth* c = *cy;
+    _tWaveSynthS* c = *cy;
     for (int t = 0; t < c->numTables; ++t)
     {
         for (int v = 0; v < c->numVoices; ++v)
         {
-            tCompactWaveOsc_setAntiAliasing(&c->oscs[t][v], aa);
+            tWaveOscS_setAntiAliasing(&c->oscs[t][v], aa);
         }
     }
 }
 
-void tCompactWaveSynth_setIndex(tCompactWaveSynth* const cy, float index)
+void tWaveSynthS_setIndex(tWaveSynthS* const cy, float index)
 {
-    _tCompactWaveSynth* c = *cy;
+    _tWaveSynthS* c = *cy;
     c->index = index;
 }
 
-void tCompactWaveSynth_setIndexGain(tCompactWaveSynth* const cy, int i, float gain)
+void tWaveSynthS_setIndexGain(tWaveSynthS* const cy, int i, float gain)
 {
-    _tCompactWaveSynth* c = *cy;
+    _tWaveSynthS* c = *cy;
     if (i >= c->numTables) return;
     c->g[i] = gain;
 }
 
-void tCompactWaveSynth_setIndexPhase(tCompactWaveSynth* const cy, int i, float phase)
+void tWaveSynthS_setIndexPhase(tWaveSynthS* const cy, int i, float phase)
 {
-    _tCompactWaveSynth* c = *cy;
+    _tWaveSynthS* c = *cy;
     if (i >= c->numTables) return;
     for (int v = 0; v < c->numVoices; ++v)
     {
-        tCompactWaveOsc_setPhaseOffset(&c->oscs[i][v], phase);
+        tWaveOscS_setPhaseOffset(&c->oscs[i][v], phase);
     }
 }
 //
-//void tCompactWaveSynth_setIndexTable(tCompactWaveSynth* const cy, int i, float* table, int size)
+//void tWaveSynthS_setIndexTable(tWaveSynthS* const cy, int i, float* table, int size)
 //{
-//    _tCompactWaveSynth* c = *cy;
+//    _tWaveSynthS* c = *cy;
 //    if (i >= c->numTables) return;
-//    tCompactWaveTable_free(&c->tables[i]);
-//    tCompactWaveTable_initToPool(&c->tables[i], table, size, c->maxFreq, &c->mempool);
+//    tWaveTableS_free(&c->tables[i]);
+//    tWaveTableS_initToPool(&c->tables[i], table, size, c->maxFreq, &c->mempool);
 //    for (int v = 0; v < c->numVoices; ++v)
 //    {
-//        tCompactWaveOsc_setFreq(&c->oscs[i][v], c->oscs[i][v]->freq);
+//        tWaveOscS_setFreq(&c->oscs[i][v], c->oscs[i][v]->freq);
 //    }
 //}
--- a/leaf/leaf-config.h
+++ b/leaf/leaf-config.h
@@ -18,7 +18,7 @@
 
 //==============================================================================
 
-//! Include FIR tables required to use tOversampler and tCompactWaveTable which uses tOversampler. 
+//! Include FIR tables required to use tOversampler and tWaveTableS which uses tOversampler. 
 #define LEAF_INCLUDE_OVERSAMPLER_TABLES 1
 
 // Unused
@@ -36,7 +36,7 @@
 // Unused
 #define LEAF_INCLUDE_ADC_TABLE 0
 
-//! Include tables required to use tEnvelope and tADSR (but not tADSR2, tADSR3, and tADSR4).
+//! Include tables required to use tEnvelope and tADSR (but not tADSRT and tADSRS).
 #define LEAF_INCLUDE_ADSR_TABLES 1
 
 //! Include wave table required to use tCycle.