2011
Mar 
28

So you want to have JACK with your RRAbuntu?

Filed under: JACK,Rivendell,Rivendell Installation — frederickjh @ 23:26  

After folks get past the easy install of Rivendell they many times hear about JACK and all the neat things you can do with it. However, JACK is a program that has a lot of twists and turn to figure out mostly because the packagers have decided against a one-size-fits-all setup. The Ubuntu/Debian packages for Rivendell seem a bit that way too considering how much “tweeking” we do after the packages are installed to get it to work correctly on RRAbuntu.

Now I would not say RRAbuntu is a one-size-fits-all installation. It is more like a it-is-a-good-place-to-start-and-it-works-this-way-so-why-fix-it installation (Just try and say that 5 times fast! šŸ˜‰ ).

The biggest issues with getting JACK setup are:

1) Figuring out JACK’s idiosyncrasies

2) Figuring out the best way to interface JACK with current sound systems

3) Figuring out the best way to interconnect JACK aware programs with JACK

Now before we begin, why might you want to setup JACK with RRAbuntu? With the default RRAbuntu installation we use ALSA and disable Pulse Audio. We do the later because we do not want Pulse Audio to grab the sound card and then Rivendell cannot use it.

ALSA only allows one audio application at a time to use a sound card. You could install another sound card and use one for Rivendell and the other sound card for other applications. However, I am not going to cover that in this post.

With JACK we still use ALSA but JACK handles all the connection to ALSA. The best way to think of JACK is like a big patch panel for audio. We can connect audio applications and sound devices together automatically or manually. This allows us to have Rivendell on a computer and also run Audacity to edit some audio and still be able to hear it. JACK stands for the Jack Audio Connection Kit . It is a recursive acronym in that it refers to itself. Considering that ack is a sound of disgust in some places in the world it is all the better to name it JACK and not ACK.

But some of you may say, “Hey what about Pulse Audio? It is the default sound system on Ubuntu and I want to hear the system sounds and such.” Well since the last version of RRAbuntu was released (1.13) I have learned how to interface JACK and PulseAudio so that you can have sound from non-JACK aware applications as well, however this has proved not so stable in testing when stopping and restarting jackd. I am still working on this but the fact that a reboot was needed to allow jackd to start again is not a good thing in my book. I need to research that setup more.

So, on to the setup. First the assumptions. You did an install from the RRAbuntu 1.13 CD and ran the First Run script. This may work with other Rivendell versions (1.7.2 is what we are testing with) or other releases or Ubuntu distros (Ubuntu Lucid 10.04 LTS in what we are using). And once again the point is not to assume you know anything nor to teach you, so if you learn something that is great bit it may take a bit of reading up on your part.

1)Ā  Stop the Rivendell daemons

sudo /etc/init.d/rivendell stopĀ 

2) Setup a startup script which waits to start Rivendell until jackd has started. Download the startup script from my blog post here (right-click> “Save Linked Content As…”) and save it as /etc/init.d/rivendell. Make it executable and change the variable WAITFORJACK=0 to WAITFORJACK=1.

You can do this with the commands:

sudo wget -t 0 -O /tmp/rivendell.init http://ubuntuone.com/p/HNF/
sed s/WAITFORJACK=0\ \ #1=yes\ 0=no/WAITFORJACK=1\ \ #1=yes\ 0=no/ /tmp/rivendell.init | sudo tee /etc/init.d/rivendell >/dev/null
rm /tmp/rivendell.init


3) Setup Jack Control as a Startup Application with the following command:

echo "
[Desktop Entry]
Type=Application
Exec=qjackctl
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_US]=Quick Jack Control
Name=Jack Control
Comment[en_US]=Starts Jack Control and the jack daemon
Comment=Starts Jack Control and the jack daemon
 " > ~/.config/autostart/qjackctl.desktopĀ 

4) Add aĀ  Jack section to /etc/rd.conf with the command:

echo "
; JACK Session Management
;
; See /usr/share/doc/rivendell/JACK.txt for details
;
[JackSession]
Source1=rivendell_0:playout_0L
Destination1=system:playback_1

Source2=rivendell_0:playout_0R
Destination2=system:playback_2

Source3=rivendell_0:playout_1L
Destination3=system:playback_1

Source4=rivendell_0:playout_1R
Destination4=system:playback_2

Source5=rivendell_0:playout_2L
Destination5=system:playback_1

Source6=rivendell_0:playout_2R
Destination6=system:playback_2

Source7=rivendell_0:playout_3L
Destination7=system:playback_1

Source8=rivendell_0:playout_3R
Destination8=system:playback_2

Source9=rivendell_0:playout_4L
Destination9=system:playback_1

Source10=rivendell_0:playout_4R
Destination10=system:playback_2

Source11=rivendell_0:playout_5L
Destination11=system:playback_1

Source12=rivendell_0:playout_5R
Destination12=system:playback_2

Source13=rivendell_0:playout_6L
Destination13=system:playback_1

Source14=rivendell_0:playout_6R
Destination14=system:playback_2

Source15=rivendell_0:playout_7L
Destination15=system:playback_1

Source16=rivendell_0:playout_7R
Destination16=system:playback_2

Source17=system:capture_1
Destination17=rivendell_0:record_0L

Source18=system:capture_2
Destination18=rivendell_0:record_0R

Source19=system:capture_1
Destination19=rivendell_0:record_1L

Source20=system:capture_2
Destination20=rivendell_0:record_1R

Source21=system:capture_1
Destination21=rivendell_0:record_2L

Source22=system:capture_2
Destination22=rivendell_0:record_2R

Source23=system:capture_1
Destination23=rivendell_0:record_3L

Source24=system:capture_2
Destination24=rivendell_0:record_3R

Source25=system:capture_1
Destination25=rivendell_0:record_4L

Source26=system:capture_2
Destination26=rivendell_0:record_4R

Source27=system:capture_1
Destination27=rivendell_0:record_5L

Source28=system:capture_2
Destination28=rivendell_0:record_5R

Source29=system:capture_1
Destination29=rivendell_0:record_6L

Source30=system:capture_2
Destination30=rivendell_0:record_6R

Source31=system:capture_1
Destination31=rivendell_0:record_7L

Source32=system:capture_2
Destination32=rivendell_0:record_7R
" | sudo tee -a /etc/rd.conf > /dev/null

5) Setup Jack Control to start jackd and other needed settings with the commands:

mkdir ~/.config/rncbc.org/


echo "[Splitter]
AudioConnectView\sizes=248, 83, 248
MidiConnectView\sizes=34, 20, 34
AlsaConnectView\sizes=34, 20, 34
PatchbayView\sizes=34, 20, 34

[Geometry]
qjackctlMessagesForm\x=0
qjackctlMessagesForm\y=0
qjackctlMessagesForm\width=328
qjackctlMessagesForm\height=200
qjackctlMessagesForm\visible=false
qjackctlStatusForm\x=0
qjackctlStatusForm\y=0
qjackctlStatusForm\width=378
qjackctlStatusForm\height=231
qjackctlStatusForm\visible=false
qjackctlConnectionsForm\x=0
qjackctlConnectionsForm\y=0
qjackctlConnectionsForm\width=1206
qjackctlConnectionsForm\height=795
qjackctlConnectionsForm\visible=false
qjackctlPatchbayForm\x=0
qjackctlPatchbayForm\y=0
qjackctlPatchbayForm\width=726
qjackctlPatchbayForm\height=333
qjackctlPatchbayForm\visible=false
qjackctlMainForm\x=163
qjackctlMainForm\y=39
qjackctlMainForm\width=474
qjackctlMainForm\height=100
qjackctlMainForm\visible=false

[Program]
Version=0.3.4

[Presets]
DefPreset=(default)

[Options]
StartJack=true
StartupScript=false
StartupScriptShell=artsshell -q terminate
PostStartupScript=false
PostStartupScriptShell=
ShutdownScript=false
ShutdownScriptShell=
PostShutdownScript=false
PostShutdownScriptShell=killall jackd
StdoutCapture=true
XrunRegex=xrun of at least ([0-9|]+) msecs
XrunIgnoreFirst=false
ActivePatchbay=false
ActivePatchbayPath=
MessagesLog=false
MessagesLogPath=qjackctl.log
BezierLines=true
TimeDisplay=0
TimeFormat=0
MessagesFont="Sans,10,-1,5,50,0,0,0,0,0"
MessagesLimit=true
MessagesLimitLines=1000
DisplayFont1="Sans,12,-1,5,75,0,0,0,0,0"
DisplayFont2="Sans,10,-1,5,50,0,0,0,0,0"
DisplayEffect=true
DisplayBlink=true
JackClientPortAlias=0
ConnectionsIconSize=0
ConnectionsFont="Sans,10,-1,5,50,0,0,0,0,0"
QueryClose=true
KeepOnTop=false
SystemTray=true
StartMinimized=true
DelayedSetup=false
ServerConfig=true
ServerConfigName=.jackdrc
ServerConfigTemp=false
QueryShutdown=true
AlsaSeqEnabled=true
AliasesEnabled=false
AliasesEditing=false
LeftButtons=true
RightButtons=true
TransportButtons=true
TextLabels=true
BaseFontSize=0

[Defaults]
PatchbayPath=

[Settings]
Server=/usr/bin/jackd
Realtime=true
SoftMode=false
Monitor=false
Shorts=false
NoMemLock=false
UnlockMem=false
HWMon=false
HWMeter=false
IgnoreHW=false
Priority=0
Frames=1024
SampleRate=44100
Periods=2
WordLength=16
Wait=21333
Chan=0
Driver=alsa
Interface=
Audio=0
Dither=0
Timeout=500
InDevice=
OutDevice=
InChannels=0
OutChannels=0
InLatency=0
OutLatency=0
StartDelay=2
Verbose=false
PortMax=256
MidiDriver=none

[History]
ServerComboBox\Item1=/usr/bin/jackd
ServerComboBox\Item2=jackd
ServerComboBox\Item3=jackdmp
ServerComboBox\Item4=jackstart
ServerComboBox\Item5=jackd-realtime
InterfaceComboBox\Item1=(default)
InterfaceComboBox\Item2=hw:0
InterfaceComboBox\Item3=plughw:0
InterfaceComboBox\Item4=/dev/audio
InterfaceComboBox\Item5=/dev/dsp
InDeviceComboBox\Item1=(default)
InDeviceComboBox\Item2=hw:0
InDeviceComboBox\Item3=plughw:0
InDeviceComboBox\Item4=/dev/audio
InDeviceComboBox\Item5=/dev/dsp
OutDeviceComboBox\Item1=(default)
OutDeviceComboBox\Item2=hw:0
OutDeviceComboBox\Item3=plughw:0
OutDeviceComboBox\Item4=/dev/audio
OutDeviceComboBox\Item5=/dev/dsp
StartupScriptShellComboBox\Item1=artsshell -q terminate
PostShutdownScriptShellComboBox\Item1=killall jackd
XrunRegexComboBox\Item1=xrun of at least ([0-9|]+) msecs
MessagesLogPathComboBox\Item1=qjackctl.log
ServerConfigNameComboBox\Item1=.jackdrc
" > ~/.config/rncbc.org/QjackCtl.conf

6) At this point the easiest thing to do is reboot the computer. This will start the Rivendell daemons, JACK Control and jackd and set the proper group permissions.

7) Set Audio Output and Inputs up in RDAdmin to use the outputs and inputs you want for each Rivendell application. First go to RDAdmin>Manage Hosts> select the host >Edit>Audio Resources Scroll down and look for the title “AUDIO ADAPTERS“. Under it it should say:

Card0: JACK Audio Connection Kit
Ā  Driver: JACK Audio Connection Kit
Ā  Inputs: 8
Ā  Outputs: 8Ā 

If it does then you can click Close. Ā In the Host: menu that you will be looking at you can go in to RDLibrary, RDCatch, RDAirplay, RDPanel and RDLogEdit and assign what inputs and outputs you want to use for what functions in those programs. Jack has 8 inputs and outputs numbered 0-7 The card number will be 0 as that is what card we have JACK setup as. By default they will be set to Card 0, Port 0.

8 ) Check connections in Jack Control. Click on the JACK icon in the task bar, then click on the Connect button. Ā  Check that you have connections between the rivendell_0:playback ports and the system:playback ports so you can hear sound in Rivendell. You should see a line connecting them.

JACK Control Taskbar Icon - A Diagonal TRS (Tip, Ring, Sleeve connector) or a headphone plug if your not sure what that is ;) and a white circle with, hopefully a yellow play symbol

JACK Control Taskbar Icon

The yellow play symbol in the JACK Control taskbar icon means jackd was started by a program other than JACK Control. A green play symbol means jackd was started by JACK Control. In the screen shot above I had started it from the command line.

9) Test: Play a sound in Rivendell and see if it works!

Again if you don’t want to do all that copy and pasting I am providing a script that will do all this for you. One word of warning do not have any other package managers running when you try to run the script. Especially keep an eye out for the update manager. It has a way of automatically starting and then minimizing itself.

You can download the rrabuntuandjack.sh script here.

Happy patching!

No Comments

Sorry, the comment form is closed at this time.