Making virtual alsa devices (pipewire & wireplumber)

Actually this is how i solved the alsa part for future reference:

echo "options snd-aloop index=0 id=MyLoop pcm_substreams=4" | sudo tee /etc/modprobe.d/snd-aloop.conf

(this would make a new device at index 0, that will likely fail for most people since index 0 is usually the physical speaker or monitor; with id MyLoop, that is like node.name; and makes 4 ports)

and later i used:

nano /etc/modprobe.d/snd-aloop.conf

and changed the contents to:

options snd-aloop enable=1,1 id=AVdevice,AVmic pcm_substreams=2,2

(this enables 2 devices, with ids AVdevice and AVmic, and 2 ports)

Then i did:

echo "snd_aloop" | sudo tee /etc/modules-load.d/snd_aloop.conf

To enable the loop device on startup.

This gives me what i asked for.
Now to clean up my connections i use the config file (opened with nano as example):

nano ~/.config/wireplumber/wireplumber.conf.d/10-rename-devices.conf

and fill the contents with:

monitor.alsa.rules = [
  {
    matches = [
      {
        node.name = "alsa_output.platform-snd_aloop.0.analog-stereo"
      }
    ]
    actions = {
      update-props = {
        node.description = "AV Device (Playback)"
        node.autoconnect = false
        node.virtual = false
        node.passive = true
        priority.session = 200
        priority.driver  = 200
      }
    }
  }
  {
    matches = [
      {
        node.name = "alsa_input.platform-snd_aloop.0.analog-stereo"
      }
    ]
    actions = {
      update-props = {
        node.description = "AV Device (Capture)"
        node.autoconnect = false
        node.virtual = true
        node.passive = true
        priority.session = 200
        priority.driver  = 200
      }
    }
  }
  {
    matches = [
      {
        node.name = "alsa_output.platform-snd_aloop.1.analog-stereo"
      }
    ]
    actions = {
      update-props = {
        node.description = "AV Mic (Playin)"
        node.autoconnect = false
        node.virtual = true
        node.passive = true
        priority.session = 100
        priority.driver  = 100
      }
    }
  }
  {
    matches = [
      {
        node.name = "alsa_input.platform-snd_aloop.1.analog-stereo"
      }
    ]
    actions = {
      update-props = {
        node.description = "AV Mic (Microphone)"
        node.autoconnect = false
        node.virtual = false
        node.passive = true
        priority.session = 100
        priority.driver  = 100
      }
    }
  }
]

This will give me what i was looking for.
Sadly kdenlike is still not quite working, but that is just a kdenlive bug.
In theory this setup is correct (future reference).

1 Like