arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
audio_tools::SimpleDelay Class Reference

Simple Delay effect consiting of a single tap delay with Effect Gain and feed back controls Constructor requires internal delay in samples. More...

#include <AudioEffectsSuite.h>

Inheritance diagram for audio_tools::SimpleDelay:
audio_tools::DelayEffectBase audio_tools::EffectSuiteBase audio_tools::AudioEffect

Public Member Functions

 SimpleDelay (int maxDelayInSamples=8810, int samplingRate=44100)
 
 SimpleDelay (SimpleDelay &copy)=default
 
 ~SimpleDelay ()=default
 
SimpleDelayclone () override
 
effect_t process (effect_t inputSample) override
 
effectsuite_t processDouble (effectsuite_t inputSample) override
 
void setDelayGain (effectsuite_t gain)
 
void setDelayTime (effectsuite_t delayInSamples)
 
void setDelayTransitionTime (effectsuite_t seconds)
 
void setFeedbackGain (effectsuite_t gain)
 
void setupSimpleDelay (int delayInSamples)
 
- Public Member Functions inherited from audio_tools::DelayEffectBase
 DelayEffectBase ()=default
 
 DelayEffectBase (DelayEffectBase &copy)=default
 
 DelayEffectBase (int bufferSizeSamples)
 
 ~DelayEffectBase ()
 
void setupDelayEffectBase (const int bufferSizeSamples)
 
- Public Member Functions inherited from audio_tools::AudioEffect
virtual bool active ()
 determines if the effect is active
 
virtual AudioEffectclone ()=0
 
int id ()
 Allows to identify an effect.
 
virtual effect_t process (effect_t in)=0
 calculates the effect output from the input More...
 
virtual void setActive (bool value)
 sets the effect active/inactive
 
void setId (int id)
 Allows to identify an effect.
 

Protected Member Functions

void capGain (effectsuite_t &gain)
 
effectsuite_t getSplineOut (effectsuite_t bufferIndex)
 
- Protected Member Functions inherited from audio_tools::DelayEffectBase
void delaySample (effectsuite_t inputSample)
 
effectsuite_t getInterpolatedOut (effectsuite_t bufferIndex)
 
void incDelayBuffReadIndex (effectsuite_t indexInc)
 
void incDelayBuffWriteIndex ()
 
void printInterpTable ()
 
bool setDelayBuffer (int bufferSizeSamples)
 
void setDelayBuffReadIndex (effectsuite_t index)
 
void storeSample (effectsuite_t inputSample)
 
- Protected Member Functions inherited from audio_tools::AudioEffect
int16_t clip (int32_t in, int16_t clipLimit=32767, int16_t resultLimit=32767)
 generic clipping method
 
void copyParent (AudioEffect *copy)
 

Protected Attributes

int count = 0
 
effectsuite_t currentDelaySamples
 
effectsuite_t delayGain = .707
 
effectsuite_t delayIncrement
 
bool delayTimeChanged = false
 
effectsuite_t delayTransitionTime
 
effectsuite_t delayTransitionTimeInSamples
 
effectsuite_t feedbackGain = 0.
 
effectsuite_t invDelayIncrement
 
effectsuite_t readHeadIndex
 
int sampleRate
 
effectsuite_t targetDelaySamples
 
unsigned int writeHeadIndex
 
- Protected Attributes inherited from audio_tools::DelayEffectBase
effectsuite_t currentDelayReadIndex = 0
 
int currentDelayWriteIndex = 0
 
effectsuite_t * delayBuffer = 0
 
int delayTimeSamples = 44100
 
bool error
 
int maxDelayBufferSize = 441000
 
- Protected Attributes inherited from audio_tools::AudioEffect
bool active_flag = true
 
int id_value = -1
 

Additional Inherited Members

- Static Protected Member Functions inherited from audio_tools::DelayEffectBase
static effectsuite_t ** setInterpolationTable ()
 
- Static Protected Attributes inherited from audio_tools::DelayEffectBase
static const int interpOrder = 4
 
static const int interpResolution = 1000
 

Detailed Description

Simple Delay effect consiting of a single tap delay with Effect Gain and feed back controls Constructor requires internal delay in samples.

See also
process
Author
Matthew Hamilton

Constructor & Destructor Documentation

◆ SimpleDelay()

audio_tools::SimpleDelay::SimpleDelay ( int  maxDelayInSamples = 8810,
int  samplingRate = 44100 
)
inline

Constructor: DigitalEffect Base Must Be initialised

Parameters
delayInSamplesSet the amount of delay in samples
See also
DelayEffectBase constructor

◆ ~SimpleDelay()

audio_tools::SimpleDelay::~SimpleDelay ( )
default

Destructor.

Member Function Documentation

◆ capGain()

void audio_tools::SimpleDelay::capGain ( effectsuite_t &  gain)
inlineprotected

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

Parameters
gainaddress of gain value

◆ clone()

SimpleDelay * audio_tools::SimpleDelay::clone ( )
inlineoverridevirtual

◆ getSplineOut()

effectsuite_t audio_tools::SimpleDelay::getSplineOut ( effectsuite_t  bufferIndex)
inlineprotected

get a cubic spline interpolated out from the wave table Derived from code by Alec Wright at repository: https://github.com/Alec-Wright/Chorus

Authors
Matthew Hamilton, Alec Wright
Parameters
bufferIndexthe required buffer index
Returns
returns interpolated value as effectsuite_t

◆ process()

effect_t audio_tools::SimpleDelay::process ( effect_t  inputSample)
inlineoverridevirtual

Main process block for applying audio effect

Parameters
inputSampleThe int16_t input audio sample for the effect to be applied to
Returns
an audio sample as a int16_t with effect applied

Reimplemented from audio_tools::EffectSuiteBase.

◆ processDouble()

effectsuite_t audio_tools::SimpleDelay::processDouble ( effectsuite_t  inputSample)
inlineoverridevirtual

Apply delay and return input sample along with delay buffer signal

Parameters
inputSample<#inputSample description#>
Returns
<#return value description#>

Implements audio_tools::EffectSuiteBase.

◆ setDelayGain()

void audio_tools::SimpleDelay::setDelayGain ( effectsuite_t  gain)
inline

setDelayGain: sets the delay 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
setFeedbackGain

◆ setDelayTime()

void audio_tools::SimpleDelay::setDelayTime ( effectsuite_t  delayInSamples)
inline

<Description#>

Parameters
delayInSample<#delayInSample description#>

◆ setDelayTransitionTime()

void audio_tools::SimpleDelay::setDelayTransitionTime ( effectsuite_t  seconds)
inline

<Description#>

Parameters
seconds<#seconds description#>

◆ setFeedbackGain()

void audio_tools::SimpleDelay::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

◆ setupSimpleDelay()

void audio_tools::SimpleDelay::setupSimpleDelay ( int  delayInSamples)
inline

<Description#>

Parameters
delayInSamples<#delayInSamples description#>

Member Data Documentation

◆ delayIncrement

effectsuite_t audio_tools::SimpleDelay::delayIncrement
protected

increment when transition from current to target delay per sample set by delayTransitionTime

◆ delayTransitionTime

effectsuite_t audio_tools::SimpleDelay::delayTransitionTime
protected

time in seconds to transition from one delay to another

◆ invDelayIncrement

effectsuite_t audio_tools::SimpleDelay::invDelayIncrement
protected

inverse of delay increment: for working out whole number cyles to reach target delay


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