Digital Crackle with USB Audio Interfaces

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

mnemonic
Established Member
Posts: 17
Joined: Sun Apr 11, 2021 4:16 pm

Digital Crackle with USB Audio Interfaces

Post by mnemonic »

Dear Linuxmusicians community,

I am almost desperate. Maybe (hopefully) you can help me?

I have various USB 2.0 audio interfaces (MOTU, Focusrite) connected to my five-year-old HP ZBook Studio G5 laptop via an i-tec 5K Thunderbolt docking station.

The laptop is running manjaro GNOME with Linux Kernel 6.6 and I'm using Jack2 with 48000 sample rate, buffer size 256 and 3 periods/buffer with PulseAudio Plugin Bridge enabled.

I have activated a few tweaks according to the following instructions: https://blog.inagaki.in/en/post/manjaro ... vironment/ and this works very well.

Now I have set up my new HP ZBook Studio G10 laptop with the same distro, kernel, configuration and tweaks applied. But I can't even play a YT video without huge digital crackles in the audio output.

I then used rtirq to drastically increase the priority of the xHCI interrupt and that seemed to solve the problem for a moment.

Until after about an hour of audio streaming the digital crackling started again and didn't stop. Stopping the stream and running jack_control stop/start helps for a while until the digital crackling comes back again.

By the way, no Xruns are reported in qjackctl or cadence, as long as sample rate is not below 32. The sample rate therefore appears to have no influence on the occurrence of the digital clicks. And connecting the audio interface directly to the laptop (i.e. not via the TB Dock), or to any other USB port on the Dock, does not change anything. I also tried kernel 6.1 with same results.

It also makes no difference whether the audio stream runs through the MOTU 828es (with Drumfix driver: options motu samplerate=48000 midi=1 vendor=0) or the Scarlett 18i20 (with USB kernel driver: options snd_usb_audio vid=0x1235 pid=0x8201 device_setup=1). It always starts to crackle sooner or later.

The rtcqs script shows all tests as OK - on both laptops.

I am completely lost here. Do any of you have any ideas on what else I could try, configure or tune to achieve a smooth audio stream?

Any help is highly appreciated!

tseaver
Established Member
Posts: 408
Joined: Mon Mar 13, 2017 6:07 am
Has thanked: 12 times
Been thanked: 102 times

Re: Digital Crackle with USB Audio Interfaces

Post by tseaver »

I'd first try to isolate the problem by plugging the audio interface directly into a USB 2.0 (or 3.0) port on the laptop. If that works, then you know that the issue is with the docking station. I've had very mixed luck running any interface even through a powered USB hub in the past, and so I always aim to plug them in directly.

Ubuntu, Mixbus32C; acoustic blues / country / jazz
User avatar
d.healey
Established Member
Posts: 611
Joined: Fri Sep 22, 2017 8:33 pm
Has thanked: 279 times
Been thanked: 101 times

Re: Digital Crackle with USB Audio Interfaces

Post by d.healey »

Is it definitely a digital problem and not a hardware connection issue between the speakers and the DAC?

David Healey
YouTube - Free HISE scripting and sample library dev tutorials
Libre Wave - Freedom respecting instruments and effects.
mnemonic
Established Member
Posts: 17
Joined: Sun Apr 11, 2021 4:16 pm

Re: Digital Crackle with USB Audio Interfaces

Post by mnemonic »

Hi @tseaver and @d.healey,

thanks for your fast replies :D

tseaver wrote: Wed Mar 13, 2024 2:26 am

I'd first try to isolate the problem by plugging the audio interface directly into a USB 2.0 (or 3.0) port on the laptop.

I have already done this and it has made no difference. It doesn't matter whether I connect the audio interfaces to the docking station or directly to the laptop via any USB port.

d.healey wrote: Wed Mar 13, 2024 3:35 pm

Is it definitely a digital problem and not a hardware connection issue between the speakers and the DAC?

Yes, I'm pretty sure it's on the laptop side and has something to do with how the USB audio stream is processed in the laptop. When I connect the same audio interfaces to my old laptop (with identical - as far as I can tell - distro, kernel, configuration and tweaks applied, either directly or via docking station), everything works as expected.

With the old laptop, there is not even a need to configure special performance tweaks for the IRQs.

Compared to my old laptop, the new laptop is a real performance monster. But as mentioned earlier, the drastic increase in priority for the xHCI interrupts, which presumably handle all the data transfer between the laptop and the docking station, has improved the situation dramatically. The digital crackling now only starts after about an hour of uninterrupted audio streaming.

Unfortunately, I have no idea about the Advanced Linux Sound architecture and know nothing about the challenges of thread prioritization of the various audio servers (ALSA, JACK, PulseAudio and Pipewire also still hanging around somewhere in the system), so I'm completely in the dark at the moment.

What can I do to find the cause of the digital crackling?

User avatar
bluebell
Established Member
Posts: 1927
Joined: Sat Sep 15, 2012 11:44 am
Location: Saarland, Germany
Has thanked: 113 times
Been thanked: 122 times

Re: Digital Crackle with USB Audio Interfaces

Post by bluebell »

mnemonic wrote: Wed Mar 13, 2024 10:25 pm

The digital crackling now only starts after about an hour of uninterrupted audio streaming.

That might be a misbehaving USB autosuspend.

Try:

Code: Select all

sudo echo -1 > /sys/module/usbcore/parameters/autosuspend

If that solves the problem you can make it permanent with

Code: Select all

/etc/modprobe.d/usb.conf
options usbcore autosuspend=-1

or

Code: Select all

usbcore.autosuspend=-1

as kernel option.

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

mnemonic
Established Member
Posts: 17
Joined: Sun Apr 11, 2021 4:16 pm

Re: Digital Crackle with USB Audio Interfaces

Post by mnemonic »

Hi @bluebell

That is very interesting. After I set the auto-suspense flag for USB to -1, I can lock my laptop and the USB devices do not shut down. Which was to be expected. So far, locking my laptop has reproducible led to the digital crackling. This no longer happens. Another lesson learned.

I also activated "Enable D-Bus interface" and "Enable Jack D-Bus interface" via QjackCtrl (previously I had only used Cadence and I don't think the setting exists there). For some reason, this seems to have led to the digital crackling slowly "retreating" after a short time and everything sounds "normal" again.

I am currently trying to check this by disabling it again and am now waiting for the digital crackling to reappear.

By the way, I was able to record the crackle in Audacity. Attached is the waveform of the sine wave at 400 Hz. Does this give any information about anything?

This is the recording of the digital crackle of the sinewave:

Screenshot from 2024-03-16 23-34-49.png
Screenshot from 2024-03-16 23-34-49.png (102.18 KiB) Viewed 555 times

and spectral view:

Screenshot from 2024-03-16 23-59-58.jpeg
Screenshot from 2024-03-16 23-59-58.jpeg (239.12 KiB) Viewed 544 times

and how it sounds:

Sinewave-to-crackles.mp3
(30.68 KiB) Downloaded 17 times
Last edited by mnemonic on Sat Mar 16, 2024 11:30 pm, edited 1 time in total.
mnemonic
Established Member
Posts: 17
Joined: Sun Apr 11, 2021 4:16 pm

Re: Digital Crackle with USB Audio Interfaces

Post by mnemonic »

right after I wrote my last post (while listening to the 400Hz sine wave) the digital crackling started again - and this time it didn't stop!

I had previously disabled "Enable D-Bus interface" and "Enable Jack D-Bus interface" via QjackCtrl.

Screenshot from 2024-03-17 00-23-01.png
Screenshot from 2024-03-17 00-23-01.png (88.92 KiB) Viewed 549 times

Now I'm wondering what these settings have to do with the duration of the digital crackling or its independent recovery?

Does anyone have any ideas?

mnemonic
Established Member
Posts: 17
Joined: Sun Apr 11, 2021 4:16 pm

Re: Digital Crackle with USB Audio Interfaces

Post by mnemonic »

btw, these are the Audacity audio settings to record the 400Hz sine wave played from a YT video to the Pulse audio jack sink:

Screenshot from 2024-03-17 00-37-23.png
Screenshot from 2024-03-17 00-37-23.png (45.93 KiB) Viewed 541 times
mnemonic
Established Member
Posts: 17
Joined: Sun Apr 11, 2021 4:16 pm

Re: Digital Crackle with USB Audio Interfaces

Post by mnemonic »

ok, I have reactivated the "Enable D-Bus interface" and "Enable Jack D-Bus interface" via QjackCtrl and the digital crackling has reappeared and disappeared again on its own.

I.e. this setting has some influence on the digital crackling.

And at the moment the digital crackling seems to occur very frequently. Which is not bad for the documentation, but the frequency of occurrence seems to be rather random...

... I am confused to the max.

User avatar
bluebell
Established Member
Posts: 1927
Joined: Sat Sep 15, 2012 11:44 am
Location: Saarland, Germany
Has thanked: 113 times
Been thanked: 122 times

Re: Digital Crackle with USB Audio Interfaces

Post by bluebell »

mnemonic wrote: Sat Mar 16, 2024 11:50 pm

ok, I have reactivated the "Enable D-Bus interface" and "Enable Jack D-Bus interface" via QjackCtrl and the digital crackling has reappeared and disappeared again on its own.

I.e. this setting has some influence on the digital crackling.

And at the moment the digital crackling seems to occur very frequently. Which is not bad for the documentation, but the frequency of occurrence seems to be rather random...

... I am confused to the max.

D-Bus is just a communication line to start/stop jackd. This should not have any effect regarding crackling.

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

User avatar
Impostor
Established Member
Posts: 1392
Joined: Wed Aug 17, 2022 1:55 pm
Has thanked: 148 times
Been thanked: 366 times

Re: Digital Crackle with USB Audio Interfaces

Post by Impostor »

mnemonic wrote: Sat Mar 16, 2024 11:14 pm

By the way, I was able to record the crackle in Audacity. Attached is the waveform of the sine wave at 400 Hz. Does this give any information about anything?

That's suspiciously regular distortion. Exactly 20 times per 400Hz period, you get a sample value of 0. And these are in sync with the 400Hz zero crossing! Did you choose 400 Hz arbitrarily? Given the correlation between distortion and signal I'd suspect the audio (soft- or hardware) source or DAC/ADC, but that's just a hunch.

Edit: I now read that the source is a youtube video. Maybe not the best way to troubleshoot your system's audio problems. Or does it exclusively occur with audio from youtube?

mnemonic
Established Member
Posts: 17
Joined: Sun Apr 11, 2021 4:16 pm

Re: Digital Crackle with USB Audio Interfaces

Post by mnemonic »

Hi @bluebell

thanks for clarification.

bluebell wrote: Sun Mar 17, 2024 8:54 am

D-Bus is just a communication line to start/stop jackd. This should not have any effect regarding crackling.

and just as I was reading that, the digital crackling started again and did not stopp. The D-Bus interface settings were activated. So as you say, it has no effect. That was apparently a coincidence yesterday.

mnemonic
Established Member
Posts: 17
Joined: Sun Apr 11, 2021 4:16 pm

Re: Digital Crackle with USB Audio Interfaces

Post by mnemonic »

Hi @Impostor

Thank you for your reply!

Impostor wrote: Sun Mar 17, 2024 9:47 am

That's suspiciously regular distortion. Exactly 20 times per 400Hz period, you get a sample value of 0. And these are in sync with the 400Hz zero crossing! Did you choose 400 Hz arbitrarily? Given the correlation between distortion and signal I'd suspect the audio (soft- or hardware) source or DAC/ADC, but that's just a hunch.

The 400 Hz just happened to be the first video in the YT search.

Impostor wrote: Sun Mar 17, 2024 9:47 am

Edit: I now read that the source is a youtube video. Maybe not the best way to troubleshoot your system's audio problems. Or does it exclusively occur with audio from youtube?

Now I have a test tone generator running at 1KHz. Let's see what that gives...

Screenshot from 2024-03-17 13-40-03.png
Screenshot from 2024-03-17 13-40-03.png (150.61 KiB) Viewed 431 times

Currently giving a nice sine in the oscilloscope

Screenshot from 2024-03-17 13-28-50.png
Screenshot from 2024-03-17 13-28-50.png (65.81 KiB) Viewed 431 times

Not sure, if I can see anything with the analytics tools:

Screenshot from 2024-03-17 13-28-43.jpeg
Screenshot from 2024-03-17 13-28-43.jpeg (128.83 KiB) Viewed 431 times

What can I do to get to the root of the issue?

User avatar
erlkönig
Established Member
Posts: 210
Joined: Tue May 31, 2022 8:58 am
Has thanked: 42 times
Been thanked: 48 times

Re: Digital Crackle with USB Audio Interfaces

Post by erlkönig »

mnemonic wrote: Wed Mar 13, 2024 10:25 pm

What can I do to find the cause of the digital crackling?

I never heard a distortion like this before. Maybe you could simplify your testing procedures. If i understand you right, you are doing your tests with jack and pulse running. As jack and pulse sit on top of alsa, i would try to do the tests without them, just with alsa. Maybe you can isolate the source of this problem by enabling the layers seperately.

Currently working with
https://www.honeysuckers.rocks/?lang=en
Fiddling with sequencers does not evolve into music necessarily and Mac users have smelly feet and guzzle little children.

mnemonic
Established Member
Posts: 17
Joined: Sun Apr 11, 2021 4:16 pm

Re: Digital Crackle with USB Audio Interfaces

Post by mnemonic »

Moin @erlkönig ,

Thank you for your suggestion.

erlkönig wrote: Sun Mar 17, 2024 1:27 pm

As jack and pulse sit on top of alsa, i would try to do the tests without them, just with alsa.

Ok, I will try to reproduce the crackling with just ALSA.

Impostor wrote: Sun Mar 17, 2024 9:47 am

Or does it exclusively occur with audio from youtube?

Now I had the digital crackling with the test tone generator at 1KHz. But it is slightly different and it "pulsates". The sine wave changes abruptly into digital crackling and then slowly recovers before abruptly reverting to crackling. If that makes any sense?!

Recording in Audacity looks like this zoomed out:

Screenshot from 2024-03-17 14-33-48.png
Screenshot from 2024-03-17 14-33-48.png (47.25 KiB) Viewed 400 times

And like this zoomed in:

Screenshot from 2024-03-17 14-34-28.png
Screenshot from 2024-03-17 14-34-28.png (49.04 KiB) Viewed 400 times

And it sounds like this

1KHz-sine-to-crackle.mp3
(109.69 KiB) Downloaded 11 times

All now with the ALSA <--> PulseAudio <--> Jack setup...

Post Reply