|
arduino-audio-tools
|
Abstract base class for effects that operate on audio in the frequency domain: incoming samples are transformed with a forward FFT, the resulting bins are modified by the effect() method that a subclass implements, and the modified spectrum is transformed back with an inverse FFT (overlap-add) and streamed to the output. More...
#include <FFTEffects.h>
Public Member Functions | |
| FFTEffect (Print &out) | |
| FFTEffect (Print &out, AudioFFTBase &fft) | |
| virtual void | addNotifyAudioChange (AudioInfoSupport &bi) |
| Adds target to be notified about audio changes. | |
| virtual AudioInfo | audioInfo () override |
| provides the actual input AudioInfo | |
| virtual AudioInfo | audioInfoOut () |
| virtual int | availableForWrite () override |
| bool | begin () override |
| virtual bool | begin (AudioInfo info) |
| bool | begin (FFTEffectConfig info) |
| virtual void | clearNotifyAudioChange () |
| Deletes all change notify subscriptions. | |
| FFTEffectConfig | defaultConfig () |
| virtual void | end () |
| virtual void | flush () |
| virtual bool | isDeletable () |
| If true we need to release the related memory in the destructor. | |
| bool | isNotifyActive () |
| Checks if the automatic AudioInfo update is active. | |
| virtual | operator bool () |
| virtual bool | removeNotifyAudioChange (AudioInfoSupport &bi) |
| Removes a target in order not to be notified about audio changes. | |
| virtual void | setAudioInfo (AudioInfo newInfo) override |
| Defines the input AudioInfo. | |
| void | setNotifyActive (bool flag) |
| Deactivate/Reactivate automatic AudioInfo updates: (default is active) | |
| size_t | write (const uint8_t *data, size_t len) override |
| virtual size_t | write (uint8_t ch) override |
| virtual void | writeSilence (size_t len) |
Protected Member Functions | |
| virtual void | effect (AudioFFTBase &fft)=0 |
| void | notifyAudioChange (AudioInfo info) |
| void | processOutput () |
Static Protected Member Functions | |
| static void | effect_callback (AudioFFTBase &fft) |
Protected Attributes | |
| int | _timeout = 10 |
| BufferedWindow | buffered {&hann} |
| AudioInfo | cfg |
| StreamCopy | copier |
| AudioRealFFT | default_fft |
| AudioFFTConfig | fft_cfg {default_fft.defaultConfig(RXTX_MODE)} |
| Hann | hann |
| bool | is_active = false |
| bool | is_notify_active = true |
| Vector< AudioInfoSupport * > | notify_vector |
| AudioFFTBase * | p_fft = nullptr |
| Print * | p_out = nullptr |
| SingleBuffer< uint8_t > | tmp {MAX_SINGLE_CHARS} |
| int | tmpPos = 0 |
Abstract base class for effects that operate on audio in the frequency domain: incoming samples are transformed with a forward FFT, the resulting bins are modified by the effect() method that a subclass implements, and the modified spectrum is transformed back with an inverse FFT (overlap-add) and streamed to the output.
Processing pipeline driven by write():
Usage:
By default an internally owned AudioRealFFT performs the fft/ifft; pass a different AudioFFTBase-derived instance (e.g. AudioKissFFT, AudioCmsisFFT, AudioESP32FFT, AudioEspressifFFT, AudioFixedFFT) to the constructor to use a different implementation. The engine must outlive the effect.
To implement a new effect, subclass FFTEffect and override effect(AudioFFTBase&); see FFTRobotize, FFTWhisper, FFTPitchShift and FFTEqualizer for examples.
|
inline |
|
inlinevirtualinherited |
Adds target to be notified about audio changes.
Reimplemented in CodecNOP, EncodedAudioOutput, EncodedAudioStream, AACDecoderFDK, DecoderBasic, CodecChain, MP3DecoderHelix, MP3DecoderMAD, OggContainerDecoder, RTSPClient< TcpClient, UdpSocket >, Pipeline, and Pipeline::ModifyingStreamAdapter.
|
inlineoverridevirtualinherited |
provides the actual input AudioInfo
Implements AudioInfoSupport.
Reimplemented in AdapterPrintToAudioOutput, EncodedAudioOutput, and AdapterAudioStreamToAudioOutput.
|
inlinevirtualinherited |
provides the actual output AudioInfo: this is usually the same as audioInfo() unless we use a transforming stream
Reimplemented in MP3EncoderShine, PureDataStream, PWMAudioOutput< PWMDriverT >, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, FormatConverterStream, Pipeline, ResampleStream, and ResampleStreamT< TInterpolator >.
|
inlineoverridevirtualinherited |
Reimplemented from Print.
Reimplemented in AudioESP32ULP, RTSPOutput< Platform >, SPIAudioMaster, EncodedAudioOutput, AudioServerEx, AudioSyncWriter, AdapterAudioStreamToAudioOutput, CsvOutput< T >, MemoryOutput, and PWMAudioOutput< PWMDriverT >.
|
inlineoverridevirtual |
Reimplemented from AudioOutput.
Reimplemented in FFTPitchShift, and FFTEqualizer.
|
inlinevirtualinherited |
Reimplemented in AudioESP32ULP, RTSPOutput< Platform >, RTTTLOutput< T >, ChannelsSelectOutput, CsvOutput< T >, and EncodedAudioOutput.
|
inline |
|
inlinevirtualinherited |
Deletes all change notify subscriptions.
Reimplemented in RTSPClient< TcpClient, UdpSocket >.
|
inline |
|
protectedpure virtual |
Implemented in FFTRobotize, FFTWhisper, FFTNop, FFTPitchShift, and FFTEqualizer.
|
inlinestaticprotected |
|
inlinevirtualinherited |
|
inlinevirtualinherited |
Reimplemented from Print.
Reimplemented in MultiOutput, and HexDumpOutput.
|
inlinevirtualinherited |
If true we need to release the related memory in the destructor.
Reimplemented in AdapterPrintToAudioOutput, and AdapterAudioStreamToAudioOutput.
|
inlineinherited |
Checks if the automatic AudioInfo update is active.
|
inlineprotectedinherited |
|
inlinevirtualinherited |
Reimplemented in RTSPOutput< Platform >, EncodedAudioOutput, and AdapterAudioStreamToAudioOutput.
|
inlineprotected |
|
inlinevirtualinherited |
Removes a target in order not to be notified about audio changes.
Reimplemented in RTSPClient< TcpClient, UdpSocket >.
|
inlineoverridevirtualinherited |
Defines the input AudioInfo.
Implements AudioInfoSupport.
Reimplemented in ChannelsSelectOutput, AdapterPrintToAudioOutput, MultiOutput, SPIAudioMaster, AdapterAudioStreamToAudioOutput, CsvOutput< T >, PWMAudioOutput< PWMDriverT >, and EncodedAudioOutput.
|
inlineinherited |
Deactivate/Reactivate automatic AudioInfo updates: (default is active)
|
inlineoverridevirtual |
Implements AudioOutput.
|
inlineoverridevirtualinherited |
Reimplemented in MetaDataOutput, and MultiOutput.
|
inlinevirtualinherited |
Writes n 0 values (= silence)
| len |
|
protectedinherited |
|
protected |
|
protectedinherited |
|
protected |
|
protected |
|
protected |
|
protected |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protected |
|
protected |
|
protectedinherited |
|
protectedinherited |