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

Simple Chorus effect with a single delay voice and mono output Chorus is effective between 15 and 20 miliseconds delay of original audio. Requires the sample rate when initialising. More...

#include <AudioEffectsSuite.h>

Inheritance diagram for audio_tools::SimpleChorus:
audio_tools::DelayEffectBase audio_tools::ModulationBaseClass audio_tools::SimpleLPF audio_tools::FilterEffectBase audio_tools::EffectSuiteBase audio_tools::AudioEffect

Public Member Functions

 SimpleChorus (int extSampleRate=44100)
 
 SimpleChorus (SimpleChorus &copy)=default
 
SimpleChorusclone () override
 
virtual effectsuite_t processDouble (effectsuite_t inputSample) override
 
void setBase (effectsuite_t baseAmount)
 
void setSwing (effectsuite_t swingAmount)
 
void setupChorus (effectsuite_t extSampleRate)
 
- 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::ModulationBaseClass
 ModulationBaseClass ()
 
 ModulationBaseClass (effectsuite_t extSampRate)
 
 ModulationBaseClass (ModulationBaseClass &copy)=default
 
 ~ModulationBaseClass ()=default
 
void clipWave (effectsuite_t amp)
 
bool isNoise ()
 
void printInterpTable ()
 
effectsuite_t readNoise ()
 
effectsuite_t readTable (effectsuite_t freq)
 
void setDC ()
 
bool setInterpTable ()
 
void setNoise ()
 
void setOffSine ()
 
void setRamp ()
 
void setSawtooth ()
 
void setSine ()
 
void setSquare ()
 
void setTriangle ()
 
void setupModulationBaseClass (effectsuite_t extSampRate)
 setup the class with a given sample rate. Basically reperforming the constructor More...
 
- Public Member Functions inherited from audio_tools::SimpleLPF
 SimpleLPF (effectsuite_t cutoff, int order)
 
 SimpleLPF (SimpleLPF &copy)=default
 
 ~SimpleLPF ()=default
 
SimpleLPFclone ()
 
- Public Member Functions inherited from audio_tools::FilterEffectBase
 FilterEffectBase ()
 
 FilterEffectBase (FilterEffectBase &copy)=default
 
 ~FilterEffectBase ()=default
 
virtual effectsuite_t applyFilter (effectsuite_t sampVal)
 
effectsuite_t envelope (effectsuite_t sample)
 
void printBuffers ()
 
void printCoefs ()
 
virtual effect_t process (effect_t inputSample) override
 see applyFilter More...
 
virtual effectsuite_t processDouble (effectsuite_t inputSample) override
 Main process block for applying audio effect. More...
 
bool setChebyICoefficients (effectsuite_t cutFreq, bool shelfType, effectsuite_t ripple)
 
- 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

effectsuite_t getModSignal ()
 
void setRandLfo ()
 
- 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::ModulationBaseClass
bool allocateMemory ()
 
effectsuite_t getInterpOut (effectsuite_t bufferIndex)
 
effectsuite_t getSplineOut (effectsuite_t bufferIndex, int freq)
 
- Protected Member Functions inherited from audio_tools::FilterEffectBase
void allocateBufferMemory ()
 
bool changeChebyICoefficients (effectsuite_t cutFreq, bool shelfType, effectsuite_t ripple, int poles)
 
void clearMemory ()
 
void incBufferIndex ()
 
effectsuite_t rms (effectsuite_t sample)
 
bool setSimpleLpf (int order)
 
- 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

effectsuite_t base
 
effectsuite_t modMax = .5
 
effectsuite_t modMin = .5
 
effectsuite_t modNorm = 1 / (modMax - modMin)
 
const effectsuite_t readSpeed = ((readNoise() + 1) * .5) * .0005
 
effectsuite_t swing
 
- 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::ModulationBaseClass
effectsuite_t interpTable [order][res]
 
bool is_noise = false
 
- Protected Attributes inherited from audio_tools::FilterEffectBase
int bufferIndex = 0
 
int filterOrder = 0
 
effectsuite_t * firBuffer = 0
 
effectsuite_t * firCoefficients = 0
 
effectsuite_t * firTemp = 0
 
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
 
- Protected Attributes inherited from audio_tools::AudioEffect
bool active_flag = true
 
int id_value = -1
 

Additional Inherited Members

- Public Attributes inherited from audio_tools::ModulationBaseClass
int sampleRate
 
effectsuite_t tableIndex = 0
 
effectsuite_t timeStep
 
effectsuite_t * waveTable
 
- 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
 
- Static Protected Attributes inherited from audio_tools::ModulationBaseClass
static const int order = 4
 
static const int res = 100
 
- Static Protected Attributes inherited from audio_tools::FilterEffectBase
static constexpr const effectsuite_t pi = 3.141592653589793
 

Detailed Description

Simple Chorus effect with a single delay voice and mono output Chorus is effective between 15 and 20 miliseconds delay of original audio. Requires the sample rate when initialising.

Author
Matthew Hamilton

Constructor & Destructor Documentation

◆ SimpleChorus()

audio_tools::SimpleChorus::SimpleChorus ( int  extSampleRate = 44100)
inline

Constructor: initialises the effect parameters Since the class inherits DelayEffectBase it must set a delay buffer size when initialisi.

Member Function Documentation

◆ clone()

SimpleChorus * audio_tools::SimpleChorus::clone ( )
inlineoverridevirtual

Reimplemented from audio_tools::SimpleLPF.

◆ getModSignal()

effectsuite_t audio_tools::SimpleChorus::getModSignal ( )
inlineprotected

modulation signal scaling equation: ((n - modMin)*modNorm*swing) + base modulates a random white noise signal by lowpass filtering then scaling to a range between 15 to 25 miliseconds of delay.

◆ processDouble()

virtual effectsuite_t audio_tools::SimpleChorus::processDouble ( effectsuite_t  inputSample)
inlineoverridevirtual

apply chorus effect to audio sample

Parameters
inputSampleinput audio sample
Returns
processed audio sample

Reimplemented from audio_tools::FilterEffectBase.

◆ setBase()

void audio_tools::SimpleChorus::setBase ( effectsuite_t  baseAmount)
inline

sets the 'base' of the chorus: the minimum delay in the signal.

Parameters
baseAmount<#baseAmount description#>

◆ setSwing()

void audio_tools::SimpleChorus::setSwing ( effectsuite_t  swingAmount)
inline

set the 'swing' of the chorus: The amount intensity of vibrato in the delay signal

Parameters
swingAmount<#swingAmount description#>

◆ setupChorus()

void audio_tools::SimpleChorus::setupChorus ( effectsuite_t  extSampleRate)
inline

set parameters and internal sample rate

Parameters
extSampleRateexternal sample rate

Member Data Documentation

◆ base

effectsuite_t audio_tools::SimpleChorus::base
protected

minimum delay in samples. Typically 10 milliseconds

◆ modMax

effectsuite_t audio_tools::SimpleChorus::modMax = .5
protected

the maximum value of the lowpassed random modulation signal

◆ modMin

effectsuite_t audio_tools::SimpleChorus::modMin = .5
protected

the minimum value of the lowpassed random modulation signal

◆ modNorm

effectsuite_t audio_tools::SimpleChorus::modNorm = 1 / (modMax - modMin)
protected

the normalising factor of the random delay signal

◆ swing

effectsuite_t audio_tools::SimpleChorus::swing
protected

swing range of delayed audio index in samples typical maximum swing would be 15 milliseconds (i.e. 0.015*sampleRate)


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