Skip to content

Instantly share code, notes, and snippets.

@f0x48
Last active January 30, 2025 17:41
Show Gist options
  • Save f0x48/99b2779437aaa0c9e250070916f66f76 to your computer and use it in GitHub Desktop.
Save f0x48/99b2779437aaa0c9e250070916f66f76 to your computer and use it in GitHub Desktop.
Swap Stereo Channels with WirePlumber on Manjaro/Arch Linux

Swap Stereo Channels with WirePlumber on Manjaro/Arch Linux

This tutorial uses WirePlumber's new JSON configuration format, replacing the legacy Lua format. Ensure you're using WirePlumber ≥ 0.5.

1. Install WirePlumber

sudo pacman -S wireplumber

2. Create Configuration Directory

mkdir -p ~/.config/wireplumber/wireplumber.conf.d

3. Identify Audio Device

Get Sink ID

wpctl status

Look for your device under "Sinks":

├─ Sinks:
│  *   57. USB Audio  [vol: 0.50]

Get Node Name

wpctl inspect 57  # Replace with your sink ID

Copy the node.name value from output:

node.name = "alsa_output.pci-0000_00_1f.3.analog-stereo"

4. Create Swap Configuration

Create new config file:

nano ~/.config/wireplumber/wireplumber.conf.d/99-swap-channels.conf

Add this content (replace with your node.name):

monitor.alsa.rules = [
  {
    matches = [
      {
        node.name = "alsa_output.pci-0000_00_1f.3.analog-stereo"
      }
    ]
    actions = {
      update-props = {
        audio.position = ["FR", "FL"]
      }
    }
  }
]

5. Apply Changes

systemctl --user restart wireplumber

6. Verify Channel Swap

Test with speaker channels:

speaker-test -c 2 -t wav

You should hear:

  • Right channel audio in left speaker
  • Left channel audio in right speaker

Troubleshooting

  • Verify node.name matches exactly from wpctl inspect
  • Check config file location: ~/.config/wireplumber/wireplumber.conf.d/
  • View logs: journalctl --user -u wireplumber -f

Revert Changes

  1. Remove config file:
    rm ~/.config/wireplumber/wireplumber.conf.d/99-swap-channels.conf
  2. Restart WirePlumber:
    systemctl --user restart wireplumber
    

Note: Configuration persists across reboots

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment