JACK over ethernet network?

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

Frank Carvalho
Established Member
Posts: 363
Joined: Sat Nov 17, 2012 3:36 pm

JACK over ethernet network?

Post by Frank Carvalho »

Hi

As I have my recording space in several rooms, I am considering using a secondary computer in another room for XWin to the DAW/Carla/.. and for providing an extra sound card for monitoring/recording, while the main computer stays in the control room with HD and processing power. I also dream of using a small Raspberry PI as a send/receive unit for remote effects like plate reverb or echo chamber. Instead of running long audio cables, I want to use a network switch and ethernet cables, using netjack or something similar.
My previous experiments some years ago with this were not so stable. So I want to ask what the status is on this area?
Is it possible to slave a remote JACK instance over the eth network?
Can I use both the local sound card with JACK and netjack whith JACK slaved to a remote master sync?
Has anybody else used a similar setup and what are their experiences?

/Frank
Vox, Selmer, Yamaha and Leslie amplifiers. Rickenbacker, Epiphone, Ibanez, Washburn, Segovia, Yamaha and Fender guitars. Hammond, Moog, Roland, Korg, Yamaha, Crumar, Ensoniq and Mellotron keyboards. Xubuntu+KXStudio recording setup.
Frank Carvalho
Established Member
Posts: 363
Joined: Sat Nov 17, 2012 3:36 pm

Re: JACK over ethernet network?

Post by Frank Carvalho »

Replying to my own subject, sorry. I spent some time searching the web, and found a good working setup, based on NetJACK2.

It seems that the computer with the audio card must be master in order to be able to bridge card to network. This means that the secondary computer with the sound card should be master, while the processor heavy DAW is to be slave.
I made some simple shell scripts to start the netjack master and slave, so the DAW slave has 20 in/out and 4 MIDI in/out. Since I last looked at netjack, in netjack1 days, autodiscover has been added, which is most useful.
The secondary computer/master has my recent M-Audio Quattro USB card attached, and I made a test configuration to be able to measure the different latencies introduced by the setup. These were my test results:
Latency is almost exclusively introduced by the sound cards and the jack buffers. I made a test recording in Ardour 4.0 and after that I overdubbed the part through the remote sound card. The latency correction in the remote DAW left the two tracks perfectly in sync.
Then I tried playing back one recorded track in the DAW to the network, and from the secondary (master) machine I sent it back over the network to the DAW on another channel and recorded. This has exactly the latency of the JACK buffers (5.2ms), which means that the network introduces no audible latency.

This is really great news for me, as now I know I can set up secondary machines anywhere and processing slaves if so necessary, and expect no more latency than what is usually introduced by JACK. Very cool indeed. I always thought that the speed used in wired ethernet networks could be used for something musical.

/Frank
Vox, Selmer, Yamaha and Leslie amplifiers. Rickenbacker, Epiphone, Ibanez, Washburn, Segovia, Yamaha and Fender guitars. Hammond, Moog, Roland, Korg, Yamaha, Crumar, Ensoniq and Mellotron keyboards. Xubuntu+KXStudio recording setup.
gimmeapill
Established Member
Posts: 564
Joined: Thu Mar 12, 2015 8:41 am
Has thanked: 44 times
Been thanked: 8 times

Re: JACK over ethernet network?

Post by gimmeapill »

Good to hear this net thing actually works with decent performance.
Still scratching my head about possible use cases though...

Cheers,

LX
Frank Carvalho
Established Member
Posts: 363
Joined: Sat Nov 17, 2012 3:36 pm

Re: JACK over ethernet network?

Post by Frank Carvalho »

The thing that really inspired me, was an article in the july 2015 issue of Sound-On-Sound, which has a review of the Waves/Digico Digigrid (http://www.soundonsound.com/sos/jul15/a ... gigrid.htm), and I thought, something like this got to be possible to do with Linux too.

The ethernet cable is inherently noise free. And these days everyone has a spare computer lying around unused, and ethernet cables and switches are a really cheap and simple way to replace multi cables. Remember, one ethernet cable could transport all my 20 audio channels and some MIDI channels with ease. And with less clutter.


/Frank
Vox, Selmer, Yamaha and Leslie amplifiers. Rickenbacker, Epiphone, Ibanez, Washburn, Segovia, Yamaha and Fender guitars. Hammond, Moog, Roland, Korg, Yamaha, Crumar, Ensoniq and Mellotron keyboards. Xubuntu+KXStudio recording setup.
rango
Established Member
Posts: 12
Joined: Tue Jun 09, 2015 9:55 pm

Re: JACK over ethernet network?

Post by rango »

Thanks Frank, for doing these tests. I have been interested in using Netjack and have been wondering some of the things you are learning. In my example, I have a laptop that is adequate for basic 8 analog channel recordings. I sometimes take it out for a remote recording (small rack for an 1818VSL). I have an old server that has more CPU and disk I/O I have re-purposed, but it is quite loud audibly. This is a good case for sticking the server in another room in the basement with gigabit ethernet. I am not interested in a remote interface at this point.

My general idea hopefully was to have the laptop be the master (it has the USB --> interface that fits my space best and multiple monitors in a dock). I hoped that the heavy lifting and more storage for larger projects take place on the secondary.

What's the best way to use the slave as the main storage, export an NFS share and use from the master? I have casually used NFS for years. I understand that you can tweak NFS data transfer buffer sizes, specified by the mount command options rsize and wsize, but have never done it. Is there a better protocol than NFS? NAS? No Windows involved, so no SMB needed. The old server has two NICs, so one is dedicated for the internal communication with the master, the second could be enabled only to get online for updates.

I was contemplating using a crossover cable instead of a switch to remove potential switch latency. These are both base installs from KXStudio with no extra services running. My hope was to be able to have a lighter rig for remote use, that back at home could interface with something with more horsepower.

Thanks!
Rusty old Bitcoins lying around? Dispose of them safely here:14hjbheQVki8eG75otRK4d2MQBarCCWQfJ
Frank Carvalho
Established Member
Posts: 363
Joined: Sat Nov 17, 2012 3:36 pm

Re: JACK over ethernet network?

Post by Frank Carvalho »

The recording setup I tested looked like this:
Laptop USB in --> JACK System in --> Master in --> eth --> Slave in --> Ardour 4
and monitoring goes the other way:
Ardour 4 --> Slave out --> eth --> Master out -->JACK System out --> Laptop USB out

Of course it's a bit easier with a fixed set of ins and outs on the two sides. Hence a script to start master and slave. And then it is easier to have for instance a Carla configuration to connect the laptops physical I/O to the net master I/O.
I have also found that on the slave side, the slave I/O is treated by other programs in exactly the same way as if it was an internal sound card. Therefore I have configured the same number of I/O for the slave as I have from the internal sound card. This means that opening an Ardour 4 project will connect audio to the slave sink in the same way it connects to the System I/O, and you can treat the netjack master I/O on the laptop as if you were communicating directly with the DAW.

Regarding the NFS thing, then I personally think that DAW traffic to the HD should be direct. Therefore send the sound through the network to the DAW, but let the DAW write directly to the local HD. In any case, if you were recording to an NFS filesystem, that would defeat the point of connecting to JACK over network. NFS is good for saving stuff of course, but I don't think it is fast enough to deal with DAW traffic.

BTW, last night I set up another stationary PC as a network sattelite. It has a simple M-Audio card, and only an SSD drive, to make it as quiet as possible. This PC will now be in my other room to server as a remote sound card server.

Edit: Oh yeah, so what about the DAW GUI. You will want that on the laptop. But the Linux solution is sooo simple; ssh -X to the slave, and start the DAW from the command line. X will provide the DAW GUI on your laptop! I took this for granted, so I didn't even mention it.

Edit, edit: Reading up on an older thread about NetJack, I was reminded that it may be worthwhile mentioning too, that my LAN uses a privat network segment, and that all my machines have static IP addresses. Machines should communicate pretty much directly to one another on a closed network.

/Frank
Vox, Selmer, Yamaha and Leslie amplifiers. Rickenbacker, Epiphone, Ibanez, Washburn, Segovia, Yamaha and Fender guitars. Hammond, Moog, Roland, Korg, Yamaha, Crumar, Ensoniq and Mellotron keyboards. Xubuntu+KXStudio recording setup.
Frank Carvalho
Established Member
Posts: 363
Joined: Sat Nov 17, 2012 3:36 pm

Re: JACK over ethernet network?

Post by Frank Carvalho »

Hi again
Here's another really odd observation I've made. I was trying to configure JACK on the secondary stationary PC to act as master and bridge to the network. So I was adjusting the buffer size, to minimize xruns. But strangely it did not improve things to use a large buffer. The larger the buffer, the more the CPU worked. With a buffer size of 1024 it maxed out at 100.0%, and the network stream became unusable. Instead I lowered the buffer size until CPU usage was down at 5-15%. I hit this mark at a buffer size around 64 to 128! (I got to be careful here, because the slave DAW must work with the same buffer size).
Apart from an uninterrupted network audio stream, this also happens to give the lowest latency. But I wonder why netjack2 has this "reverse logic" with respect to buffer size.

/Frank
Vox, Selmer, Yamaha and Leslie amplifiers. Rickenbacker, Epiphone, Ibanez, Washburn, Segovia, Yamaha and Fender guitars. Hammond, Moog, Roland, Korg, Yamaha, Crumar, Ensoniq and Mellotron keyboards. Xubuntu+KXStudio recording setup.
rango
Established Member
Posts: 12
Joined: Tue Jun 09, 2015 9:55 pm

Re: JACK over ethernet network?

Post by rango »

EDIT/del. Saw you have an updated thread, I'll check more there.
Rusty old Bitcoins lying around? Dispose of them safely here:14hjbheQVki8eG75otRK4d2MQBarCCWQfJ
Arthurx
Established Member
Posts: 77
Joined: Thu Oct 22, 2015 1:27 pm
Location: Holland
Has thanked: 1 time
Contact:

Re: JACK over ethernet network?

Post by Arthurx »

Hi Frank,

I also try to get it working over Ethernet. I have a master with 16 inputs. I also have 3 Linux sampler and a synth there. So I wanted to move all the synth s to a slave. I start with a bash script. But cannot set the slave to send 8 outputs to the master.

Do you maybe know how to do that? :D :mrgreen: :roll:
Greetings Arthur
"A mind is like a parachute -
It doesn't work if it's not open."
Frank Zappa

"Politics is the:
Clowning division of the army."
Zappa

http://www.arthurx.com
asbak
Established Member
Posts: 897
Joined: Thu Sep 11, 2014 3:04 pm
Has thanked: 71 times
Been thanked: 64 times

Re: JACK over ethernet network?

Post by asbak »

jackd -R -d netone -o8
Some Focal / 20.04 audio packages and resources https://midistudio.groups.io/g/linuxaudio
folderol
Established Member
Posts: 2072
Joined: Mon Sep 28, 2015 8:06 pm
Location: Here, of course!
Has thanked: 224 times
Been thanked: 400 times
Contact:

Re: JACK over ethernet network?

Post by folderol »

Have a look at zita-njbridge
The Yoshimi guy {apparently now an 'elderly'}
Arthurx
Established Member
Posts: 77
Joined: Thu Oct 22, 2015 1:27 pm
Location: Holland
Has thanked: 1 time
Contact:

Re: JACK over ethernet network?

Post by Arthurx »

Hi Asbak and Folderol,

I will test both. I also like the Zita verb. :D :roll:

Thanks Arthur
asbak
Established Member
Posts: 897
Joined: Thu Sep 11, 2014 3:04 pm
Has thanked: 71 times
Been thanked: 64 times

Re: JACK over ethernet network?

Post by asbak »

Frank Carvalho wrote:The thing that really inspired me, was an article in the july 2015 issue of Sound-On-Sound, which has a review of the Waves/Digico Digigrid (http://www.soundonsound.com/sos/jul15/a ... gigrid.htm), and I thought, something like this got to be possible to do with Linux too.
From SOS
Because Digigrid is a modular system, it can be configured in many different ways. The SoundGrid software is included with all hardware units, but Waves plug‑ins will need to be purchased separately. Pricing for the Digigrid interfaces is as follows (including VAT):

Digigrid MGB and MGO: £1260 each.
Digigrid DLI: £840.
Digigrid DLS: £2035.
Digigrid IOX: £1860.
Digigrid IOC: £2040.
Digigrid IOS: £2700.
Waves Horizon Plugins: $4000
I guess that hipster-tech is not priced for the plebs.

How fortunate that one can effectively get the same thing with Linux, Jack, some PC's and audio interfaces. Why pay more.
Some Focal / 20.04 audio packages and resources https://midistudio.groups.io/g/linuxaudio
Frank Carvalho
Established Member
Posts: 363
Joined: Sat Nov 17, 2012 3:36 pm

Re: JACK over ethernet network?

Post by Frank Carvalho »

Arthurx wrote:Hi Frank,

I also try to get it working over Ethernet. I have a master with 16 inputs. I also have 3 Linux sampler and a synth there. So I wanted to move all the synth s to a slave. I start with a bash script. But cannot set the slave to send 8 outputs to the master.

Do you maybe know how to do that? :D :mrgreen: :roll:
Greetings Arthur
Hi

This is my netjack2slave.sh script:

Code: Select all

#!/bin/bash

# Script to start daemon making this machine JACK slave
# Network latency is near 0, even with 20 channels I/O
# Latency is added by the sound cards at either end.

JDPID=`ps -ef | grep "/usr/bin/jackd" | gawk '{print $2}'`
PAPID=`ps -ef | grep "pulse" | gawk '{print $2}'`
if [ "$JDPID" ]
then
  kill -9 $JDPID
fi
if [ "$PAPID" ]
then
  kill -9 $PAPID
fi
/usr/bin/jackd -R -d net -C 20 -P 20 -i 12 -o 10 &
sleep 5
alsa_in  -j local_in  -d hw:0 -c 12 -r 48000 &
alsa_out -j local_out -d hw:0 -c 10 -r 48000 &
sleep 1
jack_connect system:capture_1 local_out:playback_1 
jack_connect system:capture_2 local_out:playback_2
jack_connect local_in:capture_1 system:playback_1
jack_connect local_in:capture_2 system:playback_2
PID=`ps -ef | grep "/usr/bin/jackd" | gawk '{print $2}'`
echo "jackd pid=$PID"
PID=`ps -ef | grep "alsa_in" | gawk '{print $2}'`
echo "alsa_in pid=$PID"
PID=`ps -ef | grep "alsa_out" | gawk '{print $2}'`
echo "alsa_out pid=$PID"
Pretty rough script, that will brutally kill pulseaudio and other jack demons. But the key command line is:

Code: Select all

/usr/bin/jackd -R -d net -C 20 -P 20 -i 12 -o 10 &
which provides a slave instance with 12 channels in and 10 out. 12/10 is an M-Audio 1010 thing, so adjust to -i 8 -o 8. the -C and -P options are for MIDI I think.

But before this one is started, the master machine must announce itself, so run a script like this first on the master:

Code: Select all

/usr/bin/jackd -R -d net -C 20 -P 20 -i 12 -o 10 &
Edit: Wrong script. See my next post.

And askbak: Yeah! Exactly! Those price tags really made me happy to use Linux!

/Frank

/Frank
Last edited by Frank Carvalho on Thu Jan 07, 2016 10:01 pm, edited 1 time in total.
Vox, Selmer, Yamaha and Leslie amplifiers. Rickenbacker, Epiphone, Ibanez, Washburn, Segovia, Yamaha and Fender guitars. Hammond, Moog, Roland, Korg, Yamaha, Crumar, Ensoniq and Mellotron keyboards. Xubuntu+KXStudio recording setup.
asbak
Established Member
Posts: 897
Joined: Thu Sep 11, 2014 3:04 pm
Has thanked: 71 times
Been thanked: 64 times

Re: JACK over ethernet network?

Post by asbak »

Frank Carvalho wrote: But before this one is started, the master machine must announce itself, so run a script like this first on the master:

Code: Select all

/usr/bin/jackd -R -d net -C 20 -P 20 -i 12 -o 10 &
/Frank
Hi Frank, how do you monitor audio if the Slave and Master are both set to use net?
Some Focal / 20.04 audio packages and resources https://midistudio.groups.io/g/linuxaudio
Post Reply