Recording lags when capturing from front microphone, results in garbled noise

There appears to be a driver or configuration glitch with input on my main audio card. The problem only affects the integrated motherboard audio (Starship/Matisse HD Audio Controller Analog Stereo) with my headphone microphone plugged into the front panel: When using my USB webcam as the capture device I experience no issue.

Essentially sound does come through the microphone, however the recorder begins to lag when using it. This is even visible on the capture waveform or volume bar which are only updated in slow increments with huge delays. The audio captured is a garbled mess: It does correspond to noises received by the microphone at various points in time, but it’s as if the whole thing is fast-forwarded and you only hear a bunch of absurd noises.

This doesn’t happen quite all the time: On rare occasions capturing through this microphone works just fine, but after the first attempt this lag is introduced and it becomes unusable. At first I only experienced the issue when recording sound in Audacity, now I’m also having it occur in Discord and other voice chat applications.

Anyone know what can cause an input device to do this? I played with the settings in Pavucontrol but nothing seems to make it go away. Intuition tells me it might be related to buffer overflow and the device being overwhelmed by something, in which case I may need to hack some latency setting.

As you didn’t post an inxi --admin --verbosity=7 --filter --no-host --width, we can only guess, but my first port of call would be a real-time (RT) kernel.

Use the kernel GUI program or the mhwd-kernel CLI program to install an RT kernel and grub options to boot in said kernel and see if the lag goes away…

  • If yes, Solution :grin:
  • If no, report back with some more info (Using an RT kernel?)

:+1:

How does a realtime kernel help? To be fair I’m actually not familiar with what that is, I think I heard the name but need to look it up again. But as far as the kernel goes I’m using Linux 5.11.14-1 (latest stable). And here’s the output of that command:

[mircea@linux-qz0r ~]$ inxi --admin --verbosity=7 --filter --no-host --width
System:
  Kernel: 5.11.14-1-MANJARO x86_64 bits: 64 compiler: gcc v: 10.2.0 
  parameters: BOOT_IMAGE=/boot/vmlinuz-5.11-x86_64 
  root=UUID=eabe1a99-1671-4b1c-9817-d5855ba9cea3 rw quiet apparmor=1 
  security=apparmor udev.log_priority=3 
  Desktop: KDE Plasma 5.21.4 tk: Qt 5.15.2 wm: kwin_x11 vt: 1 dm: SDDM 
  Distro: Manjaro Linux base: Arch Linux 
Machine:
  Type: Desktop Mobo: ASUSTeK model: PRIME X370-PRO v: Rev X.0x 
  serial: <filter> UEFI: American Megatrends v: 5603 date: 07/28/2020 
Battery:
  Message: No system battery data found. Is one present? 
Memory:
  RAM: total: 15.63 GiB used: 6.8 GiB (43.5%) 
  RAM Report: permissions: Unable to run dmidecode. Root privileges required. 
CPU:
  Info: 8-Core model: AMD Ryzen 7 3700X bits: 64 type: MT MCP arch: Zen 2 
  family: 17 (23) model-id: 71 (113) stepping: 0 microcode: 8701021 cache: 
  L2: 4 MiB bogomips: 129652 
  Speed: 4049 MHz min/max: 2200/4050 MHz boost: enabled Core speeds (MHz): 
  1: 4049 2: 4050 3: 4050 4: 4041 5: 4050 6: 4049 7: 4044 8: 4048 9: 4049 
  10: 4050 11: 4030 12: 4050 13: 4048 14: 4049 15: 4050 16: 4050 
  Flags: 3dnowprefetch abm adx aes aperfmperf apic arat avic avx avx2 bmi1 
  bmi2 bpext cat_l3 cdp_l3 clflush clflushopt clwb clzero cmov cmp_legacy 
  constant_tsc cpb cpuid cqm cqm_llc cqm_mbm_local cqm_mbm_total cqm_occup_llc 
  cr8_legacy cx16 cx8 de decodeassists extapic extd_apicid f16c flushbyasid 
  fma fpu fsgsbase fxsr fxsr_opt ht hw_pstate ibpb ibs irperf lahf_lm lbrv lm 
  mba mca mce misalignsse mmx mmxext monitor movbe msr mtrr mwaitx nonstop_tsc 
  nopl npt nrip_save nx osvw overflow_recov pae pat pausefilter pclmulqdq 
  pdpe1gb perfctr_core perfctr_llc perfctr_nb pfthreshold pge pni popcnt pse 
  pse36 rdpid rdpru rdrand rdseed rdt_a rdtscp rep_good sep sev sev_es sha_ni 
  skinit smap smca sme smep ssbd sse sse2 sse4_1 sse4_2 sse4a ssse3 stibp 
  succor svm svm_lock syscall tce topoext tsc tsc_scale umip v_vmsave_vmload 
  vgif vmcb_clean vme vmmcall wbnoinvd wdt xgetbv1 xsave xsavec xsaveerptr 
  xsaveopt xsaves 
  Vulnerabilities: Type: itlb_multihit status: Not affected 
  Type: l1tf status: Not affected 
  Type: mds status: Not affected 
  Type: meltdown status: Not affected 
  Type: spec_store_bypass 
  mitigation: Speculative Store Bypass disabled via prctl and seccomp 
  Type: spectre_v1 
  mitigation: usercopy/swapgs barriers and __user pointer sanitization 
  Type: spectre_v2 mitigation: Full AMD retpoline, IBPB: conditional, STIBP: 
  conditional, RSB filling 
  Type: srbds status: Not affected 
  Type: tsx_async_abort status: Not affected 
Graphics:
  Device-1: AMD Hawaii PRO [Radeon R9 290/390] vendor: XFX Pine driver: amdgpu 
  v: kernel alternate: radeon bus-ID: 0a:00.0 chip-ID: 1002:67b1 
  class-ID: 0300 
  Device-2: Microsoft LifeCam HD-5000 type: USB driver: snd-usb-audio,uvcvideo 
  bus-ID: 5-1:2 chip-ID: 045e:076d class-ID: 0102 
  Display: x11 server: X.Org 1.20.11 compositor: kwin_x11 driver: 
  loaded: amdgpu,ati unloaded: modesetting alternate: fbdev,vesa 
  display-ID: :0 screens: 1 
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.0x11.2") 
  s-diag: 582mm (22.9") 
  Monitor-1: DisplayPort-0 res: 1920x1080 hz: 144 dpi: 94 
  size: 521x293mm (20.5x11.5") diag: 598mm (23.5") 
  OpenGL: renderer: AMD Radeon R9 390 Series (HAWAII DRM 3.40.0 
  5.11.14-1-MANJARO LLVM 11.1.0) 
  v: 4.6 Mesa 21.0.2 direct render: Yes 
Audio:
  Device-1: AMD Hawaii HDMI Audio [Radeon R9 290/290X / 390/390X] 
  vendor: XFX Pine driver: snd_hda_intel v: kernel bus-ID: 0a:00.1 
  chip-ID: 1002:aac8 class-ID: 0403 
  Device-2: AMD Starship/Matisse HD Audio vendor: ASUSTeK 
  driver: snd_hda_intel v: kernel bus-ID: 0c:00.4 chip-ID: 1022:1487 
  class-ID: 0403 
  Device-3: Microsoft LifeCam HD-5000 type: USB driver: snd-usb-audio,uvcvideo 
  bus-ID: 5-1:2 chip-ID: 045e:076d class-ID: 0102 
  Sound Server-1: ALSA v: k5.11.14-1-MANJARO running: yes 
  Sound Server-2: JACK v: 0.125.0 running: no 
  Sound Server-3: PulseAudio v: 14.2 running: yes 
  Sound Server-4: PipeWire v: 0.3.25 running: yes 
Network:
  Device-1: Intel I211 Gigabit Network vendor: ASUSTeK driver: igb v: kernel 
  port: e000 bus-ID: 08:00.0 chip-ID: 8086:1539 class-ID: 0200 
  IF: enp8s0 state: up speed: 1000 Mbps duplex: full mac: <filter> 
  IP v4: <filter> type: noprefixroute scope: global broadcast: <filter> 
  IP v6: <filter> type: noprefixroute scope: link 
  Device-2: Realtek RTL8188EUS 802.11n Wireless Network Adapter type: USB 
  driver: r8188eu bus-ID: 1-12:2 chip-ID: 0bda:8179 class-ID: 0000 
  serial: <filter> 
  IF: wlp2s0f0u12 state: down mac: <filter> 
  WAN IP: <filter> 
Bluetooth:
  Device-1: Integrated System Solution Bluetooth Device type: USB 
  driver: btusb v: 0.8 bus-ID: 1-13:3 chip-ID: 1131:1004 class-ID: fe01 
  Report: rfkill ID: hci0 rfk-id: 0 state: up address: see --recommends 
Logical:
  Message: No logical block device data found. 
RAID:
  Message: No RAID data found. 
Drives:
  Local Storage: total: 5 TiB used: 1.84 TiB (36.7%) 
  SMART Message: Unable to run smartctl. Root privileges required. 
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Samsung 
  model: SSD 970 EVO Plus 500GB size: 465.76 GiB block-size: physical: 512 B 
  logical: 512 B speed: 31.6 Gb/s lanes: 4 rotation: SSD serial: <filter> 
  rev: 1B2QEXM7 temp: 50.9 C scheme: GPT 
  ID-2: /dev/sda maj-min: 8:0 vendor: Samsung model: SSD 860 EVO 1TB 
  size: 931.51 GiB block-size: physical: 512 B logical: 512 B speed: 6.0 Gb/s 
  rotation: SSD serial: <filter> rev: 4B6Q scheme: GPT 
  ID-3: /dev/sdb maj-min: 8:16 vendor: Seagate model: ST4000VN008-2DR166 
  size: 3.64 TiB block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s 
  rotation: 5980 rpm serial: <filter> rev: SC60 scheme: GPT 
  Message: No optical or floppy data found. 
Partition:
  ID-1: / raw-size: 461.76 GiB size: 453.44 GiB (98.20%) 
  used: 26.57 GiB (5.9%) fs: ext4 dev: /dev/nvme0n1p1 maj-min: 259:1 
  label: Manjaro uuid: eabe1a99-1671-4b1c-9817-d5855ba9cea3 
  ID-2: /archive raw-size: 3.64 TiB size: 3.58 TiB (98.40%) 
  used: 1.69 TiB (47.3%) fs: ext4 dev: /dev/sdb1 maj-min: 8:17 label: Archive 
  uuid: e7fc4aee-f26a-4880-8e6a-628abcd50514 
  ID-3: /boot/efi raw-size: 4 GiB size: 3.99 GiB (99.80%) used: 296 KiB (0.0%) 
  fs: vfat dev: /dev/nvme0n1p2 maj-min: 259:2 label: N/A uuid: 17A0-DD48 
  ID-4: /home raw-size: 931.51 GiB size: 915.89 GiB (98.32%) 
  used: 120.09 GiB (13.1%) fs: ext4 dev: /dev/sda1 maj-min: 8:1 label: Home 
  uuid: bf55ce0e-d6cc-49fd-ba02-d14886a418bd 
Swap:
  Alert: No swap data was found. 
Unmounted:
  Message: No unmounted partitions found. 
USB:
  Hub-1: 1-0:1 info: Full speed (or root) Hub ports: 14 rev: 2.0 
  speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900 
  Device-1: 1-12:2 info: Realtek RTL8188EUS 802.11n Wireless Network Adapter 
  type: Network driver: r8188eu interfaces: 1 rev: 2.0 speed: 480 Mb/s 
  power: 500mA chip-ID: 0bda:8179 class-ID: 0000 serial: <filter> 
  Device-2: 1-13:3 info: Integrated System Solution Bluetooth Device 
  type: Bluetooth driver: btusb interfaces: 3 rev: 2.0 speed: 12 Mb/s 
  chip-ID: 1131:1004 class-ID: fe01 
  Hub-2: 2-0:1 info: Full speed (or root) Hub ports: 8 rev: 3.1 speed: 10 Gb/s 
  chip-ID: 1d6b:0003 class-ID: 0900 
  Hub-3: 3-0:1 info: Full speed (or root) Hub ports: 2 rev: 2.0 
  speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900 
  Hub-4: 4-0:1 info: Full speed (or root) Hub ports: 2 rev: 3.1 speed: 10 Gb/s 
  chip-ID: 1d6b:0003 class-ID: 0900 
  Hub-5: 5-0:1 info: Full speed (or root) Hub ports: 4 rev: 2.0 
  speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900 
  Device-1: 5-1:2 info: Microsoft LifeCam HD-5000 type: Video,Audio 
  driver: snd-usb-audio,uvcvideo interfaces: 4 rev: 2.0 speed: 480 Mb/s 
  power: 500mA chip-ID: 045e:076d class-ID: 0102 
  Hub-6: 5-2:3 info: VIA Labs VL813 Hub ports: 4 rev: 2.1 speed: 480 Mb/s 
  chip-ID: 2109:2813 class-ID: 0900 
  Device-1: 5-2.2:4 info: Wacom CTH-460 [Bamboo Pen & Touch] type: Mouse,HID 
  driver: usbhid,wacom interfaces: 2 rev: 2.0 speed: 12 Mb/s power: 98mA 
  chip-ID: 056a:00d1 class-ID: 0300 
  Device-2: 5-2.3:5 info: Logitech M-U0007 [Corded Mouse M500] type: Mouse 
  driver: hid-generic,usbhid interfaces: 1 rev: 2.0 speed: 1.5 Mb/s 
  power: 98mA chip-ID: 046d:c069 class-ID: 0301 
  Device-3: 5-2.4:6 info: Logitech Illuminated Keyboard type: Keyboard,Mouse 
  driver: hid-generic,usbhid interfaces: 2 rev: 2.0 speed: 12 Mb/s 
  power: 300mA chip-ID: 046d:c318 class-ID: 0300 
  Hub-7: 6-0:1 info: Full speed (or root) Hub ports: 4 rev: 3.1 speed: 10 Gb/s 
  chip-ID: 1d6b:0003 class-ID: 0900 
Sensors:
  System Temperatures: cpu: 61.4 C mobo: 0 C gpu: amdgpu temp: 60.0 C 
  Fan Speeds (RPM): N/A 
Info:
  Processes: 405 Uptime: 1d 17m wakeups: 0 Init: systemd v: 247 
  tool: systemctl Compilers: gcc: 10.2.0 clang: 11.1.0 Packages: pacman: 1638 
  lib: 403 flatpak: 0 Shell: Bash v: 5.1.0 running-in: konsole inxi: 3.3.04

Also a little update: I found some threads for Arch Linux of someone else seemingly addressing the same issue, including a section in the docs about it.

https://bbs.archlinux.org/viewtopic.php?id=261401
https://wiki.archlinux.org/index.php/PulseAudio/Troubleshooting#Glitches,_skips_or_crackling

It seems to require playing with some core configs so I may try this one later. It’s possible the default fragment count / size for Pulseaudio is too demanding for certain hardware. The documentation suggests disabling timer-based scheduling via tsched=0 in /etc/pulse/default.pa

A RT kernel gives priority to background processes over front-end processes and results in lower latency.

It’s an easy solution to the exact issues you’re facing, so try that out as a first port of call before you try updating a non-LTS kernel like 5.11.

:man_shrugging:

System has 2 active sound servers that are probably conflicting and causing audio issues

  Sound Server-3: PulseAudio v: 14.2 running: yes 
  Sound Server-4: PipeWire v: 0.3.25 running: yes 

You can choose either:

  • Disable the pipewire systemd socket and service to continue using PulseAudio

    systemctl --user mask --now pipewire.socket &&
    systemctl --user stop pipewire.service
    

    (KDE requires pipewire base package so uninstalling it is not possible for this DE)

OR

  • Install manjaro-pipewire metapackage to get the additional dependency files for Pipewire to replace PulseAudio
1 Like