Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In computer I have 2 sound devices.

When I run some program (let's say Skype) I can (using "pavucontrol" -> "PulseAudio Volume Control") setup so that this application will use given device for playback or recording.

But - in the Playback/Recording tabs application is visible only if it is currently doing something (playback or recording).

How can I set device per application, but before the application starts recording or playing sounds?

share|improve this question

3 Answers 3

up vote 5 down vote accepted

I don't know if there is a setting or configuration file for this anywhere but it can be done with environment variables. I've based my answer on this entry in the PulseAudio FAQ about setting the recording source. I've tried this with output (a sink in PulseAudio) but it should work for both input and ouput.

The first step is to get the internal name of the source and sink that you want to use. To do that you need to use the pactl list command. That command will return a pile of data, but the following will list just the source names:

LANG=C pactl list | grep -A2 'Source #' | grep 'Name: ' | cut -d" " -f2

That list will probably include the names for both regular sources and PulseAudio's monitor sources (which on my system have "monitor" in the name). You'll want to use the regular source name of the device you want to target.

You can do the same thing to get the sink names:

LANG=C pactl list | grep -A2 'Sink #' | grep 'Name: ' | cut -d" " -f2

Once you've got the names you can run something like the following from your terminal:

PULSE_SINK=<sink_name> PULSE_SOURCE=<source_name> <command_to_run_skype>

Of course, if you want to run this from a menu you'll probably need to create a shell script and use that instead of the default command. Something like this should work:

set PULSE_SINK <sink_name>
set PULSE_SOURCE <source_name>
share|improve this answer

You need to EXPORT and assign the variables, like this:

export PULSE_SINK="sink_name" 
export PULSE_SOURCE="source_name" 
share|improve this answer

I wrote a perl module that does this

It permits you to use a syntax like this,

use PulseAudio;
use constant TRACKIN  => 'pci-0000:00:1d.7-usb-0:2.3:1.0'

my $pa = PulseAudio->new;

my $sink   = $pa->get_sink_by([qw/properties device.bus_path/] => TRACKIN );
my $source = $pa->get_source_by(
  [qw/properties device.bus_path/] => TRACKIN
  , [qw/properties] => 'analog-stereo'
  sink      => $sink
  , source  => $source
  , prog    => '/usr/bin/audacity'

Of course, you can use any criteria in get_sink_by and get_source_by. It reads from pacmd info. This works on the same idea of @moberley's answer except it uses a perl library rather than forcing you do your own parsing. It also provides some other nifty features.

For my podcast show, I actually use this to launch Skype too..

  sink      => $sink
  , source  => $source
  , prog    => '/usr/bin/skype'
  , args    => ['--callto','btrlistener021']

(the btrlistener* Skype names are for blogtalkradio).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.