.TH "libpipewire-module-combine-stream" 7 "1.2.7" "PipeWire" \" -*- nroff -*-
.ad l
.nh
.SH NAME
libpipewire-module-combine-stream \- Combine Stream 
.SH DESCRIPTION
.PP
The combine stream can make:
.PP
.IP "\(bu" 2
a new virtual sink that forwards audio to other sinks
.IP "\(bu" 2
a new virtual source that combines audio from other sources
.PP
.PP
The sources and sink that need to be combined can be selected using generic match rules\&. This makes it possible to combine static nodes or nodes based on certain properties\&.
.PP
.SH "MODULE NAME"
.PP
.PP
\fClibpipewire-module-combine-stream\fP
.PP
.SH "MODULE OPTIONS"
.PP
.PP
.IP "\(bu" 2
\fCnode\&.name\fP: a unique name for the stream
.IP "\(bu" 2
\fCnode\&.description\fP: a human readable name for the stream
.IP "\(bu" 2
\fCcombine\&.mode\fP = capture | playback | sink | source, default sink
.IP "\(bu" 2
\fCcombine\&.latency-compensate\fP: use delay buffers to match stream latencies
.IP "\(bu" 2
\fCcombine\&.on-demand-streams\fP: use metadata to create streams on demand
.IP "\(bu" 2
\fCcombine\&.props = {}\fP: properties to be passed to the sink/source
.IP "\(bu" 2
\fCstream\&.props = {}\fP: properties to be passed to the streams
.IP "\(bu" 2
\fCstream\&.rules = {}\fP: rules for matching streams, use create-stream actions
.PP
.PP
.SH "GENERAL OPTIONS"
.PP
.PP
Options with well-known behavior\&.
.PP
.IP "\(bu" 2
\fBremote.name\fP
.IP "\(bu" 2
\fBaudio.channels\fP
.IP "\(bu" 2
\fBaudio.position\fP
.IP "\(bu" 2
\fBmedia.name\fP
.IP "\(bu" 2
\fBnode.latency\fP
.IP "\(bu" 2
\fBnode.name\fP
.IP "\(bu" 2
\fBnode.description\fP
.IP "\(bu" 2
\fBnode.group\fP
.IP "\(bu" 2
\fBnode.virtual\fP
.IP "\(bu" 2
\fBmedia.class\fP
.PP
.PP
.SH "STREAM OPTIONS"
.PP
.PP
.IP "\(bu" 2
\fCaudio\&.position\fP: Set the stream channel map\&. By default this is the same channel map as the combine stream\&.
.IP "\(bu" 2
\fCcombine\&.audio\&.position\fP: map the combine audio positions to the stream positions\&. combine input channels are mapped one-by-one to stream output channels\&.
.PP
.PP
.SH "EXAMPLE CONFIGURATION"
.PP
.PP
.PP
.nf
# ~/\&.config/pipewire/pipewire\&.conf\&.d/my\-combine\-stream\-1\&.conf

context\&.modules = [
{   name = libpipewire\-module\-combine\-stream
    args = {
        combine\&.mode = sink
        node\&.name = "combine_sink"
        node\&.description = "My Combine Sink"
        combine\&.latency\-compensate = false
        combine\&.props = {
            audio\&.position = [ FL FR ]
        }
        stream\&.props = {
        }
        stream\&.rules = [
            {
                matches = [
                    # any of the items in matches needs to match, if one does,
                    # actions are emitted\&.
                    {
                        # all keys must match the value\&. ! negates\&. ~ starts regex\&.
                        #node\&.name = "~alsa_input\&.*"
                        media\&.class = "Audio/Sink"
                    }
                ]
                actions = {
                    create\-stream = {
                        #combine\&.audio\&.position = [ FL FR ]
                        #audio\&.position = [ FL FR ]
                    }
                }
            }
        ]
    }
}
]
.fi
.PP
.PP
Below is an example configuration that makes a 5\&.1 virtual audio sink from 3 separate stereo sinks\&.
.PP
.PP
.nf
# ~/\&.config/pipewire/pipewire\&.conf\&.d/my\-combine\-stream\-2\&.conf

context\&.modules = [
{   name = libpipewire\-module\-combine\-stream
    args = {
        combine\&.mode = sink
        node\&.name = "combine_sink_5_1"
        node\&.description = "My 5\&.1 Combine Sink"
        combine\&.latency\-compensate = false
        combine\&.props = {
            audio\&.position = [ FL FR FC LFE SL SR ]
        }
        stream\&.props = {
                stream\&.dont\-remix = true      # link matching channels without remixing
        }
        stream\&.rules = [
            {   matches = [
                    {   media\&.class = "Audio/Sink"
                        node\&.name = "alsa_output\&.usb\-Topping_E30\-00\&.analog\-stereo"
                    } ]
                actions = { create\-stream = {
                        combine\&.audio\&.position = [ FL FR ]
                        audio\&.position = [ FL FR ]
                } } }
            {   matches = [
                    {   media\&.class = "Audio/Sink"
                        node\&.name = "alsa_output\&.usb\-BEHRINGER_UMC404HD_192k\-00\&.pro\-output\-0"
                    } ]
                actions = { create\-stream = {
                        combine\&.audio\&.position = [ FC LFE ]
                        audio\&.position = [ AUX0 AUX1 ]
                } } }
            {   matches = [
                    {   media\&.class = "Audio/Sink"
                        node\&.name = "alsa_output\&.pci\-0000_00_1b\&.0\&.analog\-stereo"
                    } ]
                actions = { create\-stream = {
                        combine\&.audio\&.position = [ SL SR ]
                        audio\&.position = [ FL FR ]
                } } }
        ]
    }
}
]
.fi
.PP
.PP
Below is an example configuration that makes a 4\&.0 virtual audio source from 2 separate stereo sources\&.
.PP
.PP
.nf
# ~/\&.config/pipewire/pipewire\&.conf\&.d/my\-combine\-stream\-3\&.conf

context\&.modules = [
{   name = libpipewire\-module\-combine\-stream
    args = {
        combine\&.mode = source
        node\&.name = "combine_source_4_0"
        node\&.description = "My 4\&.0 Combine Source"
        combine\&.props = {
            audio\&.position = [ FL FR SL SR ]
        }
        stream\&.props = {
                stream\&.dont\-remix = true
        }
        stream\&.rules = [
            {   matches = [
                    {   media\&.class = "Audio/Source"
                        node\&.name = "alsa_input\&.usb\-046d_HD_Pro_Webcam_C920_09D53E1F\-02\&.analog\-stereo"
                    } ]
                actions = { create\-stream = {
                        audio\&.position = [ FL FR ]
                        combine\&.audio\&.position = [ FL FR ]
                } } }
            {   matches = [
                    {   media\&.class = "Audio/Source"
                        node\&.name = "alsa_input\&.usb\-046d_0821_9534DE90\-00\&.analog\-stereo"
                    } ]
                actions = { create\-stream = {
                        audio\&.position = [ FL FR ]
                        combine\&.audio\&.position = [ SL SR ]
                } } }
        ]
    }
}
]
.fi
.PP
 

