Crackling without xruns with RT PREEMPT kernel

Optimize your system for ultimate performance.

Moderators: khz, MattKingUSA

User avatar
lilith
Established Member
Posts: 1494
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Contact:

Re: Crackling without xruns.. worse with large buffers

Post by lilith »

puleglot wrote: Mon Apr 20, 2020 9:15 pm
lilith wrote: Mon Apr 20, 2020 9:11 pm Did someone delete something here??
Yes, that was me. :)
lilith wrote: Mon Apr 20, 2020 9:03 pm Why are they changeing these things in the kernel??
I didn't understand this question.
I see :mrgreen: I mean in the older kernel it was obviously working. The problem startet with a kernel update for funkmuscle
puleglot
Established Member
Posts: 113
Joined: Thu Jan 23, 2020 3:14 pm

Re: Crackling without xruns.. worse with large buffers

Post by puleglot »

lilith wrote: Mon Apr 20, 2020 9:37 pm I see :mrgreen: I mean in the older kernel it was obviously working. The problem startet with a kernel update for funkmuscle
Maybe he just didn't notice this issue before. :)

Update: it turned out he had a hardware failure
User avatar
lilith
Established Member
Posts: 1494
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Contact:

Re: Crackling without xruns.. worse with large buffers

Post by lilith »

puleglot wrote: Sat Apr 18, 2020 3:23 pm
lilith wrote: Sat Apr 18, 2020 3:05 pm What about the Behringer U-Phoria USB Interfaces? Do they have a better compatibility or which interface would you recommend?
For the best compatibility with linux you should get an USB audio class compliant interface with Asynchronous endpoints and explicit feedback. So basically any XMOS-based interface excluding Scarlett 3rd Gen and MOTU M2/M4 should work. :) I think Behringer U-Phoria meets this criteria. I have Roland Rubix24 that works without any problems. 2nd Gen Scarlett should be fine (but you can only find them used I think) and a lot of other interfaces in the same generation.
I was wrong. Just tested it once more and the crackles occur in duplex and non-duplex mode. The ESI DAC works fine (tested it again)
That's the Roland

Code: Select all

Bus 002 Device 002: ID 0582:01e0 Roland Corp. 
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2 
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  idVendor           0x0582 Roland Corp.
  idProduct          0x01e0 
  bcdDevice           11.1f
  iManufacturer           1 
  iProduct                3 
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0162
    bNumInterfaces          6
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower                0mA
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         0
      bInterfaceCount         3
      bFunctionClass          1 Audio
      bFunctionSubClass       0 
      bFunctionProtocol      32 
      iFunction               0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      1 Control Device
      bInterfaceProtocol     32 
      iInterface              3 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               2.00
        bCategory               8
        wTotalLength       0x0065
        bmControls           0x01
          Latency control Control (read-only)
      AudioControl Interface Descriptor:
        bLength                 8
        bDescriptorType        36
        bDescriptorSubtype     10 (CLOCK_SOURCE)
        bClockID               41
        bmAttributes            3 Internal programmable clock 
        bmControls           0x07
          Clock Frequency Control (read/write)
          Clock Validity Control (read-only)
        bAssocTerminal          0
        iClockSource            9 
      AudioControl Interface Descriptor:
        bLength                 8
        bDescriptorType        36
        bDescriptorSubtype     11 (CLOCK_SELECTOR)
        bClockID               40
        bNrInPins               1
        baCSourceID(0)         41
        bmControls           0x03
          Clock Selector Control (read/write)
        iClockSelector          8 
      AudioControl Interface Descriptor:
        bLength                17
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID             2
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          0
        bCSourceID             40
        bNrChannels             4
        bmChannelConfig    0x00000000
        iChannelNames          13 
        bmControls         0x0000
        iTerminal               6 
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID            20
        wTerminalType      0x0301 Speaker
        bAssocTerminal          0
        bSourceID               2
        bCSourceID             40
        bmControls         0x0000
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                17
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID             1
        wTerminalType      0x0201 Microphone
        bAssocTerminal          0
        bCSourceID             40
        bNrChannels             2
        bmChannelConfig    0x00000000
        iChannelNames          17 
        bmControls         0x0000
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                18
        bDescriptorType        36
        bDescriptorSubtype      6 (FEATURE_UNIT)
        bUnitID                11
        bSourceID               1
        bmaControls(0)     0x00000000
        bmaControls(1)     0x00000000
        bmaControls(2)     0x00000000
        iFeature                0 
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID            22
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          0
        bSourceID              11
        bCSourceID             40
        bmControls         0x0000
        iTerminal               7 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol     32 
      iInterface              4 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           2
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol     32 
      iInterface              4 
      AudioStreaming Interface Descriptor:
        bLength                16
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink           2
        bmControls           0x00
        bFormatType             1
        bmFormats          0x00000001
          PCM
        bNrChannels             4
        bmChannelConfig    0x00000000
        iChannelNames          13 
      AudioStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bSubslotSize            4
        bBitResolution         24
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x0190  1x 400 bytes
        bInterval               1
        AudioStreaming Endpoint Descriptor:
          bLength                 8
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x00
          bmControls           0x00
          bLockDelayUnits         2 Decoded PCM samples
          wLockDelay         0x0008
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes           17
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Feedback
        wMaxPacketSize     0x0004  1x 4 bytes
        bInterval               4
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol     32 
      iInterface              5 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol     32 
      iInterface              5 
      AudioStreaming Interface Descriptor:
        bLength                16
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink          22
        bmControls           0x00
        bFormatType             1
        bmFormats          0x00000001
          PCM
        bNrChannels             2
        bmChannelConfig    0x00000000
        iChannelNames          17 
      AudioStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bSubslotSize            4
        bBitResolution         24
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x00c8  1x 200 bytes
        bInterval               1
        AudioStreaming Endpoint Descriptor:
          bLength                 8
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x00
          bmControls           0x00
          bLockDelayUnits         2 Decoded PCM samples
          wLockDelay         0x0008
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      1 Control Device
      bInterfaceProtocol      0 
      iInterface              0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength       0x0009
        bInCollection           1
        baInterfaceNr(0)        1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        4
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         1 Audio
      bInterfaceSubClass      3 MIDI Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      MIDIStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength       0x0041
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               1 Embedded
        bJackID                 1
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               2 External
        bJackID                 2
        iJack                  12 
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               1 Embedded
        bJackID                 3
        bNrInputPins            1
        baSourceID( 0)          2
        BaSourcePin( 0)         1
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               2 External
        bJackID                 4
        bNrInputPins            1
        baSourceID( 0)          1
        BaSourcePin( 0)         1
        iJack                  11 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
        bRefresh                0
        bSynchAddress           0
        MIDIStreaming Endpoint Descriptor:
          bLength                 5
          bDescriptorType        37
          bDescriptorSubtype      1 (GENERAL)
          bNumEmbMIDIJack         1
          baAssocJackID( 0)       1
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
        bRefresh                0
        bSynchAddress           0
        MIDIStreaming Endpoint Descriptor:
          bLength                 5
          bDescriptorType        37
          bDescriptorSubtype      1 (GENERAL)
          bNumEmbMIDIJack         1
          baAssocJackID( 0)       3
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        5
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass       254 Application Specific Interface
      bInterfaceSubClass      1 Device Firmware Update
      bInterfaceProtocol      1 
      iInterface             10 
      Device Firmware Upgrade Interface Descriptor:
        bLength                             9
        bDescriptorType                    33
        bmAttributes                        7
          Will Not Detach
          Manifestation Tolerant
          Upload Supported
          Download Supported
        wDetachTimeout                    250 milliseconds
        wTransferSize                      64 bytes
        bcdDFUVersion                   1.10
So the ESI DAC has adaptive endpoints, the Zoom synchronous and the Roland asynchronous endpoints.
With Bitwig and Reaper no issues, only with Renoise.
puleglot
Established Member
Posts: 113
Joined: Thu Jan 23, 2020 3:14 pm

Re: Crackling without xruns.. worse with large buffers

Post by puleglot »

puleglot wrote: Sat Apr 18, 2020 1:51 pm 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.
Ignore this. After some more testing I came to conclusion that this is actually pulseaudio-only issue (related to timer-based scheduling and transfer size).
User avatar
lilith
Established Member
Posts: 1494
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Contact:

Re: Crackling without xruns.. worse with large buffers

Post by lilith »

puleglot wrote: Sat May 02, 2020 8:36 pm
puleglot wrote: Sat Apr 18, 2020 1:51 pm 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.
Ignore this. After some more testing I came to conclusion that this is actually pulseaudio-only issue (related to timer-based scheduling and transfer size).
Ah ok. I will keep it anyway. It looks much better than the zoom :lol: . I tried a very old Renoise version from 2010 and there it also crackles, but it correlates with xruns. On the old version it is getting worse when I open chromium (cause CPU usage goes up a lot). In the latest Renoise version it is crackling much more and it does not get worse when opening chromium. I try if I can locate when there was a change in Renoise.
Last edited by lilith on Sat May 02, 2020 9:31 pm, edited 1 time in total.
User avatar
lilith
Established Member
Posts: 1494
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Contact:

Re: Crackling without xruns.. worse with large buffers

Post by lilith »

Ok, until Renoise 2.72 it behaves normal I would say. The issue becomes worse or apparent with 2.8.0.
User avatar
lilith
Established Member
Posts: 1494
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Contact:

Re: Crackling without xruns.. worse with large buffers

Post by lilith »

I was testing the Zoom R8 on a Laptop (also with Debian 10 running). There is no crackling in Renoise. If there is then I also get xruns. The way it should be.

My assumption at the moment is that I misconfigured something with RT prioritization.
User avatar
lilith
Established Member
Posts: 1494
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Contact:

Re: Crackling without xruns.. worse with large buffers

Post by lilith »

OMG:
I found what's responsible for that mess. I almost thought my CPU or RAM is broken, but it was the #GRUB threadirqs boot option

Some weeks ago I realized that I don't have the RTIRQ script running. When I made some changes in the RTIRQ settings file I added threadirqs to the boot options. Is far I understand this is needed for RTIRQ. I took it out now, rebooted and the crackling is gone!

But what I don't understand yet is: Why did I still get crackles (with threadirqs in the boot parameters) when I stop RTIRQ with

Code: Select all

sudo /etc/init.d/rtirq stop
? Shouldn't this stop IRQ handling?

The other question is also why does threadirqs affects Renoise, but not Bitwig or Reaper.

edit: Seems much more prone to xruns now (also in Bitwig). Is it possbile that it's getting worse with RT IRQ handling when using large buffer sizes like 1024 samples?


Maybe that's part of the problem. Frequency should be 1000 Hz.

Code: Select all

cat /boot/config-`uname -r` | grep HZ
CONFIG_NO_HZ_COMMON=y
# CONFIG_HZ_PERIODIC is not set
CONFIG_NO_HZ_IDLE=y
# CONFIG_NO_HZ_FULL is not set
# CONFIG_NO_HZ is not set
# CONFIG_HZ_100 is not set
CONFIG_HZ_250=y
# CONFIG_HZ_300 is not set
# CONFIG_HZ_1000 is not set
CONFIG_HZ=250
CONFIG_MACHZ_WDT=m
User avatar
thetotalchaos
Established Member
Posts: 186
Joined: Mon Sep 29, 2014 8:29 pm
Contact:

Re: Crackling without xruns.. worse with large buffers

Post by thetotalchaos »

lilith wrote: Sun May 03, 2020 8:41 pm OMG:
I found what's responsible for that mess. I almost thought my CPU or RAM is broken, but it was the #GRUB threadirqs boot option
This is just for information. I don't claim, if it directly apply to you @lilith

Have in mind that the threadirqs option is not needed for realtime kernels.
And even if you are using PREEMPT enabled standard kernel (like the so called lowlatency kernel), you cannot use the values between 90-99. Anything set with those values will default on 89.

Best regards, Totalchaos
Check out my latest music album Le Femme Robotique 2021
https://totalchaos-music.bandcamp.com/a ... -viii-2006
User avatar
thetotalchaos
Established Member
Posts: 186
Joined: Mon Sep 29, 2014 8:29 pm
Contact:

Re: Crackling without xruns.. worse with large buffers

Post by thetotalchaos »

lilith wrote: Sun May 03, 2020 8:41 pm
Maybe that's part of the problem. Frequency should be 1000 Hz.

Code: Select all

cat /boot/config-`uname -r` | grep HZ
CONFIG_NO_HZ_COMMON=y
# CONFIG_HZ_PERIODIC is not set
CONFIG_NO_HZ_IDLE=y
# CONFIG_NO_HZ_FULL is not set
# CONFIG_NO_HZ is not set
# CONFIG_HZ_100 is not set
CONFIG_HZ_250=y
# CONFIG_HZ_300 is not set
# CONFIG_HZ_1000 is not set
CONFIG_HZ=250
CONFIG_MACHZ_WDT=m
Hi @lilith,

Setting 1000hz is important. Think of it as quantizing of sound and MIDI events. At 1000hz the pieces are smaller.
Check out my latest music album Le Femme Robotique 2021
https://totalchaos-music.bandcamp.com/a ... -viii-2006
User avatar
lilith
Established Member
Posts: 1494
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Contact:

Re: Crackling without xruns.. worse with large buffers

Post by lilith »

Booted in the realtime kernel (Linux marco 4.19.0-8-rt-amd64 #1 SMP PREEMPT RT Debian 4.19.98-1+deb10u1 (2020-04-27) x86_64 GNU/Linux) again with threadirq taken out from grub (as it is not needed for RT kernels) and the crackling is back.

I checked the timer settings and get:

Code: Select all

cat config-4.19.0-8-rt-amd64 | grep 'CONFIG_HZ'
# CONFIG_HZ_PERIODIC is not set
# CONFIG_HZ_100 is not set
CONFIG_HZ_250=y
# CONFIG_HZ_300 is not set
# CONFIG_HZ_1000 is not set
CONFIG_HZ=250
According to this thread it is not necessary to make any changes to the timer: viewtopic.php?t=19359
Also here: https://techpatterns.com/forums/about2748.html

The priorities of my interface (xhi_hcd) are:

Code: Select all

sudo /etc/init.d/rtirq status

  PID CLS RTPRIO  NI PRI %CPU STAT COMMAND	
  210 FF      95   - 135  7.7 S    irq/28-xhci_hcd	
  218 FF      94   - 134  0.0 S    irq/29-xhci_hcd	
    9 TS       -   0  19  0.0 S    ksoftirqd/0	
   25 TS       -   0  19  0.0 S    ksoftirqd/1	
   33 TS       -   0  19  0.0 S    ksoftirqd/2	
   41 TS       -   0  19  0.0 S    ksoftirqd/3	
   59 TS       -   0  19  0.0 S    irq/9-acpi	
   82 TS       -   0  19  0.0 S    irq/8-rtc0	
  163 TS       -   0  19  0.0 S    irq/18-i801_smb	
  187 TS       -   0  19  0.0 S    irq/16-ehci_hcd	
  216 TS       -   0  19  0.0 S    irq/23-ehci_hcd	
  219 TS       -   0  19  0.0 S    irq/27-ahci[000	
  236 TS       -   0  19  0.0 S    irq/30-i915	
  398 TS       -   0  19  0.0 S    irq/31-mei_me	
  770 TS       -   0  19  0.0 S    irq/26-enp2s0	
When I stop rtirq it is still crackling.

With the stock kernel (4.19.0-8-amd64 #1 SMP Debian 4.19.98-1+deb10u1 (2020-04-27) ) there's no crackling.
So I assume that either Renoise has problems with the RT kernel or there's something wrong with my configuration.
User avatar
lilith
Established Member
Posts: 1494
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Contact:

Re: Crackling without xruns with RT PREEMPT kernel

Post by lilith »

I get the same issue on a laptop also with Debian 10 running. Checked the realtime kernel from AVlinux and also get the same behaviour. I'll use the stock kernel from Debian now.
Post Reply