Benguin
Posts: 3
Joined: Thu Sep 27, 2012 8:57 pm

Can't get pulseaudio working (over the network, to local PC)

Thu Sep 27, 2012 9:52 pm

Hi, I'm trying to have all the sound from my pi, sent to my pc. I tried with paprefs (after installing pulseaudio,) and I read this thread: http://raspberrypi.stackexchange.com/questions/639/how-to-get-pulseaudio-running ...

I can play files with "paplay", and I can hear them on my pc, butt if I use vlc to play the same file, it gives me

Code: Select all

[0x11d5d18] pulse audio output error: PulseAudio server connection failure: Connection refused
I did start pulse with "pulseaudio --start", and I can see the process when I do "ps aux", what am I doing wrong here? :s

Update (without actually having posted this yet,):I got rid of the vlc error... and pulse starts without complaint still, but, when I play sounds through vlc I still can't hear anything...

It should be said that I'm accessing my PI with SSH, and vlc with Xforwarding, since I don't have a screen for my pi..

Benguin
Posts: 3
Joined: Thu Sep 27, 2012 8:57 pm

Re: Can't get pulseaudio working (over the network, to local

Thu Sep 27, 2012 10:39 pm

Sorry, I left out information...

I'm using the latest Raspbian version...


macey
Posts: 58
Joined: Thu May 24, 2012 6:05 pm

Re: Can't get pulseaudio working (over the network, to local

Wed May 08, 2013 11:54 am

Did you ever get this working? I am also trying to get pulseaudio working.
Getting:-

Code: Select all

AO: [pulse] Init failed: Connection refused
Failed to initialize audio driver 'pulse'
I prefer to use pulse as can handle more than one input, less crackles & pops
during input transitions.
Help to get pulseaudio working appreciated.
adding users to group pulse does not fix...

macey
Posts: 58
Joined: Thu May 24, 2012 6:05 pm

Re: Can't get pulseaudio working (over the network, to local

Wed May 08, 2013 12:38 pm

Turns out that pulseaudio daemon is supposed to start on login (pulseaudio only runs in 'system' mode if configured to) see /etc/default/pulseaudio :-

Code: Select all

cat /etc/default/pulseaudio
# Start the PulseAudio sound server in system mode.
# (enables the pulseaudio init script - requires that users be in the
# pulse-access group)
# System mode is not the recommended way to run PulseAudio as it has some
# limitations (such as no shared memory access) and could potentially allow
# users to disconnect or redirect each others' audio streams. The
# recommended way to run PulseAudio is as a per-session daemon. For GNOME/KDE/
# Xfce sessions in Ubuntu Lucid/10.04, /etc/xdg/autostart/pulseaudio.desktop
# handles this function of automatically starting PulseAudio on login, and for
# it to work correctly your user must *not* have "autospawn = no" set in
# ~/.pulse/client.conf (or in /etc/pulse/client.conf). By default, autospawn
# is enabled. For other sessions, you can simply start PulseAudio with
# "pulseaudio --daemonize".
# 0 = don't start in system mode, 1 = start in system mode
PULSEAUDIO_SYSTEM_START=0

# Prevent users from dynamically loading modules into the PulseAudio sound
# server. Dynamic module loading enhances the flexibility of the PulseAudio
# system, but may pose a security risk.
# 0 = no, 1 = yes
DISALLOW_MODULE_LOADING=1
pulseaudio daemon does not run when I log in. Anyone here know how that
SHOULD happen, I know I could botch it....

surfatwork
Posts: 62
Joined: Mon May 06, 2013 8:26 am

Re: Can't get pulseaudio working (over the network, to local

Wed May 08, 2013 3:20 pm

1. Does pulseaudio start if started from the commandline as a normal user (pulseaudio --start)?
2. Once that's working, see if your players can access the pulse device. install mplayer, and play something: mplayer -ao pulse <some audio>. You should get no error and mplayer will tell you it is using the pulse device.
3. If that is done, you can start pulseaudio at startup with pulseaudio --system. This will start pulse as root and then transfer to the pulse user. Make sure the pulse user has appropriate permissions and belongs to the audio/pulse-access//pulse groups. Add the following to rc.local

Code: Select all

 /usr/bin/pulseaudio --log-target=syslog --system 
4. Reboot and check everything is working again. This is your basic pulse setup.
5. Once that is working, edit /etc/pulse/default.pa to load the following modules (on your laptop and on the pi). Amend the 192.168.0.0/24 to suit your local network IPs.

Code: Select all

load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;192.168.0.0/24 auth-anonymous=1
load-module module-zeroconf-publish 
Make sure avahi daemon is running on the pi and your laptop.
6. It would make things easy if you can start a X session, because you can then open pulseaudio volume control and pulseaudio preferences.
7. On your laptop (Not the Pi), open pulseaudio preferences, click on the network tab and check "enable network access to local sound devices".
8. On the pi, open pulseaudio preferences. On the Network Access tab, check the first box (make discoverable pulseaudio network sound devices available locally)
9. Play something through vlc.
10. Open pulseaudio volume control. On the playback tab, you should see a box next to the vlc sound stream. Click on that and you should be able to select your laptop's sound card. If you dont see it, open pulseaudio preference again and uncheck/check the checkbox in 8. above.

After all that, you will discover that it is quite impossible to listen to the music because it keeps stuttering. When you get to that point, open /etc/pulse/daemon.conf and try adjusting the default-fragments and default-fragment-size options. Spend a lot of time doing this with no effect (or if you are lucky, get it all working). If it doesnt, make the decision to drop pulseaudio streaming and find a better solution (using DLNA maybe). Enjoy.
Last edited by surfatwork on Wed May 08, 2013 3:48 pm, edited 2 times in total.

macey
Posts: 58
Joined: Thu May 24, 2012 6:05 pm

Re: Can't get pulseaudio working (over the network, to local

Wed May 08, 2013 3:39 pm

surfatwork wrote:.......................... If it doesn't, make the decision to drop pulseaudio streaming and find a better solution (using DLNA maybe). Enjoy.
Ok surfatwork, point taken! Thank you very much for the time taken in putting together this useful posting...

Tell me about DLNA, does it perform the same functions as pulseaudio, only better?

I run pulseaudio on all of my Linux machines,without problems, including my Nokia N900,
I find it smooths out transitions between sound sources, it even handles multiple inputs at the same time, try that going direct to alsa.

surfatwork
Posts: 62
Joined: Mon May 06, 2013 8:26 am

Re: Can't get pulseaudio working (over the network, to local

Wed May 08, 2013 3:53 pm

I do use pulseaudio because I use rygel. Streaming over pulseaudio doesnt work over wireless. rygel as a dlna server and dlna renderer works far better over wireless.

macey
Posts: 58
Joined: Thu May 24, 2012 6:05 pm

Re: Can't get pulseaudio working (over the network, to local

Wed May 08, 2013 4:23 pm

surfatwork wrote:I do use pulseaudio because I use rygel...........
Does that mean you DO or DON'T use pulseaudio......
Sorry, just to make it clear......


Return to “Troubleshooting”