Audio crackling, I really need help :'(

Every time I play a sound, my speakers make a very loud crackling noise (this only happens on my PC). Here’s what I’ve already tried:

  • Test the second jack port on my motherboard (it didn’t work)
  • Buy an adapter for my cable (it didn’t work)
  • Changing my distribution (fedora) (it didn’t work)
  • Turning pulse audio on and off (it didn’t work)
  • Using the speakers on my New 3DS XL, and on my phone with and without adapters (it worked)
  • I have no sound problems with my headphones.

I have no idea where this problem is coming from. Please help me, I would love to use my speakers.
PS: I’m a linux beginner, so could you please explain in detail what I need to do ? Thanks in advance !

Software :
OS : OpenSuse Tumbleweed
DE : KDE Plasma 6.1.0
Graphic Platform : Wayland
Kernel : 6.9.6-1-default (64-bit)
Qt : 6.7.2

Hardware :
CPU : 8 × Intel® Core™ i7-9700K CPU @ 3.60GHz
GPU: NVIDIA GeForce GTX 1660/PCIe/SSE2
Motherboard : TUF Z390-PLUS GAMING (WI-FI)
RAM: 31.3 GB
Speakers : JBL Professional 305P MkII
Cable : Cable Matters 3.5mm 1/8 Inch TRS to 2 XLR
Adapter : USB Audio Adapter, DuKabel USB to 3.5mm Jack TRS
Headphones : Corsair HS80 RGB WIRELESS

@RealSuse:

First, welcome to the openSUSE Forums.


Audio these days is via Pipewire – with plug-ins to handle Pulse, Alsa and Jack.
There may also be real-time issues, even with Pipewire, but, due to the move to Pipewire for most Use-Cases the need for real-time adjustments has decreased.

 > systemctl --user list-unit-files | grep -iE 'pipe|puls|als'
pipewire-pulse.service                                                disabled  disabled
pipewire-session-manager.service                                      alias     -
pipewire.service                                                      disabled  disabled
pipewire-pulse.socket                                                 enabled   enabled
pipewire.socket                                                       enabled   enabled
 >

Here on Leap 15.6, I have the following Pipewire packages are installed –

 > zypper search --installed-only pipewire
Repository                                                                                  : Time since last refresh
 .
 .
 .
Repository-Daten werden geladen...
Installierte Pakete werden gelesen...

S  | Name                           | Summary                                                                  | Type
---+--------------------------------+--------------------------------------------------------------------------+------
i+ | gstreamer-plugin-pipewire      | Gstreamer Plugin for PipeWire                                            | Paket
i  | kpipewire-imports              | QtQuick bindings for kpipewire                                           | Paket
i  | libKPipeWire5                  | PipeWire integration for KDE Plasma - main library                       | Paket
i  | libKPipeWire5-lang             | Translations for package kpipewire                                       | Paket
i  | libKPipeWireDmaBuf5            | PipeWire integration for KDE Plasma - DMA-BUF support                    | Paket
i  | libKPipeWireRecord5            | PipeWire integration for KDE Plasma - recording support                  | Paket
i+ | libpipewire-0_3-0              | A Multimedia Framework designed to be an audio and video server and more | Paket
i  | libpipewire-0_3-0-32bit        | A Multimedia Framework designed to be an audio and video server and more | Paket
i+ | pipewire                       | A Multimedia Framework designed to be an audio and video server and more | Paket
i  | pipewire-alsa                  | PipeWire media server ALSA support                                       | Paket
i  | pipewire-alsa-32bit            | PipeWire media server ALSA support                                       | Paket
i+ | pipewire-jack                  | PipeWire JACK implementation                                             | Paket
i+ | pipewire-lang                  | Translations for package pipewire                                        | Paket
i  | pipewire-libjack-0_3           | PipeWire libjack replacement libraries                                   | Paket
i+ | pipewire-module-x11-0_3        | X11 support For PipeWire, A Multimedia Framework                         | Paket
i+ | pipewire-modules-0_3           | Modules For PipeWire, A Multimedia Framework                             | Paket
i  | pipewire-modules-0_3-32bit     | Modules For PipeWire, A Multimedia Framework                             | Paket
i  | pipewire-pulseaudio            | PipeWire PulseAudio implementation                                       | Paket
i+ | pipewire-spa-plugins-0_2       | Plugins For PipeWire SPA                                                 | Paket
i  | pipewire-spa-plugins-0_2-32bit | Plugins For PipeWire SPA                                                 | Paket
i+ | pipewire-spa-tools             | The PipeWire SPA Tools                                                   | Paket
i+ | pipewire-tools                 | The PipeWire Tools                                                       | Paket
 >

Hi, I don’t quite understand what I need to do but here’s what I get when I enter the commands you quoted :

> systemctl --user list-unit-files | grep -iE 'pipe|puls|als'
pipewire-pulse.service                                                  masked    disabled
pipewire-session-manager.service                                        alias     -
pipewire.service                                                        disabled  disabled
pipewire-pulse.socket                                                   masked    enabled
pipewire.socket                                                         enabled   enabled
> zypper search --installed-only pipewire
Chargement des données du dépôt...
Lecture des paquets installés...

S | Name                           | Summary                                                                  | Type
--+--------------------------------+--------------------------------------------------------------------------+-------
i | kpipewire6-imports             | QtQuick bindings for kpipewire6                                          | paquet
i | libKPipeWire6                  | PipeWire integration for KDE Plasma - main library                       | paquet
i | libKPipeWire6-lang             | Translations for package libKPipeWire6                                   | paquet
i | libKPipeWireDmaBuf6            | PipeWire integration for KDE Plasma - DMA-BUF support                    | paquet
i | libKPipeWireRecord6            | PipeWire integration for KDE Plasma - recording support                  | paquet
i | libpipewire-0_3-0              | A Multimedia Framework designed to be an audio and video server and more | paquet
i | libpipewire-0_3-0-32bit        | A Multimedia Framework designed to be an audio and video server and more | paquet
i | pipewire                       | A Multimedia Framework designed to be an audio and video server and more | paquet
i | pipewire-alsa                  | PipeWire media server ALSA support                                       | paquet
i | pipewire-jack                  | PipeWire JACK implementation                                             | paquet
i | pipewire-lang                  | Translations for package pipewire                                        | paquet
i | pipewire-libjack-0_3           | PipeWire libjack replacement libraries                                   | paquet
i | pipewire-modules-0_3           | Modules For PipeWire, A Multimedia Framework                             | paquet
i | pipewire-modules-0_3-32bit     | Modules For PipeWire, A Multimedia Framework                             | paquet
i | pipewire-pulseaudio            | PipeWire PulseAudio implementation                                       | paquet
i | pipewire-spa-plugins-0_2       | Plugins For PipeWire SPA                                                 | paquet
i | pipewire-spa-plugins-0_2-32bit | Plugins For PipeWire SPA                                                 | paquet
i | pipewire-spa-tools             | The PipeWire SPA Tools                                                   | paquet
i | pipewire-tools                 | The PipeWire Tools                                                       | paquet

@RealSuse:

First, you’ve masked the following systemd user service and socket –

  • pipewire-pulse.service
  • pipewire-pulse.socket

If you want Pipewire to support Pulse – which is usually a good idea – you should unmask the systemd Pipewire-Pulse service and socket –

> systemctl --user unmask pipewire-pulse.service pipewire-pulse.socket

Once you’ve done that, the Pipewire-Pulse service should be disabled (it’s triggered by the Pipewire-Pulse socket) and, the Pipewire-Pulse socket should be enabled.

Check as follows (with of course your time-stamp) –

 > systemctl --user reload-or-restart pipewire-pulse.socket
 >
 > systemctl --user status pipewire-pulse.service
● pipewire-pulse.service - PipeWire PulseAudio
     Loaded: loaded (/usr/lib/systemd/user/pipewire-pulse.service; disabled; preset: disabled)
     Active: active (running) since Fri 2024-06-28 12:21:59 CEST; 6h ago
TriggeredBy: ● pipewire-pulse.socket
   Main PID: 3290 (pipewire-pulse)
      Tasks: 3 (limit: 4915)
        CPU: 85ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/pipewire-pulse.service
             └─3290 /usr/bin/pipewire-pulse

Jun 28 12:21:59 xxx systemd[2676]: Started PipeWire PulseAudio.
 > 
 > systemctl --user status pipewire-pulse.socket 
● pipewire-pulse.socket - PipeWire PulseAudio
     Loaded: loaded (/usr/lib/systemd/user/pipewire-pulse.socket; enabled; preset: enabled)
     Active: active (running) since Fri 2024-06-28 12:21:56 CEST; 6h ago
   Triggers: ● pipewire-pulse.service
     Listen: /run/user/1000/pulse/native (Stream)
     CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/pipewire-pulse.socket

Jun 28 12:21:56 xxx systemd[2676]: Listening on PipeWire PulseAudio.
 >

You should consider installing the GStreamer plug-in for Pipewire.

Why? What it adds to the system?

Hello @RealSuse

Based on what you wrote, this could be an issue with the onboard analog audio hardware itself, rather than with any configuration as such. I wanted to share this troubleshooting guide

although after reading the opening post I’m not convinced there is much you can do.

Anyway, this will report your machine hardware more defitiviely, and that might help others to advise further…

inxi -MSAa

FWIW, a similar thread…

@dcurtisfra
Here’s what I got, it doesn’t seem to have worked unfortunately… :frowning:

> systemctl --user unmask pipewire-pulse.service pipewire-pulse.socket
> systemctl --user reload-or-restart pipewire-pulse.socket
Failed to reload-or-restart pipewire-pulse.socket: Unit pipewire-pulse.socket is masked.
> systemctl --user status pipewire-pulse.service
○ pipewire-pulse.service
     Loaded: masked (Reason: Unit pipewire-pulse.service is masked.)
     Active: inactive (dead)
> systemctl --user status pipewire-pulse.socket
○ pipewire-pulse.socket
     Loaded: masked (Reason: Unit pipewire-pulse.socket is masked.)
     Active: inactive (dead)

I only followed the Full Guide, and here’s what happened:

1. Create the config files for pipewire (If they don’t exist)

> sudo mkdir -p /etc/pipewire/media-session.d/ && sudo cp /usr/share/pipewire/*.conf /etc/pipewire/ && sudo cp /usr/share/pipewire/media-session.d/*.conf /etc/pipewire/media-session.d/
cp: impossible d'évaluer '/usr/share/pipewire/media-session.d/*.conf': Aucun fichier ou dossier de ce nom
> mkdir -p ~/.config/pipewire/media-session.d/ && cp /usr/share/pipewire/*.conf ~/.config/pipewire/ && cp /usr/share/pipewire/media-session.d/*.conf ~/.config/pipewire/media-session.d/
cp: impossible d'évaluer '/usr/share/pipewire/media-session.d/*.conf': Aucun fichier ou dossier de ce nom
> sudo mkdir -p /etc/pipewire/ && sudo mkdir -p /etc/wireplumber/wireplumber.conf.d/ && sudo cp /usr/share/pipewire/*.conf /etc/pipewire/ && sudo cp /usr/share/wireplumber/wireplumber.conf.d/* /etc/wireplumber/wireplumber.conf.d/
> mkdir -p ~/.config/pipewire/ && mkdir -p ~/.config/wireplumber/wireplumber.conf.d/ && cp /usr/share/pipewire/*.conf ~/.config/pipewire/ && cp /usr/share/wireplumber/wireplumber.conf.d/* ~/.config/wireplumber/wireplumber.conf.d/

2. Disable Suspend

Then I modified the alsa-vm.conf file using
> sudo nano alsa-vm.conf

# ALSA node property overrides for virtual machine hardware

monitor.alsa.rules = [
  # Generic PCI cards on any VM type
  {
    matches = [
      {
        node.name = "~alsa_input.pci.*"
        cpu.vm.name = "~.*"
      }
      {
        node.name = "~alsa_output.pci.*"
        cpu.vm.name = "~.*"
      }
    ]
    actions = {
      update-props = {
        api.alsa.period-size   = 1024
        api.alsa.headroom      = 2048
        session.suspend-timeout-seconds = 0
      }
    }
  }
]

I restarted pipewire

> systemctl --user restart pipewire pipewire-pulse pipewire-media-session wireplumber
Failed to restart pipewire-pulse.service: Unit pipewire-pulse.service is masked.
Failed to restart pipewire-media-session.service: Unit pipewire-media-session.service not found.

I restarted my computer
But now I’ve got a new problem: I can’t select an audio peripĥérique in the settings (nothing appears). What’s more, the speakers are still crackling…

Should I continue?

Oh, and I almost forgot, here’s what I got with your last command line :

> inxi -MSAa
System:
  Host: localhost.localdomain Kernel: 6.9.6-1-default arch: x86_64 bits: 64
    compiler: gcc v: 13.3.0 clocksource: tsc avail: hpet,acpi_pm
    parameters: BOOT_IMAGE=/boot/vmlinuz-6.9.6-1-default
    root=UUID=988f1840-f7bb-46ae-8f64-565b36c6c74d splash=silent
    mitigations=auto quiet security=apparmor
  Desktop: KDE Plasma v: 6.1.1 tk: Qt v: N/A info: frameworks v: 6.3.0
    wm: kwin_wayland tools: avail: xscreensaver vt: 3 dm: SDDM Distro: openSUSE
    Tumbleweed 20240627
Machine:
  Type: Desktop Mobo: ASUSTeK model: TUF Z390-PLUS GAMING (WI-FI) v: Rev X.0x
    serial: <superuser required> part-nu: ASUS_MB_CNL uuid: <superuser required>
    UEFI: American Megatrends v: 3006 date: 10/12/2021
Audio:
  Device-1: Intel Cannon Lake PCH cAVS vendor: ASUSTeK driver: snd_hda_intel
    v: kernel alternate: snd_soc_skl, snd_soc_avs, snd_sof_pci_intel_cnl
    bus-ID: 00:1f.3 chip-ID: 8086:a348 class-ID: 0403
  Device-2: NVIDIA TU116 High Definition Audio vendor: ASUSTeK
    driver: snd_hda_intel v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16
    bus-ID: 01:00.1 chip-ID: 10de:1aeb class-ID: 0403
  Device-3: Corsair HS80 RGB Wireless Gaming Receiver
    driver: hid-generic,snd-usb-audio,usbhid type: USB rev: 2.0 speed: 12 Mb/s
    lanes: 1 mode: 1.1 bus-ID: 1-8:9 chip-ID: 1b1c:0a6b class-ID: 0300
    serial: 179af2cc00030215
  API: ALSA v: k6.9.6-1-default status: kernel-api with: aoss
    type: oss-emulator tools: alsactl,alsamixer,amixer
  Server-1: PipeWire v: 1.1.83 status: active with: 1: pipewire-pulse
    status: off 2: wireplumber status: active 3: pipewire-alsa type: plugin
    4: pw-jack type: plugin tools: pactl,pw-cat,pw-cli,wpctl

My mistake – you have to unmask with 2 separate systemctl commands –

 > systemctl --user unmask pipewire-pulse.service
 > systemctl --user unmask pipewire-pulse.socket

Your trace indicated the following error –

Failed to reload-or-restart pipewire-pulse.socket: Unit pipewire-pulse.socket is masked.

Which is possibly the reason why, it didn’t function as expected for your case.

WirePlumber (wireplumber.service) replaced pipewire-media-session as the PipeWire session manager a couple of years back. Make sure that it is running.

(PS That was mentioned in the Manjaro guide.)

A quick online search of this model (and similar ASUS models) with “crackling audio” and similar keywords turns up numerous results describing similar problems. Seems to have a known design issue with audio.

Also had that issue, setting default.clock.allowed-rates wasn’t working for me. This issue was most noticeable on Firefox.

Setting /usr/share/wireplumber/wireplumber.conf.d/alsa-vm.conf for that solved to me

# ALSA node property overrides for virtual machine hardware

monitor.alsa.rules = [
  # Generic PCI cards on any VM type
  {
    matches = [
      {
        node.name = "~alsa_input.pci.*"
        cpu.vm.name = "~.*"
      }
      {
        node.name = "~alsa_output.pci.*"
        cpu.vm.name = "~.*"
      }
    ]
    actions = {
      update-props = {
        api.alsa.period-size   = 256
        api.alsa.headroom      = 2048
      }
    }
  }
]

Here, i changed api.alsa.period-size and api.alsa.headroom to these values. Then i restarted pipewire and firefox to test

systemctl restart --user pipewire pipewire-pulse

But as deani_ferrari mentioned, it may most likely be a hardware issue. I found a guy saying that setting audio rate to 44khz 16bits solved this.
So i would change default.clock.rate to 44100 and default.clock.allowed-rates to [ 44100 ] in /usr/share/pipewire/pipewire.conf

OK, thank you very much everyone, I haven’t managed to solve my problem but at least I know it’s coming from my hardware. I continued to follow the guide until the 4th, but nothing has changed (to tell the truth, now I can’t even select an audio device or listen to a song).
PS: @deano_ferrari I made the same mistake when I restarted pipewire because I hadn’t seen your message, sorry.

3. Enable sample rate switching

I modified the pipewire.conf file with :
> sudo nano pipewire.conf

# Daemon config file for PipeWire version "1.0.7" #
#
# Copy and edit this file in /etc/pipewire for system-wide changes
# or in ~/.config/pipewire for local changes.
#
# It is also possible to place a file with an updated section in
# /etc/pipewire/pipewire.conf.d/ for system-wide changes or in
# ~/.config/pipewire/pipewire.conf.d/ for local changes.
#

context.properties = {
    ## Configure properties in the system.
    #library.name.system                   = support/libspa-support
    #context.data-loop.library.name.system = support/libspa-support
    #support.dbus                          = true
    #link.max-buffers                      = 64
    link.max-buffers                       = 16                       # version < 3 clients can't handle more
    #mem.warn-mlock                        = false
    #mem.allow-mlock                       = true
    #mem.mlock-all                         = false
    #clock.power-of-two-quantum            = true
    #log.level                             = 2
    #cpu.zero.denormals                    = false

    core.daemon = true              # listening for socket connections
    core.name   = pipewire-0        # core name and socket name

    ## Properties for the DSP configuration.
    #default.clock.rate          = 48000
    default.clock.allowed-rates = [ 44100 48000 ]
    #This is not default because: https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Config-PipeWire#setting-global-sample-rate
    #default.clock.quantum       = 1024
    #default.clock.min-quantum   = 32
    #default.clock.max-quantum   = 2048
    #default.clock.quantum-limit = 8192
    #default.clock.quantum-floor = 4
    #default.video.width         = 640
    #default.video.height        = 480
    #default.video.rate.num      = 25
    #default.video.rate.denom    = 1
    #
    #settings.check-quantum      = false
    #settings.check-rate         = false
    #
    # These overrides are only applied when running in a vm.
    vm.overrides = {
        default.clock.min-quantum = 1024
    }

    # keys checked below to disable module loading
    module.x11.bell = true
    # enables autoloading of access module, when disabled an alternative
    # access module needs to be loaded.
    module.access = true
    # enables autoloading of module-jackdbus-detect
    module.jackdbus-detect = true
}

context.spa-libs = {
    #<factory-name regex> = <library-name>
    #
    # Used to find spa factory names. It maps an spa factory name
    # regular expression to a library name that should contain
    # that factory.
    #
    audio.convert.* = audioconvert/libspa-audioconvert
    avb.*           = avb/libspa-avb
    api.alsa.*      = alsa/libspa-alsa
    api.v4l2.*      = v4l2/libspa-v4l2
    api.libcamera.* = libcamera/libspa-libcamera
    api.bluez5.*    = bluez5/libspa-bluez5
    api.vulkan.*    = vulkan/libspa-vulkan
    api.jack.*      = jack/libspa-jack
    support.*       = support/libspa-support
    #videotestsrc   = videotestsrc/libspa-videotestsrc
    #audiotestsrc   = audiotestsrc/libspa-audiotestsrc
}

context.modules = [
    #{ name = <module-name>
    #    ( args  = { <key> = <value> ... } )
    #    ( flags = [ ( ifexists ) ( nofail ) ] )
    #    ( condition = [ { <key> = <value> ... } ... ] )
    #}
    #
    # Loads a module with the given parameters.
    # If ifexists is given, the module is ignored when it is not found.
    # If nofail is given, module initialization failures are ignored.
    # If condition is given, the module is loaded only when the context
    # properties all match the match rules.
    #

    # Uses realtime scheduling to boost the audio thread priorities. This uses
    # RTKit if the user doesn't have permission to use regular realtime
    # scheduling. You can also clamp utilisation values to improve scheduling
    # on embedded and heterogeneous systems, e.g. Arm big.LITTLE devices.
    { name = libpipewire-module-rt
        args = {
            nice.level    = -11
            rt.prio       = 88
            #rt.time.soft = -1
            #rt.time.hard = -1
            #uclamp.min = 0
            #uclamp.max = 1024
        }
        flags = [ ifexists nofail ]
    }

    # The native communication protocol.
    { name = libpipewire-module-protocol-native
        args = {
            # List of server Unix sockets, and optionally permissions
            #sockets = [ { name = "pipewire-0" }, { name = "pipewire-0-manager" } ]
        }
    }

    # The profile module. Allows application to access profiler
    # and performance data. It provides an interface that is used
    # by pw-top and pw-profiler.
    { name = libpipewire-module-profiler }

    # Allows applications to create metadata objects. It creates
    # a factory for Metadata objects.
    { name = libpipewire-module-metadata }

    # Creates a factory for making devices that run in the
    # context of the PipeWire server.
    { name = libpipewire-module-spa-device-factory }

    # Creates a factory for making nodes that run in the
    # context of the PipeWire server.
    { name = libpipewire-module-spa-node-factory }

    # Allows creating nodes that run in the context of the
    # client. Is used by all clients that want to provide
    # data to PipeWire.
    { name = libpipewire-module-client-node }

    # Allows creating devices that run in the context of the
    # client. Is used by the session manager.
    { name = libpipewire-module-client-device }

    # The portal module monitors the PID of the portal process
    # and tags connections with the same PID as portal
    # connections.
    { name = libpipewire-module-portal
        flags = [ ifexists nofail ]
    }

    # The access module can perform access checks and block
    # new clients.
    { name = libpipewire-module-access
        args = {
            # Socket-specific access permissions
            #access.socket = { pipewire-0 = "default", pipewire-0-manager = "unrestricted" }

            # Deprecated legacy mode (not socket-based),
            # for now enabled by default if access.socket is not specified
            #access.legacy = true
        }
        condition = [ { module.access = true } ]
    }

    # Makes a factory for wrapping nodes in an adapter with a
    # converter and resampler.
    { name = libpipewire-module-adapter }

    # Makes a factory for creating links between ports.
    { name = libpipewire-module-link-factory }

    # Provides factories to make session manager objects.
    { name = libpipewire-module-session-manager }

    # Use libcanberra to play X11 Bell
    { name = libpipewire-module-x11-bell
        args = {
            #sink.name = "@DEFAULT_SINK@"
            #sample.name = "bell-window-system"
            #x11.display = null
            #x11.xauthority = null
        }
        flags = [ ifexists nofail ]
        condition = [ { module.x11.bell = true } ]
    }
    { name = libpipewire-module-jackdbus-detect
        args = {
            #jack.library     = libjack.so.0
            #jack.server      = null
            #jack.client-name = PipeWire
            #jack.connect     = true
            #tunnel.mode      = duplex  # source|sink|duplex
            source.props = {
                #audio.channels = 2
		#midi.ports = 1
                #audio.position = [ FL FR ]
                # extra sink properties
            }
            sink.props = {
                #audio.channels = 2
		#midi.ports = 1
                #audio.position = [ FL FR ]
                # extra sink properties
            }
        }
        flags = [ ifexists nofail ]
        condition = [ { module.jackdbus-detect = true } ]
    }
]

context.objects = [
    #{ factory = <factory-name>
    #    ( args  = { <key> = <value> ... } )
    #    ( flags = [ ( nofail ) ] )
    #    ( condition = [ { <key> = <value> ... } ... ] )
    #}
    #
    # Creates an object from a PipeWire factory with the given parameters.
    # If nofail is given, errors are ignored (and no object is created).
    # If condition is given, the object is created only when the context properties
    # all match the match rules.
    #
    #{ factory = spa-node-factory   args = { factory.name = videotestsrc node.name = videotestsrc node.description = videotestsrc "Spa:Pod:Object:Param:Props:patternType" = 1 } }
    #{ factory = spa-device-factory args = { factory.name = api.jack.device foo=bar } flags = [ nofail ] }
    #{ factory = spa-device-factory args = { factory.name = api.alsa.enum.udev } }
    #{ factory = spa-node-factory   args = { factory.name = api.alsa.seq.bridge node.name = Internal-MIDI-Bridge } }
    #{ factory = adapter            args = { factory.name = audiotestsrc node.name = my-test node.description = audiotestsrc } }
    #{ factory = spa-node-factory   args = { factory.name = api.vulkan.compute.source node.name = my-compute-source } }

    # A default dummy driver. This handles nodes marked with the "node.always-process"
    # property when no other driver is currently active. JACK clients need this.
    { factory = spa-node-factory
        args = {
            factory.name    = support.node.driver
            node.name       = Dummy-Driver
            node.group      = pipewire.dummy
            priority.driver = 20000
            #clock.id       = monotonic # realtime | tai | monotonic-raw | boottime
            #clock.name     = "clock.system.monotonic"
        }
    }
    { factory = spa-node-factory
        args = {
            factory.name    = support.node.driver
            node.name       = Freewheel-Driver
            priority.driver = 19000
            node.group      = pipewire.freewheel
            node.freewheel  = true
        }
    }

    # This creates a new Source node. It will have input ports
    # that you can link, to provide audio for this source.
    #{ factory = adapter
    #    args = {
    #        factory.name     = support.null-audio-sink
    #        node.name        = "my-mic"
    #        node.description = "Microphone"
    #        media.class      = "Audio/Source/Virtual"
    #        audio.position   = "FL,FR"
    #        monitor.passthrough = true
    #    }
    #}

    # This creates a single PCM source device for the given
    # alsa device path hw:0. You can change source to sink
    # to make a sink in the same way.
    #{ factory = adapter
    #    args = {
    #        factory.name           = api.alsa.pcm.source
    #        node.name              = "alsa-source"
    #        node.description       = "PCM Source"
    #        media.class            = "Audio/Source"
    #        api.alsa.path          = "hw:0"
    #        api.alsa.period-size   = 1024
    #        api.alsa.headroom      = 0
    #        api.alsa.disable-mmap  = false
    #        api.alsa.disable-batch = false
    #        audio.format           = "S16LE"
    #        audio.rate             = 48000
    #        audio.channels         = 2
    #        audio.position         = "FL,FR"
    #    }
    #}

    # Use the metadata factory to create metadata and some default values.
    #{ factory = metadata
    #    args = {
    #        metadata.name = my-metadata
    #        metadata.values = [
    #            { key = default.audio.sink   value = { name = somesink } }
    #            { key = default.audio.source value = { name = somesource } }
    #        ]
    #    }
    #}
]

context.exec = [
    #{   path = <program-name>
    #    ( args = "<arguments>" )
    #    ( condition = [ { <key> = <value> ... } ... ] )
    #}
    #
    # Execute the given program with arguments.
    # If condition is given, the program is executed only when the context
    # properties all match the match rules.
    #
    # You can optionally start the session manager here,
    # but it is better to start it as a systemd service.
    # Run the session manager with -h for options.
    #
    #{ path = "/usr/bin/pipewire-media-session" args = ""
    #  condition = [ { exec.session-manager = null } { exec.session-manager = true } ] }
    #
    # You can optionally start the pulseaudio-server here as well
    # but it is better to start it as a systemd service.
    # It can be interesting to start another daemon here that listens
    # on another address with the -a option (eg. -a tcp:4713).
    #
    #{ path = "/usr/bin/pipewire" args = "-c pipewire-pulse.conf"
    #  condition = [ { exec.pipewire-pulse = null } { exec.pipewire-pulse = true } ] }
]

I restarted pipewire

> systemctl --user restart pipewire pipewire-pulse pipewire-media-session wireplumber
Failed to restart pipewire-pulse.service: Unit pipewire-pulse.service is masked.
Failed to restart pipewire-media-session.service: Unit pipewire-media-session.service not found.

4. Try setting alsa headroom

Here I didn’t change anything because the default value was already correct

# ALSA node property overrides for virtual machine hardware

monitor.alsa.rules = [
  # Generic PCI cards on any VM type
  {
    matches = [
      {
        node.name = "~alsa_input.pci.*"
        cpu.vm.name = "~.*"
      }
      {
        node.name = "~alsa_output.pci.*"
        cpu.vm.name = "~.*"
      }
    ]
    actions = {
      update-props = {
        api.alsa.period-size   = 1024
        api.alsa.headroom      = 2048
        session.suspend-timeout-seconds = 0
      }
    }
  }
]

So I looked for another solution and here’s what I found:

  • Buy an external song card (can you tell me if this will work please)
  • Use the application “Audio Relay” so that the speakers reproduce the song from my PC via my phone.

@JoseskVolpe, I’ve modified the file but nothing has changed.
Thank you again for all the help you’ve given me. I’d now like to make a backup of my PC on a hard disk and reinstall Opensuse Thumbulweed, so I won’t have any problems due to my ignorance and erroneous system modifications that I’ve certainly made.

Or maybe audio share, which is a good open source alternative.

I’ve got great news, I’ve finally figured out how to remove the crackling ! In fact I had a ground loop so all I had to do was remove the ground from the speakers and all the crackling was gone. Here’s what I did:

  • I took a power strip just for my speakers
  • I stripped about 3cm of the cable on this power strip (WARNING : the power strip MUST NOT BE CONNECTED).
  • then I cut a segment of about 3cm of the yellow and green cable (on some power strips the cable can be only yellow or green)
  • to finish, I wrapped some electrician’s tape around the stripped area

All that’s left is to connect your speakers (AND ONLY YOUR SPEAKERS) to this modified power strip. Congratulations, the crackling noise is gone!

You can also buy an external sound card and connect your speakers and PC to it, or even use an audio relay (e.g. Audio Share (Open Source) or AudioRelay (Proprietary)) to transfer sound from your PC to your phone, which will then be connected to your speakers.

In conclusion, here’s how to solve your crackling problems :

  1. Follow this guide [HowTo] Troubleshoot crackling in PipeWire, if it doesn’t work then move on to the next step.
  2. Connect your speakers to several devices other than your PC (note that the device must not be plugged into the mains), if this removes the crackling then move on to the next step, otherwise it’s probably a fault in the construction of your cable or speakers.
  3. You can now use one of the following three methods to remove the crackling :
    • Remove the ground from your speakers (see above)
    • Buy a sound card
    • Use an audio relay
1 Like

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