get sink information from pulseaudio in system mode

On my raspberry pi I want to use mpd to listen to music. That should also work without any user logged in. This is the only case you should (and have to) use pulseaudio in the so called system-mode. If you don’t want to do that, you could also configure your machine to auto-login a user, but I won’t describe that here. Servers normally operate without logged-in users. That’s why you call them servers: they passively offer their services.

In all other cases you don’t need the system mode. Read here.

The drawback of system mode is, that you cannot easily interact with pulseaudio, so getting information about audio sinks and served soundcards, which normally can be done using pacmd and pactl is not that easy. How we can do this anyway I’ll describe now briefly.

First stop your pulseaudio service, running in system-mode.

sudo /etc/init.d/pulseaudio stop or on debian/ubuntu systems sudo service pulseaudio stop

Then start the service as normal user with

pulseaudio -D

If your user is member of the groups pulse and pulse-access you are now able to use

pacmd list

which gives you a list of all available sinks, cards and modules. For more detailed description of pacmd see the manpage. You can now get the needed information, e.g. to insert lines like

set-default-sink sink
set-card-profile 0 profile

in the system-mode configuration of pulseaudio located at /etc/pulse/system.pa to force pulseaudio to use some sink with a specified card profile by default. Then test the changes just made by killing your session-mode service with

killall pulseaudio

(test it with ps -eF|grep pulse) and start pulseaudio in debug mode

sudo pulseaudio --system -vvvv

If pulseaudio then uses the sink you want it to, issue Ctr+C and restart pulseaudio. Voilá!

About

Peter Pan. Kann fliegen mit Feenstaub.

Tagged with: , , ,
Posted in Linux, Musik, Technik

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Posts by topic…
…by month
Have a look at…


%d bloggers like this: