arduino-audio-tools
Loading...
Searching...
No Matches
EqualizerNBands< SampleT, AccT, NUM_TAPS, NUM_BANDS > Class Template Reference

N-Band Equalizer using FIR filters with logarithmically spaced bands. More...

#include <EqualizerNBands.h>

Inheritance diagram for EqualizerNBands< SampleT, AccT, NUM_TAPS, NUM_BANDS >:
ModifyingStream AudioStream AudioStream AudioInfoSource AudioInfoSupport BaseStream AudioInfoSource AudioInfoSupport BaseStream AudioInfoSource AudioInfoSupport BaseStream AudioInfoSource AudioInfoSupport BaseStream

Classes

class  EQFIRFilter

Public Member Functions

 EqualizerNBands ()
 EqualizerNBands (AudioOutput &out)
 EqualizerNBands (AudioStream &stream)
 EqualizerNBands (Print &out)
 EqualizerNBands (Stream &in)
 ~EqualizerNBands ()
virtual void addNotifyAudioChange (AudioInfoSupport &bi)
 Adds target to be notified about audio changes.
virtual void addNotifyAudioChange (AudioInfoSupport &bi)
 Adds target to be notified about audio changes.
virtual AudioInfo audioInfo () override
 provides the actual input AudioInfo
virtual AudioInfo audioInfo () override
 provides the actual input AudioInfo
virtual AudioInfo audioInfoOut ()
virtual AudioInfo audioInfoOut ()
virtual int available () override
virtual int available () override
virtual int availableForWrite () override
virtual int availableForWrite () override
bool begin () override
 Initializes the equalizer with the current audio info.
bool begin (AudioInfo info)
virtual void clearNotifyAudioChange ()
 Deletes all change notify subscriptions.
virtual void clearNotifyAudioChange ()
 Deletes all change notify subscriptions.
void end ()
void flush () override
int getBandCount () const
 Get number of bands.
float getBandDB (int band) const
float getBandFrequency (int band) const
float getBandGain (int band)
 Get current gain for a specific band as normalized volume (-1.0 to 1.0).
bool isNotifyActive ()
 Checks if the automatic AudioInfo update is active.
bool isNotifyActive ()
 Checks if the automatic AudioInfo update is active.
virtual operator bool ()
virtual operator bool ()
size_t readBytes (uint8_t *data, size_t len) override
virtual size_t readSilence (uint8_t *buffer, size_t length)
 Source to generate silence: just sets the buffer to 0.
virtual size_t readSilence (uint8_t *buffer, size_t length)
 Source to generate silence: just sets the buffer to 0.
virtual bool removeNotifyAudioChange (AudioInfoSupport &bi)
 Removes a target in order not to be notified about audio changes.
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.
virtual void setAudioInfo (AudioInfo newInfo) override
 Defines the input AudioInfo.
void setAutoUpdate (bool enabled)
bool setBandDB (int band, float gainDb)
bool setBandGain (int band, float volume)
bool setBandGains (float volume)
 Set same gain for all frequency bands.
void setNotifyActive (bool flag)
 Deactivate/Reactivate automatic AudioInfo updates: (default is active).
void setNotifyActive (bool flag)
 Deactivate/Reactivate automatic AudioInfo updates: (default is active).
virtual void setOutput (AudioOutput &out)
 Defines/Changes the output target and registers for audio change notifications.
void setOutput (Print &out) override
virtual void setStream (AudioStream &io)
 Defines/Changes the input & output and registers for audio change notifications.
void setStream (Stream &io) override
void setWriteBufferSize (int size)
void setWriteBufferSize (int size)
bool update ()
virtual size_t write (uint8_t ch) override
size_t write (const uint8_t *data, size_t len) override
virtual void writeSilence (size_t len)
 Writes len bytes of silence (=0).
virtual void writeSilence (size_t len)
 Writes len bytes of silence (=0).

Protected Member Functions

void enterCritical ()
void exitCritical ()
void initializeKernel (volatile int16_t *kernel)
template<typename T>
float map (T x, T in_min, T in_max, T out_min, T out_max)
void maybeUpdateKernel ()
virtual int not_supported (int out, const char *msg="")
virtual int not_supported (int out, const char *msg="")
void notifyAudioChange (AudioInfo info)
void notifyAudioChange (AudioInfo info)
void preCalculateWindow ()
void refillReadBuffer ()
 Refill small read buffer (e.g. 8 bytes) to avoid single byte reads when calling read().
void refillReadBuffer ()
 Refill small read buffer (e.g. 8 bytes) to avoid single byte reads when calling read().
void setupFrequencies (int sampleRate)
float sinc (float x)
bool updateFIRKernel ()

Protected Attributes

int _timeout = 10
volatile int16_t * activeKernel
bool autoUpdate = false
float centerFreqs [NUM_BANDS]
int currentSampleRate = 0
FilteredStream< SampleT, SampleT > filtered
Vector< EQFIRFilter > fir_vector
 Vector of FIR filters for each channel.
float gains [NUM_BANDS] = {0}
volatile bool gainsDirty = false
AudioInfo info
bool is_notify_active = true
volatile bool isUpdating = false
int16_t kernelA [NUM_TAPS]
int16_t kernelB [NUM_TAPS]
Vector< AudioInfoSupport * > notify_vector
Stream * p_io = nullptr
 Input stream for read operations.
Print * p_out = nullptr
 Output stream for write operations.
float pendingGains [NUM_BANDS] = {0}
float tempFloat [NUM_TAPS] = {0}
RingBuffer< uint8_t > tmp_in {0}
RingBuffer< uint8_t > tmp_out {0}
volatile int16_t * updateKernel
float windowCoeffs [NUM_TAPS]
int write_buffer_size = 8

Static Protected Attributes

static constexpr float Q15_SCALE = 32767.0f

Detailed Description

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
class audio_tools::EqualizerNBands< SampleT, AccT, NUM_TAPS, NUM_BANDS >

N-Band Equalizer using FIR filters with logarithmically spaced bands.

This class implements a graphic equalizer with configurable number of bands using FIR (Finite Impulse Response) filtering. Frequency bands are logarithmically spaced between 20Hz and Nyquist frequency.

Features:

  • Template-based configuration for number of taps and bands
  • Fixed-point Q15 arithmetic for efficient processing on embedded systems
  • Blackman windowing for reduced spectral leakage
  • Per-band gain control (-90dB to +12dB)
  • Multi-channel support
  • Double-buffered kernel for thread-safe real-time updates

Thread Safety: Uses double-buffering with two kernel buffers. Audio processing reads from the active kernel while updates are written to the inactive kernel. An atomic pointer swap ensures glitch-free transitions without blocking audio processing.

Template Parameters
NUM_TAPSNumber of FIR filter taps (higher = sharper transitions, more CPU usage). Typical values: 64, 128, 256
NUM_BANDSNumber of frequency bands. Typical values: 3, 5, 10, 31
Note
NUM_TAPS should be odd for symmetric filter response
Higher NUM_TAPS values require more memory and processing time

Constructor & Destructor Documentation

◆ EqualizerNBands() [1/5]

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
EqualizerNBands ( )
inline

◆ EqualizerNBands() [2/5]

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
EqualizerNBands ( Print & out)
inline

Constructor with Print output

Parameters
outPrint stream for output

◆ EqualizerNBands() [3/5]

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
EqualizerNBands ( Stream & in)
inline

Constructor with Stream input

Parameters
inStream for input

◆ EqualizerNBands() [4/5]

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
EqualizerNBands ( AudioOutput & out)
inline

Constructor with AudioOutput

Parameters
outAudioOutput for output with automatic audio change notifications

◆ EqualizerNBands() [5/5]

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
EqualizerNBands ( AudioStream & stream)
inline

Constructor with AudioStream

Parameters
streamAudioStream for input/output with automatic audio change notifications

◆ ~EqualizerNBands()

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
~EqualizerNBands ( )
inline

Member Function Documentation

◆ addNotifyAudioChange() [1/2]

virtual void addNotifyAudioChange ( AudioInfoSupport & bi)
inlinevirtualinherited

Adds target to be notified about audio changes.

Reimplemented in CodecNOP, CodecNOP, EncodedAudioOutput, and EncodedAudioStream.

◆ addNotifyAudioChange() [2/2]

virtual void addNotifyAudioChange ( AudioInfoSupport & bi)
inlinevirtualinherited

Adds target to be notified about audio changes.

Reimplemented in CodecNOP, CodecNOP, EncodedAudioOutput, and EncodedAudioStream.

◆ audioInfo() [1/2]

◆ audioInfo() [2/2]

◆ audioInfoOut() [1/2]

◆ audioInfoOut() [2/2]

◆ available() [1/2]

virtual int available ( )
inlineoverridevirtualinherited

Reimplemented from Stream.

Reimplemented in A2DPStream, AnalogAudioStream, AudioStreamWrapper, AudioStreamWrapper, BufferedStream, BufferedStream, CallbackStream, CallbackStream, CatStream, CatStream, ConverterStream< T >, ConverterStream< T >, DynamicMemoryStream, DynamicMemoryStream, FilteredStream< T, TF >, FilteredStream< T, TF >, FilteredStream< int16_t, int16_t >, GeneratedSoundStream< T >, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, InputMerge< T >, InputMerge< T >, InputMixer< T, SumT >, InputMixer< T, SumT >, MemoryStream, MemoryStream, ProgressStream, ProgressStream, QueueStream< T >, QueueStream< T >, QueueStream< uint8_t >, ReformatBaseStream, RingBufferStream, RingBufferStream, Throttle, Throttle, TimedStream, AudioBLEClient, AudioBLEClient, AudioBLEServer, AudioBLEServer, AudioEffectStream, AudioEffectStreamT< T >, AudioFFTBase, AudioKitStream, AudioLoRa, AudioMP34DT05, AudioStreamWrapper, AutomaticGainControlStream, BufferedStream, BufferedTaskStream, CallbackStream, CatStream, ChannelFormatConverterStream, ChannelFormatConverterStreamT< T >, ConverterStream< T >, DynamicMemoryStream, Equalizer3BandsPerChannelT< T >, Equalizer3BandsPerChannelT< float >, Equalizer3BandsT< T >, Equalizer3BandsT< float >, ESPNowStream, FadeStream, FaustStream< DSP >, FileLoopT< FileType >, FileLoopT< File >, FilteredStream< T, TF >, FrequencyDetectorAutoCorrelation, FrequencyDetectorZeroCrossing, GeneratedSoundStream< T >, HammingFEC< bytecount, block_t >, HLSStreamT< URLStream >, HLSStreamT< URLStreamESP32 >, HttpRequest, I2SCodecStream, I2SStream, ICYStreamT< T >, ICYStreamT< URLStream >, ICYStreamT< URLStreamESP32 >, InputMerge< T >, InputMixer< T, SumT >, MeasuringStream, MemoryStream, MiniAudioStream, NRF24Stream, NumberFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, Pipeline, Pipeline::ModifyingStreamAdapter, ProgressStream, QualityAnalysisStream, QueueStream< T >, ReedSolomonFEC< bytecount, additional_bytes >, ReformatBaseStream, RingBufferStream, SPIAudioSlave, StdioStream, SupportedRatesStream, TfLiteAudioStream, Throttle, TimedStream, UDPStream, URLStream, URLStreamBufferedT< T >, URLStreamBufferedT< ICYStream >, URLStreamBufferedT< ICYStreamESP32 >, URLStreamBufferedT< URLStream >, URLStreamBufferedT< URLStreamESP32 >, USBAudioStreamBase, VBANStream, and VolumeStream.

◆ available() [2/2]

virtual int available ( )
inlineoverridevirtualinherited

Reimplemented from Stream.

Reimplemented in A2DPStream, AnalogAudioStream, AudioStreamWrapper, AudioStreamWrapper, BufferedStream, BufferedStream, CallbackStream, CallbackStream, CatStream, CatStream, ConverterStream< T >, ConverterStream< T >, DynamicMemoryStream, DynamicMemoryStream, FilteredStream< T, TF >, FilteredStream< T, TF >, FilteredStream< int16_t, int16_t >, GeneratedSoundStream< T >, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, InputMerge< T >, InputMerge< T >, InputMixer< T, SumT >, InputMixer< T, SumT >, MemoryStream, MemoryStream, ProgressStream, ProgressStream, QueueStream< T >, QueueStream< T >, QueueStream< uint8_t >, ReformatBaseStream, RingBufferStream, RingBufferStream, Throttle, Throttle, TimedStream, AudioBLEClient, AudioBLEClient, AudioBLEServer, AudioBLEServer, AudioEffectStream, AudioEffectStreamT< T >, AudioFFTBase, AudioKitStream, AudioLoRa, AudioMP34DT05, AudioStreamWrapper, AutomaticGainControlStream, BufferedStream, BufferedTaskStream, CallbackStream, CatStream, ChannelFormatConverterStream, ChannelFormatConverterStreamT< T >, ConverterStream< T >, DynamicMemoryStream, Equalizer3BandsPerChannelT< T >, Equalizer3BandsPerChannelT< float >, Equalizer3BandsT< T >, Equalizer3BandsT< float >, ESPNowStream, FadeStream, FaustStream< DSP >, FileLoopT< FileType >, FileLoopT< File >, FilteredStream< T, TF >, FrequencyDetectorAutoCorrelation, FrequencyDetectorZeroCrossing, GeneratedSoundStream< T >, HammingFEC< bytecount, block_t >, HLSStreamT< URLStream >, HLSStreamT< URLStreamESP32 >, HttpRequest, I2SCodecStream, I2SStream, ICYStreamT< T >, ICYStreamT< URLStream >, ICYStreamT< URLStreamESP32 >, InputMerge< T >, InputMixer< T, SumT >, MeasuringStream, MemoryStream, MiniAudioStream, NRF24Stream, NumberFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, Pipeline, Pipeline::ModifyingStreamAdapter, ProgressStream, QualityAnalysisStream, QueueStream< T >, ReedSolomonFEC< bytecount, additional_bytes >, ReformatBaseStream, RingBufferStream, SPIAudioSlave, StdioStream, SupportedRatesStream, TfLiteAudioStream, Throttle, TimedStream, UDPStream, URLStream, URLStreamBufferedT< T >, URLStreamBufferedT< ICYStream >, URLStreamBufferedT< ICYStreamESP32 >, URLStreamBufferedT< URLStream >, URLStreamBufferedT< URLStreamESP32 >, USBAudioStreamBase, VBANStream, and VolumeStream.

◆ availableForWrite() [1/2]

virtual int availableForWrite ( )
inlineoverridevirtualinherited

Reimplemented from Print.

Reimplemented in A2DPStream, AbstractURLStream, AnalogAudioStream, AudioStreamWrapper, AudioStreamWrapper, ConverterStream< T >, ConverterStream< T >, DynamicMemoryStream, DynamicMemoryStream, EncodedAudioStream, FilteredStream< T, TF >, FilteredStream< T, TF >, FilteredStream< int16_t, int16_t >, MemoryStream, MemoryStream, ProgressStream, ProgressStream, QueueStream< T >, QueueStream< T >, QueueStream< uint8_t >, ReformatBaseStream, RingBufferStream, RingBufferStream, Throttle, Throttle, TimedStream, AudioBLEClient, AudioBLEClient, AudioBLEServer, AudioBLEServer, AudioEffectStream, AudioEffectStreamT< T >, AudioFFTBase, AudioLoRa, AudioStreamWrapper, AutomaticGainControlStream, ChannelFormatConverterStream, ChannelFormatConverterStreamT< T >, ConverterStream< T >, DynamicMemoryStream, EncodedAudioStream, Equalizer3BandsPerChannelT< T >, Equalizer3BandsPerChannelT< float >, Equalizer3BandsT< T >, Equalizer3BandsT< float >, ESPNowStream, FadeStream, FaustStream< DSP >, FilteredStream< T, TF >, FrequencyDetectorAutoCorrelation, FrequencyDetectorZeroCrossing, HammingFEC< bytecount, block_t >, I2SCodecStream, I2SStream, MeasuringStream, MemoryStream, MiniAudioStream, NRF24Stream, NumberFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, Pipeline, ProgressStream, QualityAnalysisStream, QueueStream< T >, ReedSolomonFEC< bytecount, additional_bytes >, ReformatBaseStream, RingBufferStream, SPIAudioSlave, StdioStream, SupportedRatesStream, Throttle, TimedStream, UDPStream, URLStreamESP32, USBAudioStreamBase, VBANStream, and VolumeStream.

◆ availableForWrite() [2/2]

virtual int availableForWrite ( )
inlineoverridevirtualinherited

Reimplemented from Print.

Reimplemented in A2DPStream, AbstractURLStream, AnalogAudioStream, AudioStreamWrapper, AudioStreamWrapper, ConverterStream< T >, ConverterStream< T >, DynamicMemoryStream, DynamicMemoryStream, EncodedAudioStream, FilteredStream< T, TF >, FilteredStream< T, TF >, FilteredStream< int16_t, int16_t >, MemoryStream, MemoryStream, ProgressStream, ProgressStream, QueueStream< T >, QueueStream< T >, QueueStream< uint8_t >, ReformatBaseStream, RingBufferStream, RingBufferStream, Throttle, Throttle, TimedStream, AudioBLEClient, AudioBLEClient, AudioBLEServer, AudioBLEServer, AudioEffectStream, AudioEffectStreamT< T >, AudioFFTBase, AudioLoRa, AudioStreamWrapper, AutomaticGainControlStream, ChannelFormatConverterStream, ChannelFormatConverterStreamT< T >, ConverterStream< T >, DynamicMemoryStream, EncodedAudioStream, Equalizer3BandsPerChannelT< T >, Equalizer3BandsPerChannelT< float >, Equalizer3BandsT< T >, Equalizer3BandsT< float >, ESPNowStream, FadeStream, FaustStream< DSP >, FilteredStream< T, TF >, FrequencyDetectorAutoCorrelation, FrequencyDetectorZeroCrossing, HammingFEC< bytecount, block_t >, I2SCodecStream, I2SStream, MeasuringStream, MemoryStream, MiniAudioStream, NRF24Stream, NumberFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, Pipeline, ProgressStream, QualityAnalysisStream, QueueStream< T >, ReedSolomonFEC< bytecount, additional_bytes >, ReformatBaseStream, RingBufferStream, SPIAudioSlave, StdioStream, SupportedRatesStream, Throttle, TimedStream, UDPStream, URLStreamESP32, USBAudioStreamBase, VBANStream, and VolumeStream.

◆ begin() [1/2]

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
bool begin ( )
inlineoverridevirtual

Initializes the equalizer with the current audio info.

Reimplemented from BaseStream.

◆ begin() [2/2]

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
bool begin ( AudioInfo info)
inline

◆ clearNotifyAudioChange() [1/2]

virtual void clearNotifyAudioChange ( )
inlinevirtualinherited

◆ clearNotifyAudioChange() [2/2]

virtual void clearNotifyAudioChange ( )
inlinevirtualinherited

◆ end()

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
void end ( )
inlinevirtual

Reimplemented from BaseStream.

◆ enterCritical()

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
void enterCritical ( )
inlineprotected

◆ exitCritical()

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
void exitCritical ( )
inlineprotected

◆ flush()

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
void flush ( )
inlineoverridevirtual

Reimplemented from BaseStream.

◆ getBandCount()

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
int getBandCount ( ) const
inline

Get number of bands.

◆ getBandDB()

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
float getBandDB ( int band) const
inline

Get current gain for a specific band in dB

Parameters
bandBand index (0 to NUM_BANDS-1)
Returns
Gain in dB (-90 to +12), or 0 if band index invalid

◆ getBandFrequency()

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
float getBandFrequency ( int band) const
inline

Get center frequency for a specific band

Parameters
bandBand index (0 to NUM_BANDS-1)
Returns
Center frequency in Hz, or 0 if band index invalid

◆ getBandGain()

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
float getBandGain ( int band)
inline

Get current gain for a specific band as normalized volume (-1.0 to 1.0).

◆ initializeKernel()

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
void initializeKernel ( volatile int16_t * kernel)
inlineprotected

◆ isNotifyActive() [1/2]

bool isNotifyActive ( )
inlineinherited

Checks if the automatic AudioInfo update is active.

◆ isNotifyActive() [2/2]

bool isNotifyActive ( )
inlineinherited

Checks if the automatic AudioInfo update is active.

◆ map()

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
template<typename T>
float map ( T x,
T in_min,
T in_max,
T out_min,
T out_max )
inlineprotected

◆ maybeUpdateKernel()

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
void maybeUpdateKernel ( )
inlineprotected

◆ not_supported() [1/2]

virtual int not_supported ( int out,
const char * msg = "" )
inlineprotectedvirtualinherited

◆ not_supported() [2/2]

virtual int not_supported ( int out,
const char * msg = "" )
inlineprotectedvirtualinherited

◆ notifyAudioChange() [1/2]

void notifyAudioChange ( AudioInfo info)
inlineprotectedinherited

◆ notifyAudioChange() [2/2]

void notifyAudioChange ( AudioInfo info)
inlineprotectedinherited

◆ operator bool() [1/2]

◆ operator bool() [2/2]

◆ preCalculateWindow()

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
void preCalculateWindow ( )
inlineprotected

◆ readBytes()

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
size_t readBytes ( uint8_t * data,
size_t len )
inlineoverridevirtual

Reimplemented from AudioStream.

◆ readSilence() [1/2]

virtual size_t readSilence ( uint8_t * buffer,
size_t length )
inlinevirtualinherited

Source to generate silence: just sets the buffer to 0.

◆ readSilence() [2/2]

virtual size_t readSilence ( uint8_t * buffer,
size_t length )
inlinevirtualinherited

Source to generate silence: just sets the buffer to 0.

◆ refillReadBuffer() [1/2]

void refillReadBuffer ( )
inlineprotectedinherited

Refill small read buffer (e.g. 8 bytes) to avoid single byte reads when calling read().

◆ refillReadBuffer() [2/2]

void refillReadBuffer ( )
inlineprotectedinherited

Refill small read buffer (e.g. 8 bytes) to avoid single byte reads when calling read().

◆ removeNotifyAudioChange() [1/2]

virtual bool removeNotifyAudioChange ( AudioInfoSupport & bi)
inlinevirtualinherited

Removes a target in order not to be notified about audio changes.

◆ removeNotifyAudioChange() [2/2]

virtual bool removeNotifyAudioChange ( AudioInfoSupport & bi)
inlinevirtualinherited

Removes a target in order not to be notified about audio changes.

◆ setAudioInfo() [1/2]

◆ setAudioInfo() [2/2]

◆ setAutoUpdate()

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
void setAutoUpdate ( bool enabled)
inline

Enable/disable automatic kernel updates during read/write

Parameters
enabledWhen true, pending gain changes are applied automatically

◆ setBandDB()

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
bool setBandDB ( int band,
float gainDb )
inline

Set gain for a specific band directly in dB

Parameters
bandBand index (0 to NUM_BANDS-1)
gainDbGain in dB (-90 to +12). The lower limit matches Q15 dynamic range; the upper limit prevents clipping.

◆ setBandGain()

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
bool setBandGain ( int band,
float volume )
inline

Set gain for a specific frequency band

Parameters
bandBand index (0 to NUM_BANDS-1)
volumeVolume level (-1.0 to 1.0) mapped to -12dB to +12dB. For deeper cuts use setBandDB() directly.

◆ setBandGains()

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
bool setBandGains ( float volume)
inline

Set same gain for all frequency bands.

◆ setNotifyActive() [1/2]

void setNotifyActive ( bool flag)
inlineinherited

Deactivate/Reactivate automatic AudioInfo updates: (default is active).

◆ setNotifyActive() [2/2]

void setNotifyActive ( bool flag)
inlineinherited

Deactivate/Reactivate automatic AudioInfo updates: (default is active).

◆ setOutput() [1/2]

virtual void setOutput ( AudioOutput & out)
inlinevirtualinherited

Defines/Changes the output target and registers for audio change notifications.

Reimplemented in AudioInputMonitor, AudioInputMonitor, EncodedAudioStream, ReformatBaseStream, TimedStream, VolumeMeter, and VolumeMeter.

◆ setOutput() [2/2]

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
void setOutput ( Print & out)
inlineoverridevirtual

Defines/Changes the output target

Parameters
outPrint stream where processed audio will be written

Implements ModifyingStream.

◆ setStream() [1/2]

virtual void setStream ( AudioStream & io)
inlinevirtualinherited

Defines/Changes the input & output and registers for audio change notifications.

Reimplemented in AudioInputMonitor, AudioInputMonitor, EncodedAudioStream, ReformatBaseStream, TimedStream, VolumeMeter, and VolumeMeter.

◆ setStream() [2/2]

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
void setStream ( Stream & io)
inlineoverridevirtual

Defines/Changes the input & output stream

Parameters
ioStream to use for both reading and writing audio data

Implements ModifyingStream.

◆ setupFrequencies()

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
void setupFrequencies ( int sampleRate)
inlineprotected

◆ setWriteBufferSize() [1/2]

void setWriteBufferSize ( int size)
inlineinherited

◆ setWriteBufferSize() [2/2]

void setWriteBufferSize ( int size)
inlineinherited

◆ sinc()

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
float sinc ( float x)
inlineprotected

◆ update()

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
bool update ( )
inline

◆ updateFIRKernel()

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
bool updateFIRKernel ( )
inlineprotected

◆ write() [1/2]

◆ write() [2/2]

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
size_t write ( const uint8_t * data,
size_t len )
inlineoverridevirtual

Reimplemented from AudioStream.

◆ writeSilence() [1/2]

virtual void writeSilence ( size_t len)
inlinevirtualinherited

Writes len bytes of silence (=0).

◆ writeSilence() [2/2]

virtual void writeSilence ( size_t len)
inlinevirtualinherited

Writes len bytes of silence (=0).

Member Data Documentation

◆ _timeout

int _timeout = 10
protectedinherited

◆ activeKernel

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
volatile int16_t* activeKernel
protected

◆ autoUpdate

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
bool autoUpdate = false
protected

◆ centerFreqs

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
float centerFreqs[NUM_BANDS]
protected

◆ currentSampleRate

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
int currentSampleRate = 0
protected

◆ filtered

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
FilteredStream<SampleT, SampleT> filtered
protected

◆ fir_vector

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
Vector<EQFIRFilter> fir_vector
protected

Vector of FIR filters for each channel.

◆ gains

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
float gains[NUM_BANDS] = {0}
protected

◆ gainsDirty

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
volatile bool gainsDirty = false
protected

◆ info

AudioInfo info
protectedinherited

◆ is_notify_active

bool is_notify_active = true
protectedinherited

◆ isUpdating

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
volatile bool isUpdating = false
protected

◆ kernelA

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
int16_t kernelA[NUM_TAPS]
protected

◆ kernelB

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
int16_t kernelB[NUM_TAPS]
protected

◆ notify_vector

Vector< AudioInfoSupport * > notify_vector
protectedinherited

◆ p_io

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
Stream* p_io = nullptr
protected

Input stream for read operations.

◆ p_out

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
Print* p_out = nullptr
protected

Output stream for write operations.

◆ pendingGains

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
float pendingGains[NUM_BANDS] = {0}
protected

◆ Q15_SCALE

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
float Q15_SCALE = 32767.0f
staticconstexprprotected

◆ tempFloat

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
float tempFloat[NUM_TAPS] = {0}
protected

◆ tmp_in

RingBuffer< uint8_t > tmp_in {0}
protectedinherited

◆ tmp_out

RingBuffer< uint8_t > tmp_out {0}
protectedinherited

◆ updateKernel

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
volatile int16_t* updateKernel
protected

◆ windowCoeffs

template<typename SampleT = int16_t, typename AccT = int64_t, int NUM_TAPS = 128, int NUM_BANDS = 12>
float windowCoeffs[NUM_TAPS]
protected

◆ write_buffer_size

int write_buffer_size = 8
protectedinherited

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