Prev: X.509 Client Certificates on Firefox for Android | Next: Why Doesn't My Device Sync to ownCloud? |
(Index) |
I bought a sound device and I want PulseAudio to use it but I can't find how to influence PulseAudio to use other than its system default device.
Specifically, it's a Pioneer SMM301 "Digital USB Speaker System", which has an audio chip embedded in one speaker, rather than just drawing power from USB and taking an analog audio signal from the host's own audio chip. However, the same issue would arise with any sound device including PCI.
This is a documentation problem. What is obvious to an experienced PulseAudio developer, is unfathomable to a normal user.
I went through Fedora's How to Debug PulseAudio Problems. I prepared as if submitting a bug report, even though I expected that the problem would not be found in the actual code. Here are some points from the report:
Do different apps cause the same problem? Yes, all apps that expect to play sound, fail.
Do other backends work? If you play direct to ALSA, it works.
What is seen on a different (non-default) sound device? Same behavior: ALSA works, PulseAudio does not play.
Is your ALSA configuration wacked? I hid ~/.asoundrc; no improvement.
Is your PulseAudio configuration wacked? I hid ~/.pulse; no improvement.
If I'm restarting pulseaudio (the daemon) with debug parameters, I don't want it to be started automatically. Also I wanted to begin debugging with pure system defaults. Therefore I moved ~/.pulse to another name, then re-created ~/.pulse and created ~/.pulse/client.conf containing (only) autospawn=no, which was effective.
Output of pulseaudio -vvvvv (2646 lines) had a lot of information, none of which suggested that PulseAudio rejected or failed to notice the new sound device.
All modules and packages that seem relevant are installed. Specifically, I have:
Time to bring out the heavy guns. I ran:
strace -f -o pulseaudio.str pulseaudio -v
But I failed to spot the key configuration file in 12180 lines
of stuff.
Searching on Google with keywords: pulseaudio connect client sink. I got
a hit:
PulseAudio Examples on the Arch Linux wiki, dated 2012-02-xx.
Execute pacmd from the pulseaudio-utils package:
pacmd list-sinks | less
In the output look for index: $N
(Mine is #1.) Then edit
/etc/pulse/default.pa or ~/.pulse/default.pa and insert/alter the
set-default-sink command. Apparently the sink number was once accepted,
but of course the numbering cannot be guaranteed repeatable, so now it
wants the sink's name. In my case:
set-default-sink alsa_output.usb-Burr-Brown_from_TI_USB_Audio_DAC-00-DAC.analog-stereo
Pulseaudio reads only one of /etc/pulse/default.pa or ~/.pulse/default.pa, not overriding system defaults from the user's file. In the recommended case that you put your default into ~/.pulse/default.pa, you should first copy /etc/pulse/default.pa to ~/.pulse/default.pa (or else handcraft a complete PulseAudio configuration).
You need to restart pulseaudio for this to take effect. And it works! (Very loudly.) Use pavucontrol to adjust the volume for your player app.
Alternatively for an ad-hoc change, execute pavucontrol (from package pavucontrol) from the command line, or in the desktop menu system look in the Multimedia category for PulseAudio Volume Control. Look on the Playback tab for the stanza for your player. In the first row is a widget with the name of the sink it is connected to. Click it: it's a listbox and you can re-route the client to a different sink (or source). You can also adjust the volume, specifically for that client.
It turns out that you don't have to edit ~/.pulse/default.pa after all.
In PulseAudio Volume Control's Output Devices tab, each one has an icon of
a checkmark with a tooltip saying Set as Fallback
. It's like a
radiobutton and the selected one's background is subtly darker than the othrs.
Select your preferred device, and it will be used if other devices are
unplugged or if an app is not specifically configured to use a specific
device.
The last piece of the puzzle will be to get the mixer applet to control PulseAudio's volume, as it would for ALSA output. This is the XFCE Audio Mixer (/usr/lib64/xfce4/panel/plugins/libmixer.so from package xfce4-panel-plugin-mixer). Presumably the Gnome or KDE mixers would be similar.
Right click on the panel icon and pick Properties.
The second row has a dropdown list labelled Sound Card. Pick the PulseAudio instance of your device (bypassing ALSA, and the capture devices). For me: Playback: Audio Codec Analog Stereo (PulseAudio Mixer).
If you've never used this device with the mixer it will suggest
that you Select Controls
. Take its suggestion. In my case
only the Master volume control is available; select it.
The default state of the control is with both channels yoked (icon of a chain with three links near the bottom) and unmuted (picture of a loudspeaker with curved lines representing sound). Change to these states if incorrect.
Now if you left click on the mixer icon and move the slider, it will influence the playback volume, and you will see the setting grips move on the properties display. You could quit from that now. If your mouse has a scroll wheel, scroll events also affect the volume.
There are now multiple ways to control the volume: the panel mixer icon, the panel mixer properties GUI (PulseAudio or ALSA device), PulseAudio Volume control's playback (application) stanza, its stanza for the output device, and the ncurses alsamixer program. A change made to any of these will be propagated to all the others.
Prev: X.509 Client Certificates on Firefox for Android | Next: Why Doesn't My Device Sync to ownCloud? |
(Index) |