Sample Header Ad - 728x90

Creating ALSA nodes with WirePlumber

1 vote
0 answers
442 views
I'm trying to work out pipewire/wireplumber configuration. I have one unresolved question open already: https://unix.stackexchange.com/questions/784526/pipewire-fails-to-create-nodes-for-all-alsa-devices I have as a workaround to that worked out how I can create Sinks for all my ALSA devices by configuring pipewire. In pipewire.conf I can simply add to context.objects:
{ factory = adapter
        args = {
            factory.name           = api.alsa.pcm.sink
            node.name              = "Yamaha"
            node.description       = "Yamaha RX-A760 AV Receiver"
            media.class            = "Audio/Sink"
            api.alsa.path          = "hdmi:0"
            alsa.card              = "0"
            alsa.device            = "3"
            audio.channels         = 6
        }
    }
    { factory = adapter
        args = {
            factory.name           = api.alsa.pcm.sink
            node.name              = "Sony TV"
            node.description       = "Soni Bravia Television"
            media.class            = "Audio/Sink"
            api.alsa.path          = "hdmi:0"
            alsa.card              = "0"
            alsa.device            = "7"
            audio.channels         = 2
        }
    }
    { factory = adapter
        args = {
            factory.name           = api.alsa.pcm.sink
            node.name              = "FM 90"
            node.description       = "High Power FM Transmitter on Line Out"
            media.class            = "Audio/Sink"
            api.alsa.path          = "hw:0"
            alsa.card              = "0"
            alsa.device            = "0"
            audio.channels         = 2
        }
    }
    { factory = adapter
        args = {
            factory.name           = api.alsa.pcm.sink
            node.name              = "FM 107.9"
            node.description       = "Low Power FM Transmitter on USB"
            media.class            = "Audio/Sink"
            api.alsa.path          = "hw:1"
            alsa.card              = "1"
            alsa.device            = "0"
            audio.channels         = 2
        }
    }
And voilà I have audio sinks. I can even play music on them. I'm fairly content. But for one thing. This a pipewire configuration and it's a tad sensitive to USB device I have configured. I noticed that if it's not plugged in pipewire doesn't start, it fails with an error. It strikes me that wireplumber is the intended place to do such configuration and is more responsive to USB devices being or not being available. I understand it is configured with Lua scripting but I have failed to find a basic example of how to create an ALSA Audio sink with wireplumber. I'm wondering what does the above configuration look like as a Wireplumber Lua script?
Asked by Bernd Wechner (161 rep)
Oct 13, 2024, 12:51 AM