Ugly distortion with Jack at random times

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

emillo
Established Member
Posts: 21
Joined: Fri Dec 05, 2008 11:26 am
Contact:

Ugly distortion with Jack at random times

Post by emillo »

Hello folks,

I'm in the process of replacing my trusty 12 years old desktop PC (AMD Phenom X3) where I have an excellent sound card: an RME multiface that served me very well for many years and that I sadly have to abandon due to the impossibility (at least that I know of) of obtaining a current motherboard with pci slots.

The computer that I replace it with is a lenovo thinkpad X270 with its docking station/port replicator, and for music production I planned to used my BOSS BR-800, which is a very versatile little recorder that can act also as usb sound card. It works well for the most part, but at times after 3/15 minutes, apparently without a cause the audio that I record from the BR800 thru Jack becomes an ugly distorted mess, like if you changed the sample rate underneath or something of that sort. When it goes in this wrong place I'm not able anymore to record cleanly until I restart Jack. Strangely, the output still sounds good if I play other files.

The OS is debian stable, I tried the rt kernel from stable and also that in the backports. I tried with and without pulseaudio, changing kernel, changing jack parameters (currently I use "/usr/bin/jackd -P80 -dalsa -dhw:BR800 -r44100 -p256 -n3 -s"), changing ports on the docking station, put the cpu governor to performance, but I didn't solve the issue. I didn't try yet to use an usb port on the laptop itself, it will be my next move (maybe is the docking station?).

Initially I thought that the BR800 was the culprit, but then I tried another usb device that I have (Roland SCD-70) and it shows the same behavior, so it mus be a software issue.

Any hints?

Thank you in advance
Emiliano Grilli
Linux user #209089
http://www.emillo.net
User avatar
autostatic
Established Member
Posts: 1994
Joined: Wed Dec 09, 2009 5:26 pm
Location: Beverwijk, The Netherlands
Has thanked: 32 times
Been thanked: 104 times
Contact:

Re: Ugly distortion with Jack at random times

Post by autostatic »

I would definitely try to connect a soundcard directly, so without the docking station. And maybe try a different USB cable.
emillo
Established Member
Posts: 21
Joined: Fri Dec 05, 2008 11:26 am
Contact:

Re: Ugly distortion with Jack at random times

Post by emillo »

Thank you for your reply, I just tried but the problem is still present bypassing the docking station (still have to try another cable)

I attach a picture to illustrate the problem as seen in the wave file.

2021-03-13_19-12.png
2021-03-13_19-12.png (29.81 KiB) Viewed 2606 times
Last edited by emillo on Sat Mar 13, 2021 7:00 pm, edited 1 time in total.
Emiliano Grilli
Linux user #209089
http://www.emillo.net
User avatar
autostatic
Established Member
Posts: 1994
Joined: Wed Dec 09, 2009 5:26 pm
Location: Beverwijk, The Netherlands
Has thanked: 32 times
Been thanked: 104 times
Contact:

Re: Ugly distortion with Jack at random times

Post by autostatic »

That doesn't look good no... Could you post the output of the following commands (you have to enter these in a terminal) with the BR-800 attached:

Code: Select all

cat /proc/interrupts
aplay -l
lsusb
Thanks!
emillo
Established Member
Posts: 21
Joined: Fri Dec 05, 2008 11:26 am
Contact:

Re: Ugly distortion with Jack at random times

Post by emillo »

Sure, here's the outputs of those commands:

Code: Select all

cat /proc/interrupts 
            CPU0       CPU1       CPU2       CPU3       
   0:          8          0          0          0  IR-IO-APIC    2-edge      timer
   1:          0          0          0         17  IR-IO-APIC    1-edge      i8042
   8:          0          1          0          0  IR-IO-APIC    8-edge      rtc0
   9:          0      15442          0          0  IR-IO-APIC    9-fasteoi   acpi
  12:          0          0        511          0  IR-IO-APIC   12-edge      i8042
  16:          0          0          0          0  IR-IO-APIC   16-fasteoi   i801_smbus, i2c_designware.0, idma64.0
  17:          2          0          0          0  IR-IO-APIC   17-fasteoi   i2c_designware.1, idma64.1
 120:          0          0          0          0  DMAR-MSI    0-edge      dmar0
 121:          0          0          0          0  DMAR-MSI    1-edge      dmar1
 122:          0          0      19298          0  IR-PCI-MSI 520192-edge      enp0s31f6
 123:          0          0          0         13  IR-PCI-MSI 2097152-edge      nvme0q0
 124:          0          0          0       4699  IR-PCI-MSI 1048576-edge      rtsx_pci
 125:          0          0   63421526          0  IR-PCI-MSI 327680-edge      xhci_hcd
 126:          0          0          0    3299941  IR-PCI-MSI 32768-edge      i915
 127:     105956          0          0          0  IR-PCI-MSI 2097153-edge      nvme0q1
 128:          0      93286          0          0  IR-PCI-MSI 2097154-edge      nvme0q2
 129:          0          0      83167          0  IR-PCI-MSI 2097155-edge      nvme0q3
 130:          0          0          0      94709  IR-PCI-MSI 2097156-edge      nvme0q4
 131:          0         79          0          0  IR-PCI-MSI 360448-edge      mei_me
 132:          0          0     354430          0  IR-PCI-MSI 1572864-edge      iwlwifi
 133:          0          0          0       1193  IR-PCI-MSI 514048-edge      snd_hda_intel:card0
 NMI:          0          0          0          0   Non-maskable interrupts
 LOC:   10898236   10843998   11903857   10092550   Local timer interrupts
 SPU:          0          0          0          0   Spurious interrupts
 PMI:          0          0          0          0   Performance monitoring interrupts
 IWI:      75566     105854      16595     374085   IRQ work interrupts
 RTR:          0          0          0          0   APIC ICR read retries
 RES:    2323196    1947036    2059756    1132490   Rescheduling interrupts
 CAL:     906427     941907     661521     798306   Function call interrupts
 TLB:     715717     754027     587105     691824   TLB shootdowns
 TRM:     101105     101105     101105     101105   Thermal event interrupts
 THR:          0          0          0          0   Threshold APIC interrupts
 DFR:          0          0          0          0   Deferred Error APIC interrupts
 MCE:          0          0          0          0   Machine check exceptions
 MCP:        124        125        125        125   Machine check polls
 ERR:          0
 MIS:          0
 PIN:          0          0          0          0   Posted-interrupt notification event
 NPI:          0          0          0          0   Nested posted-interrupt event
 PIW:          0          0          0          0   Posted-interrupt wakeup event

Code: Select all

aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC298 Analog [ALC298 Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 10: HDMI 4 [HDMI 4]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: BR800 [BR-800], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0


Code: Select all

lsusb
Bus 002 Device 002: ID 17ef:1010 Lenovo 
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 5986:111c Acer, Inc 
Bus 001 Device 003: ID 8087:0a2b Intel Corp. 
Bus 001 Device 011: ID 17ef:100f Lenovo 
Bus 001 Device 012: ID 0582:0033 Roland Corp. EDIROL PCR
Bus 001 Device 008: ID 1a40:0101 Terminus Technology Inc. Hub
Bus 001 Device 010: ID 04d9:a0cd Holtek Semiconductor, Inc. 
Bus 001 Device 007: ID 046d:c534 Logitech, Inc. Unifying Receiver
Bus 001 Device 004: ID 1a40:0101 Terminus Technology Inc. Hub
Bus 001 Device 002: ID 17ef:1010 Lenovo 
Bus 001 Device 021: ID 0582:011e Roland Corp. BR-800
Bus 001 Device 020: ID 0451:2046 Texas Instruments, Inc. TUSB2046 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Thanks!
Emiliano Grilli
Linux user #209089
http://www.emillo.net
User avatar
autostatic
Established Member
Posts: 1994
Joined: Wed Dec 09, 2009 5:26 pm
Location: Beverwijk, The Netherlands
Has thanked: 32 times
Been thanked: 104 times
Contact:

Re: Ugly distortion with Jack at random times

Post by autostatic »

Nothing weird there. USB has its own IRQ but I do see the USB 2 hub has a lot of devices. Does the Lenovo have a separate USB 3 port? Maybe you could try that one if it's not USB-C.
User avatar
bluebell
Established Member
Posts: 1909
Joined: Sat Sep 15, 2012 11:44 am
Location: Saarland, Germany
Has thanked: 111 times
Been thanked: 116 times

Re: Ugly distortion with Jack at random times

Post by bluebell »

emillo wrote: Sat Mar 13, 2021 6:14 pm Thank you for your reply, I just tried but the problem is still present bypassing the docking station (still have to try another cable)

I attach a picture to illustrate the problem as seen in the wave file.

2021-03-13_19-12.png
Try changing the samplerate, e.g. to 48000.

Linux – MOTU UltraLite AVB – Qtractor – http://suedwestlicht.saar.de/

emillo
Established Member
Posts: 21
Joined: Fri Dec 05, 2008 11:26 am
Contact:

Re: Ugly distortion with Jack at random times

Post by emillo »

I think that on the laptop all ports are usb 3.0 ...

The sample rate is fixed at 44100 on the BR800 , I tried to start jack with 48000 but it always produces 44100 files.

I think it's a software issue because until that "something" happens all is working perfectly fine, then jackd goes in this weird state where everything recorded is bad, but the output still works correctly. And then you restart jackd and everything is fine again until this "something" happens again. I've been unable to correlate it to anything unfortunately... tried also jackd --verbose but nothing strange there... I'm beginning to feel discouraged :(

Again thanks for your help
Emiliano Grilli
Linux user #209089
http://www.emillo.net
emillo
Established Member
Posts: 21
Joined: Fri Dec 05, 2008 11:26 am
Contact:

Re: Ugly distortion with Jack at random times

Post by emillo »

UPDATE: I think I sorted it out:

If I leave out the `-s` (softmode) option in jack, it seems that it doesn't go anymore in the weird place, and I get an XRUN instead, but after that it's still usable. So probably the "something" that made it go nuts was simply an XRUN. Now it's a matter of getting it to run without XRUNs, which doesn't look so easy either...


Thank you guys for your kind assistance!
Emiliano Grilli
Linux user #209089
http://www.emillo.net
JamesPeters
Established Member
Posts: 188
Joined: Fri Jun 29, 2018 6:35 pm
Has thanked: 8 times
Been thanked: 15 times

Re: Ugly distortion with Jack at random times

Post by JamesPeters »

Have you disabled USB_autosuspend? I found that step to be important for reliable performance with USB audio in ALSA and Jack.
emillo
Established Member
Posts: 21
Joined: Fri Dec 05, 2008 11:26 am
Contact:

Re: Ugly distortion with Jack at random times

Post by emillo »

Have you disabled USB_autosuspend? I found that step to be important for reliable performance with USB audio in ALSA and Jack.
How do I go about it?

Thanks,
Emiliano Grilli
Linux user #209089
http://www.emillo.net
User avatar
autostatic
Established Member
Posts: 1994
Joined: Wed Dec 09, 2009 5:26 pm
Location: Beverwijk, The Netherlands
Has thanked: 32 times
Been thanked: 104 times
Contact:

Re: Ugly distortion with Jack at random times

Post by autostatic »

Code: Select all

echo -1 | sudo tee /sys/module/usbcore/parameters/autosuspend
in a terminal.
JamesPeters
Established Member
Posts: 188
Joined: Fri Jun 29, 2018 6:35 pm
Has thanked: 8 times
Been thanked: 15 times

Re: Ugly distortion with Jack at random times

Post by JamesPeters »

In Manjaro, I use TLP and its frontend TLPUI. It allows for disabling that, setting the CPU frequency governor, and more.
emillo
Established Member
Posts: 21
Joined: Fri Dec 05, 2008 11:26 am
Contact:

Re: Ugly distortion with Jack at random times

Post by emillo »

Thanks, the autosuspend setting seems to have helped with the xruns but I'm still unable to achieve zero xruns. I use these settings:

Code: Select all

/usr/bin/jackd -P87 -m -dalsa -dhw:BR800,0 -r44100 -p512 -n2
I also tried with -n3 but it makes no difference, I still get an xrun once in a while (say in the order of ten minutes or so)
Emiliano Grilli
Linux user #209089
http://www.emillo.net
JamesPeters
Established Member
Posts: 188
Joined: Fri Jun 29, 2018 6:35 pm
Has thanked: 8 times
Been thanked: 15 times

Re: Ugly distortion with Jack at random times

Post by JamesPeters »

You changed the number of periods from 3 to 2 (while increasing the blocksize). Try changing the number of periods to 3 again (or 4), and then try reducing blocksize. You may just need more periods, even if they're a smaller size.

I use 4 periods of 64 samples, for instance, and it's very stable (Focusrite Scarlett 2i2, 3rd gen).

If you're trying to use Jack "realtime", then you need to have made some changes to your system configuration. You probably need to use a realtime kernel. If you aren't using a realtime kernel (or in other distros a "lowlatency" kernel), you're going to have issues. Also there are more steps to follow for using Jack:

https://jackaudio.org/faq/linux_rt_config.html

I assume you're already running your system like this, but I figured I should mention it just in case.

Since I just use ALSA directly from Reaper, I don't need to configure my system for Jack. I just use a lowlatency or realtime kernel, turn the CPU frequency governor to "performance", and disable USB_autosuspend. Then it's more stable than any configuration I've had (Windows, OSX, using any DAW).

I have tried Jack though. To use it properly, I had to configure the system for it.
Post Reply