arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
STKGenerator< StkCls, T > Class Template Reference

The Synthesis ToolKit in C++ (STK) is a set of open source audio signal processing and algorithmic synthesis classes written in the C++ programming language. You need to install https://github.com/pschatzmann/Arduino-STK. More...

#include <AudioSTK.h>

Inheritance diagram for STKGenerator< StkCls, T >:
SoundGenerator< T > STKInstrument< StkCls, T >

Public Member Functions

 STKGenerator ()=default
 
 STKGenerator (StkCls &instrument)
 
virtual AudioInfo audioInfo ()
 Provides the AudioInfo.
 
virtual bool begin ()
 
bool begin (AudioInfo cfg)
 Starts the processing.
 
AudioInfo defaultConfig ()
 provides the default configuration
 
virtual void end ()
 ends the processing
 
virtual bool isActive ()
 
virtual size_t readBytes (uint8_t *data, size_t len)
 Provides the data as byte array with the requested number of channels.
 
T readSample ()
 Provides a single sample.
 
virtual void setAudioInfo (AudioInfo info)
 Defines/updates the AudioInfo.
 
virtual void setFrequency (float frequency)
 Abstract method: not implemented! Just provides an error message...
 
void setInput (StkCls &instrument)
 
void setPlayTime (uint32_t playMs, uint8_t upPercent=20, uint8_t downPercent=30)
 

Protected Member Functions

T applyRamp (T sample)
 
size_t readBytesFrames (uint8_t *buffer, size_t lengthBytes, int frames, int channels)
 
size_t readBytesFromBuffer (uint8_t *buffer, size_t lengthBytes, int frame_size, int channels)
 
void recalculatePlayTime ()
 

Protected Attributes

bool active = false
 
bool activeWarningIssued = false
 
uint32_t currentSample = 0
 
uint8_t downPercent = 40
 
float factor = 1.0f
 
AudioInfo info
 
T max_value
 
StkClsp_instrument = nullptr
 
uint32_t playMs = 0
 
uint32_t playSamples = 0
 
float rampDownDec = 0.0
 
uint32_t rampDownSamples = 0
 
float rampUpInc = 0.0
 
RingBuffer< uint8_tring_buffer {0}
 
uint8_t upPercent = 5
 
uint32_t upSamples = 0
 

Detailed Description

template<class StkCls = stk::Generator, class T = int16_t>
class audio_tools::STKGenerator< StkCls, T >

The Synthesis ToolKit in C++ (STK) is a set of open source audio signal processing and algorithmic synthesis classes written in the C++ programming language. You need to install https://github.com/pschatzmann/Arduino-STK.

You can find further informarmation in the original Readme of the STK Project

Like many other sound libraries it originates from an University (Princeton) and can look back at a very long history: it was created in 1995. In the 90s the computers had limited processor power and memory available. In todays world we can get some cheap Microcontrollers, which provide almost the same capabilities.

Template Parameters
T
Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ STKGenerator() [1/2]

template<class StkCls = stk::Generator, class T = int16_t>
STKGenerator ( )
default

◆ STKGenerator() [2/2]

template<class StkCls = stk::Generator, class T = int16_t>
STKGenerator ( StkCls instrument)
inline

Member Function Documentation

◆ applyRamp()

template<class T = int16_t>
T applyRamp ( T  sample)
inlineprotectedinherited

◆ audioInfo()

template<class T = int16_t>
virtual AudioInfo audioInfo ( )
inlinevirtualinherited

Provides the AudioInfo.

◆ begin() [1/2]

template<class T = int16_t>
virtual bool begin ( )
inlinevirtualinherited

◆ begin() [2/2]

template<class StkCls = stk::Generator, class T = int16_t>
bool begin ( AudioInfo  cfg)
inlinevirtual

Starts the processing.

Reimplemented from SoundGenerator< T >.

◆ defaultConfig()

template<class StkCls = stk::Generator, class T = int16_t>
AudioInfo defaultConfig ( )
inlinevirtual

provides the default configuration

Reimplemented from SoundGenerator< T >.

◆ end()

template<class T = int16_t>
virtual void end ( )
inlinevirtualinherited

ends the processing

Reimplemented in GeneratorFromArray< T >.

◆ isActive()

template<class T = int16_t>
virtual bool isActive ( )
inlinevirtualinherited

Checks if the begin method has been called - after end() isActive returns false

◆ readBytes()

template<class T = int16_t>
virtual size_t readBytes ( uint8_t data,
size_t  len 
)
inlinevirtualinherited

Provides the data as byte array with the requested number of channels.

◆ readBytesFrames()

template<class T = int16_t>
size_t readBytesFrames ( uint8_t buffer,
size_t  lengthBytes,
int  frames,
int  channels 
)
inlineprotectedinherited

◆ readBytesFromBuffer()

template<class T = int16_t>
size_t readBytesFromBuffer ( uint8_t buffer,
size_t  lengthBytes,
int  frame_size,
int  channels 
)
inlineprotectedinherited

◆ readSample()

template<class StkCls = stk::Generator, class T = int16_t>
T readSample ( )
inlinevirtual

Provides a single sample.

Implements SoundGenerator< T >.

◆ recalculatePlayTime()

template<class T = int16_t>
void recalculatePlayTime ( )
inlineprotectedinherited

◆ setAudioInfo()

template<class T = int16_t>
virtual void setAudioInfo ( AudioInfo  info)
inlinevirtualinherited

Defines/updates the AudioInfo.

Reimplemented in SineWaveGenerator< T >, and SineWaveGenerator< int16_t >.

◆ setFrequency()

template<class T = int16_t>
virtual void setFrequency ( float  frequency)
inlinevirtualinherited

Abstract method: not implemented! Just provides an error message...

Reimplemented in SineFromTable< T >, STKInstrument< StkCls, T >, SineWaveGenerator< T >, and SineWaveGenerator< int16_t >.

◆ setInput()

template<class StkCls = stk::Generator, class T = int16_t>
void setInput ( StkCls instrument)
inline

◆ setPlayTime()

template<class T = int16_t>
void setPlayTime ( uint32_t  playMs,
uint8_t  upPercent = 20,
uint8_t  downPercent = 30 
)
inlineinherited

Member Data Documentation

◆ active

template<class T = int16_t>
bool active = false
protectedinherited

◆ activeWarningIssued

template<class T = int16_t>
bool activeWarningIssued = false
protectedinherited

◆ currentSample

template<class T = int16_t>
uint32_t currentSample = 0
protectedinherited

◆ downPercent

template<class T = int16_t>
uint8_t downPercent = 40
protectedinherited

◆ factor

template<class T = int16_t>
float factor = 1.0f
protectedinherited

◆ info

template<class T = int16_t>
AudioInfo info
protectedinherited

◆ max_value

template<class StkCls = stk::Generator, class T = int16_t>
T max_value
protected

◆ p_instrument

template<class StkCls = stk::Generator, class T = int16_t>
StkCls* p_instrument = nullptr
protected

◆ playMs

template<class T = int16_t>
uint32_t playMs = 0
protectedinherited

◆ playSamples

template<class T = int16_t>
uint32_t playSamples = 0
protectedinherited

◆ rampDownDec

template<class T = int16_t>
float rampDownDec = 0.0
protectedinherited

◆ rampDownSamples

template<class T = int16_t>
uint32_t rampDownSamples = 0
protectedinherited

◆ rampUpInc

template<class T = int16_t>
float rampUpInc = 0.0
protectedinherited

◆ ring_buffer

template<class T = int16_t>
RingBuffer<uint8_t> ring_buffer {0}
protectedinherited

◆ upPercent

template<class T = int16_t>
uint8_t upPercent = 5
protectedinherited

◆ upSamples

template<class T = int16_t>
uint32_t upSamples = 0
protectedinherited

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