2

I run Debian 9 with PulseAudio on a computer with two sound cards. The screenshot below shows the Volume Control application when no audio is played back. When audio is played back, a drop down is displayed where I can select the output device. Is there a way to select the output device before the audio stream is started? To me this seems more natural.

PulseAudio Volume Control

Edit: Here is my typical use case. I want to play a song from my computer on the living room stereo (sound card B) instead of through the desktop speakers (sound card A). Since I cannot select the output in advance I have to start the song and have it played back on the desktop speakers, then select the living room speakers once the option shows up in the playback tab in the Volume Control window. Then I need to play the song from the beginning now that I have selected the desired output. This is bad UX.

August Karlstrom
  • 1,736
  • 2
  • 27
  • 39
  • 1
    The `output devices` tab should have a checkbox for marking the default and fallback devices to use. If not, you might need to install `pavucontrol`. – Mio Rin Nov 25 '18 at 10:46
  • @Mioriin `pavucontrol` is the application you see in the screenshot. The problem is not that I can't select a playback device. What I would like to do is to select the playback device before an audio stream is started. – August Karlstrom Nov 25 '18 at 10:56
  • 1
    Pulseaudio cannot direct a non-existing audio stream anywhere. If you want to preselect a non-default device, you may have to do it by telling the playback program which device to use when you start the stream or by specifying the output in the program's configuration. – Mio Rin Nov 25 '18 at 11:52
  • In principle, all applications using the Pulseaudio API can choose a specific sink, e.g. `paplay -d sink_name ...`. You didn't tell us anything about the application you want to do this for, so I can't tell you how this specific application handles it. The "Volume Control" application by itself can't do it. As you've already been told, if you've redirected sound once for a specific application, Pulseaudio will remember it, and apply the same setting the next time the application starts. – dirkt Nov 26 '18 at 08:15

2 Answers2

3

By default, PulseAudio will attempt to remember where each application's output was directed the last time it was used, and keep using that output device for it until told otherwise. If there is no record of previous use, the fallback device is used.

You could disable this feature and make all applications always start using the fallback device unless specifically configured otherwise by editing /etc/pulse/default.pa to change the line:

load-module module-stream-restore

to this:

load-module module-stream-restore restore_device=false

Alternatively, there's a paswitch tool that walks through PulseAudio's persistent record of outputs per application and changes them all to point to a specified device: https://www.tablix.org/~avian/git/paswitch.git (more info here)

telcoM
  • 87,318
  • 3
  • 112
  • 232
  • Thanks for the instructions. This suggests that, after editing default.pa, the solution to my problem is to switch fallback (default) device in the Output Devices section. However, all output devices are set as fallback and I cannot deselect any of them (when I click on the button with a checkmark it remains pressed). – August Karlstrom Nov 25 '18 at 19:06
  • That's odd. Only one input device and only one output device should act as a fallback in any given time. If you select a new device as a fallback it should automatically unselect the old one. – telcoM Nov 26 '18 at 08:27
0

Pulseaudio playback will try to use default sink device first
if default is not available will then use fallback devices

With only 2 devices, set one as default and 2nd device will automatically be fallback if default not available

pavucontrol does not show default sink setting

you can use these terminal commands:
pactl get-default-sink - to show default sink name
andpactl list sinks | grep 'Name' - to show names of all active sinks
Then usepactl set-default-sink <Name> - to change default sink
(can also change the default-sink file in 1st command with text editor)

Or use pasystray to view information in gui and change default if needed

Once default is set, audio streams can be set by user in pavucontrol to use other sink
User changes in pavucontrol are saved to database file in folder ~/.config/pulse/

nik gnomic
  • 753
  • 4
  • 9