When upgraded Ubuntu from Feisty to Gusty, the newer freebob audio-firewire driver broke the support of Focusrite Saffire Pro. I have not tested the non-pro versions (Saffire and Saffire LE), but I guess it applies also to them.

Freebob/ffado main developer quickly identified the problem and proposed a provisional patch, which is what I’m gonna explain in this post. For a more definitive solution we’ll probably have to wait to the next ffado release. Hopefully soon.

First, the symtoms: This is how Gutsy freebob complains when starting jack with a Saffire Pro.

$ jackd -d freebob
jackd 0.103.0
Copyright 2001-2005 Paul Davis and others.
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK compiled with System V SHM support.
loading driver ..
Freebob using Firewire port 0, node -1
unexpected response received (0x9)
Error (bebob_light/bebob_light_avdevice.cpp)[1679] setSamplingFrequencyPlug: setSampleRate: Could not set sample rate 48000 to IsoStreamInput plug 0
Error (bebob_light/bebob_light_avdevice.cpp)[1696] setSamplingFrequency: setSampleRate: Setting sample rate failed
FreeBoB ERR: FREEBOB: Error creating virtual device
cannot load driver module freebob

The problem is related to the sample rate interface. The quick solution is not using that interface. Just a matter of commenting out a piece of code.

Update 9th March:
Pieter Palmer makes me notice that from version 1.0.9 there is a ./configure switch that does what the below patch does. So you can safely skip the part of this blog about downloading 1.0.7 version and applying the patch.

Instead you should download the svn trunk

svn co https://freebob.svn.sourceforge.net/svnroot/freebob/trunk/libfreebob libfreebob

and then use –disable-samplerate at the ./configure step.

Begin deprecated:

Apply the following patch. If you don’t know how to do it, follow these steps: copy-paste the following patch into a file (i.e. /tmp/saffire.patch).

Index: src/libfreebobstreaming/freebob_streaming.c
--- src/libfreebobstreaming/freebob_streaming.c	(revision 449)
+++ src/libfreebobstreaming/freebob_streaming.c	(working copy)
@@ -154,7 +154,7 @@
 	 * This should be done after device discovery
	 * but before reading the bus description as the device capabilities can change
+#if 0 //disabled for Focusrite Saffire
    if(options.node_id > -1) {
        if (freebob_set_samplerate(dev->fb_handle, options.node_id, options.sample_rate) != 0) {
@@ -178,8 +178,8 @@
			return NULL;

	/* Read the connection specification

Then change dir to the checked out repository and apply the patch:

cd libfreebob-1.0.7
patch -p0 < /tmp/saffire.patch

End deprecated:

Now, the building phase. Get the build dependencies.

sudo apt-get build-dep libfreebob0

There is a problem here. For some reason libtool (or some package that includes it) is missing in the debian/control file. This seems to me a packaging bug that makes autoreconf give errors like this one:

possibly undefined macro: AC_ENABLE_STATIC

So, install libtool:

sudo apt-get install libtool

And build:

autoreconf -f -i -s 
sudo make install

To make sure that jack will take the new libfreebob (in /usr/local) we will hide the current freebob libs to jackd. I mean the ones installed by the debian package.

cd /usr/lib
sudo mkdir freebob_hidden
sudo mv libfreebob.* freebob_hidden/

That’s all.
As always check that raw1394 module is ready. Else do this:

sudo modprobe raw1394
sudo chmod a+rw /dev/raw1394

Now jack should work without complaining:

 jackd -d freebob

How to compile freebob with optimizations

CFLAGS="-march=core2" ./configure --enable-optimize --enable-mmx --enable-sse

Or use this for 64bits enabled cpus:

CFLAGS="-march=nocona" ./configure --enable-optimize --enable-mmx --enable-sse


I’m very thankful to Pieter Palmer for the quick help at #ffado irc channel.

My next posts will talk about the reason I needed audio-firewire in linux. It was related to a real-time 3D audio exhibition developed with CLAM. It just happened yesterday and I’m very happy that it all worked really well.

In my last how-to we played a multichannel video with surround audio (coded with ac3) using mplayer and jack. Jack (the audio server and router) is perfect to use with firewire audio interfaces. However, the Ubuntu Gutsy mplayer is not jack enabled by default.

To see the list of audio backends:

mplayer -ao help

However, it is very easy to compile a new mplayer .deb package jack enabled. First, create a temp dir (for example debs) and change to it. Install libjack with it’s development headers

sudo apt-get install libjack-dev

Install all the packages to build the mplayer-nogui package. This is done in a single command:

sudo apt-get build-dep mplayer-nogui

Now just get the source package and build it (the -b option is for build). This will take time.

sudo apt-get -b source mplayer-nogui

The mplayer build system automatically searches for libjack headers and when found configures its build system to use jack.

Finally install the new packages (dpkg complains with an error error processing mplayer which you can ignore):

sudo dpkg -i *.deb

To use it, choose the jack audio driver with -ao jack. A nice feature is that it automatically connects all the outputs to the physical device inputs.

mplayer -ao jack someaudiofile.mp3

If your file have more that 2 channels:

mplayer -ao jack -channels 5 surround.wav

As a final note, I’ve checked that debian (not ubuntu) package is jack enabled by default. The reason is that their packaging scripts differ a little bit (specifically debian/control file). The Ubuntu one don’t define the jack-dev build dependency.

My requirements for an audio interface where basically: low-latency, good pre-amps and DA/AD converters, and having more than two outputs. And well it had to be an external interface to use with my laptop (macbook), work with Linux, and below 400 eur.

I need low-latency for live gigs. I use to play bass and some synths with Guillamino, but I really want to incorporate soft synths, and live material processing with sooperlooper, supercollider and freewheeling.

For latency reasons I discarded buying a USB interface. Also it’s a plus that nowadays music shops have plenty of new firewire interfaces.

When recording music, monitoring or hearing an audio mix that is independent of what is being recorded is a must. Since I’m aiming to have a really portable recording station I don’t want to rely on external mixing desk. So I needed at least 4 outputs and flexible routing.

Firewire support for Linux is in its early stage but growing steadily. I knew about the freebob project when Pieter Palmers presented it at Linux Audio Conference 2005. Freebob is a Linux driver (by now only a JACK backend; alsa driver is planed) for devices based on the bebob chip. Fortunately many audio interfaces are based on this chip.

My choice: Focusrite Saffire (LE)

Edirol FA-101 and ESI QuataFire 610 also looked good and where options I also considered. But in comparison, Saffire bought more features (and hopefully sound quality) for its price. I’ve to say it is fantastic to have a huge two-story audio-gear supermarket (Alfasoni) near my flat in Barcelona. And their prices are generally lower than any other store in the city. Saffire (LE) was 323 eur plus taxes. Not bad.

Saffire (LE) audio interface have 6 ins and 8 outs (including digital spdif), and good quality audio (at least this is my first impression in a home-studio environment, and Focusrite have a reputation on its high-end gear).

focusrite saffire le. front and rear

In Linux, you don’t have an app for controlling the internal audio routing, but you can access all 6 ins and 8 outs with JACK, and with a ridiculous latency you can do all monitoring routing with JACK, so no big deal. Another happy surprise was to find that firewire provides enough power for the device. You only need to plug the power adapter for enabling phantom feed for condenser mics.

How to enable freebob driver in Ubuntu

That can be a little tricky. If your distribution doesn’t come with libfreebob package you’ll need to compile this library (and some dependencies) from the source and then rebuild libjack from subversion sources. But that’s not the end of the hassle. You’ll probably find (as I did) that the new compiled (svn) libjack is not compatible with already installed libjack and applications (I think they use different client/server protocols so the incompatibility have sense). Of course, I was not happy at all having to recompile all my jack applications so I looked at fixing the libjack .deb package from its source package.

Luckily, I found that enabling freebob in Ubuntu Feisty is really easy. Feisty is currently the testing/developing Ubuntu version, due for april 2007, so it’s not intended users who need a solid, reliable OS. However, since I have a macbook and the Feisty kernel supports macintel hardware much better than current Ubuntu Edgy, installing Feisty was a decision I already took. And I’ve had no crashes and had a good experience, so far.

So, the good news is that in Feisty you already have libfreebob0 in universe repository. The bad new is that, however, jackd comes with freebob driver disabled. Note that freebob is not a driver you can plug-in but is it built-in with jack. I believe it’s a packaging bug and very simple to resolve (though still in unconfirmed state).
Update: (January 25th) it seems that this problem has been resolved in new ubuntu-feisty libjack package (its already compiled against libfreebob). So ignore the next steps for compiling jackd from sources.

So here goes the how-to for enabling freebob in jackd maintaining all jack-apps compatible:

Enable universe binary and source repositories and install libfreebob-dev
$ sudo apt-get libfreebob0-dev
Download and compile libjack from source package. It can be done with a single instruction:
$ sudo sudo apt-get -b source libjack0.100.0-dev
Is very likely that you’ll need to install several -dev packages for compiling this source package. But don’t worry, the error message specify all those packages. After installing them, try again.
Then install all new created .deb packages:
$ sudo dpkg -i *.deb

Now if you do
$ jackd -d freebob
you’ll see that –though it still doesn’t work– at least it is using the freebob driver.

The rationale behind that is that the autoconfiguration of libjack enables freebob driver if it finds the the freebob library and headers installed. But libfreebob0 dependency is not enforced in its debian/rules, that’s why binary package have freebob disabled. And since Feisty already have libfreebob I think it should be enforced.

Fixing /dev/raw1304 permissions

Let’s fix the before-mentioned error. Doing jackd -d freebob I got:

Freebob using Firewire port 0, node -1
Ieee1394Service::initialize: Could not get 1394 handle: Permission denied
Is ieee1394 and raw1394 driver loaded?
Fatal (devicemanager.cpp)[68] initialize: Could not initialize Ieee1349Service object
Fatal (freebob.cpp)[69] freebob_new_handle: Could not initialize device manager
FreeBoB ERR: FREEBOB: Error creating virtual device

That’s because a normal user does not have access to raw1394
$ ls -l /dev/raw1394
crw-rw---- 1 root disk 171, 0 2006-12-17 16:10 /dev/raw1394

Changing permissions
$ sudo chmod o+rw /dev/raw1394
solves the problem. However after a new reboot the permissions have been reset. A permanent and easy way to solve this is adding your user into the disk group.
$ sudo gedit /etc/group
In my case, the username is parumi so I edited the group file like this: “disk:x:6:parumi”
Update: $ sudo adduser parumi disk is the right way instead of directly editing /etc/group. Thanks Maarten de Boer for this feedback.

Another solution is using udev rules like explained in this linux-audio-user thread

After that, login again and you should be able use jackd -d freebob and all installed jack-apps. Finally, this screenshot shows qjacktl connection window with the Focusrite Saffire (LE) 6 inputs and 8 outputs.

qjackctl showing Focusrite Saffire (LE) 6 ins and 8 outs