Audio Crackling With No Xruns (JACK+PulseAudio)

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

Post Reply
DungeonMystic
Established Member
Posts: 7
Joined: Tue May 30, 2023 7:03 pm

Audio Crackling With No Xruns (JACK+PulseAudio)

Post by DungeonMystic »

Crackling distortion plays over all audio played through my computer. I've had stuttering audio before (a buffer issue), but it doesn't sound like that. It sounds like the crackling is layered on top of the audio that's played. qjackctl says there are no xruns and its logs do not show any errors. This started happening out of nowhere; I didn't change anything on my system.

I'm using AV Linux (MX Linux x86_64), Kernel: 6.0.0-10.1-liquorix-amd64. AV Linux integrates PulseAudio and JACK. Also using Xfce and AMD GPU if that matters. My audio interface is a Presonus Audiobox USB. The same hardware setup on Linux Mint Xfce with PipeWire did not have this problem (different partition on the same disk).

I have tried killing Pulseaudio. This cuts all audio outside of my DAW (expected behavior) but the audio from my DAW continues to crackle, as it uses pure JACK.

I tried changing the frames per period and periods per buffer in various combinations. The higher each of them was the longer it would take for the crackling to start in. But it would always start again. Previously my settings were 1024 frames per period and 3 periods per buffer and I had no crackling then.

I tried setting jackdbus and my DAW to -20 niceness with renice, same issue.

And just for completeness, I did try updating all my packages and restarting.

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: Audio Crackling With No Xruns (JACK+PulseAudio)

Post by erlkönig »

Two things come to mind for me: it could be a problem with missmatching samplerates, or with the audio levels, maybe somewhere you run the audio a bit too loud? Have you tried turning the audio levels down in your (system-) mixer?

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.

DungeonMystic
Established Member
Posts: 7
Joined: Tue May 30, 2023 7:03 pm

Re: Audio Crackling With No Xruns (JACK+PulseAudio)

Post by DungeonMystic »

erlkönig wrote: Sun Oct 08, 2023 6:45 am

Two things come to mind for me: it could be a problem with missmatching samplerates

What should I be looking to match sample rates between?
Here's what I currently know of:
JACK: 48000
DAW: 48000
PulseAudio: 48000 (set default-sample-rate = 48000 in /etc/pulse/daemon.conf) (though PA shouldn't matter because this happens even with JACK alone)

erlkönig wrote: Sun Oct 08, 2023 6:45 am

or with the audio levels, maybe somewhere you run the audio a bit too loud? Have you tried turning the audio levels down in your (system-) mixer?

There's no system mixer for JACK; pavucontrol has no effect on it. It all comes down to volume of individual applications, and those are running at a pretty sane volume I would say.
Listening closer thanks to this suggestion, the crackling sounds very much like bitcrush distortion. Not so much like volume clipping. It has a tubular and grainy sound. The audio underneath the crackling doesn't sound like it's at a lower bit depth; only the distortion itself. It sounds like the distortion is just layered on top (I wouldn't stake my life on my ears there, but that's what I think I'm hearing).

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: Audio Crackling With No Xruns (JACK+PulseAudio)

Post by autostatic »

Does the crackling also occur when you use plain ALSA, i.e. Ardour with the ALSA backend? And what are your exact JACK settings?

DungeonMystic
Established Member
Posts: 7
Joined: Tue May 30, 2023 7:03 pm

Re: Audio Crackling With No Xruns (JACK+PulseAudio)

Post by DungeonMystic »

autostatic wrote: Sun Oct 08, 2023 2:30 pm

Does the crackling also occur when you use plain ALSA, i.e. Ardour with the ALSA backend?

I've never done that before so tell me if I did it right:

  1. stopped JACK server
  2. pulseaudio -k
  3. new ardour project, Audio System: ALSA
  4. Import a sample and play it

The crackling is still present in playback.

autostatic wrote: Sun Oct 08, 2023 2:30 pm

what are your exact JACK settings?

Image
^ Note that any configuration of sample rate, frames, and periods does not solve the crackling. But increasing the values can delay the onset of the crackling by a few seconds.
Image
^ these scripts come preloaded on AV Linux. I did not write them.
Image

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: Audio Crackling With No Xruns (JACK+PulseAudio)

Post by autostatic »

Yes, you did it right, if you can select ALSA as backend then Ardour uses that. Otherwise Ardour will indicate in a bold red font that it will connect to an existing running JACK server.

Weird that the crackling persists, the sample itself has no crackles? And the JACK settings look good except for the "Execute script on startup" command. You just have to run apt-get install qjackctl pulseaudio-module-jack once and not use qjackctl itself to ensure those packages are installed, it will work but probably slows down starting up qjackctl.

Did you try a different USB port? Or a different USB cable?

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: Audio Crackling With No Xruns (JACK+PulseAudio)

Post by erlkönig »

Is your soundcard connected to another soundcard? I had a clockdrift in this situation (toslink) which led to crackles, syncing the components via wordclock solved the problem.

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.

DungeonMystic
Established Member
Posts: 7
Joined: Tue May 30, 2023 7:03 pm

Re: Audio Crackling With No Xruns (JACK+PulseAudio)

Post by DungeonMystic »

autostatic wrote: Sun Oct 08, 2023 6:24 pm

Weird that the crackling persists, the sample itself has no crackles?

Correct. I've used the sample before, and tested on a number of other samples as well.

autostatic wrote: Sun Oct 08, 2023 6:24 pm

And the JACK settings look good except for the "Execute script on startup" command. You just have to run apt-get install qjackctl pulseaudio-module-jack once and not use qjackctl itself to ensure those packages are installed, it will work but probably slows down starting up qjackctl.

I removed that command just for the hell of it. No change to the crackling of course.

autostatic wrote: Sun Oct 08, 2023 6:24 pm

Did you try a different USB port? Or a different USB cable?

The thing is that it works on my Mint partition with the same setup and USB port.

HOLD THE FORT: I switched the USB ports again for a sanity check and this time one of them worked. I checked every USB port multiple times already. I swear to Dead God that I did. I do not understand this. Especially because that port has not been a problem at all on my Mint partition.

I'm truly baffled. Any idea why this is?

I honestly don't trust that this issue will remain at bay. Regardless, I'll hesitantly consider this Solved.

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: Audio Crackling With No Xruns (JACK+PulseAudio)

Post by autostatic »

DungeonMystic wrote: Sun Oct 08, 2023 7:39 pm
autostatic wrote: Sun Oct 08, 2023 6:24 pm

And the JACK settings look good except for the "Execute script on startup" command. You just have to run apt-get install qjackctl pulseaudio-module-jack once and not use qjackctl itself to ensure those packages are installed, it will work but probably slows down starting up qjackctl.

I removed that command just for the hell of it. No change to the crackling of course.

Yeah sorry, I should've mentioned that this part was not necessary at all and unrelated to your issue. But it caught my eye as it could cause other issues and at a closer look, it won't work because you're not running qjackctl as root I hope ;)

DungeonMystic wrote: Sun Oct 08, 2023 7:39 pm

HOLD THE FORT: I switched the USB ports again for a sanity check and this time one of them worked. I checked every USB port multiple times already. I swear to Dead God that I did. I do not understand this. Especially because that port has not been a problem at all on my Mint partition.

I'm truly baffled. Any idea why this is?

Maybe the port is shared with other devices like a webcam or bluetooth. You could check with lsusb. Each device sits on a bus and if a bus is too crowded that could cause issues with audio. Check if you could attach the sound card to a bus that has as little other devices attached to it as possible.

Post Reply