For those experiencing distortion and crackles after stopping jack on USB interfaces

What other apps and distros do you use to round out your studio?

Moderators: MattKingUSA, khz

Post Reply
Robin Cherry
Established Member
Posts: 72
Joined: Wed Apr 15, 2020 1:18 am
Has thanked: 2 times
Been thanked: 15 times

For those experiencing distortion and crackles after stopping jack on USB interfaces

Post by Robin Cherry »

I found a workaround to this problem that I and others have been experiencing with USB interfaces not coming back to life correctly after stopping jack. The symptoms are distorted, quiet, and crackly audio after stopping jack. I don't fully know the cause. I suspect the interface isn't reverting to the correct sample rate somehow when jack stops. I had been unplugging the USB cable and plugging it back in to reset it which fixed it just fine but puts extra wear and tear on my hardware. I just found the usbreset utility though.

For my card I do the following:

  • Enter "usbreset" in a terminal and find your interface in the list.
  • Use "sudo usbreset" and whichever of the methods listed in the terminal referring to your device you prefer.
  • In my case I used "sudo usbreset 001/004" because that is the location shown for my card in the terminal.

I wish there was a way to do it without sudo but alas.

Hope that's helpful,
Robin Cherry

User avatar
Linuxmusician01
Established Member
Posts: 1548
Joined: Mon Feb 23, 2015 2:38 pm
Location: Holland (Europe)
Has thanked: 784 times
Been thanked: 144 times

Re: For those experiencing distortion and crackles after stopping jack on USB interfaces

Post by Linuxmusician01 »

Thanks for the tip. Never heard of the handy command usbreset until now. :)

User avatar
sjzstudio
Established Member
Posts: 166
Joined: Fri Apr 10, 2020 11:24 pm
Has thanked: 19 times
Been thanked: 28 times

Re: For those experiencing distortion and crackles after stopping jack on USB interfaces

Post by sjzstudio »

This solved a problem that has been with AvLinux MXE for the past year or so.
Also works when returning to the desktop from Ardour or Mixbus 32C after using ALSA
Behringer U-phoria UMC202HD

For some reason RME UFX+ and 802 don't need anything but work directly without resetting.

Thanks a lot

Robin Cherry
Established Member
Posts: 72
Joined: Wed Apr 15, 2020 1:18 am
Has thanked: 2 times
Been thanked: 15 times

Re: For those experiencing distortion and crackles after stopping jack on USB interfaces

Post by Robin Cherry »

sjzstudio wrote: Mon Nov 13, 2023 6:41 pm

This solved a problem that has been with AvLinux MXE for the past year or so.
Also works when returning to the desktop from Ardour or Mixbus 32C after using ALSA
Behringer U-phoria UMC202HD

For some reason RME UFX+ and 802 don't need anything but work directly without resetting.

Thanks a lot

I'm glad to help! I've had the same issue on my manjaro system for the same amount of time.

I'd be really happy if someone knows a way to do it without sudo privileges so I could add it to my qjackctl post shutdown script though.

User avatar
sunrat
Established Member
Posts: 926
Joined: Wed Jul 22, 2020 2:08 pm
Has thanked: 152 times
Been thanked: 247 times

Re: For those experiencing distortion and crackles after stopping jack on USB interfaces

Post by sunrat »

Robin Cherry wrote: Tue Nov 14, 2023 1:41 am

I'd be really happy if someone knows a way to do it without sudo privileges so I could add it to my qjackctl post shutdown script though.

You may be able to add a custom line in /etc/sudoers file to run that command with NOPASSWD option.
For example, I have one to run cpupower to change CPU governor:

Code: Select all

#Allow <user> to execute cpupower without password
<user>   ALL=(root) NOPASSWD: /usr/bin/cpupower

Of course substitute <user> for your username. You can use a group name instead if you wish.

Robin Cherry
Established Member
Posts: 72
Joined: Wed Apr 15, 2020 1:18 am
Has thanked: 2 times
Been thanked: 15 times

Re: For those experiencing distortion and crackles after stopping jack on USB interfaces

Post by Robin Cherry »

sunrat wrote: Tue Nov 14, 2023 2:30 am
Robin Cherry wrote: Tue Nov 14, 2023 1:41 am

I'd be really happy if someone knows a way to do it without sudo privileges so I could add it to my qjackctl post shutdown script though.

You may be able to add a custom line in /etc/sudoers file to run that command with NOPASSWD option.
For example, I have one to run cpupower to change CPU governor:

Code: Select all

#Allow <user> to execute cpupower without password
<user>   ALL=(root) NOPASSWD: /usr/bin/cpupower

Of course substitute <user> for your username. You can use a group name instead if you wish.

Cool, I tried this last night but it wouldn't work. I think it's because my user file is also in the admin group if I understand things correctly. I also tried putting it in a file in /etc/sudoers.d with the same result. It always asks for the password. I think this is the right approach though if I can work it out.

User avatar
LAM
Established Member
Posts: 992
Joined: Thu Oct 08, 2020 3:16 pm
Has thanked: 141 times
Been thanked: 349 times

Re: For those experiencing distortion and crackles after stopping jack on USB interfaces

Post by LAM »

Robin Cherry wrote: Tue Nov 14, 2023 3:14 pm

Cool, I tried this last night but it wouldn't work. I think it's because my user file is also in the admin group if I understand things correctly. I also tried putting it in a file in /etc/sudoers.d with the same result. It always asks for the password. I think this is the right approach though if I can work it out.

Have you tried to use sudo in front of the command?

in mix, nobody can hear your screen

Robin Cherry
Established Member
Posts: 72
Joined: Wed Apr 15, 2020 1:18 am
Has thanked: 2 times
Been thanked: 15 times

Re: For those experiencing distortion and crackles after stopping jack on USB interfaces

Post by Robin Cherry »

LAM wrote: Tue Nov 14, 2023 3:36 pm
Robin Cherry wrote: Tue Nov 14, 2023 3:14 pm

Cool, I tried this last night but it wouldn't work. I think it's because my user file is also in the admin group if I understand things correctly. I also tried putting it in a file in /etc/sudoers.d with the same result. It always asks for the password. I think this is the right approach though if I can work it out.

Have you tried to use sudo in front of the command?

I will try that tonight. Is the idea that I still use sudo but it won't prompt for a password?

User avatar
LAM
Established Member
Posts: 992
Joined: Thu Oct 08, 2020 3:16 pm
Has thanked: 141 times
Been thanked: 349 times

Re: For those experiencing distortion and crackles after stopping jack on USB interfaces

Post by LAM »

Yes

in mix, nobody can hear your screen

User avatar
sunrat
Established Member
Posts: 926
Joined: Wed Jul 22, 2020 2:08 pm
Has thanked: 152 times
Been thanked: 247 times

Re: For those experiencing distortion and crackles after stopping jack on USB interfaces

Post by sunrat »

Yes you still need to prepend sudo to the command and it shouldn't ask for password. I actually made 2 scripts in ~/bin for cpu govermors, one called ondemand and one called performance. To run them I just need to use the script name as the command. Contents of script:

Code: Select all

#!/bin/bash
/usr/bin/sudo cpupower frequency-set -g performance
Robin Cherry
Established Member
Posts: 72
Joined: Wed Apr 15, 2020 1:18 am
Has thanked: 2 times
Been thanked: 15 times

Re: For those experiencing distortion and crackles after stopping jack on USB interfaces

Post by Robin Cherry »

Nice, that totally works! Thanks @sunrat and @LAM. I hadn't understood it's implementation correctly.

I've successfully added it to my post shutdown script in qjackctl also. I also had been setting my cpugovernor with a script but have now integrated both enabling performance mode on jack startup and reverting to schedutil after jack shutdown into my qjackctl settings.

Thanks again.

profquad
Established Member
Posts: 8
Joined: Wed Oct 18, 2023 9:39 pm

Re: For those experiencing distortion and crackles after stopping jack on USB interfaces

Post by profquad »

wow thank you so much for this. Was getting annoyed switching away from Reaper and trying to get anything else to play.

Robin Cherry
Established Member
Posts: 72
Joined: Wed Apr 15, 2020 1:18 am
Has thanked: 2 times
Been thanked: 15 times

Re: For those experiencing distortion and crackles after stopping jack on USB interfaces

Post by Robin Cherry »

profquad wrote: Fri Nov 24, 2023 8:03 pm

wow thank you so much for this. Was getting annoyed switching away from Reaper and trying to get anything else to play.

Happy to help!

Post Reply