Saturday, January 14, 2012

Streaming different audio streams to different audio devices in Ubuntu 11.10

Started with my sis talking to me over Skype. And I wanted to listen to some Westlife songs on youtube. But the issue was that her voice was routed to the speakers and when I played the song (i had the song buffered), it too started playing on the speaker. So, naturally, I was being swore at for this. Especially since she got to listen to the song through my mic streaming to her at less than 300 kbps. I can understand how it must be sounding to her. So my problem definition: I wanted to get the westlife song to my USB headset and my sis call on the speaker. This way, she does not get to listen to the staccato variant of the song and I get both the call and the song.

Bit of googling and forum reading led me to Pulse Audio Volume control application for linux. The package is named "pavucontrol". Command to install it in ubuntu:

$ sudo apt-get install pavucontrol 

Run the application. It provides an interface for you for audio input, audio output and a tab where you can set the type of audio interface for each device. eg. a normal sound card would be Analog stereo duplex. Other options are Analog stereo output, input, digital stereo etc...
The feature which I was looking for was in the first tab. This tab gives you an interface for each application that is using an audio stream. In my case, it was showing me two entries:

1. Skype

2. Alsa plugin for chrome (since I was listening to youtube through chrome. Chrome uses the alsa plugin to access the sound hardware.)

For each of these applications, it provides a slider volume control and also provides a drop down for selection of audio device to be used (most required). So I simply selected the USB headset for alsa plugin and internal sound card for the skype app. There..done! Everyone's at peace... 

What I understood..ALSA(Advanced Linux Sound Architecture) works at a lower level and is closer to the hardware, while, Pulse Audio is a sound server at a higher level that provides you a host of features for the available streams like manipulatiing the stream, streaming it to another pulse audio server over the network, routing to different audio hardware etc..

No comments: