Netjack2 or how to expand your studio

Post fully complete "how to" guides and tutorials here. This is a great place to get feedback on stuff you might put in the wiki.

Moderators: khz, MattKingUSA

thorgal
Established Member
Posts: 739
Joined: Mon Apr 07, 2008 6:04 pm

Netjack2 or how to expand your studio

Postby thorgal » Sun Apr 12, 2009 3:02 pm

Hello, here is a non exhaustive account of my experience with netjack, in particular netjack2. Netjack has been around for quite some time, and it works fine. But having switched to jack2 (aka jackmp), I will talk about netjack2, a rewrite of netjack in the context of jackmp. The great advantage of netjack2 is that it is multiplatform, I have tested it on linux AND windows XP :)

Unfortunately (or not) for linux newbies, if you want to try things out, you'll need to be comfortable with compiling stuff, terminal commands, but it should not be such a big hassle. Anyway, fear not, you're dealing with linux and we like to have our hands dirty :) that's how we learn, and knowledge is power, isn't it ? :D

So, a few prerequisites:
- you have a stable and good system (RT kernel, good jack stability in RT mode, etc)
- you are part of a local network, gigabit would be best
- you have an extra PC running linux or winXP, that is RT and jack enabled if running linux

Goal: transform your normal DAW into a master netjack server, your extra PC into a netjack client communicating with the master server via the network. The idea is that we can decouple some of the DSP, so we share the load between the server and client, instead of having one single monolithic DAW that does everything.

Use cases:
- VSTs running on the winXP client, audio coming from the master, processed by the client and returned to the master. Of course, this implies some latency so this is not meant as a live setup :)
- VSTis running on the master server (thanks to wine), MIDI sequencer running on client, streaming out MIDI events to master server, triggering the VSTis.
- etc, you can think of others

Let's get to it. I will first describe the linux-2-linux case. I'll get to the windows client later.

I - Building and installing jack2 svn: LINUX server and client
Get the latest jack2 code from svn (make sure you have subversion, and build-essential installed on debian based systems) and you have a directory where you can check out source code from the net. I will call the latter 'src' and located in the home directory for the sake of the post):

Code: Select all

cd
mkdir src
cd src
svn co http://subversion.jackaudio.org/jack/jack2/trunk/jackmp jack2_svn
cd jack2_svn
./waf configure --prefix=/usr
./waf build


let's not install yet. I am sure you have some jack packages installed. Now, don't get to worried about the following, we will simply remove it (be careful here, I am removing stuff from a sensitive area so don't screw up with the * symbol):

Code: Select all

sudo rm -fr /usr/lib/jack/*
sudo rm -fr /usr/lib/libjack*.so.*
sudo rm /usr/bin/jack*


Note that I am not removing the /usr/lib/libjack.0.100.0 symbolic link (if you have it). On debian systems, this useless stuff still lies around, which is really stupid as some packages still depend on it (for nothing) but one day, this crap will disappear.

So, why am I doing this in such a brute way ? because if you try to uninstall jack (in particular libjack) via apt-get or whatever package manager you normally use, it may want to remove most of your jack apps (ardour, rosegarden, etc ..., and we don't want that, do we ? :) )
Well, there may be some clever options to 'apt-get remove' but I don't know them. And anyway, if the newly compiled jack does not fulfill your needs, you can always reinstall jackd, libjack, etc (e.g. 'sudo apt-get install --reinstall jackd').

OK, so your packaged jack is out of the way, so we can install jack2_svn:

Code: Select all

sudo ./waf install


Do this on both the soon to be netjack2 master server and linux client.

II Run the stuff on the master server
1- from the command line
Let's be a bit conservative (not low latency). Note: replace with options that make sense to you (sample rate, hw and backend driver). E.g.:

Code: Select all

/usr/bin/jackd -S -R -P70 -dalsa -dhw:1 -r96000 -p1024 -n2 -s -Xseq

Also note the -S option to jackd. This is important (synchronization option).

If it goes well and starts up fine, we will do another thing. Open another terminal and type:

Code: Select all

jack_load netmanager


This in-process client will listen to broadcast messages from potential netjack clients.

2- from qjackctl
In my qjackctl config, I have this in-process client call in the setup Options under the field "Execute script after startup". So when I launch jackd through the GUI, it executes this post-command. In fact I have a little more than this under this option:

Code: Select all

jack_load netmanager; a2jmidid&

a2jmidid is a useful "daemon" that will expose the legacy ALSA MIDI ports to the jack MIDI scope. Some apps do not use the jack MIDI API to expose their MIDI ports, so a2jmidid will do it for you. That's only if you want to stick to jack only for ALL routing, including MIDI.

As you understand by now, you can easily stuff the qjackctl config with all this. In the setup window, make sure that the "Server path" contains 'jackd -S', not 'jackd' only.

For a2jmidid, you can always get it and compile / install it:

Code: Select all

cd; cd src
svn co svn://svn.gna.org/svn/a2jmidid/code a2jmidid
cd a2jmidid
./waf configure --prefix=/usr # you can have it in /usr/local as well if you want
./waf build
sudo ./waf install


III Run the stuff on the netjack linux client
So you compiled and installed jack2_svn on the client as well, and now comes the moment of truth. Open a terminal and type:

Code: Select all

jackd -R -P 70 -S -d net -t -i 1 -o 1 -m slow


explanations:
-R = RT mode
-P 70 = RT priority level of the jackd RT thread
-d net = using the net backend
-t = synchronize transport with master (aka jack1 transport slave mode)
-i 1 = declaring one MIDI capture port
-o 2= declaring one MIDI playback port
-m slow = slow mode (most safe). You can read about supported modes here: http://trac.jackaudio.org/wiki/WalkThro ... r/NetJack2.

You should see something going on in the master message window in qjackctl. Assuming all is cool and dandy, fire up qjackctl on the netjack client. Hopefully, you won't have the automatic startup option turned on as we already have jackd running from the terminal by now. We use qjackctl here for the connection window. You should see some stuff in the audio and MIDI tab.

On the server side, look at the client ports in the connection window, now you see the client name, and the audio ports, but also in the MIDI tab.

IV Quick test that things are running fine
Say you have your EL guitar plugged to the master server, and it shows up at system:capture_1 in the qjackctl connection window. In case you have hardware monitoring, disable it. Connect system:capture_1 to netjackclient:playback_1 and netjackclient:playback_2.

On the client, connect system:capture_1 and 2 directly to system:playback_1 and 2.

back on the server, connect netjackclient:capture_1 and 2 to system:playback_1 and 2 (assuming your studio speakers are connected to system:playback_1 and 2 on the master server).

Now play :)

Enable hardware monitoring on the master server, and play again with the connections still on. You will hear the latency introduced, like a simple delay line effect.

So, can you visualize the journey of the audio signal ? :)

V Running something cool from there
OK, now, on the master, let's say you open up a soft synth (VST or native), that has a MIDI playback port exposed in the MIDI tab in qjackctl (right hand side window). Connect that port to the client MIDI capture port (located on the left hand side window).

Now, on the client, open up a MIDI sequencer like qtractor or rosegarden, import some MIDI file or open a current project of yours. In the MIDI tab of qjackctl, connect the MIDI capture port of your sequencer to the system MIDI playback port (you have created one when you launched jackd from the terminal, remember ?). Now start the sequencer. It will send MIDI events to the system playback port, which is in fact the netjack backend. The latter will stream the MIDI events through the network to the master server. The in-process netmanager will redirect it to the netjack client MIDI capture port visible in the MIDI tab, which is in turn connect to the soft synth MIDI playback port. If all went well, you should hear something. So the netjack client is doing the sequencing, while the master is doing the audio. Isn't that neat ? :D:D

Next episode: windows client!!
Teaser: I could sequence a drum VSTi from the sequencer Mixcraft 4.5 (by Acoustica, 14 days free trial, it was just a proof of concept so I don't care too much but it looks like a cool app, a bit like OSX Garage-Band) and send the audio of the VSTi to the linux master sever running ardour and jamin.
Last edited by thorgal on Sun Apr 12, 2009 3:24 pm, edited 2 times in total.

thorgal
Established Member
Posts: 739
Joined: Mon Apr 07, 2008 6:04 pm

Re: Netjack2 or how to expand your studio

Postby thorgal » Sun Apr 12, 2009 3:08 pm

I forgot to mention: I also tried the windows test from a virtual machine (virtualbox) running on my main linux DAW. This works but is unreliable as the virtual machine is heavily taxing the CPU and RAM. Not really an option unless you have a very beefy master server. But at least, it's a potential neat way to have sound out of your virtual machine (no need of pulseaudio or OSS, just netjack :) )

User avatar
studio32
Established Member
Posts: 2370
Joined: Mon Apr 07, 2008 5:09 pm

Re: Netjack2 or how to expand your studio

Postby studio32 » Sun Apr 12, 2009 3:53 pm

Sounds cool, thanks a lot for sharing.

So it could be useful for using VST on an Windows OS client?

And what about using AU plugins on Mac OSX connected by netjack2 with GNU/Linux?

And could it be useful for mastering with Ardour and JAMIN? To have the Ardour and JAMin session on different pc's? To share some CPU load?

thorgal
Established Member
Posts: 739
Joined: Mon Apr 07, 2008 6:04 pm

Re: Netjack2 or how to expand your studio

Postby thorgal » Sun Apr 12, 2009 4:21 pm

absolutely, you can think of many use cases.
About jamin - ardour, I don't know how you use it but I tend to use it when a session has been mixed down to avoid loading the CPU, especially if there are software effects on all your tracks. But if you really want, netjack would definitely help here.

By the way, I am really thinking about merging jamin into ardour so we would have a new window, apart from the editor and mixing, namely a "mastering window". You would be able to visualize the frequency of the master bus in realtime, draw a frequency curve to be applied to the master bus, etc.

So basically, the jamin main window would be the same but in ardour style, with side frames where you can select tracks, busses or groups (like the mixer window) to be either soloed or muted. You could bypass the whole mastering effects, and only leave the visualization of the frequency during transport. I think that would be neat. I have to talk to Paul Davis about this and dive into ardour's code, convert jamin's code into C++, etc. That's quite a project but if this idea is interesting to the community and ardour's main developer team, I wouldn't mind doing it during some spare time.

User avatar
studio32
Established Member
Posts: 2370
Joined: Mon Apr 07, 2008 5:09 pm

Re: Netjack2 or how to expand your studio

Postby studio32 » Sun Apr 12, 2009 5:12 pm

Sounds like an amazing idea Thorgal! Could be very useful for Studio work on GNU/Linux! JAMin is from 2005 AFAIK (edit: it's 1995 I think ....), so some work on mastering on GNU/Linux would be good imho...

User avatar
studio32
Established Member
Posts: 2370
Joined: Mon Apr 07, 2008 5:09 pm

Re: Netjack2 or how to expand your studio

Postby studio32 » Wed May 27, 2009 5:17 pm

There seems to be an version for Windows out:
http://netjack.sourceforge.net/

User avatar
studio32
Established Member
Posts: 2370
Joined: Mon Apr 07, 2008 5:09 pm

Re: Netjack2 or how to expand your studio

Postby studio32 » Fri Jun 12, 2009 8:56 am

Another interesting thing about this... we could benefit as a community. Let say someone has the pianoteq VST and some other has nice GIG files or some pretty good hardware..... others can 'rent' that via netjack :)

User avatar
spm_gl
Established Member
Posts: 358
Joined: Wed Apr 22, 2009 7:58 am
Location: Spreewald, Germany
Contact:

Re: Netjack2 or how to expand your studio

Postby spm_gl » Sun Jun 21, 2009 12:17 pm

Does anyone have any real-world latency numbers for netjack? I'm seiously considering setting up a netbook or barebone as a pure metering system, and would love to connect it to the mastering computer via netjack.
--- Spreemusik ---
Jan Fuchsmann, Audio Engineer
Check our blog at http://www.spreemusik.com/blog

User avatar
studio32
Established Member
Posts: 2370
Joined: Mon Apr 07, 2008 5:09 pm

Re: Netjack2 or how to expand your studio

Postby studio32 » Sun Jun 21, 2009 1:50 pm

spm_gl wrote:a pure metering system

What's that?

thorgal
Established Member
Posts: 739
Joined: Mon Apr 07, 2008 6:04 pm

Re: Netjack2 or how to expand your studio

Postby thorgal » Sun Jun 21, 2009 2:04 pm

best thing to do is to feed the netjack client with an audio signal from the master and feed back the master server from the client for output.

Depending on your master server setting, you will feel some latency or not. I had good results with netjack1. Netjack2, for some mysterious reasons, was not performing as good as netjack1. However, if you use an MS windows client you will need jack2 on the client.

Torben H. has a netjack1 driver for windows as well but the master server will need to run jack1. I don't know what your preference is. I find jack2 better than jack1 as a server in general. And the netjack2 stuff is easier to set up than with netjack1 (but netjack1 is not difficult to set up either).

I forgot to mention that with netjack1, I could run some decent low lat (1~2ms).

User avatar
spm_gl
Established Member
Posts: 358
Joined: Wed Apr 22, 2009 7:58 am
Location: Spreewald, Germany
Contact:

Re: Netjack2 or how to expand your studio

Postby spm_gl » Sun Jun 21, 2009 2:36 pm

studio32 wrote:
spm_gl wrote:a pure metering system

What's that?

Basically a computer that acts as a meterbridge/analyzer/goniometer.
It would be a one-way feed, no need to send audio back to the master. Up to 10ms would be okay, another 12 or so are added to the display by the TFT, and some processing overhead. So if you've managed to get 1-2ms, that is perfect.
I'm trying to get a friend to make a quick hack, basically sticking all sorts of existing metering plugins/programs together into one interface. I'll let you know if we make any progress.
--- Spreemusik ---
Jan Fuchsmann, Audio Engineer
Check our blog at http://www.spreemusik.com/blog

thorgal
Established Member
Posts: 739
Joined: Mon Apr 07, 2008 6:04 pm

Re: Netjack2 or how to expand your studio

Postby thorgal » Sun Jun 21, 2009 3:04 pm

about the metering app, that is also a project I have in mind.

I want to have a jack client that can autodetect the jack graph states, listen to readable ports and display levels, wave form scrolling, stereo phase, etc, in a neat way (tabbed apps, etc).
I had already hacked meterbridge to do so but it was more as a proof of concept. I want spend more time in the design of such an app.

User avatar
spm_gl
Established Member
Posts: 358
Joined: Wed Apr 22, 2009 7:58 am
Location: Spreewald, Germany
Contact:

Re: Netjack2 or how to expand your studio

Postby spm_gl » Sun Jun 21, 2009 3:11 pm

Could you share your hacked meterbridge? My programmer ist rather busy with exams at the moment, but somehow I always manage to convince him to spend an hour or two on my projects,
--- Spreemusik ---
Jan Fuchsmann, Audio Engineer
Check our blog at http://www.spreemusik.com/blog

thorgal
Established Member
Posts: 739
Joined: Mon Apr 07, 2008 6:04 pm

Re: Netjack2 or how to expand your studio

Postby thorgal » Sun Jun 21, 2009 3:42 pm

mmm, what I did was really no big deal:
I removed all fancy display types except 'dpm'. Then I listened to the graph with a callback function for jack port registration, etc, filter out port types I don't care about (I only cared about readable audio ports from external clients, including system ports), etc.

The code does not exist any longer since I want to design my app in qt4-designer for the GUI and think about the class hierarchy for the non GUI part. Meterbridge is using some SDL library stuff and I found it OK for meterbridge itself but I don't think it is suitable for a more ambitious app like an all-in-one jack monitoring app.

User avatar
spm_gl
Established Member
Posts: 358
Joined: Wed Apr 22, 2009 7:58 am
Location: Spreewald, Germany
Contact:

Re: Netjack2 or how to expand your studio

Postby spm_gl » Sun Jun 21, 2009 3:56 pm

It works! I'm listening to "Battery 9" on my graphics workstation, and watching the goniometer on my netbook. Huge delay, probably around 100ms, but thats because neither use RT, have on-board sound chips, and I was very conservative with the jack settings. But it works!!! You just made my day with your how-to.

Edit: The netbook is only connected through a slow wireless connection.
--- Spreemusik ---
Jan Fuchsmann, Audio Engineer
Check our blog at http://www.spreemusik.com/blog


Return to “HOW TOs, Tips & Tricks”

Who is online

Users browsing this forum: No registered users and 1 guest