arduino-audio-tools
|
3 Band Equalizer with identical settings for all channels More...
#include <Equalizer.h>
Classes | |
struct | EQSTATE |
Filter state for each channel. More... | |
Public Member Functions | |
Equalizer3Bands (AudioOutput &out) | |
Equalizer3Bands (AudioStream &stream) | |
Equalizer3Bands (Print &out) | |
Equalizer3Bands (Stream &in) | |
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 () |
int | available () override |
int | availableForWrite () override |
bool | begin () |
bool | begin (ConfigEqualizer3Bands &config) |
virtual void | clearNotifyAudioChange () |
Deletes all change notify subscriptions. | |
ConfigEqualizer3Bands & | config () |
ConfigEqualizer3Bands & | defaultConfig () |
void | end () |
virtual void | flush () override |
bool | isNotifyActive () |
Checks if the automatic AudioInfo update is active. | |
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 bool | removeNotifyAudioChange (AudioInfoSupport &bi) |
Removes a target in order not to be notified about audio changes. | |
virtual void | setAudioInfo (AudioInfo info) override |
void | setNotifyActive (bool flag) |
Deactivate/Reactivate automatic AudioInfo updates: (default is active) | |
void | setOutput (Print &out) override |
void | setStream (Stream &io) override |
void | setWriteBufferSize (int size) |
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) |
Writes len bytes of silence (=0). | |
Protected Member Functions | |
void | filterSamples (const uint8_t *data, size_t len) |
virtual int | not_supported (int out, const char *msg="") |
void | notifyAudioChange (AudioInfo info) |
void | refillReadBuffer () |
float | sample (EQSTATE &es, float sample) |
Protected Attributes | |
int | _timeout = 10 |
ConfigEqualizer3Bands | cfg |
Default configuration instance. | |
AudioInfo | info |
bool | is_active = false |
Indicates if the equalizer is active. | |
bool | is_notify_active = true |
int | max_state_count = 0 |
Maximum number of allocated channel states. | |
Vector< AudioInfoSupport * > | notify_vector |
ConfigEqualizer3Bands * | p_cfg = &cfg |
Pointer to active configuration. | |
Print * | p_print = nullptr |
Output stream for write operations. | |
Stream * | p_stream = nullptr |
Input/output stream for read operations. | |
struct audio_tools::Equalizer3Bands::EQSTATE * | state = nullptr |
RingBuffer< uint8_t > | tmp_in {0} |
RingBuffer< uint8_t > | tmp_out {0} |
const float | vsa = (1.0 / 4294967295.0) |
Very small amount for denormal fix. | |
int | write_buffer_size = MAX_SINGLE_CHARS |
3 Band Equalizer with identical settings for all channels
Digital 3-band equalizer implementation inspired from https://www.musicdsp.org/en/latest/Filters/236-3-band-equaliser.html
This equalizer applies the same frequency response and gain settings to all audio channels. The audio spectrum is divided into three bands:
Each band uses a 4-pole filter implementation for smooth frequency response. If you need different settings per channel, use Equalizer3BandsPerChannel instead.
After calling begin() you can update the gain parameters of the ConfigEqualizer3Bands directly w/o calling any other methods. If you change the freq. parameters, you need to call begin() again.
|
inline |
|
inline |
|
inline |
Constructor with AudioOutput (includes automatic audio format notifications)
out | AudioOutput where processed audio will be written |
|
inline |
Constructor with AudioStream (includes automatic audio format notifications)
stream | AudioStream for both input and output |
|
inlinevirtualinherited |
Adds target to be notified about audio changes.
Reimplemented in CodecNOP, EncodedAudioOutput, EncodedAudioStream, AACDecoderFDK, DecoderBasic, MP3DecoderHelix, MP3DecoderMAD, OggContainerDecoder, Pipeline, and Pipeline::ModifyingStreamAdapter.
|
inlineoverridevirtualinherited |
provides the actual input AudioInfo
Implements AudioInfoSupport.
Reimplemented in JupyterAudioT< T >, MozziStream, TimerCallbackAudioStream, PureDataStream, AdapterAudioOutputToAudioStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, and InputMerge< T >.
|
inlinevirtualinherited |
provides the actual output AudioInfo: this is usually the same as audioInfo() unless we use a transforming stream
Reimplemented in PureDataStream, PWMAudioOutput, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, FormatConverterStream, Pipeline, ResampleStream, and ResampleStreamT< TInterpolator >.
|
inlineoverridevirtual |
Get available data for reading
Reimplemented from BaseStream.
|
inlineoverridevirtual |
Get available space for writing
Reimplemented from BaseStream.
|
inlinevirtual |
Reimplemented from BaseStream.
|
inline |
Initialize the equalizer with the provided configuration
config | Configuration settings including frequencies and gains |
|
inline |
Access to the current configuration
|
inline |
Access to the default configuration
|
inlinevirtual |
Reimplemented from BaseStream.
|
inlineprotected |
Apply 3-band equalization to audio samples
data | Pointer to audio data buffer (modified in-place) |
len | Length of data buffer in bytes |
|
inlineoverridevirtualinherited |
Reimplemented from Print.
Reimplemented in ResampleStream, BufferedTaskStream, and BufferedStream.
|
inlinevirtualinherited |
Reimplemented in A2DPStream, I2SStream, MemoryStream, and Pipeline.
|
inlineoverridevirtual |
Read and process audio data through the equalizer
data | Buffer to store processed audio data |
len | Maximum number of bytes to read |
Reimplemented from AudioStream.
|
inlineprotected |
Process a single audio sample through the 3-band equalizer
es | Reference to the filter state for this channel |
sample | Input sample value (normalized float) |
|
inlineoverridevirtual |
Called automatically when audio format changes
info | New audio format information |
Reimplemented from AudioStream.
|
inlineoverridevirtual |
Defines/Changes the output target
out | Print stream where processed audio will be written |
Implements ModifyingStream.
|
inlineoverridevirtual |
Defines/Changes the input & output stream
io | Stream to use for both reading and writing audio data |
Implements ModifyingStream.
|
inlineoverridevirtual |
Process and write audio data through the equalizer
data | Pointer to audio data buffer |
len | Length of data in bytes |
Reimplemented from AudioStream.
|
inlineoverridevirtualinherited |
Reimplemented in BufferedTaskStream, and BufferedStream.