Sound is messed up at busy loads

well im not 100% on the when, but when im playing OSU, at seemingly random times the audio will sort of… “break”? in-game, in the menu…
similarly i was on call with a friend on discord, all normal, then loaded a pretty heavy game, and the exact same breaking was happening, and my friends voice was robotic and my game sounds crackily. not 100% of the time. sometimes it felt like it was responding to heavier demands of the game.

never used to happen. and today it happened just when listening to music when first loading it up! so i godda fix it. It’s not my hardware. this does not happen with my amp/speakers are connected to my CD player or phone. never has on my pc before either.

bit less than a month it has been happening.

thanks for any help :slight_smile:

inxi -v7azy output

Audio:
Device-1: NVIDIA GP104 High Definition Audio vendor: Gigabyte
driver: snd_hda_intel v: kernel bus-ID: 1-3:3 chip-ID: 046d:081b pcie:
class-ID: 0102 gen: 3 speed: 8 GT/s serial: <filter> lanes: 16
bus-ID: 09:00.1 chip-ID: 10de:10f0 class-ID: 0403
Device-2: AMD Family 17h HD Audio vendor: ASUSTeK driver: snd_hda_intel
v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16 bus-ID: 0b:00.3
chip-ID: 1022:1457 class-ID: 0403
Device-3: Logitech Webcam C310 type: USB driver: snd-usb-audio,uvcvideo
Sound Server-1: ALSA v: k5.15.55-1-MANJARO running: yes
Sound Server-2: JACK v: 1.9.21 running: no
Sound Server-3: PulseAudio v: 16.1 running: no
Sound Server-4: PipeWire v: 0.3.55 running: yes

Could be probably that the nice value changed or was reverted or just affects you on heavy loads?

Nice -19 → very high priority
Nice 20 → very low priority

Normally pulseaudio was at -11 if I am not wrong, so maybe make the same with pipewire…

You can edit the service:

systemctl --user edit pipewire.service

Add there:

[Service]
CPUSchedulingPriority=-11

and save it.
Then restart:

systemctl --user restart pipewire.service

woha, thats some sherlock-level looking magic to me.
anyway.

at first i thought this solved it, as osu played without issues. but it can do that sometimes.
but after launching the demanding game, which has the unfortunate disposition of being a Silver rated on steamProton (so does suffer anyway) and going back on call, my friends voice is still broken 90% of the time.
The skips in frames and jittering are almost always consistent with audio glitches. but it does not explain why the independent discord sounds are messed up, right?
thank you for being so prompt! amazing :slight_smile:

Well my guess is just that the “demanding game” runs at normal priority 0 like discord. Now the scheduler handles them both equal. If not enough cpu is left, then it will do such things… Soo put discord on a higher priority. Also note that running a game with gamemoderun could have an negative effect on discord.

i see okay doke. I didnt super understand you explanation of “nice” and whatnot above. How would I change priority of different applications from here?

Niceness → CPUSchedulingPriority

There is a terminal tool called nice

$ nice --help
Usage: nice [OPTION] [COMMAND [ARG]...]
Run COMMAND with an adjusted niceness, which affects process scheduling.
With no COMMAND, print the current niceness.  Niceness values range from
-20 (most favorable to the process) to 19 (least favorable to the process).

Mandatory arguments to long options are mandatory for short options too.
  -n, --adjustment=N   add integer N to the niceness (default 10)
      --help        display this help and exit
      --version     output version information and exit

NOTE: your shell may have its own version of nice, which usually supersedes
the version described here.  Please refer to your shell's documentation
for details about the options it supports.

GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
Report any translation bugs to <https://translationproject.org/team/>
Full documentation <https://www.gnu.org/software/coreutils/nice>
or available locally via: info '(coreutils) nice invocation'

However… you can set it anytime in your favorite taskmanager, just like on Windows.

okay doke thank you.
not… still not sure how i would priotize one application over the other with nice, or what we done by manually setting a nice value within the pipewire settings though :frowning:

Uff… ok explanation for a mouse-mover:

Peek 2022-07-20 19-40

1 Like