Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
mpd and pulseaudio
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
paulj
Guru
Guru


Joined: 30 Sep 2004
Posts: 511
Location: Wales, UK

PostPosted: Sun Dec 17, 2017 6:39 pm    Post subject: mpd and pulseaudio Reply with quote

I have a recently installed and now fully up to date to the latest profile Thinkpad X270. I have been a user of amarok for many years (despite frustrations with cover search and so on), but with the recent masking of the current release, and also not much visible development of the Qt5 version, I have decided to go with Cantata and MPD. I have been an MPD user on my desktop system at home and my old laptop, and I like it.

Anyway, I had issues with getting mpd to play through pulseaudio, so having solved it I am documenting it here in case others come across the same problem.

  • Modify the mpd configuration file: /etc/mpd.conf - uncomment and modify the audio output section for pulseaudio:
    Code:
    audio_output {
            type            "pulse"
            name            "Pulseaudio Output"
            mixer_control   "Master"
            server          "127.0.0.1"
    }

  • Modify the pulseaudio configuration file at /etc/pulse/default.pa. Find the line relating to module-native-protocol-tcp and modify it:
    Code:
    ### Network access (may be configured with paprefs, so leave this commented
    ### here if you plan to use paprefs)
    #load-module module-esound-protocol-tcp
    load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1

    Note - I don't use paprefs
  • Restart mpd as root (I'm using open-rc - you'll need to find the equivalent systemd command if that's how your system is configured):
    Code:
    /etc/init.d/mpd restart

  • As user, restart pulseaudio:
    Code:
    pulseaudio -k


Now your mpd audio stream should be running through the pulseaudio setup (meaning in my case through my bluetooth speaker or headphones!). I hope that this information is useful for you!
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Sun Dec 17, 2017 7:30 pm    Post subject: Reply with quote

I guess you're running pulseaudio as your normal user? If you're paranoid you may want to put "allow-module-loading = no" in daemon.conf, to prevent programs being able to create arbitrary files under your username.

I went the other route and set it up to use system-mode (the thing they try to scare you away from using) - it's a bit hard to get it working but it's fine when it does.
Back to top
View user's profile Send private message
paulj
Guru
Guru


Joined: 30 Sep 2004
Posts: 511
Location: Wales, UK

PostPosted: Sun Dec 17, 2017 7:55 pm    Post subject: Reply with quote

Yes - pulseaudio being run in the "standard" recommended way. Thanks for the tip - I'll look into adding the additional line in daemon.conf - hopefully it plays well with the bluetooth speaker being added or removed.

Are there examples of programs abusing this opportunity and creating files?
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Sun Dec 17, 2017 8:23 pm    Post subject: Reply with quote

The two main things I see are module-ladspa-sink, which lets you run arbitrary LADSPA plugins in the pulse server, and module-pipe-{sink,source} which create pipe files at a user-supplied path. With it listening on a network address it's possible, albeit far-fetched, for something in the portage compilation sandbox to escape via that route.

But like I said, it's only necessary if you're really paranoid, and the manpage says it breaks hotplug so you probably don't want to do it with bluetooth (that's painful enough to deal with already!)
Back to top
View user's profile Send private message
paulj
Guru
Guru


Joined: 30 Sep 2004
Posts: 511
Location: Wales, UK

PostPosted: Sun Dec 17, 2017 8:53 pm    Post subject: Reply with quote

Ant P. wrote:
The two main things I see are module-ladspa-sink, which lets you run arbitrary LADSPA plugins in the pulse server, and module-pipe-{sink,source} which create pipe files at a user-supplied path. With it listening on a network address it's possible, albeit far-fetched, for something in the portage compilation sandbox to escape via that route.

But like I said, it's only necessary if you're really paranoid, and the manpage says it breaks hotplug so you probably don't want to do it with bluetooth (that's painful enough to deal with already!)


I have to say, bluetooth setup proved pretty straight forward this time, but I find the issues around PulseAudio a right PITA. Seems like an OK concept, but clumsy in implementation!
Back to top
View user's profile Send private message
Josef.95
Advocate
Advocate


Joined: 03 Sep 2007
Posts: 4552
Location: Germany

PostPosted: Sun Dec 16, 2018 8:11 am    Post subject: Reply with quote

One year later …
Thanks for the tip -- it works fine :)
Back to top
View user's profile Send private message
paulj
Guru
Guru


Joined: 30 Sep 2004
Posts: 511
Location: Wales, UK

PostPosted: Sun Dec 16, 2018 4:04 pm    Post subject: Reply with quote

Josef.95 wrote:
One year later …
Thanks for the tip -- it works fine :)


Good to hear!
Back to top
View user's profile Send private message
Das_Sams
n00b
n00b


Joined: 17 Jan 2016
Posts: 5

PostPosted: Thu May 07, 2020 2:35 am    Post subject: Reply with quote

I switched to paulj's solution, so I don't have to start it as root and as "dangerous" system-wide service.
Anyways, it sucks I have to remember starting it as user AND especially if mpd starts playing before I started it as user I have to kill it as root and then start it again to be able to watch videos. If mpd is playing at shutdown it will definitely
start it before there is any chance to do it as user.
There should be a better solution. It should be made safe to start PA as an init-script.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum