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.
- Parameters
config – The configuration
- Returns
The audio element handle
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.
- Parameters
self – Audio element handle
bitrate_mode – Bitrate choose, value from amrnb_encoder_bitrate_t
- Returns
ESP_OK ESP_FAIL
-
audio_element_handle_t amrnb_encoder_init(amrnb_encoder_cfg_t *config)
Create an Audio Element handle to encode incoming AMRNB data.
- Parameters
config – The configuration
- Returns
The audio element handle
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 out_rb_size
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:
-
enumerator AMRNB_ENC_BITRATE_UNKNOW
Invalid mode
-
enumerator AMRNB_ENC_BITRATE_MR475
-
enumerator AMRNB_ENC_BITRATE_MR515
-
enumerator AMRNB_ENC_BITRATE_MR59
-
enumerator AMRNB_ENC_BITRATE_MR67
-
enumerator AMRNB_ENC_BITRATE_MR74
-
enumerator AMRNB_ENC_BITRATE_MR795
-
enumerator AMRNB_ENC_BITRATE_MR102
-
enumerator AMRNB_ENC_BITRATE_MR122
-
enumerator AMRNB_ENC_BITRATE_MRDTX
-
enumerator AMRNB_ENC_BITRATE_N_MODES
-
enumerator AMRNB_ENC_BITRATE_UNKNOW
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.
- Parameters
self – Audio element handle
bitrate_mode – Bitrate choose, value from amrwb_encoder_bitrate_t
- Returns
ESP_OK ESP_FAIL
-
audio_element_handle_t amrwb_encoder_init(amrwb_encoder_cfg_t *config)
Create an Audio Element handle to encode incoming amrwb data.
- Parameters
config – The configuration
- Returns
The audio element handle
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 out_rb_size
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:
-
enumerator AMRWB_ENC_BITRATE_MDNONE
Invalid mode
-
enumerator AMRWB_ENC_BITRATE_MD66
6.60kbps
-
enumerator AMRWB_ENC_BITRATE_MD885
8.85kbps
-
enumerator AMRWB_ENC_BITRATE_MD1265
12.65kbps
-
enumerator AMRWB_ENC_BITRATE_MD1425
14.25kbps
-
enumerator AMRWB_ENC_BITRATE_MD1585
15.85bps
-
enumerator AMRWB_ENC_BITRATE_MD1825
18.25bps
-
enumerator AMRWB_ENC_BITRATE_MD1985
19.85kbps
-
enumerator AMRWB_ENC_BITRATE_MD2305
23.05kbps
-
enumerator AMRWB_ENC_BITRATE_MD2385
23.85kbps>
-
enumerator AMRWB_ENC_BITRATE_N_MODES
Invalid mode
-
enumerator AMRWB_ENC_BITRATE_MDNONE