espressif / esp-adf

Espressif Audio Development Framework
Other
1.53k stars 669 forks source link

Aux input only redirect to speakers when sound card initialized with AUDIO_HAL_CODEC_MODE_LINE_IN (AUD-2419) #485

Open jujax opened 3 years ago

jujax commented 3 years ago

Hello,

I try to use my ESP32-LyraT 4.3 to send sound to Bluetooth headset from line input. Actualy ESP-ADF library enable line input only when sound card is initialized with :

audio_hal_ctrl_codec(board_handle->audio_hal, AUDIO_HAL_CODEC_MODE_LINE_IN, AUDIO_HAL_CTRL_START);

with this mode, sound is redirected only to speakers or line output. Pipeline doesn't send sound to writer streams.

To bypass this limitation I use directly ES8388 driver library with this function located in es8388.h :

es8388_write_reg(ES8388_ADCCONTROL2, ADC_INPUT_LINPUT2_RINPUT2);

By the way, sound is really dirty without setting PGA gain to 0db :

es8388_write_reg(ES8388_ADCCONTROL1, 0x00); // value is 0xbb when card is init

It works very well with these modifications, and I create a github deposit to make an example. Maybe I disrespect some coding and github conventions (bad licensing for code, bad README.md), every improvements are welcome. And sorry for my english.

Gaochenchang commented 3 years ago

If line_ in is used as input, setting the gain to 0 is correct.

jason-mao commented 2 years ago

This topic has become inactive so I'm going to close the issue. Please reopen this if you have any questions or need any further assistance.

TAMHAN commented 9 months ago

The man is right. His error description is correct, and it needs to be fixed.

TAMHAN commented 9 months ago

Please reopen this issue as it is valid and prudent

jason-mao commented 4 months ago

As @TAMHAN suggested, reopen it.

TAMHAN commented 4 months ago

Thank you, @jason-mao

t36512 commented 4 months ago

Hi, Thanks to @jujax 's exmple project I got my Lyrat 4.3 board working as well. The only issue in my case is extremely low volume at the paired bluetooth speaker. I spend hours looking for solutions with no luck at all. Would be great if someone can provide me some hint to fix it. Any suggestion is highly appreicated.