I have a dual monitor setup with each monitor capable of playing audio, connected to a single RX5700XT GPU.
Right now I can select either one from the Sound settings to be the Output device.
What I'm trying to do is to combine the two into one Output device so I can play audio with the two monitors simultaneously. What's the easiest way to achieve this?
Thank you.
First of all, backup your PulseAudio configuration
$sudo cp /etc/pulse/default.pa /etc/pulse/default.pa.bak
Once it's done, we'll check our list of hardware playback devices and take note of the ones we are looking for using
$ aplay -l
. Your output should look like this:Take note of the Card ID AND the Device ID of the outputs you want to sink together. Now we'll try and make a new sink for each one of those outputs using the alsa-sink module (you should really follow this link). Open any text editor and copy/paste:
Change the
[CARD_ID]
and the[DEVICE_ID]
with the ones you took note in the last step. You should have as many lines of this code as outputs that you want to combine, with their respectiveCARD_ID
andDEVICE_ID
.Once this step is done, we'll use the combine-sink module (you should follow this one too) so we can "glue" our outputs together. Copy and paste this in your editor:
In the end you should have something like this:
Once you have your configuration done, we'll have to load it into the PulseAudio configuration (we've made a backup of it as the first thing). Open it for editing using
gedit admin:///etc/pulse/default.pa
and search for this section:You section my have a couple more commented lines if you never edited this file before. Right after the last line of that section, paste your lines. Bellow you'll find my mock ones in way that your file should look like after pasting:
Now that we've done that, for it to work consistently we'll have to deactivate the PulseAudio udev-detect module (that's the last one, I promise) so it doesn't override the changes we did manually while trying to configure the system. You'll find a section like this one, make sure to comment all of its lines:
Now, to finish our editing, just set your new sink as the default one in the very last line of your file:
set-default-sink combined_vsink0
Save the file and then let's restart PulseAudio and check if everything is working using
pulseaudio --kill && pulseaudio --start
and then make sure to check if your levels are set right atalsamixer
as it sometimes load new outputs muted by default. Once you're done, check your system settings to select the newly created output.If you face any problems, you can always revert your PulseAudio configuration using the backup file I'm sure you created as your first step.
Simplifying the brilliant accepted answer, copy-paste the following function:
Then, as above, (1) backup the config, (2) find the respective sinks you want to combine, (3) generate config (it's automatically copied to the clipboard using
xclip
) and (4) edit as above:This can be achieved by creating a new sink merging the two other sinks (your sound cards) Using the pulse-audio CLI.
first get the name of the sinks:
then create a new sink
Where sink1-name & sink2-name is the names of your sinks in the output from the first command
you should now have a new sink you can select for outputting sound to both devices