following powerhouse's (awesome) guide on setting up a hardware-accelerated windows VM I wanted to get low latency audio from my windows PC (VM) to the linux mint host.
Although this method should be general to any 2 networked computers and in theory audio can be passed linux->windows by swapping the 'client' steps on each machine.
The plan is to get a basic install of the jack2 audio server on both PCs then go back and load jack clients to configure what audio to send where.
The guide is structured first as a somewhat generic setup of jackd2 on 2 PCs, then extra bits to get audio in-to jackd2 on windows (may be extended as necessary in the future)
note: my guide is based on various tutorials from jackd2 users - I just never found all the information presented in one place.
note2: I have no idea what I am doing in jack so if you know better (especially with the "config" of the jackd2 servers) please help me/us out!
So anyway here we go...
Software:
This guide assumes Linuxmint 16 x64 and windows 7 x64 although it should be possible on 32-bit/other OS versions with minimal modifications.
The latest version of jackd2 for windows can be downloaded from here (I used "Mixed 64/32 bit JACK 1.9.9" for win 7 x64 - which actually turned out to be v 1.9.9.5).
The latest version of jackd2 for linux can be grabbed from your repository or compiled from source.
Generally there is only the latest version of jackd2 for windows available for download (I have not found archived binaries anywhere), so if you want to connect between linux and windows you need the matching version in linux.
If the appropriate version is not available from the repositories you will need to compile from source (instructions at the end of the guide "Install jackd2 for linux from source")
The windows binaries version can be confirmed by installing them, running "jack Command" and entering:
Code: Select all
jackd.exe -V
jackd2 windows install and configure
Run the jackd2 installer - all options at their defaults are fine.
right-click "Jack control", go into "Properties"->"Compatiblity" and tick "run this program as an administrator", click OK.
start "Jack control"
This will bring up a small "JACK Audio Connection Kit" window, click "setup" and change the settings to those below (leave unmentioned ones at their defaults):
server prefix: jackd -S
realtime: <checked>
Timeout: 10000 ms
"save" the configuration and close the configure window.
jackd2 linux install and configure
note: in pervious versions of this guide I installed from source - the linux mint 16 repos have been updated in line with the latest windows release so this is no longer always necessary
Code: Select all
sudo apt-get install jackd2 qjackctl
Code: Select all
jackd -V

start qjackctl
This will bring up a small "JACK Audio Connection Kit" window, click "setup" and change the settings to those below (leave unmentioned ones at their defaults):
realtime: <checked>
Timeout: 10000 ms
master jackd2 server - no speakers attached (windows in my case)
Install jackd2 as above.
For windows: start "Jack control"
For linux: start "qjackctl"
click "setup"
change the "Driver" to "net"
'save' the configuration and close the configure window.
click "start" in the "Jack control"/qjackctl window.
The jackd2 server should <hopefully> start (you can open "messages" for detailed information)
Slave jackd2 server - has speakers attached (linux in my case)
Install jackd2 as above.
For windows: start "Jack control"
For linux: start "qjackctl"
click "setup"
For windows: change the "Driver" to "portaudio", and select the "interface" your speakers are connected to.
For linux: change the "Driver" to "alsa", and select the "interface" your speakers are connected to.
The jackd2 server should <hopefully> start (you can open "messages" for detailed information)
note: when I compiled from source, jackd2 complained about "/usr/local/lib/jack/jack_netone.so" so I simply deleted it and tried again
Code: Select all
sudo rm /usr/local/lib/jack/jack_netone.so
Code: Select all
sudo apt-get install alsaplayer alsaplayer-jack
alsaplayer -o jack path/to/test-file.mp3
Slave jackd2 client (linux in my case)
For windows: open a new command window as administrator (right-click run as administrator) and run:
Code: Select all
cd "C:\Program Files (x86)\Jack"
jack_load.exe netmanager
Code: Select all
jack_load netmanager
After a short period jackd2 should find your other PC and its "hostname" should appear in the jackd2 "connect" window (opened from qjackctl)
If instead the "Messages" window fills with "protocol" errors you will have to recheck the jackd2 versions and try a different combination

In qjackctl open the "connect" window and drag <master PC hostname> on the left to "system" on the right.
It should look a little like: Note the (thin) line connecting the <master PC hostname> to "system" - this tells jackd2 to route any audio from <master PC hostname>-output (whatever was recorded/captured on the remote PC) to "system"-input (input from jackd2's point-of-view but actually the system output... i.e the speakers) - yes this terminology is confusing for me too!!!

Nearly there!
Master jackd2 client(windows in my case)
For windows: open a new command window as administrator (right-click run as administrator) and run:
Code: Select all
cd "C:\Program Files (x86)\Jack"
jack_load.exe audioadaptor
Code: Select all
jack_load audioadaptor
then in the jackd2 server program ("jack control"/qjackctl)
open the "connect" window and drag "audioadaptor" from the left to "system" on the right
It should look a little like: note: the jackd2 "audioadptor" will capture any audio from the system-default recording device.
Jackd2 configuration complete!
Getting sound from windows (as jackd2 master) into jackd2 (and so to the other PC):
install "VB-CABLE driver" from here (free alternative to 'virtual audio cable')
this will create a virtual soundcard and recording device that loopback to one-another then:
- Set the cable input to be the system-default output.
- Set the cable output to be the system-default input.
- the jackd2 "audioadptor" client will now capture all system audio from the "recording device", and the "netmanager" client on the remote PC will redirect this audio out of the remote speakers

If you are having issues, first try:
- open "recording devices" (right-click the "speaker" icon in the windows-system-tray in the right of the taskbar)
- start playing a music/video file (or a youtube video - whatever)
- check that the green/grey bar beside "CABLE Output" rises and falls in time (picture worth a thousand words?). This helps confirm if the problem lies within jackd2 or the cable.
If the problem is with jackd2:
- ensure the servers are still running and connecting with one-another
- ensure that the appropriate "connections" are drawn in the "connect" windows of each machine.
If the problem is with the "cable":
- check that the cable ends are both the default playback device and recording device
- I, err..., uhh...????
Compile jackd2 for linux from source
keep jackd2 installed from the repositories as it does some system-specific configuration to save you the hassle (and the compiled-from-source binaries will overwrite and repo-installed ones)
Code: Select all
sudo apt-get install jackd2 qjackctl
Code: Select all
sudo apt-get install git build-essential
build the opus 1.1 library with custom modes - the version in the repository does not have custom modes enabled

download the source package for libopus 1.1 from here.
unpack and open a terminal in the unpacked dir then:
Code: Select all
cd opus-1.1
./configure --enable-custom-modes
make
sudo make install
Code: Select all
sudo apt-get install libffado-dev libreadline6-dev libsamplerate-dev libsndfile1-dev
then just double-click to install
The "celt" codec was likewise not in the repositories so grab the celt-0.11.1.tar.gz from here, unpack, and run
Code: Select all
cd celt-0.11.1
./configure
make
sudo make install

Code: Select all
mkdir jack_source
cd jack_source
git clone git://github.com/jackaudio/jack2.git
Code: Select all
git checkout 1.9.9.5
Code: Select all
cd jack2
./waf configure --alsa
./waf build
sudo ./waf install
note2: this will install over the top of any other/previous jack install
TODO/work-in-progress:
I have not looked into setting this up automatically on boot yet but if you are feeling adventurous:
- the qjackctl 'messages' window shows what command it used to start the jackd2 server
- jack_connect can be used to automate the 'drag this-to-that' in the 'connect' window(? - I have not played with this yet)
On the linuxmint PC, the jackd server 'takes over' the audio output whilst running so that non-jack programs can't use the speaker, but multiple jack applications can use the port simultaneously (ie alsaplayer and my windows PC)
- this could be fixed by making a loopback device in alsa similar to how the "VB-CABLE driver" works in windows
Hope you enjoyed the guide and got something useful from it
