Pipewire Combined Sink

Pipewire comes with a native module to send audio output to all connected audio devices. This is done by creating a combined output sink using module-combine-stream in Pipewire config. This is ideal if you have multiple Bluetooth headsets or speakers and want to output same audio to all of them at the same time.

The following instructions are tested on Debian 12 (Bookwork) using Gnome. They should work on other Debian based distros i.e. Ubuntu, Mint

The basic steps are as follows:

  • Open /usr/share/pipewire/pipewire.conf
  • Find context.modules section and add a module block for libpipewire-module-combine-stream
  • Restart Pipewire
# Open pipewire.conf
sudo nano /usr/share/pipewire/pipewire.conf

# Add module-combine-stream to context.modules block. 
context.modules = [
{   name = libpipewire-module-combine-stream
    args = {
        combine.mode = sink
        node.name = "my_combined_sink"
        node.description = "My Combined Sink"
        combine.props = {
            audio.position = [ FL FR ]
        }
        stream.rules = [
            {
                matches = [
                    {
                        media.class = "Audio/Sink"
                    }
                ]
                actions = {
                    create-stream = {
                    }
                }
            }
        ]
    }
}
]

# Restart Pipewire
systemctl --user restart pipewire pipewire-pulse

Once restarted, “All Connected Outputs” will appear in Top Panel and Sound Settings

Keyword based inline Search and Replace with sed

sed is a nifty utility that allows you to search and replace text in a file using a short 1-liner.

The following command does the following:
1. Searches for the keyword in every line of the input_file
2. In every matching line it looks for search_string
3. It replaces every instance of search_string with replace_string

sed '/keyword/s/search_string/replace_string/g' input_file

Neat!

Reference:
https://unix.stackexchange.com/a/155340

How to search and replace with nano text editor

Nano is a very compact and feature packed text editor commonly found on Linux and Unix based OS. One of the lesser used feature that is very useful is search & replace.

To Search and Replace text in the currently open file:

Press Ctrl + \
Enter your search string [return]
Enter your replacement string [return]
Press A to replace all instances

The search string can also be a regular expression.