Stream audio from windows to linux

kotarou3 / 0-stream-audio-windows-to-linux.md

Stream audio from Windows to Linux

Tested on Ubuntu 16.04 and Windows 10 Redstone 1

Both boxes need to be on the same network (such that multicast packets can be passed between them)

  1. Install JACK and ASIO Bridge on the Windows box
  2. Run regsvr32 32bits\JackRouter.dll and regsvr32 64bits\JackRouter.dll from JACK installation directory
  3. Modify 32bits\JackRouter.ini and 64bits\JackRouter.ini to match your channel and sample config
  4. (Optional) Set the ASIO Bridge (Hi-Fi Audio) input as the default playback device
  1. Start the netjack2 server on Linux with jack_load netmanager (probably also possible to add to .jackdrc for it to autoload)
  2. Run JACK NetDriver on Windows (it’s in the Start menu), or jackd -R -d net
  3. A new device named the hostname of the Windows box should have appeared on the Linux JACK patch panel (Catia if you’re using Cadence). Connect it as you see fit (Note: Channels might not match up as expected if you have more than 2).
  4. Run ASIO Bridge (also in the Start menu), turn ASIO on, and set the ASIO device to JackRouter
  5. The ASIO Bridge should have automatically set up routes to the system device in the Windows JACK patch panel. You can double check with qjackctl (Jack Control in the Start menu) → Connections and connect them if not

Note: Volume control does not work on the ASIO Bridge. You will have to adjust individual application’s volumes instead to control volume from Windows.

You can test the result via the Sound control panel → Configure

See attached image for what my patch panel configuration ended up looking like for my 7.1 setup

Stream audio from windows to linux

The aim for this software is to be able to stream audio from a Windows output device so Pulse Audio will be able to play it back on a Linux host. The communication between the two is done with plink from Putty. WLStream prints on stdout data formated as PCM floating signed 32 bits little endian from a Windows output device. You also can list the available devices, choose a specific device, create a wav file and choose the PCM’s size.

Читайте также:  Образ windows для android dosbox turbo

Follows the command to stream the data:

Enable OGG compression to reduce stream bandwidth (download OGG Encoder on Windows and «sudo apt-get install vorbis-tools» on Linux):

People have also been able to stream from the Windows input device e.g. a microphone as shown in the command bellow:

  • Have plink and Putty installed and configured in your Environment Variables Path.
  • Compile on Visual Studio 2017 and execute it on command prompt the line above or just download the compiled version on the Published branch and change WLStream.bat with the correct linux host’s ipAddress and login infos (better connect through ssh before to check connection with your device).
  • Make sure your Linux device is running PulseAudio.
  • Create a cool WLStream icon design.

This code was an adaptation made by Rinaldi Segecin from this code by Matthew van Eerde.

About

Stream audio from a Windows output device to be captured on a Linux host.

Fusl / gist:3a708b8c32c9d5264fa0

# Windows (receiver) side:
.\ffplay.exe -nodisp -ac 2 -acodec pcm_u8 -ar 48000 -analyzeduration 0 -probesize 32 -f u8 -i udp://0.0.0.0:18181?listen=1
# Linux (transmitter) side:
pactl load-module module-null-sink sink_name=remote
ffmpeg -f pulse -i «remote.monitor» -ac 2 -acodec pcm_u8 -ar 48000 -f u8 «udp://RECEIVER:18181»
pavucontrol # Change the default output to the Null sink or move single applications to this «output» device.

This comment has been minimized.

Copy link Quote reply

PatienceAllergy commented Sep 6, 2019 •

This works brilliantly!

But I want to know why it works so I can modify it. I’m finding the ffmpeg syntax confusing. For instance:

  • You have -f u8 but the documentation seems to indicate -sample_fmt u8 , yet when tried it doesn’t work.
  • Why does -f u16 not work for 16 bit sound?
  • How are there 2 -f options on the same line?
  • Where did you learn about -analyzeduration 0 and -probesize 32 ? I can’t find them documented.

I think I’ve answered my own questions.

Читайте также:  Whatsapp для компьютера windows 10 без смартфона

-f is used twice because the first is for input, the second for output.

-analyzeduration 0 and -probesize 32 are apparently from some older version of ffmpeg’s documentation.

u16 is not a valid sample format, so that will never work. However, this works:

How to connect JACK Audio from windows to linux?

I’m trying to route a windows playback device to play all sound on a linux speaker set, but the first issue of course is connecting jack from windows to linux over my network.

Apparently the options are netjack1, netjack2 and jack.trip which are all meant for the purpose of connecting jack over network, but I can’t for the life of me figure out how it is supposed to be done. It seems that jack ships with netjack2 and netjack1 (net/netone) when installed on both windows and linux, i have managed to set both up and start them, however they are both in «client» mode. I need the windows one to be set up as a server for the linux client to connect to.

Does anyone know how to do this?

1 Answer 1

I was able to get audio playback working from Windows to Linux with netjack2. I did a small write-up of it here: https://gist.github.com/kotarou3/3813bbf7833a0e4618f7fbe8a377872d

Partially quoting here for posterity:

Stream audio from Windows to Linux

Tested on Ubuntu 16.04 and Windows 10 Redstone 1

Both boxes need to be on the same network (such that multicast packets can be passed between them)

Installing

Linux

Windows

  1. Install JACK and ASIO Bridge on the Windows box
  2. Run regsvr32 32bits\JackRouter.dll and regsvr32 64bits\JackRouter.dll from JACK installation directory
  3. Modify 32bits\JackRouter.ini and 64bits\JackRouter.ini to match your channel and sample config
  4. (Optional) Set the ASIO Bridge (Hi-Fi Audio) input as the default playback device

Running

  1. Start the netjack2 server on Linux with jack_load netmanager (probably also possible to add to .jackdrc for it to autoload)
  2. Run JACK NetDriver on Windows (it’s in the Start menu), or jackd -R -d net
  3. A new device named the hostname of the Windows box should have appeared on the Linux JACK patch panel (Catia if you’re using Cadence). Connect it as you see fit (Note: Channels might not match up as expected if you have more than 2).
  4. Run ASIO Bridge (also in the Start menu), turn ASIO on, and set the ASIO device to JackRouter
  5. The ASIO Bridge should have automatically set up routes to the system device in the Windows JACK patch panel. You can double check with qjackctl (Jack Control in the Start menu) → Connections and connect them if not
Читайте также:  Windows mouse right click menu

Stream windows audio to linux

I have a setup with quicksynergy allowing me to use mouse keyboard and shared pastedbin between my small windows machine and my main machine running ubuntu.

It’s phenomenal for playing windows-only games and running other windows-only software because there’s no latency at all in the input.

the only problem is I’d like to have the windows audio in my linux.

I saw this https://superuser.com/a/708908/350509 which I thought was a clean solution. the issue with that is the user only explains how to stream linux audio to windows and says nothing about how to do the opposite.

Is there any way to do this that I could automate for startup on both machines?

1 Answer 1

I’ve altered a program found on internet and created WLStream. It enables you to stream audio from a Windows output device so Pulse Audio will be able to play it back on a Linux host. The communication between the two is done with plink from Putty. There’s a delay in the audio stream caused by the network, I’m sure if you alter the privilege on the TCP packet sent from plink or change your router’s configuration as you would for VOIP it’ll reduce the audio’s stream lag but my research didn’t go any further. WLStream can be compiled using Visual Studio 2017 and there’s a pre-compiled from the last version here.

Not the answer you’re looking for? Browse other questions tagged sound pulseaudio or ask your own question.

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.4.16.39093

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Оцените статью