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.

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!

2011
Mar 
11

Installing Uniseals®, Oh what fun!

Filed under: Aquaponics — frederickjh @ 11:59  

I am working on building an Aquaponics system and in doing this you need to connect tanks of water together. You can of course use the normal bulkhead connectors that you need to glue/silicon and screw in place and I have several of these. There is also another type of bulkhead connector that is threaded with a nut  and rubber washers to seal it, however I could not find those here in Switzerland in the sizes that I needed.

In looking for the bulkhead adapters I found that listed with them  in many on-line stores was a product called a Uniseal® which is made by Injection Plastics MFG. CO. INC. They look like rubber, but they are made of DuPont Alcryn® and can handle 40psi 

The installation looks quite straight forward and simple but I can tell you from first hand experience that it can be a bit of a struggle. Here are two YouTube videos that make it look easy however they are using a smaller diameter pipe than I was.

I throw in one more YouTube video in to show how Uniseals® make it possible to build some things that would be pretty much impossible. This is for a protein skimmer and they insert pipe into pipe with Uniseals®. In fact the picture for the video shows this. The audio for this video is a song and not narration. You may want to mute it due to the language used.

Now that you have an idea what a Uniseal® is and how it works, back to my story. I needed to connect two plastic tanks. One being my fish tank and one being my sump where the water would drain to once the fish tank gets full. The fish tank is a IBC. The sump is a plastic trunk for storing tools in your garden and such. The IBC has a very thin wall for the tank as the frame around it provides the needed rigidity to support the walls. The plastic trunk has much firmer walls.

Now before I go on I must add that the Uniseals® are engineered to work with US pipe sizes as you can see on The Uniseal Warehouse order form.  The pipe I had to use is 50mm outside diameter.  So after finding this little piece of information on the Shipwright Agencies Ltd website “Metric hole tolerances +2mm” I choose the  U150 UNISEAL® – 1-1/2″(48mm).  The holesaw that I used to make the holes in the tanks was the recommended metric size of 63.5mm.

I started with the pipe inside the IBC and pushed it out  and into the sump tank. I found in my case this was the easiest as then the outside IBC frame held the tank wall in place while I pushed with all my might. The pipe needs to slope down between the two tanks, however I figured out very quickly that you can not install it that way. I did find that it the Uniseal will still seal even if the pipe is at an angle, but 15 degrees is the maximum. I had my wife stand in the sump and I pushed. I pushed the sump and my wife across the floor and the pipe did not go into the Uniseal®.  I let my wife go and tried to figure out how to get the pipe in.

In the end what worked was to elevate the sump tank so that the pipe would go straight into the Uniseal®.  I also used some wood to brace the tank so that it would not slide across the floor. I also used widow cleaner as recommended when inserting the pipe. I then sat down inside the IBC and pushed with one foot to push the pipe through the two Uniseals®. A constant firm pressure was what was needed.  I found that twisting the pipe was not an help in my case as the Uniseal® and pipe rotated together instead of just the pipe turning.

To contrast this with the bulkhead adapters for the same size pipe I can with considerable effort twist the pipe through them and take it out if needed. With the Uniseals® It is going to have to stay where it is.

However, I am hopeful that with the effort it took to get them in that I will not have any leaks. Still need to test that.

Here are some pictures of my Uniseals® after they are installed. There is also a picture of on in a garbage can that I did as a test.

Sump Uniseal® showing the side of the Uniseall® that expands during installation.

Uniseal® in Fish Tank

Uniseal® in Garbage Can

Here is a list of helpful Uniseal® links:

Injection Plastics MFG. CO. INC.

Shipwright Agencies Ltd

Aquaponics Lynx LLC

The Uniseal® Warehouse

Aquatic Eco-systems Inc.

Bulk Reef Supply

Aquacave.com

Fish Farm Supply Company

TOPP Industries Incorporated

The Tank Depot

Vertical Hydro.com

Installing Rivendell the “hard” way – Ubuntu 10.04LTS – Rivendell version 1.7.2

Filed under: Rivendell,Rivendell Installation — frederickjh @ 02:57  

Rant

You might ask why I choose the title I did. Why the hard way?  Well it is because others and myself  have worked so hard to make Rivendell so easy to install on Ubuntu. But it seems that some people want to do the heavy lifting themselves and jump into Rivendell (Linux and the command line too) head first. Now by working on RRAbuntu I am not wanting to end up with what Ham(Amateur) Radio operator call “appliance operators”.

This term refers to people that can use something but have absolutely no idea as to how it works. With true every day appliances this may not be a bad thing. Does the average person need to know how the toaster works to enjoy toasted bread. Not really but if something breaks the average person is going to just put the toaster in the garbage and get a new one. 🙁

A radio automation system is not a toaster. Someone will need to know how to administer the system, period! Otherwise one day it will burn your toast or stop working. Setting up a radio automation system is not a matter of plugging it into the power and inserting bread.

The point of RRAbuntu is to get people over that initial installation learning curve that meant for many that they walked away from Rivendell sans toast. They never figured out how to plug it in or where to put the bread. I find this sad and it is the reason RRAbuntu exists today.

That all said if you think that installing Rivendell will some how magically teach you what you need to know about administering it, or you like to learn things the hard way, then this tutorial is for you. Don’t get me wrong. You will learn some things, some useful and other will be just frustrating. I will not assume you know anything but I will not attempt to teach you what all the commands that we will use mean. That is up to you to figure out.

I highly recommend cutting and pasting the commands into the terminal. Be especially careful of long commands on narrow screens as you may need to scroll to the right to select all of the command. The command line can be a very hard place. One false character including spaces could mean the command does not work.

Note I said hard way not the hardest way as there are two harder ways to install. Next in hardness is compiling and after that compiling from cvs. So, I you are just looking for something really hard to do you may want to move on and go straight to compiling the cutting edge, bleeding heart code from cvs that may or may not work.

Be for warned that for this installation I am going to be very narrow and focused. Others have published tutorials. There is a INSTALL.txt included with the source code when you compile. There is also the very good blog post by Alban. However even he was broader than I am going to be as his tutorial was for Debian and Ubuntu.

I will be using Alban blog post and the scripts that we use in RRAbuntu as the basis for this tutorial. I will focus this tutorial on Ubuntu and specifically Ubuntu 10.04 LTS (Long Term Support) release and Rivendell version 1.7.2 and only one sound card. If you choose to use this tutorial with any other Linux distro, Ubuntu release, or Rivendell version it just might not work, unless you know how “this” toaster works. 😉

So, please do not post comments asking how to plug in a different Linux toaster or where to put the toast in an other Ubuntu release, or how to output or input toast  from more than one toaster at a time. 😉

Since you are doing things the hard way I will let you figure out how to install Ubuntu 10.04 LTS on your own. I also trust that you have an ALSA compatible sound card on the computer you are going to install on.

Before you start to install Rivendell you need to decide what to do with Pulse Audio. This is the default sound system on Ubuntu. You need to make the hard decision of what to do with pulse audio. I will present two options.  Option one works with the ALSA sound  system and the other with JACK and Pulse Audio.

Option A is to basically turn Pulse Audio off and there by allow Rivendell to be the only application to use the sound card using ALSA. Thats right in this option no other program can use the sound card, but hey maybe this is what you want if this is your on-air log playback computer. You do not want systems sounds going out over the air in addition to what is playing in Rivendell.

Option B is to setup Rivendell with JACK and set up Pulse Audio to work with JACK. This allows you to still use your sound card with other applications in addition to Rivendell. However, this is even harder to setup as you need to setup jack, get jack and the daemons to all start in the correct order, etc.  So, for now I am not going to cover how to do this, but if enough people ask in the comments I might make a future blog post with that info.

Instructions

I would highly recommend that you read to the end  of this blog post before starting to work through these installation instructions.

Step 1. Say goodbye to pulseaudio. I am taking much of this from the Rivendel wiki page that I put together on it. You need to copy /etc/pulse/client.conf to ~/.pulse/client.conf.  Use this command to check if you have a .pulse folder and if not, make it.

if [ ! -d ~/.pulse ]; then mkdir ~/.pulse; fi

Now you can copy client.conf with the following command in a terminal:

cp /etc/pulse/client.conf ~/.pulse/client.conf

Then and change the line: ; autospawn = yes to autospawn = no by running in a terminal the following commands :

sed s/\;\ autospawn\ \=\ yes/autospawn\ \=\ no/ ~/.pulse/client.conf >/tmp/temp.conf

cp /tmp/temp.conf ~/.pulse/client.conf
rm /tmp/temp.conf

Now we need to kill and running instances of Pulse Audio with:

killall pulseaudio

After that run

ps -C pulseaudio

to check if pulseaudio is still running.  If you do not get back something similar to:

PID TTY          TIME CMD
17065 ?        00:00:02 pulseaudio

Then pulse audio is still running, however if you get back:

PID TTY          TIME CMD

Then all is well and pulse audio is not running anymore. However if each time you run the command to kill pulse audio it is still there when you run the command to check if it is running and the PID number keeps going higher then you have not turned off autospawning. Maybe you edited the file by hand and missed the fact that you needed to delete the semicolon(;) at the front of the line in client.conf Well one step down, want to continue or are you ready to do download the RRAbuntu CD and drink your favorite beverage in the mean time?

Step 2. Add  the Tryphon repository to your software sources. The good people at Tryphon produce packages for Debian and Ubuntu. If you ever have to compile Rivendell you will be thankful for the work they have saved you. May be a good idea to drop them a thank you for packaging and maintaining the repository for Rivendell among other programs. The repository is locate at debian.tryphon.eu and there you can read more about it. However, what you want to do right now is tell our computer to use the tryphon repository as a software source.

echo 'deb http://debian.tryphon.eu lucid main contrib #Tryphon-Rivendell
deb-src http://debian.tryphon.eu lucid main contrib #Tryphon-Rivendell Source' >/tmp/rivendell.list
sudo cp /tmp/rivendell.list /etc/apt/sources.list.d/
rm /tmp/rivendell.list

Next we need to add the repository key with the command:

 wget -q -O - http://debian.tryphon.eu/release.asc | sudo apt-key add -

Then make apt aware of the new Tryphon software repository by issuing the following command:

sudo apt-get update

Step 3. Install needed MySQL packages (client and server) as the tryphon packages do not have them listed as a dependency so  they will not be installed automatically when installing Rivendell. You also need to start the MySQL server. You can do this with the commands:

sudo apt-get install mysql-client mysql-server
sudo service mysql start

When the Configuring mysql-server dialog pops up answer the “New password for the MySQL “root” user:” with a password. Remember/write this down as you will need it later. <OK> reenter the password and once more <OK>.

Step 4. Setup Linux user  and group that the Rivendell daemons and applications will run as. The following commands will setup the Linux user you are running as as the Rivendell Linux user. I will also use the group rivendell as the Rivendell group.

sudo groupadd -f rivendell
sudo adduser $(whoami) rivendell

Step 5. Setup the Rivendell group, in our case rivendell, with real time running  privileges with the following commands.

echo '@rivendell - rtprio 99
@rivendell - memlock 250000
@rivendell - nice -10' >/tmp/rivendell.conf
sudo cp /tmp/rivendell.conf /etc/security/limits.d/rivendell.conf
rm /tmp/rivendell.conf

After this you need to log out and then back in again for the real time privileges to take effect.

Step 6. Create a ALSA configuration file. Normally you do not need an ALSA configuration file but Rivendell looks for one and more importantly for entries with rd in them. I am going to assume you do not have an ALSA configuration file and we will create one from scratch with the commands:

echo 'pcm.rd0 {
  type hw
  card 0
}
ctl.rd0 {
  type hw
  card 0
}
' >/tmp/asound.conf
sudo cp /tmp/asound.conf /etc/asound.conf

Step 7. Create Rivendell configuration file and setup the current Linux user as the Rivendell Linux user with the following commands:

echo '[Identity]
AudioOwner=username
AudioGroup=rivendell
Password=letmein

[mySQL]
Hostname=localhost
Loginname=rduser
Password=letmein
Database=Rivendell
Driver=QMYSQL3

[Logs]
Facility=Syslog

[Alsa]
PeriodQuantity=4
PeriodSize=1024

[Tuning]
UseRealtime=Yes
RealtimePriority=9

[Format]
SampleRate=44100
Channels=2

[Cae]
AudioRoot=/var/snd
AudioExtension=wav
AllowNonstandardRates=Yes
' >/tmp/tmp.rd.conf

sed s/AudioOwner=username/AudioOwner=$(whoami)/ /tmp/tmp.rd.conf >/tmp/rd.conf
sudo cp /tmp/rd.conf /etc/rd.conf
rm /tmp/rd.conf
rm /tmp/tmp.rd.conf

Step 8. Create directory /var/snd for Rivendell audio files and set permissions with these commands:

if [ ! -d /var/snd ]; then sudo mkdir /var/snd; fi
sudo chown -R $(whoami):rivendell /var/snd

Step 9. Create directory /var/run/rivendell for Rivendell pid files and set permissions with these commands:


if [ ! -d /var/run/rivendell ]; then sudo mkdir /var/run/rivendell; fi
sudo chown -R $(whoami):rivendell /var/run/rivendell

Step 10. Install the Rivendell packages and needed dependencies with:

sudo apt-get install rivendell

When the Configuring jackd dialog pops up, answer the question “Enable realtime process priority?” with <Yes>. When the Rivendell configuration dialog pops up answer the question “Configure Rivendell and rd.conf through debconf?” with <No>.

Step 11. Create test tone cart if it failed to be created correctly with this command:

if [[ ! -f /var/snd/999999_000.wav || ! $( stat -c%s /var/snd/999999_000.wav ) -eq 1769528 ]]; then rdgen -t 10 -l 16 /var/snd/999999_000.wav; fi

Step 12. Start Rivendell for the first time. Since this is the first time there will not be a rivendell database. In order to create it you will be asked for the root mysql login and password that you setup when mysql was installed.

rdadmin 

A “mySQL Admin” dialog will pop up. “Unable to access the Rivendell Database! . . .”

User Name: root

Password: the one you gave when you setup MySQL.

You should get back a “Created Database” dialog. Click OK and RDAdmin will start.

User Name: admin

Password: This is blank. Don’t enter anything in the password field just hit enter.

You can now start RDAirplay from the Sound & Video menu. Click the Add button, select the test tone, add it to the log, then click start.

Bash Script

I have made a bash script of all the commands in this blog post if you do not want to do a lot of copying and pasting you are welcome to use it. The instruction for it are this.

1. Download it and save it in your home directory. So, if your Linux login is johndoe you would save it as

/home/johndoe/lucid-1.7.2-install.sh

2. Make the script executable by running the command:

chmod +x ~/lucid-1.7.2-install.sh 

3. Run the script to install Rivendell with the command:

~/lucid-1.7.2-install.sh

4. Any time you are asked for a password at the command prompt like so, “[sudo] password for johndoe:“, enter your Linux password.

5. Any time it asks you on the command line “Do you want to continue [Y/n]?” just hit the Enter key to answer yes.

6. When the Configuring mysql-server dialog pops up answer the “New password for the MySQL “root” user:” with a password. Remember/write this down as you will need it later. <OK> reenter the password and once more <OK>.

7. When the Configuring jackd dialog pops up, answer the question “Enable realtime process priority?” with <Yes>.

8. When the Rivendell configuration dialog pops up answer the question “Configure Rivendell and rd.conf through debconf?” with <No>.

One thing that I experience a couple of times and figured out how to get around it by accident, is that before the Configuring jackd dialog  comes up my terminal went blank. That is correct, all the text in the terminal disappeared. I waited a while to give it time to come up switch to another open program and back, but only when I in the terminal when to File>Open Tab and then switch back to the original tab that the script was running in did I see the “Configure jackd” dialog.

You can download the bash installation  for Rivendell 1.7.2 on Ubuntu Lucid 10.04 LTS script here.

Testing

After five working installs of Ubuntu Lucid 10.04 LTS (and two failed with disk errors), I managed to get everything working correctly in the right order. So this is not a off the cuff blog post that has not been tested or tested on a system that was halfway configured. I hope that this will help some people just like RRAbuntu has to be able to install Rivendell for the first time easily.