arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
ModulationBaseClass< effectsuite_t > Class Template Reference

Class provides a wave table that can be populated with a number of preallocated waveforms. These can be used to generate audio in themselves or to modulate The parameters of another effect. Class initialised with sample rate. More...

#include <AudioEffectsSuite.h>

Inheritance diagram for ModulationBaseClass< effectsuite_t >:
SimpleChorus< effectsuite_t >

Public Member Functions

 ModulationBaseClass ()
 
 ModulationBaseClass (effectsuite_t extSampRate)
 
 ModulationBaseClass (ModulationBaseClass &copy)
 
 ~ModulationBaseClass ()
 
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
 

Public Attributes

int sampleRate
 
effectsuite_t tableIndex = 0
 
effectsuite_t timeStep
 
effectsuite_t * waveTable = nullptr
 

Protected Member Functions

bool allocateMemory ()
 
effectsuite_t getInterpOut (effectsuite_t bufferIndex)
 
effectsuite_t getSplineOut (effectsuite_t bufferIndex, int freq)
 

Protected Attributes

effectsuite_t interpTable [order][res]
 
bool is_noise = false
 

Static Protected Attributes

static const int order = 4
 
static const int res = 100
 

Detailed Description

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

Class provides a wave table that can be populated with a number of preallocated waveforms. These can be used to generate audio in themselves or to modulate The parameters of another effect. Class initialised with sample rate.

Author
Matthew Hamilton

Constructor & Destructor Documentation

◆ ModulationBaseClass() [1/3]

template<typename effectsuite_t = effectsuite_t_default>
ModulationBaseClass ( )
inline

Constructor

◆ ModulationBaseClass() [2/3]

template<typename effectsuite_t = effectsuite_t_default>
ModulationBaseClass ( ModulationBaseClass< effectsuite_t > &  copy)
inline

◆ ModulationBaseClass() [3/3]

template<typename effectsuite_t = effectsuite_t_default>
ModulationBaseClass ( effectsuite_t  extSampRate)
inline

◆ ~ModulationBaseClass()

template<typename effectsuite_t = effectsuite_t_default>
~ModulationBaseClass ( )
inline

Destructor

Member Function Documentation

◆ allocateMemory()

template<typename effectsuite_t = effectsuite_t_default>
bool allocateMemory ( )
inlineprotected

allocate memory to internal wave table based on sample rate

Returns
returns true on success or false on failure

◆ clipWave()

template<typename effectsuite_t = effectsuite_t_default>
void clipWave ( effectsuite_t  amp)
inline

clip wave table values with a tanh function. Effect change with a variable amp to control intensity.

Parameters
ampamount to multiply signal before being fed through a tanh function

◆ getInterpOut()

template<typename effectsuite_t = effectsuite_t_default>
effectsuite_t getInterpOut ( effectsuite_t  bufferIndex)
inlineprotected

get the interpolated output of the waveTable from the given buffer index

Parameters
bufferIndexbuffer index as effectsuite_t
Returns
returns interpolated value from surrounding wavtable indices

◆ getSplineOut()

template<typename effectsuite_t = effectsuite_t_default>
effectsuite_t getSplineOut ( effectsuite_t  bufferIndex,
int  freq 
)
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
freq(speed) that the table is being read through
Returns
returns interpolated value as effectsuite_t

◆ isNoise()

template<typename effectsuite_t = effectsuite_t_default>
bool isNoise ( )
inline

◆ printInterpTable()

template<typename effectsuite_t = effectsuite_t_default>
void printInterpTable ( )
inline

◆ readNoise()

template<typename effectsuite_t = effectsuite_t_default>
effectsuite_t readNoise ( )
inline

reads out white noise

Returns
random number between -1 and 1

◆ readTable()

template<typename effectsuite_t = effectsuite_t_default>
effectsuite_t readTable ( effectsuite_t  freq)
inline

Read through values in waveTable as a given frequency

Parameters
freqread speed in Hz: essentially the number of samples jumped between reads
Returns
value from table as effectsuite_t

◆ setDC()

template<typename effectsuite_t = effectsuite_t_default>
void setDC ( )
inline

sets wavetable to DC one

◆ setInterpTable()

template<typename effectsuite_t = effectsuite_t_default>
bool setInterpTable ( )
inline

populates the internal interpolation table

Returns
return tru on success, else false

◆ setNoise()

template<typename effectsuite_t = effectsuite_t_default>
void setNoise ( )
inline

◆ setOffSine()

template<typename effectsuite_t = effectsuite_t_default>
void setOffSine ( )
inline

sets wavetable to one period of a sine wave oscillating between 0 and 1

◆ setRamp()

template<typename effectsuite_t = effectsuite_t_default>
void setRamp ( )
inline

set wave table to be a ramp from 0 to 1

◆ setSawtooth()

template<typename effectsuite_t = effectsuite_t_default>
void setSawtooth ( )
inline

sets wavetable to one period of a sawtooth wave

◆ setSine()

template<typename effectsuite_t = effectsuite_t_default>
void setSine ( )
inline

sets wavetable to one period of a sine wave oscillating between -1 and 1

◆ setSquare()

template<typename effectsuite_t = effectsuite_t_default>
void setSquare ( )
inline

sets wavetable to one period of a square wave

◆ setTriangle()

template<typename effectsuite_t = effectsuite_t_default>
void setTriangle ( )
inline

sets wavetable to one period of a triangle wave

◆ setupModulationBaseClass()

template<typename effectsuite_t = effectsuite_t_default>
void setupModulationBaseClass ( effectsuite_t  extSampRate)
inline

setup the class with a given sample rate. Basically reperforming the constructor

Parameters
extSampRateExternal sample rate

Member Data Documentation

◆ interpTable

template<typename effectsuite_t = effectsuite_t_default>
effectsuite_t interpTable[order][res]
protected

◆ is_noise

template<typename effectsuite_t = effectsuite_t_default>
bool is_noise = false
protected

◆ order

template<typename effectsuite_t = effectsuite_t_default>
const int order = 4
staticprotected

◆ res

template<typename effectsuite_t = effectsuite_t_default>
const int res = 100
staticprotected

◆ sampleRate

template<typename effectsuite_t = effectsuite_t_default>
int sampleRate

Internal Sample Rate

◆ tableIndex

template<typename effectsuite_t = effectsuite_t_default>
effectsuite_t tableIndex = 0

current table read index

◆ timeStep

template<typename effectsuite_t = effectsuite_t_default>
effectsuite_t timeStep

time between samples: 1/sampRate

◆ waveTable

template<typename effectsuite_t = effectsuite_t_default>
effectsuite_t* waveTable = nullptr

store modulation signal as


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