arduino-audio-tools
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
EnvelopeFilter Class Referenceabstract

EnvelopeFilter. More...

#include <AudioEffectsSuite.h>

Inheritance diagram for EnvelopeFilter:
FilterEffectBase EffectSuiteBase AudioEffect

Public Member Functions

 EnvelopeFilter ()
 
 ~EnvelopeFilter ()=default
 
virtual bool active ()
 determines if the effect is active
 
virtual effectsuite_t applyFilter (effectsuite_t sampVal)
 
virtual AudioEffectclone ()=0
 
effectsuite_t envelope (effectsuite_t sample)
 
int id ()
 Allows to identify an effect.
 
virtual effect_t process (effect_t inputSample) override
 see applyFilter
 
effectsuite_t processDouble (effectsuite_t sample)
 
virtual void setActive (bool value)
 sets the effect active/inactive
 
bool setChebyICoefficients (effectsuite_t cutFreq, bool shelfType, effectsuite_t ripple)
 
void setId (int id)
 Allows to identify an effect.
 

Protected Member Functions

void allocateBufferMemory ()
 
bool changeChebyICoefficients (effectsuite_t cutFreq, bool shelfType, effectsuite_t ripple, int poles)
 
void clearMemory ()
 
int16_t clip (int32_t in, int16_t clipLimit=32767, int16_t resultLimit=32767)
 generic clipping method
 
void copyParent (AudioEffect *copy)
 
void incBufferIndex ()
 
effectsuite_t rms (effectsuite_t sample)
 
bool setSimpleLpf (int order)
 

Protected Attributes

bool active_flag = true
 
int bufferIndex = 0
 
SimpleLPF envelopeFollower
 
int filterOrder = 0
 
effectsuite_t * firBuffer = 0
 
effectsuite_t * firCoefficients = 0
 
effectsuite_t * firTemp = 0
 
int id_value = -1
 
effectsuite_t * iirBuffer = 0
 
effectsuite_t * iirCoefficients = 0
 
effectsuite_t * iirTemp = 0
 
effectsuite_t * rmsBuffer = new effectsuite_t[rmsWindowSize]
 
int rmsBufferIndex = 0
 
const int rmsWindowSize = 128
 
int samplingRate = 0
 

Static Protected Attributes

constexpr static const effectsuite_t pi = 3.141592653589793
 

Detailed Description

EnvelopeFilter.

Author
Matthew Hamilton

Constructor & Destructor Documentation

◆ EnvelopeFilter()

EnvelopeFilter ( )
inline

Constructor

◆ ~EnvelopeFilter()

~EnvelopeFilter ( )
default

Desructor

Member Function Documentation

◆ allocateBufferMemory()

void allocateBufferMemory ( )
inlineprotectedinherited

will allocate memory to a buffer given the current filter order and set all values == 0.00

◆ applyFilter()

virtual effectsuite_t applyFilter ( effectsuite_t  sampVal)
inlinevirtualinherited

with the current filter coefficients this method filters a sample then stores it the sample Buffer and increments the index

Parameters
sampValis the sample to be processed
Returns
filtered audio sample

◆ changeChebyICoefficients()

bool changeChebyICoefficients ( effectsuite_t  cutFreq,
bool  shelfType,
effectsuite_t  ripple,
int  poles 
)
inlineprotectedinherited

set firCoefficients and iirCoefficients for required chebyshev type I filter sampleBuffer memory is also set @params cutFreq normalised cutoff frequency (0 < x < .5) @params shelfType bool filter shelf type, false = low pass, true = high pass @params ripple percentage ripple (<.2929) @params poles number of poles

Returns
boolean false on error and true on success

◆ clearMemory()

void clearMemory ( )
inlineprotectedinherited

checks internal memory storage of filter coeffcients and deletes if required

◆ envelope()

effectsuite_t envelope ( effectsuite_t  sample)
inlineinherited

detect the envelop of an incoming signal

Parameters
samplethe incoming signal sample value
Returns
returns envelope dection signal sample value

◆ incBufferIndex()

void incBufferIndex ( )
inlineprotectedinherited

increment the buffer index and wrap it to the filter order

◆ processDouble()

effectsuite_t processDouble ( effectsuite_t  sample)
inlinevirtual

main process method: applies an envelope filter to the incoming signal sample @params sample incoming signal sample value

Returns
processed sample value

Reimplemented from FilterEffectBase.

◆ rms()

effectsuite_t rms ( effectsuite_t  sample)
inlineprotectedinherited

root mean square of signal over a specific sample window

◆ setChebyICoefficients()

bool setChebyICoefficients ( effectsuite_t  cutFreq,
bool  shelfType,
effectsuite_t  ripple 
)
inlineinherited

changes the current Chebyshev type 1 coefficients without altering the filter order. This allows for use in an audio process thread as it avoids dynamic allocation of memory. Filter sample and coefficient buffers are unaltered for initialising a chebyshev type 1 filter

See also
setChebyICoefficients @params cutFreq normalised cutoff frequency (0 < x < .5) @params shelfType bool Filters shelf type, false = low pass, true = high pass @params ripple percentage ripple (<.2929)
Returns
boolean false on error and true on success

◆ setSimpleLpf()

bool setSimpleLpf ( int  order)
inlineprotectedinherited

a simple normalised fir low pass filter @params order number of delay coefficients

Member Data Documentation

◆ bufferIndex

int bufferIndex = 0
protectedinherited

current buffer index

◆ envelopeFollower

SimpleLPF envelopeFollower
protected

this follows the signal envelope and alters the internallow pass filter cutoff

◆ filterOrder

int filterOrder = 0
protectedinherited

order of delay filter including the zero delay coefficients

◆ firBuffer

effectsuite_t* firBuffer = 0
protectedinherited

buffer to hold forward delay sample data

◆ firCoefficients

effectsuite_t* firCoefficients = 0
protectedinherited

Numerator coefficients in delay filter firCoefficients[0] z^0 coeffcieint firCoefficients[1] z^-1 coefficient

◆ firTemp

effectsuite_t* firTemp = 0
protectedinherited

hold temporary values for fir coeffcient buffer

◆ iirBuffer

effectsuite_t* iirBuffer = 0
protectedinherited

buffer to hold backward delay sample data

◆ iirCoefficients

effectsuite_t* iirCoefficients = 0
protectedinherited

Denomiator coefficients in delay filter

See also
firCoefficients

◆ iirTemp

effectsuite_t* iirTemp = 0
protectedinherited

hold temporary values for iir coeffcient buffer

◆ rmsBuffer

effectsuite_t* rmsBuffer = new effectsuite_t[rmsWindowSize]
protectedinherited

RMS window buffer

◆ rmsBufferIndex

int rmsBufferIndex = 0
protectedinherited

current write index of rmsBuffer

◆ rmsWindowSize

const int rmsWindowSize = 128
protectedinherited

window size in samples of rms window


The documentation for this class was generated from the following file: