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

Jack : buffer per period parameter and audio latency calculation #437

Closed
newlaurent62 opened this issue Jul 6, 2020 · 6 comments
Closed
Labels
bug Something isn't working

Comments

@newlaurent62
Copy link
Contributor

newlaurent62 commented Jul 6, 2020

Hello,

Changing buffer per period parameters in qjackctl decrease the number of Xruns (at least for USB Sound card) for the same period/frame but this increase the audio latency. Latency that is not report by Jamulus in settings.

It seems that Jamulus does not care of buffer per period in audio latency calculation.

BR,
Laurent

@corrados corrados added the bug Something isn't working label Jul 6, 2020
@corrados
Copy link
Contributor

There is a function called GetInOutLatencyMs() in Jamulus which is not implemented for the Jack audio interface (actually it is just implemented for the Windows ASIO interface). In the Jack audio help pages I found the following:
https://jackaudio.org/api/group__LatencyFunctions.html
I have not really understand how I can simply query the input/output latency. A lot of functions are declared as deprecated. If anyone has experience with this, please give a hint in this Issue.

@hselasky
Copy link
Contributor

@newlaurent62:
I have some patches for JACK and Jamulus. Can you give them a spin and see if they improve anything for you?
#529

--HPS

@bflamig
Copy link
Contributor

bflamig commented Aug 25, 2020

@corrados:

I have implemented the GetInOutLatencyMs() for the Jack audio interface. I have tested it with two different audio devices with a Raspberry Pi. I'll make a fork for it soon. (I'm still learning GitHub).

The basic gist is to call jack_port_get_latency_range(), which according to jackaudio.org is the function to call (about the only one of the latency functions that hasn't been deprecated.) After opening the jack ports, call this function twice, once for each direction (in and out.)

On my Raspberry Pi 4, I plugged in a Behringer UMC404HD, and also a Focusrite Scarlett 4i4. I put in some debug print statements, and below are the results using a frames/period value of 64, and periods of 2, 3, and 4. The latencies reported below are in units of frames.

Behringer, Frames/Period = 64, Periods/Buffer = 2: Input latency = 64, Output latency = 128, Total latency = 192
Behringer, Frames/Period = 64, Periods/Buffer = 3; Input latency = 64, Output latency = 192, Total latency = 256
Behringer, Frames/Period = 64, Periods/Buffer = 4; Input latency = 64, Output latency = 256, Total latency = 320

Scarlett, Frames/Period = 64, Periods/Buffer = 2: Input latency = 64, Output latency = 128, Total latency = 192
Scarlett, Frames/Period = 64, Periods/Buffer = 3; N/A
Scarlett, Frames/Period = 64, Periods/Buffer = 4; Input latency = 64, Output latency = 256, Total latency = 320

@bflamig
Copy link
Contributor

bflamig commented Aug 25, 2020

@corrados:

Okay, I created a fork and branch at bflamig/jamulus that has proposed changes to compute latency for Jack interfaces (blfamig:jack_latency). Just a few lines in two files. I'm unsure how to make a pull request. Github is still new to me.

@corrados
Copy link
Contributor

Great, I saw your pull request, thanks. I'll do a review shortly.

@corrados
Copy link
Contributor

Your code is now applied to the Git master. Thanks again for fixing -> closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants