You are not logged in.

#1 2020-08-02 10:23:51

Ploppz
Member
Registered: 2013-09-14
Posts: 311

[SOLVED] Cannot go below 2048 samples buffer size in JACK

I have been trying to set up an OK audio production system since March but it's just a never-ending struggle.
I cannot avoid xruns without using buffer size 2048 which makes live recording of an instrument impractical (if audio has to be routed through JACK for playback of course, which I might want to do).

Soundcard is integrated ALC892 realtek chip on my motherboard, which is MSI B350M Mortar.
CPU: Ryzen 5 1600.

I'm using Cadence with ALSA -> PulseAudio -> JACK bridge.
I did set PA's sample frequency to 48k; the same as in JACK.

On the generic kernel, if I go below 2048 buffer size, I get many xruns per second.
I tried the RT kernel, and it seemed like I could go down to 1024 buffer size without any xruns, but that was when playing from Spotify.
However, when recording input from a digital piano I got 8 xruns in 10 minutes. Only 2 of which were audible but... this is really not good, it ruins the recording.

I updated the BIOS just in case,
I tried linux-zen kernel, linux-rt and linux-rt-lts. These all seem to work more or less the same - marginally better than generic kernel.
With one exception: on the `linux-rt` kernel, it was able to use buffer size 16 with 2 periods perfectly! Uses a lot of CPU of course but it seemed flawless.
While 16 was perfect, 32 and up to 512 was catastrophical. That's really weird behaviour. Then 1024 was ok-ish.
But now it cannot do 16 at all anymore - Cadence just crashes when I try to set it. Idk if it was due to the BIOS update that it lost this ability?
But well, in any case I wouldn't actually want such a small buffer size. Preferrably in the 128-512 range.

People have said that they would expect my system to be able to handle 256 buffer size without xruns. Definitely something is off when no matter what I try, I cannot reliably go below 2048 buffer size.

Any ideas what more I can try?


Edit: On second thought I'm not sure if there's any difference between RT kernel and generic kernel. Maybe slight. However, both in RT kernel and in Zen kernel I experience random things crashing... so I'm going back to generic kernel.
However, as I might have forgotten, even with buffer size 2048 and 2 periods, I do get xruns occasionally, and it's very annoying.

Last edited by Ploppz (2020-08-02 16:20:13)

Offline

#2 2020-08-02 10:32:53

ondoho
Member
Registered: 2013-04-30
Posts: 692
Website

Re: [SOLVED] Cannot go below 2048 samples buffer size in JACK

Have you considered taking pulseaudio out of the equation completely? Uninstalling it? You don't really need it. The few apps that require it (Firefox, possibly spotify?) can be used with apulse to play sound.

Offline

#3 2020-08-02 13:35:38

Ploppz
Member
Registered: 2013-09-14
Posts: 311

Re: [SOLVED] Cannot go below 2048 samples buffer size in JACK

Thanks I'm trying it right now.

Edit: Had some errors here.
But I fixed them by changing by ~/.asoundrc.
However, it seems like I can only run one application at a time with `pulseaudio`?? When I try to run `apulse spotify` after `apulse firefox`, and when I then try to play music in spotify it says

apulse] [error] do_connect_pcm: can't open playback device "default". Error code -16 (Device or resource busy)
[apulse] [error] do_connect_pcm: failed to open ALSA device. Apulse does no resampling or format conversion, leaving that task to ALSA plugins. Ensure that selected device is capable of playing a particular sample format at a particular rate. They have to be supported by either hardware directly, or by "plug" and "dmix" ALSA plugins which will perform required conversions on CPU.

Which leads me to believe that `apulse firefox` has exclusive access to the soundcard? Doesn't apulse do any mixing between sources?

I require normal desktop usage which means effortless multitasking between applications that require sound.

Last edited by Ploppz (2020-08-02 14:26:22)

Offline

#4 2020-08-02 16:20:01

Ploppz
Member
Registered: 2013-09-14
Posts: 311

Re: [SOLVED] Cannot go below 2048 samples buffer size in JACK

The problem is solved.
Spent a lot of time testing out jack1 and jack2 with ALSA only. Still the same problem.
Then, found this https://unix.stackexchange.com/question … ack/559534

And yep, setting sample rate to 96000 makes it possible to go all the way down to 128 buffer size without any problems!
Really weird hardware quirk.

Offline

#5 2020-08-03 07:43:50

ondoho
Member
Registered: 2013-04-30
Posts: 692
Website

Re: [SOLVED] Cannot go below 2048 samples buffer size in JACK

Ploppz wrote:

Which leads me to believe that `apulse firefox` has exclusive access to the soundcard? Doesn't apulse do any mixing between sources?

On my desktop ALSA is perfectly capable of doing that (not using apulse).
Possibly installing then uninstalling pulseaudio did something there.
And FF on Archlinux doesn't even require apulse (anymore), sorry about that, I'm sure it did at some point.

Ploppz wrote:

The problem is solved.
...
And yep, setting sample rate to 96000 makes it possible to go all the way down to 128 buffer size without any problems!
Really weird hardware quirk.

Weird indeed.
Glad you solved it!

Offline

Board footer

Powered by FluxBB