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/pipeline_equalizer example.
API Reference¶
Header File¶
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 handlerate
: Audio sample ratech
: 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 handleindex
: the position of center frequencies of equalizervalue_gain
: the value of audio gain which inindex
is_channels_gain_equal
: if Number of audio channel is equal 2, the value of audio gains which two channels are equal by checkingis_channels_gain_equal
. ifis_channels_gain_equal
istrue
,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
-
bool
stack_in_ext
¶ Try to allocate stack in external memory
-
int
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.