Page 1 of 1

What is the difference between LINE_IN and ENCODE/DECODE codec modes and how to play sound from AUX

Posted: Mon Jun 07, 2021 10:42 am
by spacebiker
I'm trying to send audio from i2s (AUX in) to bluetooth headphones. I made a pipeline i2s->bt, But if i type

Code: Select all

audio_hal_ctrl_codec(board_handle->audio_hal, AUDIO_HAL_CODEC_MODE_DECODE, AUDIO_HAL_CTRL_START);
or

Code: Select all

AUDIO_HAL_CODEC_MODE_ENCODE
, i hear sound from microphones, but not from AUX_IN. But when I type

Code: Select all

AUDIO_HAL_CODEC_MODE_LINE_IN
i hear no sound at all. Moreover, it works with wire headphones(https://github.com/espressif/esp-adf/tr ... e_passthru), but doesn't for wireless. What am i doing wrong?

Full code: https://pastebin.com/AEmCqPuT

Thank you!

Re: What is the difference between LINE_IN and ENCODE/DECODE codec modes and how to play sound from AUX

Posted: Thu Jun 10, 2021 3:15 pm
by spacebiker
Problem is solved. You should add lines below:

Code: Select all

audio_hal_ctrl_codec(board_handle->audio_hal, AUDIO_HAL_CODEC_MODE_BOTH, AUDIO_HAL_CTRL_START); // instead of AUDIO_HAL_CODEC_LINE_IN
es8388_write_reg(ES8388_ADCCONTROL2, ADC_INPUT_LINPUT2_RINPUT2);
es8388_write_reg(ES8388_ADCCONTROL1, 0x00);