Audio input problem

portasynthinca3
Posts: 8
Joined: Sat May 11, 2019 10:11 pm

Audio input problem

Postby portasynthinca3 » Tue Jun 04, 2019 5:10 pm

Hi.
I'm currently working on a device with an audio input. Here's the schematic I'm using:
Image
The audio comes from an male audio jack. The ADC resolution is set to 9 bits and channel 6 and 7 attenuators are set to 11 dB. My code currently reads a value from ADC1 channels 6 and 7 and feeds them to both DACs of the ESP32 at GPIOs 25 and 26 respectively, after dividing the input value by 2 to get an 8 bit range, at 40 kHz sample rate. When nothing is connected to the input, I can't hear anything, even the noise. But when I connect some device like a PC or a phone to the input, even if it's not outputting anything, I can hear a vinyl record-like noise and cracks on the output. By disabling the DAC and feeding ADC values to the UART and plotting a graph of these values, high spikes up to 10 steps with a duration of 1-2 samples can be seen. Is this a hardware problem or the way ADC works?
Thanks for any response.

ESP_Sprite
Posts: 9766
Joined: Thu Nov 26, 2015 4:08 am

Re: Audio input problem

Postby ESP_Sprite » Wed Jun 05, 2019 2:58 am

That is a very janky audio input schematic, if you don't mind me saying. First of all, you don't have any DC blocking caps, meaning you happily assume they're there in whatever thing you connect to it, a somewhat dangerous assumption. Secondary, you bias all your input to 3.3V; as the audio signal gets superposed on this, your sound will clip most of the time, only being detected when the waveform happens to go below the top reference of the ADC.

portasynthinca3
Posts: 8
Joined: Sat May 11, 2019 10:11 pm

Re: Audio input problem

Postby portasynthinca3 » Wed Jun 05, 2019 8:40 am

Thank you for a reply!
I understand that the lack of DC blocking is bad and I will add the capacitors at the input. I don't see any consequence of the clipping problem you mentioned, but maybe it's just not visible in my particular case. I connected the audio input to a PC, played an audio file, re-enabled the DACs and disabled UART dump. However, except for vinyl-like noise I described above, the audio seems to be fine and I don't hear any clipping. By re-disabling the DACs and re-enabling UART dump, I also can't see any clipping.
Again, thank you! But I still can't solve my problem with a vinyl-like noise.

Who is online

Users browsing this forum: No registered users and 120 guests