thuneau.com support :: View topic - Universal internal audio routing for Allocator/Alloclite
 Main Page  |  Register  |  FAQ  |  Search  |  Memberlist  |  Usergroups  |  Log in 
Reply to topic
 Universal internal audio routing for Allocator/Alloclite 
Site Admin

Joined: 29 Jan 2006
Posts: 545
Reply with quote
I have been playing with Jack for Windows, which is now in version 1.9 with 2.0 supposedly just around the corner.
It's open source project that started in Linux and spread to Mac and Windows. It is a virtual sound card/router that lets the users send audio between applications.
The current release is 1.9 and the complete package (binaries for all operating systems and source code) are available from here:
http://www.grame.fr/~letz/jackdmp.html
It's a fairly large package- 20MB+

I extracted the Windows installer and saved it to this website:
www.thuneau.com/jack4win.zip

The program does what it promises, but it requires manual setup of signal flow on every startup. There is a little control app that makes it straight forward, but it takes time every time you restart the computer.
In order to make my life easier I scripted the startup of Jack, Foobar, Allocator and their connections.

Here is how I run it. You will need to edit some commands to match your paths and names of ASIO devices.

EDIT: if you follow the directions below, you will end up with fully ready to go audio computer that performs playback of your audio and crossover processing- every time you boot it up. Just point to your music of choice and hit play. That's how my little Allocator machine now runs.


1. After installing Jack you need to tell it to create enough channels for your system. This is done by editing JackRouter.ini in the jack install directory (By default C:/Program Files/Jack v1.90).
Open JackRouter.ini in your text editor (Notepad or Wordpad will do just fine) edit it to:

Code:
[IO]
input=2
output=8

[AUTO_CONNECT]
input=0
output=0


and save it.
By default Jack installs with 4 channels input and 4 channels output per application. We need to send stereo audio to Allocator and need up to 8 channels to send to sound card.
Also, by default Jack connects everything it sees as a valid client. We don't want that, as your full range signal will hit the sound card if you leave the default on.

The first time you start Jack you want to use the Jack Control application to set default drivers, buffers and some parameters. After that we will run it in background.
Open Jack Control and hit Setup:




Make sure you select portaudio as Driver type,
Find your ASIO card in Interface menu (click on the > button)
For Allocator use long buffer (called Frames/Period). For Allocator Light, you can do short buffer.
Select sample rate,
make sure Realtime is checked
Click OK.
Close Jack Control



I start Jack with the following command:

jackd.exe -S -R -dportaudio -dASIO::"ASUS Xonar D2 ASIO" -r44100 -p4096

(Replace the name of your ASIO card to match your system you can also start it with different sample rate and buffer size).
Make sure to type the name of your card exactly as it appears in Jack Control- spaces and capital letters are important.

Save the command in your text editor as startjack.bat in your Jack v1.90 directory.
* If you just double click on it Windows will quickly start Jack and then promptly close it. We want it to stay open so that we can use it.

Here is a workaround:
create a shortcut to the startjack.bat (right mouse button drag> create shortcuts here).
Right click on the shortcut you just created and select Properties

in Target box add the following to the beginning:
C:\WINDOWS\system32\cmd.exe /K

The whole line looks like this:
C:\WINDOWS\system32\cmd.exe /K "C:\Program Files\Jack v1.90\startjack19.bat"

(this opens command window, the switch /K makes it not exit when the batch file is done)

Still in Properties, the box "start in" should read: "C:\Program Files\Jack v1.90"
Click OK




Now you can place the shortcut in your Startup Folder.
This will create Jack router every time you reboot your machine.

Now we need to start our media player (I use Foobar because it has ASIO output- but Winamp is good too), Allocator (or Allocator Light) and connect them

So I run a Visual Basic script to do this. In my case it looks like this:

Code:

Option Explicit
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")

WScript.Sleep 5000

WshShell.Run """C:\Program Files\foobar2000\foobar2000.exe"" /command:Open C:/silence.wav", 1, False

WScript.Sleep 1000

WshShell.Run """C:\Documents and Settings\Jan\Desktop\Allocator1.0.15\Allocator.exe""", 1, False

WScript.Sleep 3000

WshShell.Run """C:\Documents and Settings\Jan\Desktop\connect""", 1, False


Here is what it does:
1. It waits 5 seconds (5000 milliseconds) for Jack to be in place. (it probably can be shorter, but 5 seconds is safe)
2. It starts Foobar and it plays 10 seconds long silence wave. This is there because Foobar ASIO output is invisible to Jack unless actual audio is playing. It's a bug in the module itself and I will try to contact the author to maybe update the driver. 10 seconds is long enough to establish the Jack connection, which then stays in memory even if playback is stopped. (I created the silence.wav by recording 10 seconds of nothing using Windows Sound Recorder, but it can really be any audio file that Foobar can play)
3. It waits 1 second
4. it starts Allocator
5. It waits 3 seconds for Allocator to be established
6. Runs connect script (*see below) which makes our audio flow the way we want it to.

You can copy the script above and edit it in a text editor to match your machine's paths and file names. Save it as startup.vbs (or any other name of your choice as long as it has the vbs extension) and put it in your Startup folder (C:\Documents and Settings\*user name*\Start Menu\Programs\Startup). Also accessible from Start>All Programs menu.


Before you create and save the connecting bat file, run Jack Control program and select Connect to work out all your desired connections. Something like this:



Below is the actual batch file that makes the actual connections on my machine. Again, you might need to tweak it to connect to your sound card the way you want it to.

Code:

jack_connect "foobar2000:out1" "Allocator:in1"
jack_connect "foobar2000:out2" "Allocator:in2"
jack_connect "Allocator:out1" "system:playback_3"
jack_connect "Allocator:out2" "system:playback_4"
jack_connect "Allocator:out3" "system:playback_1"
jack_connect "Allocator:out4" "system:playback_2"
jack_connect "Allocator:out5" "system:playback_5"
jack_connect "Allocator:out6" "system:playback_6"
jack_connect "Allocator:out7" "system:playback_7"
jack_connect "Allocator:out8" "system:playback_8"


Save this (after possible tweaking of numbers and names) as connect.bat in your Jack v1.90 directory
Create a shortcut to it on your desktop (right mouse button drag) and rename it to connect (skipping the .bat extension). VB Shell doesn't like .bat files for some reason. But it's happy triggering a shortcut to one. So that's why the shortcut has a simple name and is not a .bat file itself.


IMPORTANT:

In order for all this to work, you will need to install ASIO output in your Foobar ( http://www.foobar2000.org/?page=Download ) and set it as default output with JackRouter as the sound card.
Also, set up Allocator (actually VSTShell) with JackRouter as the sound card.
While working out the connections, keep the amps off or way down to protect your precious tweeters

Last little tip to keep things neat is to install Trayit ( http://www.teamcti.com/trayit/trayit.htm ) and teach it to minimize Jack command window and Allocator to tray immediately after they start. Do it after your system starts flawlessly every time. You don't want to keep going back to the tray to close things that don't work yet the way you want them to.
Ask questions below.

Good luck!

EDIT:
Follow up:

I had a few questions from people who had trouble getting Jack to work.
The one thing that's always the problem is a Microsoft C++ redistributable library that has to be installed on the machine in order for jack to work.
It's mentioned in Jack's README file, but many people don't look for it.
So, I added the installer from MS to the jack archive on my website.
But, it's probably best to grab it from MS directly. Here is the link:
http://www.microsoft.com/downloads/details.aspx?FamilyID=9b2da534-3e03-4391-8a4d-074b9f2bc1bf&displaylang=en


Last edited by thuneau on Sun Mar 01, 2009 5:30 pm; edited 1 time in total
View user's profile Find all posts by thuneau Send private message Send e-mail
  


Joined: 28 Dec 2008
Posts: 1
Reply with quote
Ok, I'm trying to make this work.

How do I configure foobar for ASIO? I have installed the plugin. As output device I've selected DS : FW 410 Multi. There's no mention of ASIO there anymore.

Maybe you can post some screenshots of the Configure window?

My soundcard is a M Audio Firewire 410. When I first configured Jack I chose ASIO::"M-Audio FW ASIO" (that's in the startjack.bat batchfile). Now, I can no longer select it in the setup of Jack. I can only choose MME::FW 410 Multi

What's going on? Something fishy with my ASIO drivers?

And in the Jack Audio Connection Kit window I only have 'system' in both Readable Clients and Writable Clients.

I'm doing something wrong. I can't figure it out myself. I have no experience with ASIO and these complicated soundcards.

Please help!
View user's profile Find all posts by FrancoB Send private message
  
Site Admin

Joined: 29 Jan 2006
Posts: 545
Reply with quote
Hi Franco,
ASIO is not that complicated. It's just a type of driver that makes professional connections and setup a bit easier and more precisely defined. As long as the applications and the sound cards are set up to the same sampling frequency it all tends to just work.

Here is the important part from my post:

In order for all this to work, you will need to install ASIO output in your Foobar ( http://www.foobar2000.org/?page=Download ) and set it as default output with JackRouter as the sound card.
Also, set up Allocator (actually VSTShell) with JackRouter as the sound card.


So, install ASIO output in Foobar.
Start your Jack. (Make sure you have defined inputs and outputs to Jack in the Jackrouter.ini file as described in the original post above.)
Then in Foobar's Preferences, under Output select ASIO: Jack Router as the sound card.
Still in Foobar Options, go to ASIO Virtual Devices menu and configure Left and Right output of Foobar to be Jack input 1 and 2.
In Allocator also set up Jack to be the sound card. Inputs jack Router 1 and 2, outputs Jack Router 1-8
Then copy/edit the script and batch files I gave examples of (saving them in correct spots) and restart your computer. Everything should fall in place.
If it doesn't, post them here and we will see what might be preventing them from running.
It would be good also if you posted some screen shots of your Foobar, Allocator and Jack settings.

*To capture a screen shot of a window, make sure it's in focus, then press Alt and Print Screen buttons on your keyboard simultaneously. This will copy a picture of the active window in your memory. Open a graphic app such as Paint and paste the picture in new document (press Control and V simultaneously).
Then save the picture as jpg, gif or png and post it to a picture hosting website such as imageshack.us. Then post the link to it here. This way we can see what you are doing and help you correct any possible wrong settings.
Hope this helps.

Jan
View user's profile Find all posts by thuneau Send private message Send e-mail
  


Joined: 28 Oct 2006
Posts: 16
Reply with quote
Hi Jan,

Will this setup work with single client ASIO drivers such as the Lynx driver?

Thank you,
Alan
View user's profile Find all posts by aljordan Send private message Visit poster's website
  
Site Admin

Joined: 29 Jan 2006
Posts: 545
Reply with quote
aljordan wrote:
Hi Jan,

Will this setup work with single client ASIO drivers such as the Lynx driver?

Thank you,
Alan


Yes it should work just fine. The only software accessing your Lynx would be Jack Router. All the other apps talk to Jack directly and not to the Lynx.
View user's profile Find all posts by thuneau Send private message Send e-mail
  


Joined: 28 Oct 2006
Posts: 16
Reply with quote
Another thing to keep in mind about Jack is that the latest versions also come with Netjack2, which allows you to wire up sound between multiple computers on a wired network. Using Jan's tutorial above, and the walk through found at http://trac.jackaudio.org/wiki/WalkThrough/User/NetJack2 , I set up the Thuneau Allocator to work across a network. This allowed me to keep my somewhat noisy high powered computer, which contains my music library and is capable of upsampling and running the Allocator, out of the listening room. I can now keep a low powered quiet computer in with my stereo system.

The system which runs the Allocator doesn't have to have a multi-channel sound card in it (nor any sound card for that matter). In my setup, the low powered computer in the listening room has the sound card, is headless, has very little memory, a minimal operating system, and with a small solid state drive is completely silent.

Basically, the low power computer in the listening room starts an instance of a Jack server acting as a master, then loads the jack net manager. The computer that runs the Allocator starts an instance of the jack server using the net driver instead of a specific sound card driver, and connections are made similar to those in Jan's tutorial. The jack server on the Allocator box will automatically become a slave to the PC in the listening room with no furher configuration. Next, at the master PC in the listening room, the outputs from the Allocator box have to be wired to specific channels of the multi-channel sound card.

The only part of this which requires a manual process is that the jack startup order between the computers has to be in a specific order. First start the master server, then start the slave server and make connections on the slave server, then make connections back on the master server.

The commands on the master server in the listening room with the multi channel sound card would look something like this:

Code:
 
  jackd -R -d alsa --device hw:1 --rate 44100
  jack_load netmanager


Note that the above jackd command is on a Linux system. On a Windows system the jackd command would look like that in Jan's tutorial, and would require the -S flag.

Then on the slave server containing the music library and running Allocator (note that you don't have to set the buffer size here):
Code:
 
  jackd.exe -R -S -d net -C 2 -P 8

(make connections as outlined in Jan's tutorial...)
Note that the driver on the slave machine is the not driver, not a specific portaudio and sound card driver. Also, the -C flag is number of input ports, and the -P flag is number of output ports.

Then back on the master, make connections from the slave to the output channels pertaining to your sound card: (note that AMD-64 would be replaced with the network name of your slave PC)
Code:
 
  jack_connect AMD-64:from_slave_1 system:playback_1
  jack_connect AMD-64:from_slave_2 system:playback_2
  jack_connect AMD-64:from_slave_3 system:playback_3
  jack_connect AMD-64:from_slave_4 system:playback_4
  jack_connect AMD-64:from_slave_5 system:playback_5
  jack_connect AMD-64:from_slave_6 system:playback_6
  jack_connect AMD-64:from_slave_7 system:playback_7
  jack_connect AMD-64:from_slave_8 system:playback_8


John Swenson mentioned that he hacked the Jack net manager code to automatically make connections from a slave device once the slave made a connection to the master. This will hopefully make it into the code line of a future jack build. If it does, the only order that would matter would be starting the master pc before the slave pc. Everything else could be scripted.

I've been listening to this system with a three way Allocator /Arbitrator crossover set up on the slave, sending output to a multichannel sound card on the master over the network and I haven't heard a single hicup. It performs very well. Also, Jack can be used on Windows, Mac, and Linux, so as long as you run Allocator on Windows, you have more choices about what you run in the listening room.

Alan
View user's profile Find all posts by aljordan Send private message Visit poster's website
  
Site Admin

Joined: 29 Jan 2006
Posts: 545
Reply with quote
Thanks Al for the heads up on Net Jack.
I haven't tried it, but meant to a while ago. Glad it all works as intended.
View user's profile Find all posts by thuneau Send private message Send e-mail
  


Joined: 23 Aug 2009
Posts: 9
Reply with quote
Holy Complicated. I have not seen this tutorial yet (sorry, stickies always become invisible). I'm going to try this out when I get a chance tomorrow and see how it works out. I didn't think this was going to be so involved. I was kind of hoping for a download and go program not a download and download other programs and make things work with each other program.
View user's profile Find all posts by McDizzle Send private message
  
Site Admin

Joined: 29 Jan 2006
Posts: 545
Reply with quote
It's not complicated if you use soundcard the way Windows forces you to. Audio appears at the inputs, gets processed and comes out the outputs.
Only internal routing is complicated, because it attempts something that Microsoft has not provided for.
As I answered in the other topic you started, some sound cards can serve as a router for audio streams.
Emu, MAudio, RME, Asus (Xonar D2) and a few others can do it.
Jack is perfect for the sound cards that can't route audio within their drivers.
View user's profile Find all posts by thuneau Send private message Send e-mail
  


Joined: 23 Aug 2009
Posts: 9
Reply with quote
It's not overly complicated once you know what you have to do. The problem lies in thinking "oh, I will download this program and try it out" thinking it will be a 5 minute thing that will either catch you interest or send you on your way. Now I'm still in the process of this tutorial and I started thinking to myself what average audio guy with little computer skills would be able to figure this out? This is pretty intense for the average user. If I could make a suggestion it would probably be to have a player embedded that automatically works with the processing software.

Don't get me wrong with my criticism there is strong praise, the reason I am still perusing this program is because it looks great and you seem like a great programmer that really has a great handle on this. The program looks marvelous enough to try and I am willing to go through the trouble. Just know that the average bloke will not. Heck, during the setup of this I had thought more than once of just going out and buying a crossover. I only need 2 channels out.

Keep up the good work though, it's nice to see some people still know a thing or two about what the heck they are doing Wink

I'll let you know how I make out
View user's profile Find all posts by McDizzle Send private message
  


Joined: 07 Jan 2011
Posts: 1
Reply with quote
Old program but very useful for now too.
astigmatism
View user's profile Find all posts by tari Send private message
  


Joined: 01 Mar 2006
Posts: 35
Reply with quote
How are the clocks synched with NetJack? Ideally, you'd want the crystal clock in the computer that outputs the analog signals to become the master.
View user's profile Find all posts by capslock Send private message
  


Joined: 14 Jun 2011
Posts: 14
Reply with quote
This all generally works OK, with one update: on Windows (XP), all you need to do to start Jack is to run qjackctl.exe, and it runs with the same settings as the last time it ran. I therefore just added a command into the vbs script file to run Jack this way, and so everything is in one file. trying to run Jack from jackd.exe was causing problems, for some reason.
View user's profile Find all posts by amdismal Send private message
  


Joined: 13 Feb 2012
Posts: 1
Reply with quote
amdismal wrote:
This all generally works OK, with one update: on Windows (XP), all you need to do to start Jack is to run qjackctl.exe, and it runs with the same settings as the last time it ran. I therefore just added a command into the vbs script file to run Jack this way, and so everything is in one file. trying to run Jack from jackd.exe was causing problems, for some reason.


As I am only using Windows XP, this is the solution I was looking for. Many thanks!

Darel
Zquiet
View user's profile Find all posts by darjon Send private message
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic