shithub: leaf

Download patch

ref: 2e55e2007f1d88321d43b776995c4911645fdcea
parent: 327ba3d40f2a118c79820438ee1ccc430895f6b9
author: Matthew Wang <mjw7@princeton.edu>
date: Tue Aug 4 14:32:22 EDT 2020

filling in docs, rename tZerocrossing to tZeroCrossingCounter

--- a/TestPlugin/Source/MyTest.cpp
+++ b/TestPlugin/Source/MyTest.cpp
@@ -37,7 +37,7 @@
 
 tPeriodDetection pd;
 
-tZeroCrossing zc;
+tZeroCrossingCounter zc;
 tEnvelopeFollower ef;
 
 float gain;
@@ -69,7 +69,7 @@
     
     tPeriodDetection_init(&pd, bufIn, bufOut, 4096, 1024);
     
-    tZeroCrossing_init(&zc, 128);
+    tZeroCrossingCounter_init(&zc, 128);
     tEnvelopeFollower_init(&ef, 0.02f, 0.9999f);
 }
 
@@ -107,7 +107,7 @@
             freq = altFreq;
     }
     
-    if (tZeroCrossing_tick(&zc, input) < 0.05 && freq > 0.0f)
+    if (tZeroCrossingCounter_tick(&zc, input) < 0.05 && freq > 0.0f)
     {
         tMBTriangle_setFreq(&btri, freq);
     }
--- a/leaf/Inc/leaf-analysis.h
+++ b/leaf/Inc/leaf-analysis.h
@@ -35,32 +35,40 @@
     /*!
      @defgroup tenvelopefollower tEnvelopeFollower
      @ingroup analysis
-     @brief
+     @brief Detects and returns the basic envelope of incoming audio data.
      @{
      
-     @fn void    tEnvelopeFollower_init          (tEnvelopeFollower* const, float attackThreshold, float decayCoeff)
-     @brief
-     @param
+     @fn void    tEnvelopeFollower_init          (tEnvelopeFollower* const follower, float attackThreshold, float decayCoeff)
+     @brief Initialize a tEnvelopeFollower to the default LEAF mempool.
+     @param follower A pointer to the tEnvelopeFollower to be initialized.
+     @param attackThreshold Amplitude threshold for determining an envelope onset. 0.0 to 1.0
+     @param decayCoefficient Multiplier to determine the envelope rate of decay. 0.0 to 1.0, above 0.95 recommended.
      
-     @fn void    tEnvelopeFollower_initToPool    (tEnvelopeFollower* const, float attackThreshold, float decayCoeff, tMempool* const)
-     @brief
-     @param
+     @fn void    tEnvelopeFollower_initToPool    (tEnvelopeFollower* const follower, float attackThreshold, float decayCoeff, tMempool* const mempool)
+     @brief Initialize a tEnvelopeFollower to a specified mempool.
+     @param follower A pointer to the tEnvelopeFollower to be initialized.
+     @param attackThreshold Amplitude threshold for determining an envelope onset. 0.0 to 1.0
+     @param decayCoefficient Multiplier to determine the envelope rate of decay. 0.0 to 1.0, above 0.95 recommended.
+     @param mempool A pointer to the tMempool to which the tEnvelopeFollower should be initialized.
      
-     @fn void    tEnvelopeFollower_free          (tEnvelopeFollower* const)
-     @brief
-     @param
+     @fn void    tEnvelopeFollower_free          (tEnvelopeFollower* const follower)
+     @brief Free a tEnvelopeFollower from its mempool.
+     @param follower A pointer to the tEnvelopeFollower to be freed.
      
-     @fn float   tEnvelopeFollower_tick          (tEnvelopeFollower* const, float x)
-     @brief
-     @param
+     @fn float   tEnvelopeFollower_tick          (tEnvelopeFollower* const follower, float input)
+     @brief Tick the tEnvelopeFollower.
+     @param follower A pointer to the relevant tEnvelopeFollower.
+     @param input The input sample.
+     @return The envelope value.
      
-     @fn int     tEnvelopeFollower_decayCoeff    (tEnvelopeFollower* const, float decayCoeff)
-     @brief
-     @param
+     @fn void    tEnvelopeFollower_setDecayCoefficient    (tEnvelopeFollower* const follower, float decayCoeff)
+     @brief Set the envelope decay coefficient.
+     @param follower A pointer to the relevant tEnvelopeFollower.
+     @param decayCoefficient Multiplier to determine the envelope rate of decay. 0.0 to 1.0, above 0.95 recommended.
      
-     @fn int     tEnvelopeFollower_attackThresh  (tEnvelopeFollower* const, float attackThresh)
-     @brief
-     @param
+     @fn void    tEnvelopeFollower_setAttackThreshold  (tEnvelopeFollower* const follower, float attackThresh)
+     @brief Set the envelope attack  threshold.
+     @param follower A pointer to the relevant tEnvelopeFollower.
      
      @} */
     
@@ -75,46 +83,50 @@
     
     typedef _tEnvelopeFollower* tEnvelopeFollower;
     
-    void    tEnvelopeFollower_init          (tEnvelopeFollower* const, float attackThreshold, float decayCoeff);
-    void    tEnvelopeFollower_initToPool    (tEnvelopeFollower* const, float attackThreshold, float decayCoeff, tMempool* const);
-    void    tEnvelopeFollower_free          (tEnvelopeFollower* const);
+    void    tEnvelopeFollower_init          (tEnvelopeFollower* const follower, float attackThreshold, float decayCoefficient);
+    void    tEnvelopeFollower_initToPool    (tEnvelopeFollower* const follower, float attackThreshold, float decayCoefficient, tMempool* const mempool);
+    void    tEnvelopeFollower_free          (tEnvelopeFollower* const follower);
     
-    float   tEnvelopeFollower_tick          (tEnvelopeFollower* const, float x);
-    int     tEnvelopeFollower_decayCoeff    (tEnvelopeFollower* const, float decayCoeff);
-    int     tEnvelopeFollower_attackThresh  (tEnvelopeFollower* const, float attackThresh);
+    float   tEnvelopeFollower_tick          (tEnvelopeFollower* const follower, float sample);
+    void    tEnvelopeFollower_setDecayCoefficient    (tEnvelopeFollower* const follower, float decayCoefficient);
+    void    tEnvelopeFollower_setAttackThreshold  (tEnvelopeFollower* const follower, float attackThreshold);
     
-    // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
-    
     /*!
-     @defgroup tzerocrossing tZeroCrossing
+     @defgroup tzerocrossingcounter tZeroCrossingCounter
      @ingroup analysis
-     @brief
+     @brief Counts the amount of zero crossings within a window of the input audio data
      @{
      
-     @fn void    tZeroCrossing_init         (tZeroCrossing* const, int maxWindowSize)
-     @brief
-     @param
+     @fn void    tZeroCrossingCounter_init         (tZeroCrossingCounter* const counter, int maxWindowSize)
+     @brief Initialize a tZeroCrossingCounter to the default LEAF mempool.
+     @param counter A pointer to the tZeroCrossingCounter to be initialized.
+     @param maxWindowSize The max and initial size of the window.
      
-     @fn void    tZeroCrossing_initToPool   (tZeroCrossing* const, int maxWindowSize, tMempool* const)
-     @brief
-     @param
+     @fn void    tZeroCrossingCounter_initToPool   (tZeroCrossingCounter* const counter, int maxWindowSize, tMempool* const mempool)
+     @brief Initialize a tZeroCrossingCounter to a specified mempool.
+     @param counter A pointer to the tZeroCrossingCounter to be initialized.
+     @param maxWindowSize The max and initial size of the window.
+     @param mempool A pointer to the tMempool to which the tZeroCrossingCounter should be initialized.
      
-     @fn void    tZeroCrossing_free         (tZeroCrossing* const)
-     @brief
-     @param
+     @fn void    tZeroCrossingCounter_free         (tZeroCrossingCounter* const counter)
+     @brief Free a tZeroCrossingCounter from its mempool.
+     @param counter A pointer to the tZeroCrossingCounter to be freed.
      
-     @fn float   tZeroCrossing_tick         (tZeroCrossing* const, float input)
-     @brief
-     @param
+     @fn float   tZeroCrossingCounter_tick         (tZeroCrossingCounter* const counter, float input)
+     @brief Tick the tZeroCrossingCounter.
+     @param counter A pointer to the relevant tZeroCrossingCounter.
+     @param input The input sample.
+     @return The amount of zero crossings as a proportion of the window.
      
-     @fn void    tZeroCrossing_setWindow        (tZeroCrossing* const, float windowSize)
-     @brief
-     @param
+     @fn void    tZeroCrossingCounter_setWindowSize (tZeroCrossingCounter* const counter, float windowSize)
+     @brief Set the size of the window. Cannot be greater than the max size given on initialization.
+     @param counter A pointer to the relevant tZeroCrossingCounter.
+     @param windowSize The new window size.
      
      @} */
     
     /* Zero Crossing Detector */
-    typedef struct _tZeroCrossing {
+    typedef struct _tZeroCrossingCounter {
         tMempool mempool;
         int count;
         int maxWindowSize;
@@ -124,16 +136,16 @@
         uint16_t* countBuffer;
         int prevPosition;
         int position;
-    } _tZeroCrossing;
+    } _tZeroCrossingCounter;
     
-    typedef _tZeroCrossing* tZeroCrossing;
+    typedef _tZeroCrossingCounter* tZeroCrossingCounter;
     
-    void    tZeroCrossing_init         (tZeroCrossing* const, int maxWindowSize);
-    void    tZeroCrossing_initToPool   (tZeroCrossing* const, int maxWindowSize, tMempool* const);
-    void    tZeroCrossing_free         (tZeroCrossing* const);
+    void    tZeroCrossingCounter_init         (tZeroCrossingCounter* const, int maxWindowSize);
+    void    tZeroCrossingCounter_initToPool   (tZeroCrossingCounter* const, int maxWindowSize, tMempool* const mempool);
+    void    tZeroCrossingCounter_free         (tZeroCrossingCounter* const);
     
-    float   tZeroCrossing_tick         (tZeroCrossing* const, float input);
-    void    tZeroCrossing_setWindow        (tZeroCrossing* const, float windowSize);
+    float   tZeroCrossingCounter_tick         (tZeroCrossingCounter* const, float input);
+    void    tZeroCrossingCounter_setWindowSize    (tZeroCrossingCounter* const, float windowSize);
     
     // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
     
@@ -144,11 +156,11 @@
      @{
      
      @fn void    tPowerFollower_init         (tPowerFollower* const, float factor)
-     @brief
+     @brief Initialize a tPowerFollower to the default LEAF mempool.
      @param
      
      @fn void    tPowerFollower_initToPool   (tPowerFollower* const, float factor, tMempool* const)
-     @brief
+     @brief Initialize a tPowerFollower to a specified mempool.
      @param
      
      @fn void    tPowerFollower_free         (tPowerFollower* const)
@@ -193,15 +205,15 @@
     /*!
      @defgroup tenvpd tEnvPD
      @ingroup analysis
-     @brief
+     @brief ENV~ from PD, modified for LEAF
      @{
      
      @fn void    tEnvPD_init             (tEnvPD* const, int windowSize, int hopSize, int blockSize)
-     @brief
+     @brief Initialize a tEnvPD to the default LEAF mempool.
      @param
      
      @fn void    tEnvPD_initToPool       (tEnvPD* const, int windowSize, int hopSize, int blockSize, tMempool* const)
-     @brief
+     @brief Initialize a tEnvPD to a specified mempool.
      @param
      
      @fn void    tEnvPD_free             (tEnvPD* const)
@@ -218,7 +230,6 @@
      
      @} */
     
-    // ENV~ from PD, modified for LEAF
 #define MAXOVERLAP 32
 #define INITVSTAKEN 64
 #define ENV_WINDOW_SIZE 1024
@@ -257,11 +268,11 @@
      @{
      
      @fn void    tAttackDetection_init           (tAttackDetection* const, int blocksize, int atk, int rel)
-     @brief
+     @brief Initialize a tAttackDetection to the default LEAF mempool.
      @param
      
      @fn void    tAttackDetection_initToPool     (tAttackDetection* const, int blocksize, int atk, int rel, tMempool* const)
-     @brief
+     @brief Initialize a tAttackDetection to a specified mempool.
      @param
      
      @fn void    tAttackDetection_free           (tAttackDetection* const)
@@ -344,11 +355,11 @@
      @{
      
      @fn void    tSNAC_init          (tSNAC* const, int overlaparg)
-     @brief
+     @brief Initialize a tSNAC to the default LEAF mempool.
      @param
      
      @fn void    tSNAC_initToPool    (tSNAC* const, int overlaparg, tMempool* const)
-     @brief
+     @brief Initialize a tSNAC to a specified mempool.
      @param
      
      @fn void    tSNAC_free          (tSNAC* const)
@@ -433,11 +444,11 @@
     
     /*!
      @fn void    tPeriodDetection_init               (tPeriodDetection* const, float* in, float* out, int bufSize, int frameSize)
-     @brief
+     @brief Initialize a tPeriodDetection to the default LEAF mempool.
      @param
      
-     @fn void    tPeriodDetection_initToPool         (tPeriodDetection* const, float* in, float* out, int bufSize, int frameSize, tMempool* const)
-     @brief
+     @fn void    tPeriodDetection_initToPool  (tPeriodDetection* const, float* in, float* out, int bufSize, int frameSize, tMempool* const)
+     @brief Initialize a tPeriodDetection to a specified mempool.
      @param
      
      @fn void    tPeriodDetection_free               (tPeriodDetection* const)
@@ -664,11 +675,11 @@
      @{
      
      @fn void    tPeriodDetector_init    (tPeriodDetector* const detector, float lowestFreq, float highestFreq, float hysteresis)
-     @brief
+     @brief Initialize a tPeriodDetector to the default LEAF mempool.
      @param
      
      @fn void    tPeriodDetector_initToPool  (tPeriodDetector* const detector, float lowestFreq, float highestFreq, float hysteresis, tMempool* const mempool)
-     @brief
+     @brief Initialize a tPeriodDetector to a specified mempool.
      @param
      
      @fn void    tPeriodDetector_free    (tPeriodDetector* const detector)
@@ -774,11 +785,11 @@
      @{
      
      @fn void    tPitchDetector_init (tPitchDetector* const detector, float lowestFreq, float highestFreq, float hysteresis)
-     @brief
+     @brief Initialize a tPitchDetector to the default LEAF mempool.
      @param
      
      @fn void    tPitchDetector_initToPool   (tPitchDetector* const detector, float lowestFreq, float highestFreq, float hysteresis, tMempool* const mempool)
-     @brief
+     @brief Initialize a tPitchDetector to a specified mempool.
      @param
      
      @fn void    tPitchDetector_free (tPitchDetector* const detector)
--- a/leaf/Inc/leaf-envelopes.h
+++ b/leaf/Inc/leaf-envelopes.h
@@ -37,7 +37,7 @@
     /*!
      @defgroup tenvelope tEnvelope
      @ingroup envelopes
-     @brief Attack-decay envelope.
+     @brief Basic attack-decay envelope.
      @{
      
      @fn void    tEnvelope_init          (tEnvelope* const, float attack, float decay, int loop)
--- a/leaf/Inc/leaf-mempool.h
+++ b/leaf/Inc/leaf-mempool.h
@@ -96,7 +96,7 @@
     void    tMempool_init           (tMempool* const pool, char* memory, size_t size);
     
     
-    //! Free a tMempool from the default LEAF mempool.
+    //! Free a tMempool from its mempool.
     /*!
      @param pool A pointer to the tMempool to be freed.
      */
@@ -115,7 +115,7 @@
     
     //! Free a tMempool from a specified mempool.
     /*!
-     @param pool A pointer to the tMempool to be freed from the default LEAF mempool.
+     @param pool A pointer to the tMempool to be freed from its mempool.
      @param poolFrom A pointer to the tMempool from which a tMempool should be freed.
      */
     void    tMempool_freeFromPool   (tMempool* const pool, tMempool* const poolFrom);
--- a/leaf/Inc/leaf-midi.h
+++ b/leaf/Inc/leaf-midi.h
@@ -48,7 +48,7 @@
      @param mempool A pointer to the tMempool to which the tStack should be initialized.
      
      @fn void    tStack_free                 (tStack* const stack)
-     @brief Free a tStack from the default LEAF mempool.
+     @brief Free a tStack from its mempool.
      @param stack A pointer to the tStack to be freed.
      
      @fn void    tStack_setCapacity          (tStack* const stack, uint16_t cap)
@@ -149,7 +149,7 @@
      @param pool A pointer to the tMempool to which the tPoly should be initialized.
      
      @fn void    tPoly_free                  (tPoly* const poly)
-     @brief Free a tPoly from the default LEAF mempool.
+     @brief Free a tPoly from its mempool.
      @param poly A pointer to the tPoly to be freed.
      
      @fn int     tPoly_noteOn                (tPoly* const poly, int note, uint8_t vel)
@@ -315,22 +315,22 @@
      @{
      
      @fn void    tSimplePoly_init                  (tSimplePoly* const poly, int maxNumVoices)
-     @brief Initialize a tPoly to the default LEAF mempool.
-     @param poly A pointer to the tPoly to be initialized.
-     @param maxNumVoices The maximum number of voices this tPoly can handle at once.
+     @brief Initialize a tSimplePoly to the default LEAF mempool.
+     @param poly A pointer to the tSimplePoly to be initialized.
+     @param maxNumVoices The maximum number of voices this tSimplePoly can handle at once.
      
      @fn void    tSimplePoly_initToPool            (tSimplePoly* const poly, int maxNumVoices, tMempool* const pool)
-     @brief Initialize a tPoly to a specified mempool.
-     @param poly A pointer to the tPoly to be initialized.
-     @param pool A pointer to the tMempool to which the tPoly should be initialized.
+     @brief Initialize a tSimplePoly to a specified mempool.
+     @param poly A pointer to the tSimplePoly to be initialized.
+     @param pool A pointer to the tMempool to which the tSimplePoly should be initialized.
      
      @fn void    tSimplePoly_free                  (tSimplePoly* const poly)
-     @brief Free a tPoly from the default LEAF mempool.
-     @param poly A pointer to the tPoly to be freed.
+     @brief Free a tSimplePoly from its mempool.
+     @param poly A pointer to the tSimplePoly to be freed.
      
      @fn int     tSimplePoly_noteOn                (tSimplePoly* const poly, int note, uint8_t vel)
      @brief Add a note with a given velocity to the poly handler.
-     @param poly A pointer to the relevant tPoly.
+     @param poly A pointer to the relevant tSimplePoly.
      @param note The MIDI note number to add.
      @param vel The MIDI velocity of the note to add.
      @return The voice that will play the note.
@@ -337,7 +337,7 @@
      
      @fn int     tSimplePoly_noteOff               (tSimplePoly* const poly, uint8_t note)
      @brief Remove a note from the poly handler.
-     @param poly A pointer to the relevant tPoly.
+     @param poly A pointer to the relevant tSimplePoly.
      @param note The MIDI note number to remove.
      @return The voice that was playing the removed note.
      
@@ -355,22 +355,22 @@
      
      @fn void    tSimplePoly_setNumVoices          (tSimplePoly* const poly, uint8_t numVoices)
      @brief Set the number of voices available to play notes.
-     @param poly A pointer to the relevant tPoly.
-     @param numVoices The new number of available voices. Cannot be greater than the max number voices given in tPoly_init().
+     @param poly A pointer to the relevant tSimplePoly.
+     @param numVoices The new number of available voices. Cannot be greater than the max number voices given on initialization.
      
      @fn int     tSimplePoly_getNumVoices          (tSimplePoly* const poly)
      @brief Get the current number of voices available to play notes.
-     @param poly A pointer to the relevant tPoly.
+     @param poly A pointer to the relevant tSimplePoly.
      @return The current number of voices available to play notes.
      
      @fn int     tSimplePoly_getNumActiveVoices    (tSimplePoly* const poly)
      @brief Get the number of voices currently playing notes.
-     @param poly A pointer to the relevant tPoly.
+     @param poly A pointer to the relevant tSimplePoly.
      @return The number of voices currently playing notes.
      
      @fn int   tSimplePoly_getPitch              (tSimplePoly* const poly, uint8_t voice)
      @brief Get the current MIDI note number of a given voice.
-     @param poly A pointer to the relevant tPoly.
+     @param poly A pointer to the relevant tSimplePoly.
      @param voice The voice to get the MIDI note number of.
      @return The MIDI note number of the given voice.
      
@@ -379,13 +379,13 @@
      
      @fn int     tSimplePoly_getVelocity           (tSimplePoly* const poly, uint8_t voice)
      @brief Get the current MIDI velocity of a given voice.
-     @param poly A pointer to the relevant tPoly.
+     @param poly A pointer to the relevant tSimplePoly.
      @param voice The voice to get the MIDI velocity of.
      @return The current MIDI velocity of the given voice.
      
      @fn int     tSimplePoly_isOn                  (tSimplePoly* const poly, uint8_t voice)
      @brief Get the current play state of a given voice.
-     @param poly A pointer to the relevant tPoly.
+     @param poly A pointer to the relevant tSimplePoly.
      @param voice The voice to get the state of.
      @return The current play state of the given voice.
      
--- a/leaf/Inc/leaf-oscillators.h
+++ b/leaf/Inc/leaf-oscillators.h
@@ -34,17 +34,21 @@
      @brief A general wavetable oscillator.
      @{
 
-     @fn void    tTable_init         (tTable* const osc, float* waveTable, int size)
+     @fn void    tTable_init         (tTable* const osc, float* table, int size)
      @brief Initialize a tTable to the default LEAF mempool.
      @param osc A pointer to the tTable to be initialized.
+     @param table A pointer to the wave table data.
+     @param size The number of samples in the wave table.
 
-     @fn void    tTable_initToPool   (tTable* const osc, float* waveTable, int size, tMempool* const mempool)
+     @fn void    tTable_initToPool   (tTable* const osc, float* table, int size, tMempool* const mempool)
      @brief Initialize a tTable to a specified mempool.
      @param osc A pointer to the tTable to be initialized.
-     @param pool A pointer to the tMempool to which the tTable should be initialized.
+     @param table A pointer to the wave table data.
+     @param size The number of samples in the wave table.
+     @param mempool A pointer to the tMempool to which the tTable should be initialized.
 
      @fn void    tTable_free         (tTable* const osc)
-     @brief Free a tTable from the default LEAF mempool.
+     @brief Free a tTable from its mempool.
      @param osc A pointer to the tTable to be freed.
  
      @fn float   tTable_tick         (tTable* const osc)
@@ -71,8 +75,8 @@
     
     typedef _tTable* tTable;
 
-     void    tTable_init(tTable* const osc, float* waveTable, int size);
-     void    tTable_initToPool(tTable* const osc, float* waveTable, int size, tMempool* const mempool);
+     void    tTable_init(tTable* const osc, float* table, int size);
+     void    tTable_initToPool(tTable* const osc, float* table, int size, tMempool* const mempool);
      void    tTable_free(tTable* const osc);
     
      float   tTable_tick(tTable* const osc);
@@ -90,13 +94,13 @@
      @brief Initialize a tCycle to the default LEAF mempool.
      @param osc A pointer to the tCycle to be initialized.
      
-     @fn void    tCycle_initToPool   (tCycle* const osc, tMempool* const pool)
+     @fn void    tCycle_initToPool   (tCycle* const osc, tMempool* const mempool)
      @brief Initialize a tCycle to a specified mempool.
      @param osc A pointer to the tCycle to be initialized.
-     @param pool A pointer to the tMempool to which the tCycle should be initialized.
+     @param mempool A pointer to the tMempool to which the tCycle should be initialized.
 
      @fn void    tCycle_free         (tCycle* const osc)
-     @brief Free a tCycle from the default LEAF mempool.
+     @brief Free a tCycle from its mempool.
      @param osc A pointer to the tCycle to be freed.
      
      @fn float   tCycle_tick         (tCycle* const osc)
@@ -123,7 +127,7 @@
     typedef _tCycle* tCycle;
     
     void    tCycle_init         (tCycle* const osc);
-    void    tCycle_initToPool   (tCycle* const osc, tMempool* const pool);
+    void    tCycle_initToPool   (tCycle* const osc, tMempool* const mempool);
     void    tCycle_free         (tCycle* const osc);
     
     float   tCycle_tick         (tCycle* const osc);
@@ -141,13 +145,13 @@
      @brief Initialize a tTriangle to the default LEAF mempool.
      @param osc A pointer to the tTriangle to be initialized.
      
-     @fn void    tTriangle_initToPool   (tTriangle* const osc, tMempool* const pool)
+     @fn void    tTriangle_initToPool   (tTriangle* const osc, tMempool* const mempool)
      @brief Initialize a tTriangle to a specified mempool.
      @param osc A pointer to the tTriangle to be initialized.
-     @param pool A pointer to the tMempool to which the tTriangle should be initialized.
+     @param mempool A pointer to the tMempool to which the tTriangle should be initialized.
      
      @fn void    tTriangle_free         (tTriangle* const osc)
-     @brief Free a tTriangle from the default LEAF mempool.
+     @brief Free a tTriangle from its mempool.
      @param osc A pointer to the tTriangle to be freed.
      
      @fn float   tTriangle_tick         (tTriangle* const osc)
@@ -175,7 +179,7 @@
     typedef _tTriangle* tTriangle;
 
     void    tTriangle_init          (tTriangle* const osc);
-    void    tTriangle_initToPool    (tTriangle* const osc, tMempool* const pool);
+    void    tTriangle_initToPool    (tTriangle* const osc, tMempool* const mempool);
     void    tTriangle_free          (tTriangle* const osc);
     
     float   tTriangle_tick          (tTriangle* const osc);
@@ -194,13 +198,13 @@
      @brief Initialize a tSquare to the default LEAF mempool.
      @param osc A pointer to the tSquare to be initialized.
      
-     @fn void    tSquare_initToPool   (tSquare* const osc, tMempool* const pool)
+     @fn void    tSquare_initToPool   (tSquare* const osc, tMempool* const mempool)
      @brief Initialize a tSquare to a specified mempool.
      @param osc A pointer to the tSquare to be initialized.
-     @param pool A pointer to the tMempool to which the tSquare should be initialized.
+     @param mempool A pointer to the tMempool to which the tSquare should be initialized.
      
      @fn void    tSquare_free         (tSquare* const osc)
-     @brief Free a tSquare from the default LEAF mempool.
+     @brief Free a tSquare from its mempool.
      @param osc A pointer to the tSquare to be freed.
      
      @fn float   tSquare_tick         (tSquare* const osc)
@@ -249,13 +253,13 @@
      @brief Initialize a tSawtooth to the default LEAF mempool.
      @param osc A pointer to the tSawtooth to be initialized.
      
-     @fn void    tSawtooth_initToPool   (tSawtooth* const osc, tMempool* const pool)
+     @fn void    tSawtooth_initToPool   (tSawtooth* const osc, tMempool* const mempool)
      @brief Initialize a tSawtooth to a specified mempool.
      @param osc A pointer to the tSawtooth to be initialized.
-     @param pool A pointer to the tMempool to which the tSawtooth should be initialized.
+     @param mempool A pointer to the tMempool to which the tSawtooth should be initialized.
      
      @fn void    tSawtooth_free         (tSawtooth* const osc)
-     @brief Free a tSawtooth from the default LEAF mempool.
+     @brief Free a tSawtooth from its mempool.
      @param osc A pointer to the tSawtooth to be freed.
      
      @fn float   tSawtooth_tick         (tSawtooth* const osc)
@@ -283,7 +287,7 @@
     typedef _tSawtooth* tSawtooth;
 
     void    tSawtooth_init          (tSawtooth* const osc);
-    void    tSawtooth_initToPool    (tSawtooth* const osc, tMempool* const pool);
+    void    tSawtooth_initToPool    (tSawtooth* const osc, tMempool* const mempool);
     void    tSawtooth_free          (tSawtooth* const osc);
 
     float   tSawtooth_tick          (tSawtooth* const osc);
@@ -301,7 +305,7 @@
      @brief
      @param
      
-     @fn void    tTri_initToPool    (tTri* const osc, tMempool* const pool)
+     @fn void    tTri_initToPool    (tTri* const osc, tMempool* const mempool)
      @brief
      @param
      
@@ -335,7 +339,7 @@
     typedef _tTri* tTri;
     
     void    tTri_init          (tTri* const osc);
-    void    tTri_initToPool    (tTri* const osc, tMempool* const pool);
+    void    tTri_initToPool    (tTri* const osc, tMempool* const mempool);
     void    tTri_free          (tTri* const osc);
     
     float   tTri_tick          (tTri* const osc);
@@ -406,7 +410,7 @@
      @brief
      @param
      
-     @fn void    tSaw_initToPool    (tSaw* const osc, tMempool* const pool)
+     @fn void    tSaw_initToPool    (tSaw* const osc, tMempool* const mempool)
      @brief
      @param
      
@@ -434,7 +438,7 @@
     typedef _tSaw* tSaw;
     
     void    tSaw_init          (tSaw* const osc);
-    void    tSaw_initToPool    (tSaw* const osc, tMempool* const pool);
+    void    tSaw_initToPool    (tSaw* const osc, tMempool* const mempool);
     void    tSaw_free          (tSaw* const osc);
     
     float   tSaw_tick          (tSaw* const osc);
@@ -555,13 +559,13 @@
      @brief Initialize a tNeuron to the default LEAF mempool.
      @param neuron A pointer to the tNeuron to be initialized.
      
-     @fn void    tNeuron_initToPool  (tNeuron* const neuron, tMempool* const pool)
+     @fn void    tNeuron_initToPool  (tNeuron* const neuron, tMempool* const mempool)
      @brief Initialize a tNeuron to a specified mempool.
      @param neuron A pointer to the tNeuron to be initialized.
-     @param pool A pointer to the tMempool to which the tNeuron should be initialized.
+     @param mempool A pointer to the tMempool to which the tNeuron should be initialized.
      
      @fn void    tNeuron_free        (tNeuron* const neuron)
-     @brief Free a tNeuron from the default LEAF mempool.
+     @brief Free a tNeuron from its mempool.
      @param neuron A pointer to the tNeuron to be freed.
      
      @fn void    tNeuron_reset       (tNeuron* const neuron)
@@ -659,7 +663,7 @@
     typedef _tNeuron* tNeuron;
     
     void    tNeuron_init        (tNeuron* const neuron);
-    void    tNeuron_initToPool  (tNeuron* const neuron, tMempool* const pool);
+    void    tNeuron_initToPool  (tNeuron* const neuron, tMempool* const mempool);
     void    tNeuron_free        (tNeuron* const neuron);
     
     void    tNeuron_reset       (tNeuron* const neuron);
@@ -692,7 +696,7 @@
      @brief
      @param
      
-     @fn void tMBPulse_initToPool(tMBPulse* const osc, tMempool* const pool)
+     @fn void tMBPulse_initToPool(tMBPulse* const osc, tMempool* const mempool)
      @brief
      @param
      
@@ -741,7 +745,7 @@
     typedef _tMBPulse* tMBPulse;
     
     void tMBPulse_init(tMBPulse* const osc);
-    void tMBPulse_initToPool(tMBPulse* const osc, tMempool* const pool);
+    void tMBPulse_initToPool(tMBPulse* const osc, tMempool* const mempool);
     void tMBPulse_free(tMBPulse* const osc);
     
     float tMBPulse_tick(tMBPulse* const osc);
@@ -760,7 +764,7 @@
      @brief
      @param
      
-     @fn void tMBTriangle_initToPool(tMBTriangle* const osc, tMempool* const pool)
+     @fn void tMBTriangle_initToPool(tMBTriangle* const osc, tMempool* const mempool)
      @brief
      @param
      
@@ -809,7 +813,7 @@
     typedef _tMBTriangle* tMBTriangle;
     
     void tMBTriangle_init(tMBTriangle* const osc);
-    void tMBTriangle_initToPool(tMBTriangle* const osc, tMempool* const pool);
+    void tMBTriangle_initToPool(tMBTriangle* const osc, tMempool* const mempool);
     void tMBTriangle_free(tMBTriangle* const osc);
     
     float tMBTriangle_tick(tMBTriangle* const osc);
@@ -829,7 +833,7 @@
      @brief
      @param
      
-     @fn void tMBSaw_initToPool(tMBSaw* const osc, tMempool* const pool)
+     @fn void tMBSaw_initToPool(tMBSaw* const osc, tMempool* const mempool)
      @brief
      @param
      
@@ -873,7 +877,7 @@
     typedef _tMBSaw* tMBSaw;
     
     void tMBSaw_init(tMBSaw* const osc);
-    void tMBSaw_initToPool(tMBSaw* const osc, tMempool* const pool);
+    void tMBSaw_initToPool(tMBSaw* const osc, tMempool* const mempool);
     void tMBSaw_free(tMBSaw* const osc);
     
     float tMBSaw_tick(tMBSaw* const osc);
--- a/leaf/Src/leaf-analysis.c
+++ b/leaf/Src/leaf-analysis.c
@@ -64,16 +64,16 @@
     return e->y;
 }
 
-int     tEnvelopeFollower_decayCoeff(tEnvelopeFollower* const ef, float decayCoeff)
+void    tEnvelopeFollower_setDecayCoefficient(tEnvelopeFollower* const ef, float decayCoeff)
 {
     _tEnvelopeFollower* e = *ef;
-    return e->d_coeff = decayCoeff;
+    e->d_coeff = decayCoeff;
 }
 
-int     tEnvelopeFollower_attackThresh(tEnvelopeFollower* const ef, float attackThresh)
+void    tEnvelopeFollower_setAttackThreshold(tEnvelopeFollower* const ef, float attackThresh)
 {
     _tEnvelopeFollower* e = *ef;
-    return e->a_thresh = attackThresh;
+    e->a_thresh = attackThresh;
 }
 
 
@@ -82,15 +82,15 @@
 
 // zero crossing detector
 
-void    tZeroCrossing_init         (tZeroCrossing* const zc, int maxWindowSize)
+void    tZeroCrossingCounter_init         (tZeroCrossingCounter* const zc, int maxWindowSize)
 {
-    tZeroCrossing_initToPool   (zc, maxWindowSize, &leaf.mempool);
+    tZeroCrossingCounter_initToPool   (zc, maxWindowSize, &leaf.mempool);
 }
 
-void    tZeroCrossing_initToPool   (tZeroCrossing* const zc, int maxWindowSize, tMempool* const mp)
+void    tZeroCrossingCounter_initToPool   (tZeroCrossingCounter* const zc, int maxWindowSize, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tZeroCrossing* z = *zc = (_tZeroCrossing*) mpool_alloc(sizeof(_tZeroCrossing), m);
+    _tZeroCrossingCounter* z = *zc = (_tZeroCrossingCounter*) mpool_alloc(sizeof(_tZeroCrossing), m);
     z->mempool = m;
 
     z->count = 0;
@@ -103,9 +103,9 @@
     z->countBuffer = (uint16_t*) mpool_calloc(sizeof(uint16_t) * maxWindowSize, m);
 }
 
-void    tZeroCrossing_free (tZeroCrossing* const zc)
+void    tZeroCrossingCounter_free (tZeroCrossingCounter* const zc)
 {
-    _tZeroCrossing* z = *zc;
+    _tZeroCrossingCounter* z = *zc;
     
     mpool_free((char*)z->inBuffer, z->mempool);
     mpool_free((char*)z->countBuffer, z->mempool);
@@ -113,9 +113,9 @@
 }
 
 //returns proportion of zero crossings within window size (0.0 would be none in window, 1.0 would be all zero crossings)
-float   tZeroCrossing_tick         (tZeroCrossing* const zc, float input)
+float   tZeroCrossingCounter_tick         (tZeroCrossingCounter* const zc, float input)
 {
-    _tZeroCrossing* z = *zc;
+    _tZeroCrossingCounter* z = *zc;
 
     z->inBuffer[z->position] = input;
     int futurePosition = ((z->position + 1) % z->currentWindowSize);
@@ -152,9 +152,9 @@
 }
 
 
-void    tZeroCrossing_setWindow        (tZeroCrossing* const zc, float windowSize)
+void    tZeroCrossingCounter_setWindowSize        (tZeroCrossingCounter* const zc, float windowSize)
 {
-    _tZeroCrossing* z = *zc;
+    _tZeroCrossingCounter* z = *zc;
     if (windowSize <= z->maxWindowSize)
         {
             z->currentWindowSize = windowSize;
--- a/leaf/Src/leaf-effects.c
+++ b/leaf/Src/leaf-effects.c
@@ -285,11 +285,11 @@
     {
         if(r[0] < min)
         {
-            for(i=0; i<n; i++)
-            {
+//            for(i=0; i<n; i++)
+//            {
                 buf[i] = 0.0f;
                 return;
-            }
+//            }
         }
 
         tTalkbox_lpcDurbin(r, o, k, G);  //calc reflection coeffs
@@ -612,11 +612,11 @@
     {
         if(r[0] < min)
         {
-            for(i=0; i<n; i++)
-            {
+//            for(i=0; i<n; i++)
+//            {
                 buf[i] = 0.0f;
                 return;
-            }
+//            }
         }
 
         tTalkbox_lpcDurbin(r, o, k, G);  //calc reflection coeffs