Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
pipewire 2 channel to 8 (7.1 / 2 + 5.1) channel filter
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
DeIM
Guru
Guru


Joined: 11 Apr 2006
Posts: 442

PostPosted: Fri Jan 05, 2024 9:35 am    Post subject: pipewire 2 channel to 8 (7.1 / 2 + 5.1) channel filter Reply with quote

I was looking for something to distribute 2 channel audio source to 8 channel output (it's generic but my setup is something like headphones on FL FR and rest is connected to 5.1 loudspeaker)
I often got audio only from headphones. I manually connected channels in helvum but it was reset each time new audio played.
So I decided to solve it somehow and I found filter which makes opposite - 8 channels to 2 channels.
I made dirty custom changes which I would like to share, ask for review and tuning.

Code:
# 2 to 8 channels sink
#
# Copy this file into a conf.d/ directory such as
# ~/.config/pipewire/filter-chain.conf.d/
#
context.modules = [
    { name = libpipewire-module-filter-chain
        flags = [ nofail ]
        args = {
            node.description = "Virtual Surround Sink DeIM"
            media.name       = "Virtual Surround Sink DeIM"
            filter.graph = {
                nodes = [
                    # duplicate inputs
                    { type = builtin label = copy name = copyFL  }
                    { type = builtin label = copy name = copyFR  }
                    { type = builtin label = copy name = copyFC  }
                    { type = builtin label = copy name = copyRL  }
                    { type = builtin label = copy name = copyRR  }
                    { type = builtin label = copy name = copySL  }
                    { type = builtin label = copy name = copySR  }
                    { type = builtin label = copy name = copyLFE }

                    # stereo output
                    { type = builtin label = mixer name = mixFL }
                    { type = builtin label = mixer name = mixFR }
                    { type = builtin label = mixer name = mixFC }
                    { type = builtin label = mixer name = mixLFE }
                    { type = builtin label = mixer name = mixRL }
                    { type = builtin label = mixer name = mixRR }
                    { type = builtin label = mixer name = mixSL }
                    { type = builtin label = mixer name = mixSR }
                ]
                links = [                   
                   { output = "copyFL:Out" input = "mixFL:In 1" }
                   { output = "copyFR:Out" input = "mixFR:In 2" }
                   { output = "copyFL:Out" input = "mixFC:In 3" }
                   { output = "copyFR:Out" input = "mixLFE:In 4" }
                   { output = "copyFL:Out" input = "mixRL:In 5" }
                   { output = "copyFR:Out" input = "mixRR:In 6" }
                   { output = "copyFL:Out" input = "mixSL:In 7" }
                   { output = "copyFR:Out" input = "mixSR:In 8" }
                ]
                inputs  = [ "copyFL:In" "copyFR:In" "copyFC:In" "copyLFE:In" "copyRL:In" "copyRR:In" "copySL:In" "copySR:In" ]
                outputs = [ "mixFL:Out" "mixFR:Out"  "mixFC:Out" "mixLFE:Out" "mixRL:Out" "mixRR:Out" "mixSL:Out" "mixSR:Out" ]
            }
            capture.props = {
                node.name      = "effect_input.virtual-surround-7.1-deim"
                media.class    = Audio/Sink
                audio.channels = 8
                audio.position = [ FL FR FC LFE RL RR SL SR ]
            }
            playback.props = {
                node.name      = "effect_output.virtual-surround-7.1-deim"
                node.passive   = false
                audio.channels = 8
                audio.position = [ FL FR FC LFE RL RR SL SR ]
            }
        }
    }
]
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum