arduino-audio-tools
Loading...
Searching...
No Matches
FilteredDelay< effectsuite_t > Class Template Reference

Delay effect that filters the repeat delay. More...

#include <AudioEffectsSuite.h>

Inheritance diagram for FilteredDelay< effectsuite_t >:
DelayEffectBase< effectsuite_t_default > FilterEffectBase< effectsuite_t_default > EffectSuiteBase< effectsuite_t_default > AudioEffect

Public Member Functions

 FilteredDelay (FilteredDelay &copy)=default
 FilteredDelay (int delayInSamples, int sample_rate=44100)
 ~FilteredDelay ()=default
virtual bool active ()
 determines if the effect is active
virtual effectsuite_t_default applyFilter (effectsuite_t_default sampVal)
FilteredDelay * clone () override
effectsuite_t_default envelope (effectsuite_t_default sample)
int id ()
 Allows to identify an effect.
effect_t process (effect_t inputSample) override
 see applyFilter
effectsuite_t processFloat (effectsuite_t inputSample) override
virtual effectsuite_t_default processFloat (effectsuite_t_default inputSample) override
virtual void setActive (bool value)
 sets the effect active/inactive
bool setChebyICoefficients (effectsuite_t_default cutFreqIn, bool shelfType, effectsuite_t_default rippleIn)
void setDelayGain (effectsuite_t gain)
void setFeedbackGain (effectsuite_t gain)
void setId (int id)
 Allows to identify an effect.
void setupDelayEffectBase (const int bufferSizeSamples)

Protected Member Functions

void allocateBufferMemory ()
void capGain (effectsuite_t &gain)
bool changeChebyICoefficients (effectsuite_t_default cutFreq, bool shelfType, effectsuite_t_default 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 delaySample (effectsuite_t_default inputSample)
effectsuite_t_default getInterpolatedOut (effectsuite_t_default bufferIndex)
void incBufferIndex ()
void incDelayBuffReadIndex (effectsuite_t_default indexInc)
void incDelayBuffWriteIndex ()
effectsuite_t_default rms (effectsuite_t_default sample)
bool setDelayBuffer (int bufferSizeSamples)
void setDelayBuffReadIndex (effectsuite_t_default index)
bool setSimpleLpf (int order)
void storeSample (effectsuite_t_default inputSample)

Static Protected Member Functions

static effectsuite_t_default ** setInterpolationTable ()

Protected Attributes

bool active_flag
int bufferIndex
effectsuite_t_default currentDelayReadIndex
int currentDelayWriteIndex
effectsuite_t_default * delayBuffer
effectsuite_t delayGain = .707
int delayTimeSamples
bool error
effectsuite_t feedbackGain = 0.0
int filterOrder
float * firBuffer
float * firCoefficients
float * firTemp
int id_value
float * iirBuffer
float * iirCoefficients
float * iirTemp
int maxDelayBufferSize
effectsuite_t_default * rmsBuffer
int rmsBufferIndex
const int rmsWindowSize
int samplingRate

Static Protected Attributes

static effectsuite_t_default ** interpolationTable
 Table of interpolation values as a 2D array indexed by interpolationTable[pointIndex][alphaIndex]. One instance per DelayEffectBase<effectsuite_t> instantiation (previously a single namespace-scope global shared – and type-mismatched – across every effectsuite_t choice).
static const int interpOrder
static const int interpResolution

Detailed Description

template<typename effectsuite_t = effectsuite_t_default>
class audio_tools::FilteredDelay< effectsuite_t >

Delay effect that filters the repeat delay.

Author
Matthew Hamilton

Constructor & Destructor Documentation

◆ FilteredDelay() [1/2]

template<typename effectsuite_t = effectsuite_t_default>
FilteredDelay ( int delayInSamples,
int sample_rate = 44100 )
inline

Constructor

◆ FilteredDelay() [2/2]

template<typename effectsuite_t = effectsuite_t_default>
FilteredDelay ( FilteredDelay< effectsuite_t > & copy)
default

◆ ~FilteredDelay()

template<typename effectsuite_t = effectsuite_t_default>
~FilteredDelay ( )
default

Destructor

Member Function Documentation

◆ active()

virtual bool active ( )
inlinevirtualinherited

determines if the effect is active

◆ 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_default applyFilter ( effectsuite_t_default 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

◆ capGain()

template<typename effectsuite_t = effectsuite_t_default>
void capGain ( effectsuite_t & gain)
inlineprotected

capGain: caps gain to a range of 1 and -1;

Parameters
gainaddress of gain value

◆ changeChebyICoefficients()

bool changeChebyICoefficients ( effectsuite_t_default cutFreq,
bool shelfType,
effectsuite_t_default 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

◆ clip()

int16_t clip ( int32_t in,
int16_t clipLimit = 32767,
int16_t resultLimit = 32767 )
inlineprotectedinherited

generic clipping method

◆ clone()

template<typename effectsuite_t = effectsuite_t_default>
FilteredDelay * clone ( )
inlineoverridevirtual

Implements AudioEffect.

◆ copyParent()

void copyParent ( AudioEffect * copy)
inlineprotectedinherited

◆ delaySample()

void delaySample ( effectsuite_t_default inputSample)
inlineprotectedinherited

store input sample into the delay buffer and increment currentDelayWriteIndex for tracking when to loop back to start of buffer

Parameters
inputSamplesample to be stored for delay (effectsuite_t)

◆ envelope()

effectsuite_t_default envelope ( effectsuite_t_default sample)
inlineinherited

detect the envelop of an incoming signal

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

◆ getInterpolatedOut()

effectsuite_t_default getInterpolatedOut ( effectsuite_t_default bufferIndex)
inlineprotectedinherited

get the value of the requested buffer index by interpolating other points

Parameters
bufferIndexThe required buffer index
Returns
interpolated output

◆ id()

int id ( )
inlineinherited

Allows to identify an effect.

◆ incBufferIndex()

void incBufferIndex ( )
inlineprotectedinherited

increment the buffer index and wrap it to the filter order

◆ incDelayBuffReadIndex()

void incDelayBuffReadIndex ( effectsuite_t_default indexInc)
inlineprotectedinherited

Increments the currentDelayBufferReadIndex by indexInc

Parameters
indexIncThe amount to increment the delay buffer index

◆ incDelayBuffWriteIndex()

void incDelayBuffWriteIndex ( )
inlineprotectedinherited

Increments the currentDelayWriteBufferIndex by 1

◆ process()

template<typename effectsuite_t = effectsuite_t_default>
effect_t process ( effect_t inputSample)
inlineoverridevirtual

see applyFilter

Reimplemented from FilterEffectBase< effectsuite_t_default >.

◆ processFloat() [1/2]

template<typename effectsuite_t = effectsuite_t_default>
effectsuite_t processFloat ( effectsuite_t inputSample)
inlineoverride

apply the DSP effect

◆ processFloat() [2/2]

virtual effectsuite_t_default processFloat ( effectsuite_t_default inputSample)
inlineoverridevirtualinherited

◆ rms()

effectsuite_t_default rms ( effectsuite_t_default sample)
inlineprotectedinherited

root mean square of signal over a specific sample window

◆ setActive()

virtual void setActive ( bool value)
inlinevirtualinherited

sets the effect active/inactive

◆ setChebyICoefficients()

bool setChebyICoefficients ( effectsuite_t_default cutFreqIn,
bool shelfType,
effectsuite_t_default rippleIn )
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

◆ setDelayBuffer()

bool setDelayBuffer ( int bufferSizeSamples)
inlineprotectedinherited

Allocates memory for delay buffer and initialises all elements to 0

Parameters
bufferSizeSamplesthe size of delay buffer to be used
Returns
false and error description if there's a problem, or sets the internal delay buffer and returns true

◆ setDelayBuffReadIndex()

void setDelayBuffReadIndex ( effectsuite_t_default index)
inlineprotectedinherited

sets the currentDelayBufferReadIndex by indexInc (Currently no wrapping)

Parameters
indexthe read index index required

◆ setDelayGain()

template<typename effectsuite_t = effectsuite_t_default>
void setDelayGain ( effectsuite_t gain)
inline

setDelayGain: sets the delay gain to a value between 1 and -1

Parameters
gainrequireddelay gain. Values beyond 1 and -1 are capped to the maximum to avoid idiocy. Negative velus invoke a phase inversion.
See also
setFeedbackGain

◆ setFeedbackGain()

template<typename effectsuite_t = effectsuite_t_default>
void setFeedbackGain ( effectsuite_t gain)
inline

setDelayGain: sets the feedback gain to a value between 1 and -1

Parameters
gainrequired delay gain. Values beyond 1 and -1 are capped to the maximum to avoid idiocy. Negative velus invoke a phase inversion.
See also
setDelayGain

◆ setId()

void setId ( int id)
inlineinherited

Allows to identify an effect.

◆ setInterpolationTable()

effectsuite_t_default ** setInterpolationTable ( )
inlinestaticprotectedinherited

Sets the internal lagrange interpolation table. Ideally it should be shared amongst all

Returns
false and an error description if there's a problem, or sets the interpolation lookup table and returns true

◆ setSimpleLpf()

bool setSimpleLpf ( int order)
inlineprotectedinherited

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

◆ setupDelayEffectBase()

void setupDelayEffectBase ( const int bufferSizeSamples)
inlineinherited

<Description#>

Parameters
bufferSizeSamples<#bufferSizeSamples description#>

◆ storeSample()

void storeSample ( effectsuite_t_default inputSample)
inlineprotectedinherited

store input sample into the delay buffer

Parameters
inputSamplesample to be stored for delay (effectsuite_t)

Member Data Documentation

◆ active_flag

bool active_flag
protectedinherited

◆ bufferIndex

int bufferIndex
protectedinherited

current buffer index

◆ currentDelayReadIndex

effectsuite_t_default currentDelayReadIndex
protectedinherited

◆ currentDelayWriteIndex

int currentDelayWriteIndex
protectedinherited

◆ delayBuffer

effectsuite_t_default* delayBuffer
protectedinherited

buffer to stored audio buffer for delay effects

◆ delayGain

template<typename effectsuite_t = effectsuite_t_default>
effectsuite_t delayGain = .707
protected

◆ delayTimeSamples

int delayTimeSamples
protectedinherited

the delay time of signal in samples

◆ error

bool error
protectedinherited

internal class error boolean

◆ feedbackGain

template<typename effectsuite_t = effectsuite_t_default>
effectsuite_t feedbackGain = 0.0
protected

◆ filterOrder

int filterOrder
protectedinherited

order of delay filter including the zero delay coefficients

◆ firBuffer

float* firBuffer
protectedinherited

buffer to hold forward delay sample data

◆ firCoefficients

float* firCoefficients
protectedinherited

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

◆ firTemp

float* firTemp
protectedinherited

hold temporary values for fir coeffcient buffer

◆ id_value

int id_value
protectedinherited

◆ iirBuffer

float* iirBuffer
protectedinherited

buffer to hold backward delay sample data

◆ iirCoefficients

float* iirCoefficients
protectedinherited

Denomiator coefficients in delay filter

See also
firCoefficients

◆ iirTemp

float* iirTemp
protectedinherited

hold temporary values for iir coeffcient buffer

◆ interpolationTable

effectsuite_t_default** interpolationTable
staticprotectedinherited

Table of interpolation values as a 2D array indexed by interpolationTable[pointIndex][alphaIndex]. One instance per DelayEffectBase<effectsuite_t> instantiation (previously a single namespace-scope global shared – and type-mismatched – across every effectsuite_t choice).

◆ interpOrder

const int interpOrder
staticprotectedinherited

◆ interpResolution

const int interpResolution
staticprotectedinherited

◆ maxDelayBufferSize

int maxDelayBufferSize
protectedinherited

Maximum number of samples that can be stored in delayBuffer

◆ rmsBuffer

effectsuite_t_default* rmsBuffer
protectedinherited

RMS window buffer

◆ rmsBufferIndex

int rmsBufferIndex
protectedinherited

current write index of rmsBuffer

◆ rmsWindowSize

const int rmsWindowSize
protectedinherited

window size in samples of rms window

◆ samplingRate

int samplingRate
protectedinherited

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