AMR Decoder and Encoder¶
Decode and encode an audio data stream from / to AMR format. Encoders cover both AMR-NB and AMR-WB formats.
Application Examples¶
Implementation of this API is demonstrated in the following examples:
API Reference - Decoder¶
Header File¶
Functions¶
-
audio_element_handle_t
amr_decoder_init
(amr_decoder_cfg_t *config)¶ Create an Audio Element handle to decode incoming AMR data.
- Return
The audio element handle
- Parameters
config
: The configuration
Structures¶
-
struct
amr_decoder_cfg_t
¶ AMR Decoder configuration.
Macros¶
-
AMR_DECODER_TASK_STACK_SIZE
¶
-
AMR_DECODER_TASK_CORE
¶
-
AMR_DECODER_TASK_PRIO
¶
-
AMR_DECODER_RINGBUFFER_SIZE
¶
-
DEFAULT_AMR_DECODER_CONFIG
()¶
API Reference - AMR-NB Encoder¶
Header File¶
Functions¶
-
esp_err_t
amrnb_encoder_set_bitrate
(audio_element_handle_t self, amrnb_encoder_bitrate_t bitrate_mode)¶ Set AMRNB encoder bitrate.
- Return
ESP_OK ESP_FAIL
- Parameters
self
: Audio element handlebitrate_mode
: Bitrate choose, value from amrnb_encoder_bitrate_t
-
audio_element_handle_t
amrnb_encoder_init
(amrnb_encoder_cfg_t *config)¶ Create an Audio Element handle to encode incoming AMRNB data.
- Return
The audio element handle
- Parameters
config
: The configuration
Structures¶
-
struct
amrnb_encoder_cfg_t
¶ AMRNB Encoder configurations.
Public Members
-
int
out_rb_size
¶ Size of output ringbuffer
-
int
task_stack
¶ Task stack size
-
int
task_core
¶ Task running in core (0 or 1)
-
int
task_prio
¶ Task priority (based on freeRTOS priority)
-
amrnb_encoder_bitrate_t
bitrate_mode
¶ AMRNB Encoder bitrate choose
-
bool
contain_amrnb_header
¶ Choose to contain amrnb header in amrnb encoder whether or not (true or false, true means choose to contain amrnb header)
-
bool
stack_in_ext
¶ Try to allocate stack in external memory
-
int
Macros¶
-
AMRNB_ENCODER_TASK_STACK
¶
-
AMRNB_ENCODER_TASK_CORE
¶
-
AMRNB_ENCODER_TASK_PRIO
¶
-
AMRNB_ENCODER_RINGBUFFER_SIZE
¶
-
DEFAULT_AMRNB_ENCODER_CONFIG
()¶
Enumerations¶
-
enum
amrnb_encoder_bitrate_t
¶ Enum of AMRNB Encoder bitrate choose.
Values:
-
AMRNB_ENC_BITRATE_UNKNOW
= -1¶ Invalid mode
-
AMRNB_ENC_BITRATE_MR475
= 0¶
-
AMRNB_ENC_BITRATE_MR515
= 1¶
-
AMRNB_ENC_BITRATE_MR59
= 2¶
-
AMRNB_ENC_BITRATE_MR67
= 3¶
-
AMRNB_ENC_BITRATE_MR74
= 4¶
-
AMRNB_ENC_BITRATE_MR795
= 5¶
-
AMRNB_ENC_BITRATE_MR102
= 6¶
-
AMRNB_ENC_BITRATE_MR122
= 7¶
-
AMRNB_ENC_BITRATE_MRDTX
= 8¶
-
AMRNB_ENC_BITRATE_N_MODES
= 9¶
-
API Reference - AMR-WB Encoder¶
Header File¶
Functions¶
-
esp_err_t
amrwb_encoder_set_bitrate
(audio_element_handle_t self, amrwb_encoder_bitrate_t bitrate_mode)¶ Set AMRWB encoder bitrate.
- Return
ESP_OK ESP_FAIL
- Parameters
self
: Audio element handlebitrate_mode
: Bitrate choose, value from amrwb_encoder_bitrate_t
-
audio_element_handle_t
amrwb_encoder_init
(amrwb_encoder_cfg_t *config)¶ Create an Audio Element handle to encode incoming amrwb data.
- Return
The audio element handle
- Parameters
config
: The configuration
Structures¶
-
struct
amrwb_encoder_cfg_t
¶ AMRWB Encoder configurations.
Public Members
-
int
out_rb_size
¶ Size of output ringbuffer
-
int
task_stack
¶ Task stack size
-
int
task_core
¶ Task running in core (0 or 1)
-
int
task_prio
¶ Task priority (based on freeRTOS priority)
-
amrwb_encoder_bitrate_t
bitrate_mode
¶ AMRWB Encoder bitrate choose
-
bool
contain_amrwb_header
¶ Choose to contain amrwb header in amrwb encoder whether or not (true or false, true means choose to contain amrwb header)
-
bool
stack_in_ext
¶ Try to allocate stack in external memory
-
int
Macros¶
-
AMRWB_ENCODER_TASK_STACK
¶
-
AMRWB_ENCODER_TASK_CORE
¶
-
AMRWB_ENCODER_TASK_PRIO
¶
-
AMRWB_ENCODER_RINGBUFFER_SIZE
¶
-
DEFAULT_AMRWB_ENCODER_CONFIG
()¶
Enumerations¶
-
enum
amrwb_encoder_bitrate_t
¶ Enum of AMRWB Encoder bitrate choose.
Values:
-
AMRWB_ENC_BITRATE_MDNONE
= -1¶ Invalid mode
-
AMRWB_ENC_BITRATE_MD66
= 0¶ 6.60kbps
-
AMRWB_ENC_BITRATE_MD885
= 1¶ 8.85kbps
-
AMRWB_ENC_BITRATE_MD1265
= 2¶ 12.65kbps
-
AMRWB_ENC_BITRATE_MD1425
= 3¶ 14.25kbps
-
AMRWB_ENC_BITRATE_MD1585
= 4¶ 15.85bps
-
AMRWB_ENC_BITRATE_MD1825
= 5¶ 18.25bps
-
AMRWB_ENC_BITRATE_MD1985
= 6¶ 19.85kbps
-
AMRWB_ENC_BITRATE_MD2305
= 7¶ 23.05kbps
-
AMRWB_ENC_BITRATE_MD2385
= 8¶ 23.85kbps>
-
AMRWB_ENC_BITRATE_N_MODES
= 9¶ Invalid mode
-