Skip to content

Instantly share code, notes, and snippets.

@Stormwind99
Last active May 15, 2019 13:42
Show Gist options
  • Save Stormwind99/6ad89a057b597df13061403df38805d4 to your computer and use it in GitHub Desktop.
Save Stormwind99/6ad89a057b597df13061403df38805d4 to your computer and use it in GitHub Desktop.
Run PulseAudio for a user session in Windows

Steps

  1. Install cygwin - include pulseaudio
  2. Configure /etc/pulse/* as required for use case (load-module module-native-protocol-tcp for example)
  3. Copy auth cookie to /home/SYSTEM/.config/pulse/cookie
  4. Open PulseAudio port (4713) in Windows Firewall as appropriate (local network, for example)
  5. Create vbs scripts to prevent window from appearing:
    1. pulseaudio-on.vbs:
Dim WShell
Set WShell = CreateObject("WScript.Shell")
WShell.Run """C:\Program Files\cygwin64\bin\pulseaudio.exe"" --realtime --no-cpu-limit --disallow-exit=on --exit-idle-time=999999999999 --daemonize", 0
Set WShell = Nothing
  1. pulseaudio-off.vbs:
Dim WShell
Set WShell = CreateObject("WScript.Shell")
WShell.Run """C:\Program Files\cygwin64\bin\pulseaudio.exe"" -k", 0
Set WShell = Nothing
  1. Create tasks in Task Manager
    1. Create logon task that runs wscript pulseaudio-on.vbs
    2. Create logoff task (Log: Security, Event ID 4647) that runs wscript pulseaudio-off.vbs
  2. Test!

References

  1. https://www.tenforums.com/tutorials/94893-play-sound-logoff-sign-out-windows-10-a.html
  2. https://winaero.com/blog/run-a-program-hidden-in-windows-10/
  3. https://stackoverflow.com/questions/15770599/about-using-double-quotes-in-vbscript
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment