Setting up PulseAudio 1.0 beta for Windows

This is a bit of a niche post, so if you’ve never heard of PulseAudio then carry on elsewhere :)

If, like me, you’ve been looking at setting up a PulseAudio server on Windows, you’ve no doubt come across an old binary download for version 0.9.6, which is approaching the healthy age of four years as of this writing. PulseAudio’s development has been very intensive since that time, with a lot of new features released. Sadly though, that development came at the cost of Windows compatibility, which meant that no newer versions were available for Windows. Until now that is, as the PulseAudio community is working on full Windows compatibility for the imminent release of version 1.0. Full details of progress are available on the PulseAudio wiki, but in the meantime a full build has been made available as a zipped package (I’ve also mirrored it here, but keep an eye out for updated versions). If you want help setting it up, then read on.

The Basics

There is no installer, so unzip the files into a location of your choice. For this tutorial, I’m going to assume the files are in C:\PulseAudio. Next, you’ll need to open a command prompt. Windows Vista and 7 users will need to open a prompt with Administrator access: to do this, find the command prompt in your start menu, right click it, and select “Run as administrator”. Click yes if asked. Windows XP users can just open a prompt without further nonsense. In the prompt, type the following and hit enter:cd C:\PulseAudio\bin We can now test the program is working by typing pulseaudio.exe -p "C:\PulseAudio\lib\pulse\modules" -nF "C:\PulseAudio\etc\pulse\" (and press enter). I got a few warnings and errors at this stage (it is beta software after all), but I think it’s safe to assume that if it doesn’t crash, it’s working enough for our needs. Hit ctrl+C to return to the prompt.

The next step is to configure PulseAudio to listen to connections on the network, since I assume nearly all Windows users want PulseAudio to stream audio from a Linux/Unix/BSD system. For this step you’ll need a text editor which can handle unix line endings, which does not include Microsoft’s own Notepad. If you don’t have one, I recommend Notepad++ as it’s totally free. Open your editor (Vista and 7 users will need to open it as administrator), and open the file at C:\PulseAudio\etc\pulse\ Underneath the line that reads load-module module-null-sink enter a new line: load-module module-native-protocol-tcp listen= auth-anonymous=1 You can now save the file, and restart PulseAudio with the same command line used earlier, and you should be able to play sound on your Windows machine across the network!

There is a caveat: this allows any machine on the network to send audio to you. If you are not firewalled from the internet or you don’t consider your network secure, you must use a cookie file that PulseAudio generates for you. You can find it in your user profile: on Windows XP, it’s located in C:\Documents and Settings\<your username>\.pulse-cookie. Vista and 7 users can find it at C:\Users\<your username>\.pulse-cookie. Simply copy this file to the home directory of the user that is sending you sound on the remote machine. Often this will be your own home directory, but some daemons run their own (for example, MPD on Ubuntu requires the cookie to be in /var/lib/mpd). When you’ve done this, you can remove the “auth-anonymous=1” part from the line above.

Update: There is one more step necessary which I wasn’t aware of previously. In this version, the default behaviour of the server is to exit after 20 seconds of no playback, which is obviously not something we want. Open your text editor (as administrator if necessary) and start editing the file at C:\PulseAudio\etc\pulse\daemon.conf. At the end of the file, copy in the following: exit-idle-time = -1 This simply tells PulseAudio not to exit until we say so.

Setting up MPD

The reason I want PulseAudio on Windows is to use it with MPD, running on another machine on the network. This allows me to use the same music player when booting between Windows and Linux on my work PC, without needing two different interfaces or two copies of the same music library. MPD is surprisingly easy to get working across a network. On the machine running MPD, open the mpd.conf file with your favourite editor, and as root if necessary. On most distros the file is at /etc/mpd.conf. At the end, append the following: audio_output {
    type "pulse"
    name "Friendly Name"
    server "hostname"
replacing “Friendly Name” with the name of your choice, and “hostname” with the hostname or IP address of the machine running PulseAudio. Optionally, you can now comment out any old audio_output entries. Restart MPD. Lastly, use your client to specify which output to use. With MPC, this is specified as mpc enable X on the command line, where X is the number of your output (the number is based on the ordering of outputs in the mpd.conf file). In GMPC (which I use), you can switch outputs under the Server menu. Load up a track and hit play – you should now be hearing music in Windows.

PulseAudio as a Windows service

This step is optional, and a bit involved, but if you want PulseAudio to be a service that runs when Windows starts up, this is how to do it. You will need something called “Windows Server 2003 Resource Kit Tools”, which is made by Microsoft and can be downloaded for free from their website. We need only two programs from this pack – instsrv.exe and srvany.exe. Install the pack, and keep track of where it was installed. In my case this was C:\Program Files (x86)\Windows Resource Kits\Tools. Open a command prompt, as administrator if necessary (you can use the prompt from earlier if it’s still open). Use the cd command as demonstrated previously to navigate to where the tools were installed. Now run instsrv PulseAudio "C:\Program Files (x86)\Windows Resource Kits\Tools\srvany.exe" If your tools were installed somewhere else, then adjust that path so that it points to where srvany.exe ended up. Hopefully you’ll get a little message proclaiming success. You will now need to open the registry editor, which you can do by typing regedit in your start menu’s run box. If you’ve not used regedit before, it’s a little daunting but I will hold your hand all the way through. The layout is similar to Windows Explorer: the left pane holds “keys” which behave a little like folders, and the right pane holds “values”. Use the left pane to navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PulseAudio. In the right pane, right click in the empty space and select New, then Key. You’ll be able to enter a name for it now, so enter Parameters. Now navigate into the new Parameters key, right click in the right pane again and select New, then String Value. Give it the name “Application” (without the quotes). Press enter to save the name, and double click your new value. In the prompt that pops up, enter the full command you used earlier to start PulseAudio, so using the same example as above this would be C:\PulseAudio\bin\pulseaudio.exe -p "C:\PulseAudio\lib\pulse\modules" -nF "C:\PulseAudio\etc\pulse\" Click OK, and close regedit. Open Control Panel, head to Administrative Tools, and open the Services applet. If you scroll down you should see our PulseAudio service. Make sure you aren’t still running PulseAudio in a command prompt (ctrl+C to exit), then right click the service and select Start. If you don’t get any errors, then this has probably worked, but you can check by looking for pulseaudio.exe in Task Manager (Windows 7 users might need to click “Show processes from all users”). From now on, PulseAudio will start as soon as Windows boots, and be available to all users.

13 thoughts on “Setting up PulseAudio 1.0 beta for Windows”

  1. Thanks alot for your manual. I wil try it on my machine.

    Did you hav some tips vor Android (not rooted if Posible) i wish to stream all sound sfrom android to desktop pc. MAy be a Windows One to.


  2. Theoretically you could make an android app that streams sound or plays music to a pulse server, but some quick googling suggests this doesn’t exist yet. If it’s just music you want though, there are a number of MPD clients for android, so you could use your phone as a remote control for the machine that’s actually doing the playing.

    As for playing all sound from an android device through pulse, that would definitely require a rooted device, and more than likely isn’t even possible for most phones and tablets. There’s a discussion on this mailing list about how feasible such a project would be, but even if successful I can’t imagine such a feature in a typical commercial device.

    P.S. apologies for the late reply, your comment ended up in my spam filter.

  3. Hi Dutch.
    I followed all the steps in your guide, and eventually ended up with pulseaudio running on Windows (XP, on VirtualBox; i’m using an ubuntu 10.04).
    However, every client application (pactl, parec, etc) returns this error message:

    “Connection failure: Connection refused
    pa_context_connect() failed: Connection refused”

    Do you have any idea about how can i fix or even debug this? I’m no expert, and it’s very difficult to find good info about PulseAudio on Windows. =/

    Thanks in advance.

  4. Hi

    Can you please post the contents of your configuration files on windows, and the full command you’re using to make the connection? Also, if you’re using Pulse as a windows service, try running it manually and see if it works that way.

    It sounds like the server has failed to make itself available to other machines.

  5. Dutch,
    It appears you left out a small detail when configuring PulseAudio to run as a Windows service. Your article states “Now navigate into the new Parameters key, right click in the right pane again and select New, then String Value. In the prompt that pops up, enter the full command you used earlier to start PulseAudio…” The name of the String value is not specified, but it should be “Application.” If you leave it, the name ends up being “New Value #1” or something similar, and the service will not start if you leave it like that. Otherwise, great post – it helped me get PulseAudio to receive audio from my Ubuntu box. Thanks!!

  6. Hey Dutch Gecko and thx a lot for this nice documentation.

    I face a problem using Windows 7 because with it the microphone device is in “not-in-use-state” by default. The new PulseAudio-Version (1.1) should fix this problem.

    And here is my problem. There is no documentation to run the new binaries in windows and your description unfortunately don’t work as well.

    Please help me if you can. Please tell me the command-line and maybe the params to add in a script to run the new version.

  7. I’m trying to do sorta the opposite. Use Pulseadio on Windows to push audio TO my linux server.
    The Linux side is correctly configured and I can stream from other sources just fine, but no idea how to setup pulse on Windows.

    On Windows I have a dummy audio driver installed and working. I’ve tested it by piping its output through linco, to netcat, to my pulse server on a linux box. Works fine but introduces some latency that sucks for gaming.

    Any idea on how to setup pulse as a client under windows, and attach and push all audio from the dummy driver to my Linux server?

  8. Hi Dutch Gecko,

    thank you so much for this great post. I was trying to get my linux server sending sound to my windows desktop with netjackd, but it has been a failure. You simply made my day.

    The only sad thing is that I have to use ncmpc instead of mocp. Well, not that bad.

    You just forgot to say that this line is required in in order to make pulseaudio work:
    set-default-sink output

    It was disabled in the default pulseaudio 1.1 configuration file.


  9. ugh – I know this is rather late but this is an answer for the first post : you can use your PC as bluetooth audio device and configure it as such (both Windows and Linux support this) – this way you will be able to pass all sound.

  10. If your client doesn’t want to connect to your windows machine, don’t forget to open your firewall on tcp-port 4713 (on the windows machine).

  11. I’m trying to get audio from Ubuntu to Win7. PulseAudio won’t start; it keeps saying “Failed to stat home directory C:\Users\judebert\: No such file or directory”. But it obviously exists; I installed in my download directory, right off the home.

    I’ve tried telling it to not make a PID file, but it REALLY wants that home directory to exist. I may have to go source diving.

Leave a Reply

Your email address will not be published. Required fields are marked *