-
Notifications
You must be signed in to change notification settings - Fork 40
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
A jack zero latency post #217
Conversation
build failed |
|
||
## What comes next? | ||
|
||
There is a chance to get rid of the extra latency in these cases, and make Mixxx use the buffer provided by Jack/Pipewire. This requires that Mixxx becomes a native Jack or Pipewire application. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why PortAudio can't do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PortAudio Is only software, so it can be refactored to do this. And than Mixxx also need to be refactored to work with the new PortAudio API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would this need a new PortAudio API? If PortAudio doesn't add any extra latency with ALSA then it is IMO a major bug if it does with JACK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you reported this bug upstream to PortAudio?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a bug. It is an intended implementation detail. I had a discussion on the Portaudio Mailing list 5 years ago or such.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot find the discussion in the PortAudio mailing list archive. If PortAudio does not add any latency with ALSA it should be possible to do the same with JACK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this bug is not fixable without a major refactoring, it may be better to write a new PipeWire backend for PortAudio.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, of cause, but that is not that easy, because Portaudio has an abstraction of sound cards. While Jack has just ports.
Portaudio gaps through Jack to get back the soundcard. This is nice to have a common interface for all APIs but comes at a cost of latency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or maybe it would be better to switch to cpal after all...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand how PortAudio's abstractions require adding latency. If they don't for ALSA, they should not for JACK.
I'm not sure our blog is the best place to put this. IMO it belongs in a PortAudio bug report. |
The intention is to get rid of the Jack has zero latency myth. |
We already have it documented in the manual to not use JACK if it is not required. |
JACK does have zero latency. PortAudio adds latency. That is a bug. |
This blog post not a bug report, just proves the current latency situation and give some insights how to measure round trip latency. We have list of pending bugs here: So hopefully this creates some momentum to improve the situation that Mixxx can start polished into the PipWire age. |
@Holzhaus thank you :-) |
The batch commit button was grayed out for some reasons. The file is prefixed with xxx but the date is set. How is this handled? |
With this picture we can verify that Mixxx actually has the same buffer size in both cases. When pressing pause. It fades this signal out over one buffer length these is equal in both cases. | ||
The peaks in the recorded right channel is the sound of the mouse click. You can only barely see the recorded sine wave. | ||
|
||
![Screenshot of audacity showing the fade out]({static}/images/news/fadeoutcompare.png) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 minor nits:
- You could run audacity on the command line with LANG=C to make the user interface english
- I think audacity has a dark mode that you can use to make the screenshots fit better into the general theme of our website.
@@ -0,0 +1,44 @@ | |||
title: "Has JACK zero latency?" | |||
authors: Daniel Schürmann |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add yourself to the AUTHORS_METADATA
dict in the pelicanconf.py
: https://github.com/mixxxdj/website/blob/website/pelicanconf.py#L158
Then run tools/update_avatars.py
. It will automatically fetch your profile picture from github and add it to the source tree (don't forget to git add
it).
Something like:
AUTHOR_METADATA = {
# ...
"daschuer": {
"name": "Daniel Schürmann",
"github": "daschuer",
"discourse": "daschuer",
"tagline": "Mixxx Core Developer",
},
}
The author information including the avatar will be displayed below the post.
298d27f
to
daf5c71
Compare
I came from RustAudio/cpal#560 and uh, this blog post does not explain anything.
It's not OK because it attributes what is apparently a PortAudio flaw to JACK's fault. There's a problem with how it is written. Also, it doesn't give enough information to make this actionable. Please at least link to the PortAudio mailing list discussion which you think is the cause. |
Thank you @ishitatsuyuki, for looking into this.
This blog post was only intended to document the current situation and the way I have gathered the information. Do you recommend any changes?
Is it? It is written from the Mixxx perspective where the user hast the choice between Jack and ALSA API. Please propose a change that this post becomes OK to you.
I have no yet a action to improve the situation. This is just a finding. And the acting from the user perspective is: Use ALSA API.
I cannot find it after a quick search. I will try again. I would be interesting to see the same graphs with CPAL. Can you share them at RustAudio/cpal#560 May be we can use them for a follow up post do document the current state with CPAL. |
Edit: After reading the post again, I think this one is actually fine. The conclusion is also too generalized. You should emphasize that the problem is specific to Mixxx. I think you should write like "For now, we recommend using Mixxx with the ALSA backends even if you are running JACK. The same applies to PipeWire as Mixxx uses JACK protocol to connect to it." Finally, you claim that "This requires that Mixxx becomes a native Jack or Pipewire application" without any investigation into the PortAudio internals. The claim is unprofessional at best, and dubious at worst.
Your blog post doesn't describe the exact method used to take the recording. The software used is probably Audacity, but how did you record the output buffers (in particular when using ALSA directly)? Did you use a loopback? If what we want to know is whether a library's abstraction adds latency, then I think a good idea is to reimplement something like the jack_iodelay tool with that library. I'll try doing that and report the results. |
I agree that it's not fair to imply that JACK is the problem here when the problem is PortAudio. |
This would not be appropriate for our blog. Our blog is for communicating with Mixxx users. It is not a discussion forum for considering the technical challenges Mixxx faces; that is what we have Zulip for. |
Thank you @ishitatsuyuki, I will update the blog post with your suggestions.
I have played a 440 Hz sine wave with Mixxx on the left channel and the microphone input on the right channel. The feedback loop was closed via air. Than I use the recording feature of Mixxx to record the result. Audacity is used vor visualize the results and to compare the recordings. I don't think you can use jack_iodelay directly because it does not use CPAL but the approach in general will work. |
I agree that it's not the right place for discussion, but I don't think that was @daschuer's intention. I think it's interesting for our users to follow the development progress and how we tackle obstacles and challenges. Your build infrastructure blog post is an example of that. |
How did you do this considering Mixxx cannot record separate channels, only a single stereo mix? |
Yes, I agree. But that post was made after we had a solution to show, not to start a discussion. |
Via the balance effect. I have added it to the blog. |
Yes right. May be we can reference the results as an amendment, to this if it contains user relevant Info. |
Co-authored-by: Jan Holthuis <holthuis.jan@googlemail.com>
Co-authored-by: Jan Holthuis <holthuis.jan@googlemail.com>
Co-authored-by: Jan Holthuis <holthuis.jan@googlemail.com>
Co-authored-by: Jan Holthuis <holthuis.jan@googlemail.com>
Co-authored-by: Jan Holthuis <holthuis.jan@googlemail.com>
Co-authored-by: Jan Holthuis <holthuis.jan@googlemail.com>
Co-authored-by: Jan Holthuis <holthuis.jan@googlemail.com>
Co-authored-by: ronso0 <ronso0@mixxx.org>
Co-authored-by: ronso0 <ronso0@mixxx.org>
Co-authored-by: ronso0 <ronso0@mixxx.org>
Co-authored-by: ronso0 <ronso0@mixxx.org>
Nope, the update_avatars,py script is just out of date. I'll remove it, because it's obsolete. You can just build the page locally and it automatically fetches the avatar to the right directory:
|
The issue persists after rebase. |
Sorry, that comment was wrong, try this please: #217 (comment) |
|
In short, run these commands: $ python3 -m venv venv # Create a virtual environment named "venv"
$ source venv/bin/activate # Activate the virtual environment
(venv) $ pip install -r requirements.txt # Install requirements to build website into the venv
(venv) $ pelican # Build website
(venv) $ deactivate # Leave virtual environment
$ git add content/images/avatars Next time you want to build the website: $ source venv/bin/activate # Activate the virtual environment
(venv) $ pelican # Build website |
Thank you! |
No description provided.