Trouble with audio devices, recording desktop sound, Audacity

I am experiencing three issues with audio in general. None of them is too bad, but they sum up to be a mild annoyance.

The issues

Issue 1

I would like to record my desktop sound in Audacity. Recording from a microphone or line-in port works fine, but when I try either pipewire or pulse as a recording device to record my desktop audio, I get this error:

Error opening recording device.
Eccor code: -9997 Invalid sample rate.

I extensively googled for this error, I set the samplerate to 44100 and to 48000, nothing does the trick.

Fun fact: recording desktop audio works just fine in OBS Studio!


Issue 2

When I plug a 3.5mm headphones jack into the front headphones port of my PC, it works fine. But when I then plug in the 3.5mm microphone jack, the “Headphones” disappear from the list of devices, the speaker icon in the taskbar switches to “muted” and no sound plays.

Before plugging in the mic:

image

After plugging in the mic:

image

Same is true for the regular “Line Out” at the back of the PC when no headphones are attached. This always happens when I plug in anything to the front mic port.

It does not happen with USB headsets.


Issue 3

This is the smallest of my problems, but when I wanted to record that problem, I was made aware of issue 1 & 2. I installed a Linux-native version of Kingdoms and Castles (yes, to my big surprise, GOG started to roll out a Linux-installer-script for some games).

Now, I tend to mute the in-game music and listen to streams either with Audacious or through Fixefox. Every now and again when I do this while playing KaC, the stream-audio gets mildly distorted. Hard to describe, which is why I wanted to record it, which then lead to issue 1. And trying to figure out whether I can record anything with Audacious, I ran into issue 2 :laughing:


The information

inxi -Abz
System:
  Kernel: 7.0.3-1-cachyos arch: x86_64 bits: 64
  Desktop: KDE Plasma v: 6.6.4 Distro: CachyOS
Machine:
  Type: Desktop System: Micro-Star product: MS-7E26 v: 1.0
    serial: <superuser required>
  Mobo: Micro-Star model: PRO B650-S WIFI (MS-7E26) v: 1.0
    serial: <superuser required> Firmware: UEFI vendor: American Megatrends LLC.
    v: 1.J0 date: 03/13/2025
Battery:
  ID-1: hidpp_battery_0 charge: 56% condition: N/A
CPU:
  Info: 8-core AMD Ryzen 7 8700G w/ Radeon 780M Graphics [MT MCP] speed (MHz):
    avg: 2971 min/max: 423/4200
Graphics:
  Device-1: NVIDIA GA106 [GeForce RTX 3060 Lite Hash Rate] driver: nvidia
    v: 595.71.05
  Device-2: Advanced Micro Devices [AMD/ATI] Phoenix1 driver: amdgpu
    v: kernel
  Display: wayland server: X.org v: 1.21.1.22 with: Xwayland v: 24.1.11
    compositor: kwin_wayland driver: gpu: nv_platform,nvidia,nvidia-nvswitch
    resolution: 1: 1920x1080~60Hz 2: 1920x1080~60Hz
  API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: nvidia mesa v: 595.71.05
    renderer: NVIDIA GeForce RTX 3060/PCIe/SSE2
  Info: Tools: api: clinfo, eglinfo, glxinfo, vulkaninfo
    de: kscreen-console,kscreen-doctor gpu: nvidia-settings,nvidia-smi
    wl: wayland-info x11: xdpyinfo, xprop, xrandr
Audio:
  Device-1: NVIDIA GA106 High Definition Audio driver: snd_hda_intel
  Device-2: Advanced Micro Devices [AMD/ATI] Radeon High Definition Audio
    driver: snd_hda_intel
  Device-3: Advanced Micro Devices [AMD] Ryzen HD Audio
    driver: snd_hda_intel
  API: ALSA v: k7.0.3-1-cachyos status: kernel-api
  Server-1: PipeWire v: 1.6.4 status: active
Network:
  Device-1: Realtek RTL8125 2.5GbE driver: r8169
  Device-2: MEDIATEK MT7922 802.11ax PCI Express Wireless Network Adapter
    driver: mt7921e
Drives:
  Local Storage: total: 10.92 TiB used: 724.57 GiB (6.5%)
Info:
  Memory: total: 32 GiB note: est. available: 30.45 GiB used: 8.48 GiB (27.9%)
  Processes: 475 Uptime: 59m Shell: Zsh inxi: 3.3.40
pacman -Qi audacity
Installed From  : cachyos-extra-znver4
Name            : audacity
Version         : 1:3.7.7-2.1
Description     : A program that lets you manipulate digital audio waveforms
Architecture    : x86_64_v4
URL             : https://audacityteam.org
Licenses        : GPL-3.0-or-later
Groups          : pro-audio
Provides        : ladspa-host  lv2-host  vamp-host  vst-host  vst3-host
Depends On      : alsa-lib  libasound.so=2-64  expat  flac  libFLAC.so=14-64  libFLAC++.so=11-64  glibc  gdk-pixbuf2  libgdk_pixbuf-2.0.so=0-64  glib2  libglib-2.0.so=0-64  libgobject-2.0.so=0-64  gtk3  libgdk-3.so=0-64
                  libgtk-3.so=0-64  hicolor-icon-theme  jack  lame  libgcc  libid3tag  libid3tag.so=0-64  libmad  libogg  libogg.so=0-64  libsbsms  libsbsms.so=2-64  libsndfile  libsndfile.so=1-64  libsoxr  libstdc++  libvorbis
                  libvorbis.so=0-64  libvorbisenc.so=2-64  libvorbisfile.so=3-64  libx11  lilv  liblilv-0.so=0-64  mpg123  libmpg123.so=0-64  opusfile  portaudio  libportaudio.so=2-64  portmidi  libportmidi.so=2-64  portsmf
                  libportSMF.so=0-64  python  soundtouch  sqlite  libsqlite3.so=0-64  suil  libsuil-0.so=0-64  twolame  libtwolame.so=0-64  util-linux-libs  wxwidgets-gtk3  vamp-plugin-sdk  libvamp-hostsdk.so=3-64  wavpack
                  wxwidgets-common
Optional Deps   : audacity-docs: for documentation
                  ffmpeg: for additional import/export capabilities [installed]
Required By     : gxplugins.lv2
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 42.94 MiB
Packager        : CachyOS <admin@cachyos.org>
Build Date      : Thu 26 Mar 2026 09:11:52 PM CET
Install Date    : Fri 27 Mar 2026 07:53:47 PM CET
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature
pacman -Qi pipewire
Installed From  : cachyos-extra-znver4
Name            : pipewire
Version         : 1:1.6.4-1.1
Description     : Low-latency audio/video router and processor
Architecture    : x86_64_v4
URL             : https://pipewire.org
Licenses        : MIT  LGPL-2.1-or-later
Groups          : None
Provides        : None
Depends On      : libpipewire=1:1.6.4-1.1  libpipewire-0.3.so=0-64  dbus  libdbus-1.so=3-64  glib2  libglib-2.0.so=0-64  glibc  libgcc  ncurses  libncursesw.so=6-64  readline  libreadline.so=8-64  systemd-libs  libsystemd.so=0-64
                  libudev.so=1-64
Optional Deps   : gst-plugin-pipewire: GStreamer plugin [installed]
                  pipewire-alsa: ALSA configuration [installed]
                  pipewire-audio: Audio support [installed]
                  pipewire-docs: Documentation
                  pipewire-ffado: FireWire support
                  pipewire-jack-client: PipeWire as JACK client
                  pipewire-jack: JACK replacement
                  pipewire-libcamera: Libcamera support
                  pipewire-onnx: ONNX filter support
                  pipewire-pulse: PulseAudio replacement [installed]
                  pipewire-roc: ROC streaming
                  pipewire-session-manager: Session manager [installed]
                  pipewire-v4l2: V4L2 interceptor
                  pipewire-x11-bell: X11 bell
                  pipewire-zeroconf: Zeroconf support
                  realtime-privileges: realtime privileges with rt module
                  rtkit: realtime privileges with rtkit module [installed]
Required By     : gst-plugin-pipewire  lib32-pipewire  obs-studio  pipewire-alsa  pipewire-audio  pipewire-pulse  proton-cachyos  qt6-multimedia  wireplumber  xdg-desktop-portal
Optional For    : qt6-webengine  sdl3
Conflicts With  : None
Replaces        : None
Installed Size  : 3.16 MiB
Packager        : CachyOS <admin@cachyos.org>
Build Date      : Wed 22 Apr 2026 06:06:12 PM CEST
Install Date    : Sat 25 Apr 2026 09:33:27 AM CEST
Install Reason  : Installed as a dependency for another package
Install Script  : Yes
Validated By    : Signature
pacman -Qi libpulse
Installed From  : cachyos-extra-znver4
Name            : libpulse
Version         : 17.0+r98+gb096704c0-1.2
Description     : A featureful, general-purpose sound server (client library)
Architecture    : x86_64_v4
URL             : https://www.freedesktop.org/wiki/Software/PulseAudio/
Licenses        : LGPL-2.1-or-later
Groups          : None
Provides        : libpulse-mainloop-glib.so=0-64  libpulse-simple.so=0-64  libpulse.so=0-64
Depends On      : bash  dbus  glib2  glibc  libasyncns  libsndfile  libxcb  systemd-libs
Optional Deps   : pulse-native-provider: PulseAudio backend [installed]
Required By     : ardour  audacious-plugins  cef  ffmpeg  firefox  fluidsynth  kinfocenter  libcanberra  libopenmpt  mpv  pavucontrol  phonon-qt6  pipewire-pulse  plasma-pa  pulseaudio-qt  qt5-multimedia  qt6-multimedia  signal-desktop
Optional For    : alsa-plugins  fastfetch  mpg123  proton-cachyos  sdl3  wine
Conflicts With  : None
Replaces        : None
Installed Size  : 1627.41 KiB
Packager        : CachyOS <admin@cachyos.org>
Build Date      : Sat 27 Dec 2025 10:02:09 PM CET
Install Date    : Sun 28 Dec 2025 10:22:36 AM CET
Install Reason  : Installed as a dependency for another package
Install Script  : No
Validated By    : Signature

pavucontrol works fine and looks good to my totally untrained eye.


If you need any other info, please let me know.

not an expert, but fairly certain Issues 1 and 2 are Audacity-specific, i’ve had the 1st issue on non-Cachy distros as well (Manjaro, base Arch, Garuda) for example.

dunno about 3, but as a temporary workaround for issue 2: before loading audacity, i play something on deadbeef (foobar-like audio player, irrelevant), and even if its basically inaudible white noise, it prevents audacity from breaking. i think either its an exclusivity control thing, or audacity tries to wipe audio devices but cant wipe headphones since the white noise is making them busy/in-use.

P.S. would it be possible for you to replace audacity with OcenAudio? it doesnt have this problem. its a bit trickier to use but still has good features.

Some nice ideas there, thanks. Will take a look at it at the weekend…

Just to add, I’m also experiencing your Issue #1. Audacity worked fine out of the box for some time but no longer - so I assume some update at some time has borked it.

I’ve worked through the Audacity troubleshooting advice (Error opening sound device - Audacity Manual) and done some Googling but like you not having any joy so far…

Unfortunately, I am having some real life hassles and can’t investigate here. Will do as soon as possible, which might mot be very soon at all :expressionless:

Okay, the problem seems to get worse.

Now, even OBS cannot record my Desktop Audio properly any longer. Here is an example:

You can clearly hear the crackles and volume-glitches. This is true not only for Diablo but for every Desktop sound.

Anyone has any idea on how to start fixing that?

Issue #1 from above is also true for Tenacity (a fork of Audacity).

Then I tried ocenaudio-bin from the AUR, but I can’t even select “Pulse Audio Server” or “Default ALSA Device” as recording source (seems identical to issue #2).

Bumping this thread because I still have no clue what to do about all of the issues in OP.

Especially Audacity is not recording ANY desktop audio signal (“Error opening device/invalid sample rate” on pipewire, pulse and default) and since a week, I can’t properly record my desktop sound with OBS any longer.

Playing this track on my system works fine, but an OBS recording of it using “Audio Output Capture (PulseAudio)” sounds like that:
http://temp.themadguys.de/2026-05-24_06-17-13.mp4

Hear the crackles?

What can I do here? Am am really at a loss.

The -9997 Invalid sample rate error in Audacity and the crackling in OBS are both closely tied to how PipeWire is handling sample rates and buffer sizes.

If your system is switching between 44.1kHz and 48kHz dynamically, it can cause Audacity to fail and OBS to crackle due to resampling lag. You could try to create a custom config for pipewire in case you did’t try yet.

nano ~/.config/pipewire/pipewire.conf.d/custom.conf

Copy/paste this in:

context.properties = {
    default.clock.rate = 48000
    default.clock.allowed-rates = [ 48000 ]
    default.clock.quantum = 1024
    default.clock.min-quantum = 512
    default.clock.max-quantum = 2048
}

Restart the pipewire services.

systemctl --user restart pipewire pipewire-pulse wireplumber

For the “Front Mic Plugging Mutes Headphones”
This is a classic ALSA auto-mute behavior or an incorrect jack-detection pin mapping where the system thinks plugging in a mic means you’ve unplugged your headphones.

  1. Open your terminal and run:

    alsamixer
    
  2. Press F6 to select your actual sound card (e.g., HDA Intel, Realtek, or AMD) instead of the default PipeWire/PulseAudio redirect.

  3. Use the left/right arrow keys to find Auto-Mute Mode.

  4. Use the up/down arrow keys to change it from Enabled to Disabled.

  5. Check if there is an Independent HP setting and toggle it to see if it changes the behavior.

  6. Press Esc to exit, and save the settings so they persist on reboot:

    sudo alsactl store
    

Please don’t get me wrong but are you sure this is not just some AI output? Because it surely reads like it.

I tried the ~/.config/pipewire/pipewire.conf.d/custom.conf and restarting the services but Audacity does just the same.

As for the alsamxer thing: automute is disabled, so still no solution here, either.

But I was able to fix the crackling sound in OBS by removing the audio source?!?! I don’t understand that at all, but with just one source “Screencapture Pipewire”, it records both audio and video and the crackles are gone.

So it’s one down, still 3 to go.

There is also the guy at Distrotube on youtube that actually talked about crackling and audio problems in this days. You could check that out aswell. Maybe you can get a clue from his video.

Same Issue 1 in my CachyOS setup, desktop Cinnamon, pipewire sound system. I receive same error:

Error opening recording device.
Eccor code: -9997 Invalid sample rate.

In pavucontrol should appear alsa-plugin (audacity), but not in my case!

And I still have no idea how to fix that. Don’t climb down the AI rabbit-hole, they all talk crap.

Don’t worry, I hate any form of AI! :wink: The weird thing is, I just turned on my gaming PC with CachyOS and the Plasma desktop, I tried recording audio with Audacity from a YouTube video, and everything worked perfectly! In the first PC with Cinnamon desktop I also added all the necessary packages for Audacity (pipewire-pulse, pipewire-alsa, alsa-plugins, etc.), so I can’t figure out why Audacity can’t record audio from any audio source on the PC in the Cinnamon desktop.

In pavucontrol, in the Recording section, I’ve also noticed that when I open Audacity and try to select pulse or pipewire in Audio Setup > Recording Device, it seems to try to add the alsa-plugin (audacity) making a sort of flickering, but then the operation fails miserably. Of course, if I start recording in Audacity I get the annoying error -9997!

I think i have the same here. I noticed the audio Plasmoid on my desktop flickering wildly when doing these things in Audacity.

However, I finally bypass the Audacity issue with OBS Studio which, with the appropriate settings, allows me to record desktop audio. Furthermore, with OBS Studio I can see in pavucontrol (Recording section) more recording options. I think it’s an Audacity-related issue, but I’m wondering why it’s only in the Cinnamon desktop, since everything works in Plasma.

Yeah, same here. OBS works fine with pipewire. Although I’d really love to record with Audacity because it is my favorite editor at the moment. Haven’t figured out how to record plain audio in OBS… guess i will have to look that up.

I also prefer Audacity, which I’ve always used. Let’s just say OBS is a fallback, it’s not designed for desktop recording, but for video recording and streaming. I hope we can find a solution to the Audacity problem! Greetings!

After a long search, I finally found a solution for recording system sounds. It’s called Reco and can be found in the Flathub repository as a flatpak application. I’ve tested it and it works 100%. For now, I think it might be a workaround to the Audacity issue. I also tried another solution called audio-recorder (aur), but it has a significant flaw…of the many recording formats it offers, only WAV format has a good sound, but with other formats the audio is distorted (is this a problem with my system or a bug in the program?). I hope this was helpful!

Oh thanks, I will test that a.s.a.p.