Equalizer

Provided in this API equalizer supports:

  • fixed number of ten (10) bands;
  • four sample rates: 11025 Hz, 22050 Hz, 44100 Hz and 48000 Hz.

The center frequencies of bands are shown in table below.

Band Index 0 1 2 3 4 5 6 7 8 9
Frequency 31 Hz 62 Hz 125 Hz 250 Hz 500 Hz 1 kHz 2 kHz 4 kHz 8 kHz 16 kHz

Default gain of each band is -13 dB. To set the gains of all bands use structure equalizer_cfg. To set the gain of individual band use function equalizer_set_gain_info().

Application Example

Implementation of this API is demonstrated in the audio_processing/equalizer example.

API Reference

Functions

esp_err_t equalizer_set_info(audio_element_handle_t self, int rate, int ch)

Set the audio sample rate and the number of channels to be processed by the equalizer.

Return
ESP_OK ESP_FAIL
Parameters
  • self: Audio element handle
  • rate: Audio sample rate
  • ch: Audio channel

esp_err_t equalizer_set_gain_info(audio_element_handle_t self, int index, int value_gain, bool is_channels_gain_equal)

Set the audio gain to be processed by the equalizer.

Return
ESP_OK ESP_FAIL
Parameters
  • self: Audio element handle
  • index: the position of center frequencies of equalizer
  • value_gain: the value of audio gain which in index
  • is_channels_gain_equal: if Number of audio channel is equal 2, the value of audio gains which two channels are equal by checking is_channels_gain_equal. if is_channels_gain_equal is true,it means equal,otherwise unequal.

audio_element_handle_t equalizer_init(equalizer_cfg_t *config)

Create an Audio Element handle that equalizes incoming data.

Return
The created audio element handle
Parameters
  • config: The configuration

Structures

struct equalizer_cfg

Equalizer Configuration.

Public Members

int samplerate

Audio sample rate (in Hz)

int channel

Number of audio channels (Mono=1, Dual=2)

int *set_gain

Equalizer gain

int out_rb_size

Size of output ring buffer

int task_stack

Task stack size

int task_core

Task running in core…

int task_prio

Task priority

Macros

EQUALIZER_TASK_STACK
EQUALIZER_TASK_CORE
EQUALIZER_TASK_PRIO
EQUALIZER_RINGBUFFER_SIZE
DEFAULT_EQUALIZER_CONFIG()

Type Definitions

typedef struct equalizer_cfg equalizer_cfg_t

Equalizer Configuration.