You are not logged in.

#1 2011-01-09 21:56:12

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

stream mpd music to remote computer using pulseaudio

Hi there,

I'm trying to stream some music using from my computer (KDE) to another (LXDE).
At first, I set up mpd to produce an http stream which I played remotely using mplayer. That's not a good solution to me because I don't want to physically use my remote computer so I need to ssh to it in order to launch mplayer.
Now I'm looking to use pulseaudio, i.e. setup mpd to stream music directly to remote pulseaudio server. I tried to follow pulseaudio and mpd articles on the wiki, plus some other resources I could find by googling,  but I got lost...

For instance, some resources mention pulse-access user groups (and other pulseaudio-related groups); arch wiki does not.
Do I need to open some ports on remote computer?

My current mpd.conf setup id

# general config
port                    "6600"
music_directory         "/home/sam/Music"
playlist_directory      "/var/lib/mpd/playlists"
db_file                 "/var/lib/mpd/mpd.db"
log_file                "/var/log/mpd/mpd.log"
pid_file                "/var/run/mpd/mpd.pid"
state_file              "/var/lib/mpd/mpdstate"
log_level               "verbose"
#user                   "mpd"
mixer_type              "software"

# pulseaudio output (streaming to a remote pulseaudio server)
#
audio_output {
        type            "pulse"
        name            "My Pulse Output"
        server          "harrypotter"         # optional
        sink            "remote_server_sink"    # optional
}

Any guidance would be appreciated,

thanks.


what goes up must come down

Offline

#2 2011-01-11 21:19:46

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: stream mpd music to remote computer using pulseaudio

this is no bump wink


what goes up must come down

Offline

#3 2011-01-12 23:04:22

Themaister
Member
From: Trondheim, Norway
Registered: 2008-07-21
Posts: 652
Website

Re: stream mpd music to remote computer using pulseaudio

I recall that you had to enable the TCP module in /etc/pulse/default.pa or something like that. Also you had to enable pulse-network or something like that in /etc/hosts.allow on server side.

Offline

#4 2011-02-13 21:35:53

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: stream mpd music to remote computer using pulseaudio

Hi, sorry for the late reply, life has been a bit intense lately.

I set up the TCP module, allowed pulse acess in /etc/hosts.allow, but mpd log gives me

Feb 13 22:28 : client: [0] process command "playid "-1""
Invalid MIT-MAGIC-COOKIE-1 keyxcb_connection_has_error() returned true
Feb 13 22:28 : output: Failed to open "My Pulse Output" [pulse]: failed to connect: Connection refused

I looked for this pulse-cookie mentioned by wiki article, copied it from remote to local, but to no avail...

Last edited by brazzmonkey (2011-02-13 21:55:55)


what goes up must come down

Offline

#5 2011-02-14 21:33:31

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: stream mpd music to remote computer using pulseaudio

on the wiki, mpd article mentions pulse-access and pulse-rt groups. Are they needed for remote access? These groups don't exist, should I create them?


what goes up must come down

Offline

#6 2011-02-14 21:41:45

Rasi
Member
From: Germany
Registered: 2007-08-14
Posts: 1,914
Website

Re: stream mpd music to remote computer using pulseaudio

pulse is normally run as your user. For mpd to have access to it you have to make sure it runs as the very same user.
thats all.

And those pulse groups are not meant for a normal pulse audio session, its meant for the pulseaudio system service.


He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.

Douglas Adams

Offline

#7 2011-02-15 08:44:55

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: stream mpd music to remote computer using pulseaudio

As a matter of fact, pulse runs as a user on remote computer, and mpd runs as an another user on local computer.
Say I want to carry on using 2 different users, does that mean I have to make pulseaudio a system service?


what goes up must come down

Offline

#8 2011-02-15 15:36:30

Rasi
Member
From: Germany
Registered: 2007-08-14
Posts: 1,914
Website

Re: stream mpd music to remote computer using pulseaudio

nah.. in that case enable tcp support and copy the cookie file to the client.


He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.

Douglas Adams

Offline

#9 2011-02-15 22:08:52

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: stream mpd music to remote computer using pulseaudio

Well, I did that already.
I had little progress by running mpd as mpd user instead of root (it no longer complains about magic cookies). Still I cannot connect to remote PA server. mpd.log:

No protocol specified
xcb_connection_has_error() returned true
Feb 15 23:31 : output: Failed to open "My Pulse Output" [pulse]: failed to connect: Access denied

Port 4713 is open.
Remote hosts.allow is:

sshd: 192.168.0.
proftpd: 192.168.0.
pkgdd: 192.168.0.
#nfsd: 192.168.0.
#portmap: 192.168.0.
#mountd: 192.168.0.
pulseaudio-native: ALL
# End of file

Last edited by brazzmonkey (2011-02-15 22:57:42)


what goes up must come down

Offline

#10 2011-02-15 22:25:45

Rasi
Member
From: Germany
Registered: 2007-08-14
Posts: 1,914
Website

Re: stream mpd music to remote computer using pulseaudio

from the archwiki:

One of PulseAudio's magnificent features is the possibility to stream audio from clients over TCP to the server running the PulseAudio daemon, allowing sound to be streamed through your LAN.

To accomplish this, one needs to enable module-native-protocol-tcp, and copy the pulse-cookie to the clients.


He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.

Douglas Adams

Offline

#11 2011-02-15 22:37:21

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: stream mpd music to remote computer using pulseaudio

Thanks, but as stated in my previous post, I did that already.

Remote:

$ cat /etc/pulse/default.pa 
#!/usr/bin/pulseaudio -nF
#
# This file is part of PulseAudio.
#
# PulseAudio is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PulseAudio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PulseAudio; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.

# This startup script is used only if PulseAudio is started per-user
# (i.e. not in system mode)

.nofail

### Load something into the sample cache
#load-sample-lazy x11-bell /usr/share/sounds/gtk-events/activate.wav
#load-sample-lazy pulse-hotplug /usr/share/sounds/startup3.wav
#load-sample-lazy pulse-coldplug /usr/share/sounds/startup3.wav
#load-sample-lazy pulse-access /usr/share/sounds/generic.wav

.fail

### Automatically restore the volume of streams and devices
load-module module-device-restore
load-module module-stream-restore
load-module module-card-restore

### Automatically augment property information from .desktop files
### stored in /usr/share/application
load-module module-augment-properties

### Load audio drivers statically (it's probably better to not load
### these drivers manually, but instead use module-hal-detect --
### see below -- for doing this automatically)
#load-module module-alsa-sink
#load-module module-alsa-source device=hw:1,0
#load-module module-oss device="/dev/dsp" sink_name=output source_name=input
#load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input
#load-module module-null-sink
#load-module module-pipe-sink

### Automatically load driver modules depending on the hardware available
.ifexists module-udev-detect.so
load-module module-udev-detect
.else
### Alternatively use the static hardware detection module (for systems that
### lack udev support)
load-module module-detect
.endif

### Automatically load driver modules for Bluetooth hardware
.ifexists module-bluetooth-discover.so
load-module module-bluetooth-discover
.endif

### Load several protocols
.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif
load-module module-native-protocol-unix

### 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                            <======= HERE
#load-module module-zeroconf-publish

### Load the RTP reciever module (also configured via paprefs, see above)
#load-module module-rtp-recv

### Load the RTP sender module (also configured via paprefs, see above)
#load-module module-null-sink sink_name=rtp format=s16be channels=2 rate=44100 description="RTP Multicast Sink"
#load-module module-rtp-send source=rtp.monitor

### Load additional modules from GConf settings. This can be configured with the paprefs tool.
### Please keep in mind that the modules configured by paprefs might conflict with manually
### loaded modules.
.ifexists module-gconf.so
.nofail
load-module module-gconf
.fail
.endif

### Automatically restore the default sink/source when changed by the user during runtime
load-module module-default-device-restore

### Automatically move streams to the default sink if the sink they are
### connected to dies, similar for sources
load-module module-rescue-streams

### Make sure we always have a sink around, even if it is a null sink.
load-module module-always-sink

### Honour intended role device property
load-module module-intended-roles

### Automatically suspend sinks/sources that become idle for too long
load-module module-suspend-on-idle

### If autoexit on idle is enabled we want to make sure we only quit
### when no local session needs us anymore.
.nofail
load-module module-console-kit
.fail

### Enable positioned event sounds
load-module module-position-event-sounds

### Cork music streams when a phone stream is active
load-module module-cork-music-on-phone

# X11 modules should not be started from default.pa so that one daemon
# can be shared by multiple sessions.

### Load X11 bell module
#load-module module-x11-bell sample=bell-windowing-system

### Register ourselves in the X11 session manager
#load-module module-x11-xsmp

### Publish connection data in the X11 root window
#.ifexists module-x11-publish.so
#.nofail
#load-module module-x11-publish
#.fail
#.endif

### Make some devices default
#set-default-sink output
#set-default-source input

Local:

# ls -a /var/lib/mpd/
.  ..  .pulse-cookie  mpd.db  mpdstate  music  playlists

Last edited by brazzmonkey (2011-02-15 22:41:02)


what goes up must come down

Offline

#12 2011-02-15 23:05:26

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: stream mpd music to remote computer using pulseaudio

Also, I have the feeling that PA only runs for a while (say, 1 minute or so). This isn't normal behaviour, is it?


what goes up must come down

Offline

Board footer

Powered by FluxBB