Crackling without xruns with RT PREEMPT kernel

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

User avatar
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Crackling without xruns with RT PREEMPT kernel

Post by lilith »

Posted this elsewhere, but I think it's worse an extra thread.

When using Renoise with Jack and my Zoom R8 interface I get crackling in the output at DSP loads of around 50%, but these crackles are not caused by xruns. There are no xruns and when I record the output there are also no crackles.

The problem does not occure with ALSA with the same parameters (48kHz, 1024 samples, 3 periods). I also could not reproduce it with Jack and Bitwig.

When I decrease the buffer size from 1024 to 512 it's better or even gone. Today I tested another interface and no problems at all with Jack at 1024.

Does anyone have an idea or did anybody oberved similar issues? I don't think the interface is broken as it is working fine with Alsa. Also strange that large buffers work even worse. It should be the other way around. On the other hand it is not a xrun issue.
Last edited by lilith on Wed May 06, 2020 7:08 pm, edited 1 time in total.
User avatar
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Re: Crackling without xruns.. worse with large buffers

Post by lilith »

Summay and Update:

Crackling without xruns with Renoise and my interface Zoom R8 when using Jack at DSP loads (shown in Jack or Renoise) > ~55%.

No issues with Bitwig / Zoom R8 / Jack
No issues with Renoise / ESI DAC interface / Jack
No issues with Renoise / Zoom R8 / Alsa

The problem with the combination Renoise / Zoom R8 / Jack gets even worse when I increase the buffer size from 1024 to 2048 samples. It becomes better when I reduce the buffer to 512 samples. Which is strange.

When I reduce the Multi CPU setting from 4 to 3 it also becomes better. I try to figure out via IRC what the problem is but I absolutely have no clue. Why does Renoise behave different than Bitwig and why is only one interface / DAW combination affected?

Another thing I just observed: I’m using rtirq to handle the IRQs (https://alsa.opensrc.org/Rtirq).
When I set Renoise to 3 CPU cores I get much better results (less crackling) when IRQ handling is enabled,
i.e. the soundcard (zoom) is set to priority 95

189 FF 95 - 135 3.8 S irq/28-xhci_hcd
224 FF 94 - 134 0.0 S irq/30-xhci_hcd
9 TS - 0 19 0.0 S ksoftirqd/0

When I stop rtirq (sudo /etc/init.d/rtirq stop) crackling is much worse. I really don't know how to interpret this.

Maybe I just should buy another interface?
User avatar
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Re: Crackling without xruns.. worse with large buffers

Post by lilith »

Noone? I'm not necessarily looking for a solution if the solution is to buy another interface :D Just wonder how this can be.
User avatar
funkmuscle
Established Member
Posts: 2806
Joined: Mon Jun 02, 2008 2:30 pm
Has thanked: 131 times
Been thanked: 33 times

Re: Crackling without xruns.. worse with large buffers

Post by funkmuscle »

Dude I'm having the same issues with Ardour, Mixbus32C and Reaper.
I've switched usb ports, switched usb cable and still the same.. Crackling like beacon cooking then the audio slows and sounds robotic.
I'm thinking it's either Alsa or Jack as this happens with my 2i2 and ua-25 interfaces.
buffer is 1024 for mixing (mixbus32c)
buffer is 256 for recording (Ardour, Reaper)
I don't get the issues while recording, only when mixing in MB32C or fixing up the recordings in Reaper and Ardour before exporting for mixing. The fix up if not redoing a recording is at buffer 1024. Dunno if a new interface will help as it's doing it with both interfaces here.
User avatar
funkmuscle
Established Member
Posts: 2806
Joined: Mon Jun 02, 2008 2:30 pm
Has thanked: 131 times
Been thanked: 33 times

Re: Crackling without xruns.. worse with large buffers

Post by funkmuscle »

I've changed buffer from 1024 to 512 and no more crackling or popping but cpu is maxing out on me using Mixbus32C. Getting the red warning as it hit 89%
User avatar
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Re: Crackling without xruns.. worse with large buffers

Post by lilith »

That sounds similar. Is the issue new for you? For me it only occurs with Jack and only with the Zoom in Renoise. @Drumfix mentioned that it might help to implememt a implicit feedback Quirk in the kernel. (What ever this is doing).
User avatar
funkmuscle
Established Member
Posts: 2806
Joined: Mon Jun 02, 2008 2:30 pm
Has thanked: 131 times
Been thanked: 33 times

Re: Crackling without xruns.. worse with large buffers

Post by funkmuscle »

lilith wrote: Fri Apr 17, 2020 6:29 pm That sounds similar. Is the issue new for you? For me it only occurs with Jack and only with the Zoom in Renoise. @Drumfix mentioned that it might help to implememt a implicit feedback Quirk in the kernel. (What ever this is doing).
yep new to me. everything use to work flawlessly until a few weeks ago!!
User avatar
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Re: Crackling without xruns.. worse with large buffers

Post by lilith »

funkmuscle wrote: Fri Apr 17, 2020 9:22 pm
lilith wrote: Fri Apr 17, 2020 6:29 pm That sounds similar. Is the issue new for you? For me it only occurs with Jack and only with the Zoom in Renoise. @Drumfix mentioned that it might help to implememt a implicit feedback Quirk in the kernel. (What ever this is doing).
yep new to me. everything use to work flawlessly until a few weeks ago!!
Did you update anything, e.g kernel?
User avatar
funkmuscle
Established Member
Posts: 2806
Joined: Mon Jun 02, 2008 2:30 pm
Has thanked: 131 times
Been thanked: 33 times

Re: Crackling without xruns.. worse with large buffers

Post by funkmuscle »

lilith wrote: Fri Apr 17, 2020 9:26 pm
funkmuscle wrote: Fri Apr 17, 2020 9:22 pm
lilith wrote: Fri Apr 17, 2020 6:29 pm That sounds similar. Is the issue new for you? For me it only occurs with Jack and only with the Zoom in Renoise. @Drumfix mentioned that it might help to implememt a implicit feedback Quirk in the kernel. (What ever this is doing).
yep new to me. everything use to work flawlessly until a few weeks ago!!
Did you update anything, e.g kernel?
Yep, the latest vanilla and the latest RT on Arch...
puleglot
Established Member
Posts: 135
Joined: Thu Jan 23, 2020 3:14 pm
Has thanked: 3 times
Been thanked: 13 times

Re: Crackling without xruns.. worse with large buffers

Post by puleglot »

@lilith
Answering to viewtopic.php?p=117517#p117517

I've found out that some devices with synchronous endpoints perform much better if the driver packs less iso frames per URB. This is the case with my Microbook IIc for example. You might want to try to decrease MAX_PACKS value in sound/usb/card.h from 6 to 4, 2 or 1.

Code: Select all

diff --git a/sound/usb/card.h b/sound/usb/card.h
index 395403a2d33f..ae5f5836a817 100644
--- a/sound/usb/card.h
+++ b/sound/usb/card.h
@@ -3,7 +3,7 @@
 #define __USBAUDIO_CARD_H
 
 #define MAX_NR_RATES	1024
-#define MAX_PACKS	6		/* per URB */
+#define MAX_PACKS	4		/* per URB */
 #define MAX_PACKS_HS	(MAX_PACKS * 8)	/* in high speed mode */
 #define MAX_URBS	12
 #define SYNC_URBS	4	/* always four urbs for sync */
puleglot
Established Member
Posts: 135
Joined: Thu Jan 23, 2020 3:14 pm
Has thanked: 3 times
Been thanked: 13 times

Re: Crackling without xruns.. worse with large buffers

Post by puleglot »

Also for some people applying implicit fb quirk helps (this was done for Behringer UFX1204/UFX1604 in mainline kernel). But it's a hack and shouldn't be necessary for devices with synchronous endpoints. So I think something is wrong with some hcd drivers or somewhere in usbcore.
User avatar
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Re: Crackling without xruns.. worse with large buffers

Post by lilith »

@ puleglot: Thanks for the answer. Your change would mean compiling the kernel on my own, right? I first have to see how to do that :) .
I find it strange that I only get the issue with Renoise and Jack. If it's a kernel thing shouldn't I get the problems also with Alsa?
puleglot
Established Member
Posts: 135
Joined: Thu Jan 23, 2020 3:14 pm
Has thanked: 3 times
Been thanked: 13 times

Re: Crackling without xruns.. worse with large buffers

Post by puleglot »

lilith wrote: Sat Apr 18, 2020 2:14 pm Your change would mean compiling the kernel on my own, right? I first have to see how to do that :) .
Yes :)
lilith wrote: Sat Apr 18, 2020 2:14 pm I find it strange that I only get the issue with Renoise and Jack. If it's a kernel thing shouldn't I get the problems also with Alsa?
If you don't have such issues with alsa with the same buffer settings, then the issue is indeed might be somewhere else and decreasing MAX_PACKS value would not help. On the other hand you mentioned that crackling is worse with large buffers. When you increase buffer size, the driver packs more and more iso frames per URB until MAX_PACKS limit is reached. So I'm not sure. The only way to verify my theory is to compile and test patched kernel. :)

And could you post lsusb -v -d 1686:014f output again please? I want to verify that endpoints are indeed Synchronous.
User avatar
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Re: Crackling without xruns.. worse with large buffers

Post by lilith »

puleglot wrote: Sat Apr 18, 2020 2:25 pm
lilith wrote: Sat Apr 18, 2020 2:14 pm Your change would mean compiling the kernel on my own, right? I first have to see how to do that :) .
Yes :)
lilith wrote: Sat Apr 18, 2020 2:14 pm I find it strange that I only get the issue with Renoise and Jack. If it's a kernel thing shouldn't I get the problems also with Alsa?
If you don't have such issues with alsa with the same buffer settings, then the issue is indeed might be somewhere else and decreasing MAX_PACKS value would not help. On the other hand you mentioned that crackling is worse with large buffers. When you increase buffer size, the driver packs more and more iso frames per URB until MAX_PACKS limit is reached. So I'm not sure. The only way to verify my theory is to compile and test patched kernel. :)
Yes, with Alsa the interface is working perfectly. The crackling starts when I hit around 55% DSP load in Renoise and gets better when I decrease the buffer size (but only with Jack) or when I set the used CPU cores from 4 to 3. I also asked at the renoise forum, maybe someone replies there too. With Bitwig the interface also works. No crackling with Jack / Bitwig.
puleglot
Established Member
Posts: 135
Joined: Thu Jan 23, 2020 3:14 pm
Has thanked: 3 times
Been thanked: 13 times

Re: Crackling without xruns.. worse with large buffers

Post by puleglot »

So this might be a Renoise+Jack specific issue indeed.
Post Reply