Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft - do not merge - Audio bridge between i2s mic and uac2 gadget #102

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jeztek
Copy link

@jeztek jeztek commented Feb 12, 2021

Creates an uac2 usb audio gadget and uses alsaloop to bridge audio between it and an i2s microphone

@jeztek jeztek mentioned this pull request Feb 12, 2021
@htruong
Copy link
Contributor

htruong commented Feb 13, 2021

Awesome. This is one rather interesting PRs. How did testing go?

@jeztek
Copy link
Author

jeztek commented Feb 13, 2021

Awesome. This is one rather interesting PRs. How did testing go?

It kinda works? I've successfully used the microphone but it also introduces some unusual behavior that I've detailed here.

@htruong
Copy link
Contributor

htruong commented Feb 15, 2021

Ah, thank you! Sorry I missed the reply on the linked thread. Please help by cleaning it up and allowing a config change to forward the audio. Since this hardware is less common, the better way to deal with this is to disable it by default and allowing enabling it with a sentinel file.

@nootc
Copy link

nootc commented Feb 15, 2021

I am using this mic. Earlier, when testing with a KDE Neon host on Audacity, I was getting inconsistent samples of sound. Now, there is no sound detected with Audacity or arecord. I have verified that the mic works and have re-flashed the image, still nothing. Is there anything that can be done?

@jeztek
Copy link
Author

jeztek commented Feb 17, 2021

@htruong sounds good, I'll work on cleaning this PR up and adding a sentinel. @nootc, just to confirm, are you getting inconsistent sound samples using my PR or using a different approach? I actually have a SPH0645 mic handy so I'll try reproducing your results.

@nootc
Copy link

nootc commented Feb 18, 2021

@jeztek, thanks for replying and spending time on this. I have been getting inconsistent sound samples using the PR zip file (git clone wasn't getting the modified version for some reason). To verify the mic was working, I used RPi OS and the documentation. I am using a single mic.

@nootc
Copy link

nootc commented Feb 18, 2021

EUREKA! I changed board/audiobridge.sh so that:

amixer set Boost 50%

instead of 85%. It works great now. I tried 55% and above, but that is when the problems start. I can record with Audacity, but not arecord for some reason.
Edit:
arecord works now.

@nootc
Copy link

nootc commented Mar 17, 2021

Is there any way of turning off the audio output? Doing so may help reduce the artifacts on the video feed.

@nootc
Copy link

nootc commented Mar 25, 2021

@jeztek
#43 (comment)
Does this mean that speaker-test replaces alsaloop in board/audiobridge.sh? I tried this, but failed to get any sound samples from the mic to the host.

@nootc
Copy link

nootc commented Mar 31, 2021

The microphone isn't working in Windows 10. The mic does appear in device manager under "Sound, video and game controllers" as "Source/Sink", but I am getting the error "This device cannot start. (Code 10)".
Seems to be traced to the UAC2 gadget in the kernel.
The kernel seems to have gone a different direction with that section of code, but the mic is still not working on Windows:
torvalds/linux@a9cf871#diff-876615ece7fb56ce8d45fc70623bef9caa2548e810426f217fb785ffa10b33d5
Those changes seemed to have made it into our kernel (5.4.73):
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/usb/gadget/function/f_uac2.c?h=v5.4.73#n218
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/usb/gadget/function/f_uac2.c?h=v5.4.73#n501
I found this post stating that using UAC1 may work. Is it possible to use UAC1 instead of UAC2?
Edit:
Tried UAC1. Still doesn't work. Something is wrong with both drivers.

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

Successfully merging this pull request may close these issues.

None yet

3 participants