Play sound from different applications on different output devices (speakers, headphones)

I want music (played e.g. via Audacious) to be played on speaker system, and all other sounds produced by other applications (including ubuntu sound effects) to be played on headphones.

  1. My computer has sound connectors at its back, and also connectors on its front panel. When I connect both headphones and speakers, only headphones work (I take it, the front connectors take precedence?). Should I purchase another sound card (in addition to the motherboard-integrated sound I have)?

  2. When I go to Audacious output settings, I see only the ouput plugin selection list, with PulseAudio selected and options like ALSA, OSS4 etc. But there's no facility to select particular output device (and I guess it wouldn't magically appear even if I had the second soundcard). Is this at all possible to bind specific application to particular output device?


Solution 1:

Two ways to do this: one is less specific to an application, and more to a task, and almost certainly will work, the other has worked on and off, but is more application specific.

Method 1 (the surefire one)

Note this is reliant on parts of KDE and may be desktop-specific. Open up Phonon audio settings and flip through the categories. Music can be assigned a different sound card than communications like Skype through a list which orders them from most preferred to least for each category. This may work on GNOME like desktops such as Unity, Xfce, LXDE, and other Gtk+ environments, but I have no proof.

Method 2 (partially covered in comments)

If you are using KDE, again, you're all set. If you are using a Gtk or other desktop you may need to install something. In KDE, just open up Kmix and right-click on the application slider shown in that'll window. You should see an option to switch sound cards. With another desktop, install pavucontrol (shown as Pulse Audio Volume Control in the menu) flip to the applications tab, and either there's a button listing the sound card, or you right click on the app. Not 100% sure which, but the functionality is there (I think)

Being a Zoom H4n, Intel Audio, and M-Audio user, I know it can be done.