How to configure LyraT v. 4.3 board to sample audio data from AUX input?

sshydlovskyi
Posts: 6
Joined: Wed Aug 14, 2019 9:02 am

How to configure LyraT v. 4.3 board to sample audio data from AUX input?

Postby sshydlovskyi » Fri Sep 06, 2019 8:33 am

Greetings!

I'm trying to get some audio data from ADC through AUX input and save into wave file.

To start with something, I have compiled and flashed i2s_adc_dac example onto the board. It runs but debug prints shows constant value (142 mV) while I'm playing some music from the source connected to the AUX.

It seems that the input chain is misconfigured somehow, but can't figure it out.

Any ideas are highly appreciated.

Thanks for your attention.

danak6jq
Posts: 15
Joined: Fri Aug 11, 2017 3:22 am

Re: How to configure LyraT v. 4.3 board to sample audio data from AUX input?

Postby danak6jq » Mon Sep 23, 2019 12:18 am

If I understand correctly, you're using the esp-idf example i2s_adc_dac, which uses the internal ADC and DAC and does nothing to interface with the ES8388 codec on the LyraT 4.3 board.

What you need to do is configure the ES8388 codec via i2c, configure i2s 0 for the desired sample rate, and then use i2s_read() to get the samples from the codec.

You probably ought to start by, uh, looking at the LyraT v4.3 schematic and probably the es8388.c driver in esp-adf, or, like I did, the ES8388 datasheet.

None of this has anything to do with the ADC/DAC internal to the ESP32.

I have a DSP modem application running well on the LyraT v4.3 using the approach described above, bring-up up on the LyraT v4.3 was about two days. Note that the ES8388 needs to be configured to use the DAC clock for both the ADC and DAC, the ES8388 user guide mentions this.

Cheers,

sshydlovskyi
Posts: 6
Joined: Wed Aug 14, 2019 9:02 am

Re: How to configure LyraT v. 4.3 board to sample audio data from AUX input?

Postby sshydlovskyi » Tue Sep 24, 2019 12:30 pm

Hi and thanks for the reply!

Currently, it seems, I use only ADC/DAC connection plus some third-party resampler library. For now, I can to sample data from ADC and send it through resampler to DAC, but the sound is just awful. I think this is due to the fact that input and output I2S buses can be set only to the same sample rate: if I sample with 44.1 kHz, then add 1% to the sample rate and output it through ADC, playing such data with the same output settings of 44.1 kHz will make a mess.

So, for now, it is my main concern. If external codec will help with that, I will be happy!

benbiles
Posts: 32
Joined: Sun Dec 15, 2019 4:46 pm

Re: How to configure LyraT v. 4.3 board to sample audio data from AUX input?

Postby benbiles » Fri Dec 20, 2019 6:26 pm

#include "esp_system.h"
#include "es8388.h"

main()
{
// sets ADC input gain 0 = 0db lineIn
es8388_set_mic_gain(0);
}


If theres something you need that's not in es8388.c then write the registers over I2C by following datasheet.

see how the functions are writing registers to the codec in es8388.c and write more for whatever you need to
control that doesn't already exist.

benbiles
Posts: 32
Joined: Sun Dec 15, 2019 4:46 pm

Re: How to configure LyraT v. 4.3 board to sample audio data from AUX input?

Postby benbiles » Fri Dec 20, 2019 6:31 pm

oh sorry I think I posted reply to wrong thread :o

Who is online

Users browsing this forum: martins, MicroController, Siuyqe and 80 guests