2011
Mar 
31

Understanding how Rivendell and JACK plug together

Filed under: JACK,Rivendell — Tags: , — frederickjh @ 22:48  

I think one of the confusing things to many new users is how JACK and Rivendell interconnect and how things are labeled. For example Rivendell starts numbering Cards and Ports at 0 while in JACK Ports start at 1.

I am basically going to be  demystifying the JACK.txt file that comes with the standard documentation from Rivendell.

When you setup a [JackSession] section in the Rivendell configuration file, /etc/rd.conf, Rivendell will if it finds the JACK daemon, jackd, running create a virtual JACK card in Rivendell.  The Rivendell daemon caed (Core Audio Engine Daemon) will look first to see if you have any Audio Science audio adapters in the system and will initialize them first. caed will number the first card 0 (Zero). If you have no Audio Science cards in your system  then the virtual JACK card will be card number 0. ALSA cards in Rivendell will come last. You need to have setup an /etc/asound.conf with entries for ALSA (see ALSA.txt for details).

If you look in JACK Control under connections you will see that Rivendell appends the Rivendell JACK client with the number of the virtual sound card that it will be available under in Rivendell. So for example the Rivendell JACK client for cardo will be rivendell_0.

When you first come in to the JACK Control Connections window you will see a list of clients. Clients are JACK aware audio applications that have created JACK ports that you can connect. Clicking the plus next to a client opens the list of ports that that client is making available.

If there is one Audio Science card, the Audio Science card would be numbered card 0. The virtual JACK card would then be numbered card 1 and appear in JACK Control under connections as the client named rivendell_1.

Rivendell will automatically make the JACK connections that are setup in /etc/rd.conf. These consist of a Source and Destination line in rd.conf. This is followed by a number that need to match. So, that Source1  will be connected to Destination1.  Sources are on the left-hand side in JACK Control in the column with the heading “Readable Clients / Output Ports”. Destinations are in the right-hand side column with the heading “Writable Clients / Input Ports”.

Rivendell’s output and input ports are stereo. JACK’s ports are mono. This means that if you setup and application to use Card0 and Port0 in the connections window in JACK Control you will have 2 ports one for the left and one for the right channel.

On an Ubuntu computer the ALSA sound card show up as the client system.

You might get confused by the terminology used for the port names, but if you remember the ports on the left are providing audio and the ports on the right are wanting to receive audio it makes things easier. Also note the icons to the left of the port names. Microphone icons are by the ports providing sound while the ports that we can send sound to have speaker icons next to them.

For  an example of the terminology the Rivendell client uses the terms for the ports playout and record.  The system client uses the terms capture and playback.

Now for an example to put it all together.  The JACK Virtual card in this example is Card0 and we are assigning RDAirplay to playout on port0. We want to monitor this on our computer speakers which are attached to our ALSA sound card that is represented by the playback_1 and playback_2 ports (Left and Right channels).

To have the port connected automatically when Rivendell starts we have the 4 lines in the [JackSession] section of /etc/rd.conf

Source1=rivendell_0:playout_0L
Destination1=system:playback_1

Source2=rivendell_0:playout_0R
Destination2=rivendell_0:playback_2

OK, so lets break it down. The Source and Destination with the same number will be connected. So, each pair needs a unique number in the configuration file. Easy enough, I hope.

The part on each line after the equal sign (=) is the client name and port name with a colon(:) in between.

So in the example lines from rd.conf the first two lines connect the left channel of RDAirplay with the left channel of the sound card and eventually with the left speaker. The next two lines do the same for the right channel.

I hope that helps someone to understand a bit better interfacing JACK and Rivendell.