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

fix channel ordering #6

Open
wants to merge 1 commit into
base: v5.9
Choose a base branch
from
Open

Conversation

jacopomaroli
Copy link

This is an attempt to address respeaker#309

It's an improvement on the patch proposed here respeaker#309 (comment)

As far as I understand it the idea was to change the clock in the ac108 (input) driver instead of the seeed-voicecard which combines the two.

The problem is that (as the initial change was written) it was getting rid also of the clock change for the ac101 (output) without doing it anywhere else. This lead to broken output. (at least on my respeaker 6 mic)

Also now that we're doing ac108_set_clock(0, substream, cmd, dai); in the SNDRV_PCM_TRIGGER_PAUSE_PUSH event, there's no need to call ac101_trigger(substream, cmd, dai) explicitly since this is done anyway inside the ac108_set_clock function.

I tested this code and I'm consistently getting the two loopback channels at the end of the 8 inputs.

@LinLin1230
Copy link

Tested on raspberry pi 3b+ and no channel shifts bug.

Appreciate for your work.

@jacopomaroli
Copy link
Author

hey @LinLin1230 , thanks! Just wanted to let you know that despite improving things a lot, it wasn't a 100% bullet proof solution.
As per respeaker#309 (comment) I ended up implementing a system to detect loopback channels by their volume when running https://github.com/voice-engine/ec .

Probably we're on the right track here but there's still some work to be done. My current speculation (I could be totally wrong) is that since all the channels are writing into the same circular buffer, there's no way to know where channel 0 start; so if you delay when you start reading, you might end up offsetting your read onto other channels. This patch makes things better by starting the clock ASAP.

But yeah, just speculations. I definitely didn't spend enough time reading and debugging the code

@HinTak HinTak closed this Apr 10, 2023
@HinTak
Copy link
Owner

HinTak commented Apr 10, 2023

Apologies, trying to change default branch to v6.1 and failed, though it might be open pulls blocking it. Turn out not be the case. Leave open until I have time to think about it.

@HinTak HinTak reopened this Apr 10, 2023
@HinTak
Copy link
Owner

HinTak commented Apr 10, 2023

It is that the mobile phone version of github does not let me. Switching to desktop version went ahead.

@wshanmu
Copy link

wshanmu commented Jan 27, 2024

Hi, I tested it with my raspberry pi 4B with 32-bit Bookwarm OS and a kernel version of 6.1. But the bug still exists.

Could you please share what OS are you using so that I can test whether the OS matters?

Thanks a lot!

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.

4 participants