Still Having Audio Issues - Delayed Audio

So I couldn’t figure out what my issue was with PipeWire giving me scratchy audio at the start of everything I started watching or really any noise the system produced, it made a popping scratching sound.

So I’ve swapped to PulseAudio to try and fix it from here instead. Probably not the best move but still learning Linux so figured why not.

[jorogumo4@leo-x470aorusultragaming ~]$ screenfetch

 ██████████████████  ████████     jorogumo4@leo-x470aorusultragaming
 ██████████████████  ████████     OS: Manjaro 23.0.0 UltimaThule
 ██████████████████  ████████     Kernel: x86_64 Linux 6.1.31-2-MANJARO
 ██████████████████  ████████     Uptime: 56m
 ████████            ████████     Packages: 1234
 ████████  ████████  ████████     Shell: bash 5.1.16
 ████████  ████████  ████████     Resolution: 7680x1440
 ████████  ████████  ████████     DE: Xfce4
 ████████  ████████  ████████     WM: Xfwm4
 ████████  ████████  ████████     WM Theme: Matcha-sea
 ████████  ████████  ████████     GTK Theme: Matcha-dark-sea [GTK2]
 ████████  ████████  ████████     Icon Theme: Papirus-Maia
 ████████  ████████  ████████     Font: Noto Sans 10
 ████████  ████████  ████████     Disk: 329G / 953G (37%)
                                  CPU: AMD Ryzen 7 2700X Eight-Core @ 16x 3.7GHz
                                  GPU: AMD Radeon RX 7900 XT (gfx1100, LLVM 15.0.7, DRM 3.49, 6.1.31-2-MANJARO)
                                  RAM: 6355MiB / 48124MiB
[jorogumo4@leo-x470aorusultragaming ~]$ inxi -Aazy
Audio:
  Device-1: AMD driver: snd_hda_intel v: kernel pcie: gen: 4 speed: 16 GT/s
    lanes: 16 bus-ID: 0b:00.1 chip-ID: 1002:ab30 class-ID: 0403
  Device-2: AMD Family 17h HD Audio vendor: Gigabyte driver: snd_hda_intel
    v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16 bus-ID: 0d:00.3
    chip-ID: 1022:1457 class-ID: 0403
  Device-3: Yamaha Steinberg UR24C driver: snd-usb-audio type: USB rev: 3.2
    speed: 5 Gb/s lanes: 1 mode: 3.2 gen-1x1 bus-ID: 6-3:2 chip-ID: 0499:174d
    class-ID: 0103
  API: ALSA v: k6.1.31-2-MANJARO status: kernel-api with: aoss
    type: oss-emulator tools: alsactl,alsamixer,amixer
  Server-1: JACK v: 1.9.22 status: off tools: N/A
  Server-2: PipeWire v: 0.3.70 status: off with: pipewire-media-session
    status: off tools: pw-cat,pw-cli
  Server-3: PulseAudio v: 16.1 status: active with: pulseaudio-alsa
    type: plugin tools: pacat,pactl,pavucontrol

Here’s what I’ve done so far.

/etc/pulse/daemon.conf
avoid-resampling = yes (changed from false)
default-sample-rate = 48000 (changed from 44100)
default-fragments = 5 (changed from 4)
default-fragment-size-msec = 2 (changed from 25)

/etc/pulse/default.pa
load-module module-udev-detect tsched=0 (added)
load-module module-suspend-on-idle (added)

This seems to have taken away the scratching at least at the moment I’m not experiencing it, but when I click on say a youtube video, it takes about 1-2 seconds for that audio to start playing.

Any ideas? I’ve been trying to follow the wiki for this, but alas haven’t fixed the issue so far. PulseAudio/Troubleshooting - ArchWiki

After making these changes I did also run the following;
pulseaudio -k
pulseaudio --start

EDIT:
I’ve discovered that load-module module-suspend-on-idle was actually already in default.pa, so I removed the part that I added and commented out the one that was there, unfortunately still having audio delay issues. Once the audio gets going it’s fine, but it just, takes a moment to get started so video is ahead of the audio.

I thought maybe this might be my issue:
https://unix.stackexchange.com/questions/362223/short-audio-playback-is-muted-requires-warming-up-or-secondary-audio-in-backgro

But upon playing something in the background and trying to watch a YouTube video again, the audio still hangs for about 1-2 seconds, then starts after the video. So the video is ahead by 1-2 seconds, which makes watching content unbearable due to the syncing.

Really playing any audio seems to take about 1-2 seconds, then starts. If you pause any audio, it takes 1-2 seconds to stop after the pause.

It’s your Steinberg UR24C audio interface, maybe check for a firmware update. This guy seems to have worked it out:

Playing youtube videos makes pulseaudio switch to 48000hz, which cannot be disabled by configuring /etc/pulse/daemon.conf for some reason (run pacmd list-sinks to get sample rates). This change of the sample rate makes the interface go quiet for 2 seconds. It can be avoided with jack2 (jack works as well probably), cadence and the pulseaudio-jack bridge alsa - Pulseaudio detects wrong sample rate. Forcing pulseaudio a sample rate - Unix & Linux Stack Exchange

You’re a legend!!! This worked! I ran most of the commands with the exception of the user cfg files part as they didn’t exist on my side. Still a TINY crackle at the start of the audio but WAY better than what it was and the audio starts right away.

# to get it to work at all this is nowadays required, otherwise it goes silent right after starting pulse
sudo sed 's/load-module module-suspend-on-idle/#load-module module-suspend-on-idle/' /etc/pulse/default.pa -i

# preventing pulseaudio crashing when opening audacity or recording into telegram,
# as well as preventing crackling
sudo echo "default-sample-rate = 44100" | sudo tee --append /etc/pulse/daemon.conf
sudo echo "alternate-sample-rate = 44100" | sudo tee --append /etc/pulse/daemon.conf

# I don't know if this is actually still required, because pavucontrol allows you to lock the profile nowadays.
# to prevent pulse from switching devices (for whatever reason), blacklist all other devices:
# (probably requires rebooting)
sudo touch /etc/modprobe.d/fix_pulse.conf
# see https://bbs.archlinux.org/viewtopic.php?id=135782
sudo echo "blacklist snd_hda_codec_hdmi" | sudo tee --append /etc/modprobe.d/fix_pulse.conf
sudo echo "blacklist snd_hda_intel" | sudo tee --append /etc/modprobe.d/fix_pulse.conf
# see lsmod | ack snd
sudo echo "blacklist snd_hda_codec_generic" | sudo tee --append /etc/modprobe.d/fix_pulse.conf
sudo echo "blacklist snd_hda_codec_realtek" | sudo tee --append /etc/modprobe.d/fix_pulse.conf

I see he also recommends in that thread to switch to pipwire, but I just could not figure out how to resolve the audio crackling…

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.