Old 02-11-2005, 12:03 AM   #1
JustinTArthur
Human being with feelings
 
Join Date: Feb 2005
Location: Staunton, VA, USA
Posts: 4
Default How to Achieve Routing and Low Latency with Jesusonic and Linux

This is a guide to using Jesusonic in a professional audio environment in Linux. A professional audio environment entails having the ability to route hardware devices and instruments on the software-side, and have this routing handled within a low-latency hardware abstraction layer. Audio professionals using Linux utilize a daemon called the JACK Audio Connection Kit to handle this task. JACK is a wonderful tool and easily triumphs over its commercial competitor, ASIO. ASIO is currently only offered on the Win32 operating platform and does little more than just provide a low-latency hardware abstraction layer. JACK goes the extra mile.

As I am writing this document, Jesusonic does not have the ability to directly connect to a JACK daemon. This is unfortunate, but have no fear for there is a workaround.

System requirements:
  • Ample processing power. We'll be working in real-time across multiple processes. I highly recommend a dual-processor or dual-core system.
  • Linux 2.6 or above. Make damn sure your kernel is compiled with the preemptable configuration option (CONFIG_PREEMPT) set to "Y"
  • ALSA drivers and libraries.
  • JACK Audio Connection Kit

Setting up the jack plugin and virtual device:
  1. First ensure that that JACK plugin for alsa-lib is installed. Unfortunately, most Linux distributions fail to do this for you. To install it yourself, download the alsa-lib source bz2 from the ALSA project's web site. Try and get the bz2 correlating to the version of the ALSA package you are currently running (if in doubt, just download the latest). cd to the src/pcm/ext folder and execute the following lines:
    Code:
    make jack
    make install-jack
  2. Open the file ~/.asoundrc in your favourite text editor. If the file doesn't exist, create it. If you want to go about things globally, you may use /etc/asoundrc instead (but I don't recommend it). Add the following block of code:
    Code:
    pcm.jesusplug {
    	type plug
    	slave { pcm "jack" }
    }
            
    pcm.jack {
    	type jack
    	playback_ports {
    		0 alsa_pcm:playback_1
    		1 alsa_pcm:playback_2
    	}
    	capture_ports {
    		0 alsa_pcm:capture_1
    		1 alsa_pcm:capture_2
    	}
    }
    the pcm.jack device essentially maps the two virtual channels created to two other clients on the JACK daemon. In the case of the code above, virtual channels 0 and 1 are mapped to your first sound card's first and second hardware I/O ports. Later on, we'll explore JACK using a GUI and you can see the names of your JACK clients in front of you, which should help you understand what this code block does.
  3. Start the JACK daemon at a sample rate of your choice. For low-latency audio, make sure you start JACK in realtime mode as the root user (there are ways of doing this without being root, but you can look that up). A sample JACK start command looks like this:
    Code:
    jackd -R -d alsa -d hw:0 -r 96000
    You may alternatively start JACK with another application such as qJACKctl, Rosegarden, or PlanetCCRMA.
  4. Now is the time to invoke Jesusonic (GOD'S OWN EFFECTS PROCESSOR). We have to be careful with our parameters. Because we are going through a software plugin to interface between Jesusonic's ALSA i/o and JACK, performance is a major issue. The JACK client will kick off any client that fails to meet its low-latency demands. For this reason, I highly recommend starting Jesusonic as root with the -high parameter (there is a way of being -high without root, but you can look that up). An alternative to doing this is starting Jesusonic with an enormous buffer size (-bufsize 4096 or above), but that can add a distinguishable delay. Another essential parameter is "-s/-srate"; set this parameter's value equal to the sample rate you started the JACK daemon at.
    Here is an example of a full JS startup command:
    Code:
    jesusonic -mode ALSA -in jesusplug -out jesusplug -s 96000 -high
    Notice how we set the input and output to point to that virtual device we created.
    Now, if Jesusonic can't eat and feed those bits to and from JACK fast enough, JACK will kick Jesus out, and Jesusonic will crash along with the JACK ALSA plugin. Restart JACK and play with your JS parameters if this happens.

Jackin' off with a GUI:
I mentioned that JACK gives you advanced routing capabilities. If you want to see this in action, I highly recommend you try out a tool called qJACKctl. After you've started the JACK daemon, load up qJACKctl and hit the "Connect" button. Here you can route audio between other JACK clients (hardware and software) at will. For example, I could route XMMS (employing the XMMS-JACK output plugin) to Jesusonic, then route Jesusonic's output to another effects processor, like Jack-Rack, and then route the output from that to my sound card's pcm outputs. Crazy good shit, I tell ya. Notice that you can also do software MIDI routing here as well like it was nothing. This is about the time when you feel good about deciding to use Linux instead of MAC or Windows as your professional audio production solution. It's powerful... and hot-diggity--it's free! BTW, here is a screenshot of what my JACK routing looks like if I followed my instructions word-for-word:


Notes:
  • I am on a dual Xeon solution at 2.4GHz each with 2GB of RAM (533MHz FSB), and I sometimes have to use both -high and -bufsize 2048 to avoid x-runs high enough to get JS kicked off of JACK.
  • Because the virtual device is an ALSA plug, we could technically feed it at any sample rate we choose, but sample rate conversion would further burden an already processor-intensive audio solution.
  • Once/if Jesusonic gets native JACK support, these instructions will be useless and unnecessary.

Relavent links:Feel free to reply to this with questions, comments, and suggestions.

Last edited by JustinTArthur; 02-11-2005 at 12:12 AM.
JustinTArthur is offline   Reply With Quote
Old 02-16-2005, 01:08 PM   #2
JustinTArthur
Human being with feelings
 
Join Date: Feb 2005
Location: Staunton, VA, USA
Posts: 4
Default Another workaround using a slightly different approach.

Recently, there has been a solution released for creating an OSS emulation layer for JACK. The project is called OSS2JACK and creates a userspace character device that can act as an OSS audio device. I haven't tried it myself, but I'd imagine it would work quite well with JesuSonic to do low-latency audio. It also seems like a little less work than doing the aforementioned ALSA library approach. If anyone does give it a whirl with JS let me know how it does!

- Justin Turner Arthur

Last edited by JustinTArthur; 02-16-2005 at 01:24 PM.
JustinTArthur is offline   Reply With Quote
Old 03-16-2005, 10:23 AM   #3
lucasa
Human being with feelings
 
Join Date: Jan 2005
Posts: 2
Default I got some error messages

I did the steps, but i got some bad errors:

"You cannot set callbacks on an active client.
cannot connect alsa_pcm:capture_1 to alsaC.8012.0:in__000"

Any idea?

Is something related to this post:
http://www.mail-archive.com/alsa-dev.../msg10828.html

Lucas Abert.
lucasa is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 12:04 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.