espressif / esp-adf

Espressif Audio Development Framework
Other
1.55k stars 685 forks source link

Audio codec input source (AUD-2345) #463

Closed utkutpcgl closed 3 years ago

utkutpcgl commented 4 years ago

How can we change the active microphone input to be auxiliary input on esp lyrat? I see that it is on adc line 2, however, I could not find any directives on esp adf documentation.

Thanks, for your awesome library and for your help.

Gaochenchang commented 4 years ago

If you want to use AUX-IN, you need to modify the es8388 driver. Specifically speaking is to change the value of ES8388_ADCCONTROL2 register in es8388.c into 0x54 and the value of ES8388_ADCCONTROL3 register is 0x83.

utkutpcgl commented 4 years ago

Thanks! I have solved this problem by changing audio_hal_codec_config_t (.adc_input =AUDIO_HAL_ADC_INPUT_LINE1), but now I face an issue with encoding speed. I want to use amr wb encoder rather than nb encoder. Therefore, I increase the i2s sample rate form 8k to 16k. However, the encoding speed was too low and the encoder could not catch up with the i2s_stream_read(16k). How can I increase the audio codec encoding decoding speed or amr encoding speed? Might I be missing something else? I already tried to increase the codec speed by making audio_hal_codec_i2s_iface_t.samples = AUDIO_HAL_16K_SAMPLES. It did not work. I use esp idf 4.1 and latest adf.

Gaochenchang commented 4 years ago

You can try increasing the CPU frequency to 240MHz, switching the SPI mode to QIO, and adjusting the SPI rate to 80MHz.

utkutpcgl commented 4 years ago

Thanks, I will show the result when I'm done.

jujax commented 4 years ago

Hello, I use my ESP32-LyraT to send line input audio to my bluetooth headset. I use these lines :

es8388_write_reg(ES8388_ADCCONTROL2, ADC_INPUT_LINPUT2_RINPUT2);
es8388_write_reg(ES8388_ADCCONTROL1, 0x00); // (optional) set PGA gain

I opened an issue to explain that : #485

utkutpcgl commented 3 years ago

Okay, it works. Thanks.