Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

Question: codec mode and input settings (line in) #6

Closed
IsiTapier opened this issue Mar 9, 2022 · 26 comments
Closed

Question: codec mode and input settings (line in) #6

IsiTapier opened this issue Mar 9, 2022 · 26 comments

Comments

@IsiTapier
Copy link

Why is LINE_IN in the audio_hal_codec_mode_t setting and not in the audio_hal_adc_input_t setting?
Isn't it possible to have AUDIO_HAL_CODEC_MODE_BOTH activated and still LINE_IN selected as Input source? (simultaneously doing line in and line out)

@IsiTapier IsiTapier changed the title Codec mode and input settings (line in) Question: codec mode and input settings (line in) Mar 9, 2022
@pschatzmann
Copy link
Owner

pschatzmann commented Mar 9, 2022

As far as I understand these are different concepts. In audio_hal_codec_mode_t you specify if you do input or output or both and audio_hal_adc_input_t specifies the input from which device you receive the input.

By the way audio_hal_adc_input_t does not work properly on the AudioKit...
Ai-Thinker-Open/ESP32-A1S-AudioKit#31

@IsiTapier
Copy link
Author

Oh good to know
Do you know whether it is working for the esp32 lyra-t?
And does it work if you set the audio_hal_codec_mode_t to AUDIO_HAL_CODEC_MODE_LINE_IN?

@IsiTapier IsiTapier reopened this Mar 9, 2022
@pschatzmann
Copy link
Owner

pschatzmann commented Mar 9, 2022

Input and Output is working for all boards.
It is just with the AI Thinker Audiokit (ES8388) that the microphone and line in get mixed together. On the old AC101 AudioKit and on the Lyrat Boards this is working properly!
I recommend to use my arduino-audio-tools project which uses this library and adds an easy to use layer on top of this and there are plenty of examples which show how to input and output audio....

cfg.adc_input = AUDIO_HAL_ADC_INPUT_LINE1; // microphone
cfg.adc_input = AUDIO_HAL_ADC_INPUT_LINE2; // line in

You can test this with https://github.com/pschatzmann/arduino-audio-tools/tree/main/examples/examples-audiokit/streams-audiokit-audiokit

@pierluigizagaria
Copy link

In my case I have a Audio kit (ES8388) 2974 and I cannot get line in audio. LINE_1 gives buzzing, LINE_2 only the on-board microphone. What can I do to debug this thing?

@pschatzmann
Copy link
Owner

@pierluigizagaria
Copy link

It's an open question then. In my case I don't event get the line in mixed. I've used a Y adapter for a headset, and nothing gets captured from the headset microphone.
Thank for the fast answer!

@pschatzmann
Copy link
Owner

pschatzmann commented Jun 9, 2022

Maybe there is just not enough power ?
I tested with an IPAD having the power 3/4 up...
If I remember right, there is also an API to set the input volume.

@pierluigizagaria
Copy link

pierluigizagaria commented Jun 9, 2022

Tried to input sound from output of my pc with a jack to jack adapter. I get sound but is very distorted and slowed. I was trying to make a voip intercom with this board but is becoming more and more frustrating.

@pschatzmann
Copy link
Owner

If you need to connect the audiokit with the pc you could try to use Wifi or Bluetooth to transmit the audio...

@pierluigizagaria
Copy link

Oh no is just for the audio in test you suggested. But no luck at all

@pschatzmann
Copy link
Owner

Ah, so voip intercom should still be possible...

@pierluigizagaria
Copy link

I was thinking about using the SIP protocol so I can think about my intercom as a phone and send a key number code to open the door. got everything working except the microphone input with esp-adf.

@pschatzmann
Copy link
Owner

I haven't worked with ADF, but I think that's strange: have you tried both AUDIO_HAL_ADC_INPUT_LINE1 and AUDIO_HAL_ADC_INPUT_LINE2 ?

@pierluigizagaria
Copy link

pierluigizagaria commented Jun 9, 2022

Line 2 works only for the built-in microphone. Line 1 low volume buzzing.

I'm thinking about desoldering the microphone and attach an audio jack...

@pschatzmann
Copy link
Owner

pschatzmann commented Jun 9, 2022

Oh, you want to use an external microphone. Is the built-in microphone not good enough ?

@pierluigizagaria
Copy link

With external jack I could take the intercom audio and pipe it into the board so it can send it to my phone and vice versa with the jack out.
I could do it even without jacks and solder wires, but this board has 2 jacks and I would like to make this crappy board do what it's built for..

@pschatzmann
Copy link
Owner

If you check the comment from Uzmeyer: If I am correct, the only way to fix this is taking MIC2 out of the circuit, simplest by removing the coupling caps C19 and C20, then you would be left with a working stereo line-in on LIN2/RIN2 and mono microphone on LIN1+RIN1.

@pierluigizagaria
Copy link

pierluigizagaria commented Jun 9, 2022

What are the coupling caps? Sorry for the stupid question!

2 capacitor on the board. Figured out.

@pierluigizagaria
Copy link

pierluigizagaria commented Jun 13, 2022

I've removed the mic2 from the board and set the line 2 (Not the coupling caps).
The line in with headset still doesn't work BUT mic1 captures audio if I plug the jack into the board line in.
This is driving me crazy.

@pierluigizagaria
Copy link

Desoldered the second mic too. The line2 with linein attached work in a strange way.
If I use a Y adapter and plug a headset with microphone into the board, I can hear sound but the microphone doesn't work. HOWEVER If I put the headphone plug into che linein, my headset speaker act as a microphone!
What's happening?

@pierluigizagaria
Copy link

pierluigizagaria commented Jun 13, 2022

Yes! In the first picture I can hear sound but linein doesn't pick up anything. In the second, headset speakers acts as microphone!

@pschatzmann
Copy link
Owner

pschatzmann commented Jun 13, 2022

I tested with some earphones and when I plug them into Linein like you did, I don't get any output!
So, either your board (version) is messed up, or then signs on your headset are wrong:
Did you try to plug the input into earphones and the output into linein (so picture 2 but reversed) ?

@pierluigizagaria
Copy link

pierluigizagaria commented Jun 13, 2022

Sorry, I've edited the post, the two images were inverted...
I'm so sorry!

Headset works well on pc

@pschatzmann
Copy link
Owner

pschatzmann commented Jun 13, 2022

My gut feeling is that the output of the microphone is just not strong enough to be picked up. Can you test with another audio source. E.g. connect your mobile phone, play music and use full volume
Or there is something wrong with the plugs...

@pierluigizagaria
Copy link

If I connect the headphone to the line in, the headset speakers act as a microphone and works!
It should not be a power problem!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants