|
arduino-audio-tools
|
3 Band Equalizer with per-channel frequency and gain control Allows independent frequency and gain settings for each audio channel. Each channel can have different low/high frequency cutoffs and different gain values for low, medium, and high frequency bands. More...
#include <Equalizer3Bands.h>
Classes | |
| struct | EQSTATE |
Protected Member Functions | |
| void | allocateChannelArrays (int num_channels) |
| void | ensureChannelArraysAllocated () |
| Ensures that per-channel arrays are allocated and properly sized. | |
| void | filterSamples (const uint8_t *data, size_t len) |
| virtual int | not_supported (int out, const char *msg="") |
| void | notifyAudioChange (AudioInfo info) |
| void | refillReadBuffer () |
| Refill small read buffer (e.g. 8 bytes) to avoid single byte reads when calling read() | |
| float | sample (int channel, float sample_val) |
Protected Attributes | |
| int | _timeout = 10 |
| ConfigEqualizer3Bands | cfg |
| Default configuration instance. | |
| Vector< int > | freq_high |
| High frequency cutoffs per channel (Hz) | |
| Vector< int > | freq_low |
| Low frequency cutoffs per channel (Hz) | |
| Vector< float > | gain_high |
| High frequency gains per channel. | |
| Vector< float > | gain_low |
| Low frequency gains per channel. | |
| Vector< float > | gain_medium |
| Medium frequency gains per channel. | |
| AudioInfo | info |
| bool | is_active = false |
| 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::Equalizer3BandsPerChannel::EQSTATE * | state = nullptr |
| RingBuffer< uint8_t > | tmp_in {0} |
| RingBuffer< uint8_t > | tmp_out {0} |
| const float | vsa |
| Very small amount for denormal fix. | |
| int | write_buffer_size = MAX_SINGLE_CHARS |
3 Band Equalizer with per-channel frequency and gain control Allows independent frequency and gain settings for each audio channel. Each channel can have different low/high frequency cutoffs and different gain values for low, medium, and high frequency bands.
|
inline |
|
inline |
|
inline |
Constructor with AudioOutput
| out | AudioOutput for output with automatic audio change notifications |
|
inline |
Constructor with AudioStream
| stream | AudioStream for input/output with automatic audio change notifications |
|
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.
Allocates and initializes per-channel frequency and gain arrays
| num_channels | Number of channels to allocate arrays for |
provides the actual input AudioInfo
Implements AudioInfoSupport.
Reimplemented in JupyterAudioT< T >, MozziStream, TimerCallbackAudioStream, EncodedAudioStream, PureDataStream, AdapterAudioOutputToAudioStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, and InputMerge< T >.
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 |
Initialize the equalizer using the current configuration
Reimplemented from BaseStream.
|
inline |
Initialize the equalizer with the given configuration
| config | Configuration settings for the equalizer |
Deletes all change notify subscriptions.
Reimplemented in RTSPClient< TcpClient, UdpSocket >.
|
inline |
|
inline |
|
inlineoverridevirtual |
Reimplemented from BaseStream.
|
inlineprotected |
Ensures that per-channel arrays are allocated and properly sized.
Applies per-channel 3-band equalization to audio samples
| data | Pointer to audio data buffer |
| len | Length of the data buffer in bytes |
Reimplemented from Print.
Reimplemented in PureDataStream, URLStreamBufferedT< T >, URLStreamBufferedT< ICYStream >, AudioStreamWrapper, ResampleStream, URLStream, BufferedTaskStream, I2SStream, MemoryStream, RingBufferStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, and BufferedStream.
Get frequency parameters for a specific channel
| channel | Channel index (0-based) |
| freq_low_val | Reference to store the low frequency cutoff |
| freq_high_val | Reference to store the high frequency cutoff |
|
inline |
Get gain parameters for a specific channel
| channel | Channel index (0-based) |
| gain_low_val | Reference to store the low frequency gain |
| gain_medium_val | Reference to store the medium frequency gain |
| gain_high_val | Reference to store the high frequency gain |
Read and process audio data through the per-channel equalizer
| data | Buffer to store processed audio data |
| len | Maximum number of bytes to read |
Reimplemented from AudioStream.
Source to generate silence: just sets the buffer to 0.
|
inlineprotectedinherited |
Refill small read buffer (e.g. 8 bytes) to avoid single byte reads when calling read()
|
inlinevirtualinherited |
Removes a target in order not to be notified about audio changes.
Reimplemented in RTSPClient< TcpClient, UdpSocket >.
Processes a single sample through the 3-band equalizer for a specific channel
| channel | The channel number to process |
| sample_val | The input sample value |
Defines the input AudioInfo.
Reimplemented from AudioStream.
Set frequency parameters for a specific channel
| channel | Channel index (0-based) |
| freq_low_val | Low frequency cutoff in Hz |
| freq_high_val | High frequency cutoff in Hz |
|
inline |
Set gain parameters for a specific channel
| channel | Channel index (0-based) |
| gain_low_val | Gain multiplier for low frequencies (0.0-2.0) |
| gain_medium_val | Gain multiplier for medium frequencies (0.0-2.0) |
| gain_high_val | Gain multiplier for high frequencies (0.0-2.0) |
Deactivate/Reactivate automatic AudioInfo updates: (default is active)
Defines/Changes the output target.
Implements ModifyingStream.
Defines/Changes the input & output.
Implements ModifyingStream.
Process and write audio data through the per-channel equalizer
| data | Pointer to audio data buffer |
| len | Length of data in bytes |
Reimplemented from AudioStream.
Reimplemented in MemoryStream, AudioStreamWrapper, BufferedTaskStream, RingBufferStream, BufferedStream, and URLStream.
|
protectedinherited |
|
protected |
Default configuration instance.
|
protectedinherited |
|
protected |
Maximum number of allocated channel states.
|
protectedinherited |
|
protected |
Pointer to active configuration.
|
protected |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |