How to play sound simultaneously on multiple screens

snapshot30

Let's suppose that your computer is connected to two monitors, in mirror mode. Let's suppose that one of those monitors is the main television in the living room, where you usually play the console or watch movies. Suppose you know the program Kodi (above XBMC), which is a mediacenter, or SMPlayer, and that you use PulseAudio, but when playing a file there is no way to hear the sound on the secondary monitor without doing pirouettes or modify the configuration at each boot. If that is your case, this tutorial may interest you, since it is specially designed for systems with a mediacenter in mind.

Previous steps

First things first, so we'll have to install the package paprefs. It is a frontend programmed in GTK to configure certain PulseAudio preferences.

En Archlinux and derivatives:
sudo pacman -S paprefs

En Ubuntu and the like
sudo apt-get install paprefs

Thanks to this simple software, we will be able to enable a «virtual device», called Simultaneous Output, which is nothing more than a simultaneous output for all the audio devices connected to our equipment. To do this, we execute the command in a terminal paprefs, to dry, and we go to the last tab, where we will have to activate the only available box, as seen in the screenshot.

snapshot26

Beware of the number of options; misunderstandings are the order of the day.

Choose the right outlet

After closing the paprefs configuration dialog, we should check our playback devices and see if the simultaneous option appears already. The way to manage the audio changes depending on the desktop environment we use, but most current environments allow us to change the device on the fly from the volume icon on the panel. Otherwise, we would have to go to the system preferences and dive between the corresponding options.

snapshot27

If the simultaneous exit is not here, first look under the chair.

Once the new device is selected, our computer will broadcast the audio through all the enabled channels. You will use the speakers, HDMI connectors, the flux capacitor, etc. If we have Bluetooth headphones linked to the computer (or connected by cable), it is possible that the default audio is also emitted by them, depending largely on the type of configuration we have. I mean that if we have set them so that the sound is silenced in the rest of the outputs when the headphones are active, that is what will happen, for example.

What if I want to mute some devices or change the volume independently?

Everything is possible in the Linux world, you just have to dig a little more and continue to refine the result. In this case it is best to install another small program that will allow us to calibrate the sound preferences in detail: Pavucontrol. Personally, I find it much more powerful and reliable than the standard configurators.

En Archlinux and related distros:
sudo pacman -S pavucontrol

En Ubuntu and family
sudo apt-get install pavucontrol

This program is highly recommended, since sometimes it allows us to solve problems with no apparent solution when managing the different devices in our system. Without going any further, when I use my Bluetooth headphones, sometimes the hi-fi profile, A2DP, does not catch me well, but Pavucontrol lets me solve this very serious problem and continue enjoying music without it looking like the cassette tapes have invaded my computer and devoured my albums.

In the Settings tab we can enable or turn off the devices as appropriate, as well as modify their profile, the number of channels (2.1, 5.1, etc.). Optionally, in the Output devices tab we can modify the volume level separately, choosing the level of annoyance that we want to cause our neighbors.

snapshot28

And if despite all our diligent attempts we have still not managed to get KODI, SMPlayer or Amarok to get the audio where we want, it would be enough to open Pavucontrol in parallel and select the desired output in the Playback tab. In this same section, we can get the audio from each application through a different device (for example Firefox through headphones, Amarok through HDMI and KODI through simultaneous output).

snapshot29

That is all for now. I hope you have found it useful.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Juan Manuel said

    Thanks a lot! Just yesterday I was dealing with this problem without success in Arch. I managed to get sound out of hdmi using SMPlayer, but I did not achieve the same in Kodi which is what I need. I will try this guide.

    1.    Wolf said

      In the Kodi Audio preferences you can also change the output device, in case it does not automatically catch the simultaneous output. Hopefully it helps you; you will tell us.

      1.    Juan Manuel said

        Fixed, you can add the virtual device and it works perfectly. I had already tried with the Kodi audio settings but no sound came out of HDMI. Thanks a lot

  2.   Rafael said

    Hello

    First of all, this is constructive criticism.

    I started reading the article because a couple of years ago I discovered the option of pulseaudio to create virtual devices and simultaneously output for them. But honestly, anyone who starts reading your article (and I already knew what the topic was about) is lost. You start by talking about "assumptions" but do not give details about what hardware is what we have (two monitors or televisions, one with HDMI input and the other with VGA, to put something and a computer with an HDMI output and another analog ...). That is, the scenario from which you start is totally ambiguous, you do not specify what we are starting from and what we want to solve. In the end, everything has to "assume". Sorry, but you are very lacking in details.

    In my case, I have a computer with an analog output built into the board, and an HDMI output, built into an Nvidia graphics card. The objective was to have the same audio signal through the two outputs (the analog for a background music and the HDMI for a television). The solution was, effectively, to activate the option to create a virtual audio device with Pulseadio and select the output to it in all the applications whose sound you want to listen to simultaneously in the mentioned audio outputs.

    Thanks anyway for commenting

    All the best

    1.    Wolf said

      Constructive criticism is accepted, although precisely the objective of this virtual device serves for any configuration, hence I did not think it necessary to specify, except perhaps to give an example. I make explicit reference to both screens, which is my personal setup, but I know it works on others. The assumptions used at the beginning are a writing device to tell a story, not a guessing exercise.

      Given that the title warns of the intention of the tutorial, which is to get sound through several screens at the same time, and because of the specificity of the subject, I would like to think that it is not so easy to get confused.

      However, I take note and will try to improve.

  3.   Michael O. said

    Thank you very much, I was looking for a way to do this and could not find a solution, in my case on a Linux Mint (Cinnamon).
    You don't stop learning things in Linux.

  4.   Niko said

    Yesterday I followed your article and managed to find the solution almost at the moment... it happens to me that I restart the computer today and have the same configuration active as yesterday and have no audio output. In my case, the problem arose when connecting a monitor via the hdmi cable and this caused the audio output to be redirected to the monitor, causing this to connect the speakers to the monitor and when it turned off it had no audio. Yesterday the problem seemed to have been solved by enabling all the audio outputs for that virtual device, but this configuration doesn't seem to be enough... do you have any idea what the problem could be? I use ubuntu although it seems to be indifferent... and thank you, your information is very useful.