Tuesday, September 22, 2009

Fedora 11 + Presonus Firebox (+fglrx)

This is how I got my firebox to work in conjunction with my onboard soundcard (in my case, Intel HDA) on Fedora 11 x86_64. This article assumes you have basic knowledge on jack and qjackctl and a jack-compatible program such as ardour.

My smolt: http://www.smolts.org/show?uuid=pub_...f-774ec4381ae7

Reasons:
Personally, I just wanted to be able to do it and to be able to give a good explanation when people ask me why I'm monitoring recordings through headphones - and because it won't work through the PC speakers wasn't going to cut it.

You may also need it because while recording "deaf" might be fine, playback needs to go through your state-of-the-art monitors.

You may need it because you have a studio all set up and for some odd reason, you just need to add a firebox in. Of course, if you had a studio, you could have just patched the line outs to your main speakers. But that is besides the point.

The Background
After searching for almost 3-4 days, I chanced upon rokit's thread and was very disheartened when he seemed to have found no solution. Today, he solved the connection issues but I wanted more. Unlike him, I wasn't using my firebox as a sound card. It would be a sin to waste my onboard audio capabilities.

The Juice (some parts paraphrased from rokit's solution)

  1. You need to install the PlanetCCRMA repository. Since I'm using Fedora 11 (x86_64), I used this one. This will install the repositories for you so tat yum will be able to locate the needed updates.
    Code:
    rpm -ivh http://ccrma.stanford.edu/planetccrma/mirror/fedora/linux/planetccrma/11/x86_64/planetccrma-repo-1.1-2.fc11.ccrma.noarch.rpm
  2. If you have jack1 (0.x.x) already installed, you MUST uninstall it. jack2 will NOT work with jack1.
    Code:
    yum remove jack-audio-connection-kit*
    The * at the end will also remove the -devel version if you had it installed. Uninstalling jack will remove a lot of existing software that uses jack as a dependancy. Take note of them so you can reinstall them later.
  3. Install FFADO. FFADO is the new Freebob from the same developers. It's the driver that will connect jack2 to the firebox. You MUST install this before jack2.
    Code:
    yum install ffado libffado
  4. Install jack2.
    Code:
    yum install jack-audio-connection-kit jack-audio-connection-kit-devel
    . Yum will automatically detect jack2 from planetccrma as the newer package because the version number is higher than that from the official fedora repo. jack2 is basically a rewritten jackdmp. It is still under development though and running jackd under the command line will print jackdmp information. It works fine though. Mostly.
  5. We also install qjackctl as it makes it a lot easier to run jack. After installation, you can find this at "START"->Multimedia->Qjackctl.
    Code:
    yum install qjackctl
    . Qjackctl, like jack itself, is best run as root. On the "START" button, right click and choose "Menu Editor". Look for Qjackctl in the list of programs and click on it (take note that it may be slow to update after a yum install). Now, on the right half of the screen, click on the advanced tab. Tick the run as user box and enter "root" as the username. Save your changes and the program.
  6. Now we need a real-time kernel. You could do without it with some tweaking (I remember only one day out of many where I got it to work) but let's face it. This is audio. You want it to be realtime.
    Code:
    yum install kernel-rt kernel-rt-devel
    (Graphics cards will need the -devel to install properly).

    Now reboot your computer and select the realtime kernel from grub. I have a total of 3 linux installations and one WinXP running and I installed this on a non-first hdd so it took some tweaking but I got there.

Now to setup jack.

Open Qjackctl from "START"->multimedia->Qjackctl. Click Setup. For the driver, select "firewire". Under parameters, tick "realtime". The rest of the settings at default should be fine. rokit suggests a frames/period of 128 is good. However for this solution where we need to add a soundcard, 512frames/period and 3periods/buffer seems to be the bare minimum in my case. I should point out that ONCE while testing this, I managed to run this solution perfectly with the frames/period set to 128 with absolutely no errors. I have no idea how it happened. Even playing the the frames/period vs periods/buffer ratio did not seem to help. With some tweaking, this probably can be improved. If you want to keep the monitoring capability of the firebox via the phones jack, leave the audio parameter as "Duplex". Otherwise, choose "Capture only".

Click "Start" in Qjackctl. Make sure the red light is on before doing this. If it's blue, you either already have jack running or it hasn't been reset since the last use. i.e. it is still initialised. In this case, unplug and replug the firewire cable to the firebox.

Run ardour to test if you can see the vu meter rising and falling on your instrument's track. Ardour should automatically set the connections for you in jack. You can see the routes in Qjackctl by clicking on "Connections". Expand the entries if necessary by clicking on the little plus-es. Remember, ardour probably has set it all up for you. If you are new to ardour and need help, do let me know and I'll help you out.

Now, to add the soundcard into the list.

Tutorials on the net (which are rare btw) will tell you to use alsa_in or alsa_out. As of jack2, these are no longer included. Now we use jack_load. *Hold off on the sniggers. In a command prompt as root, run:
Code:
jack_load -w onboard audioadapter
the -w option means we wait for the signal before we unload. I have no idea what it means since it doesn't unload itself when I stop the server but it seems to work slightly better during "resets" (I have experienced a number of resets where jackd fails, causing ardour to jam). "onboard" is the name we give to the client (what we see in Qjackctl's connection list. "audioadapter" is the name of the plugin we use to load the soundcard into jackd, it includes alsa_in and alsa_out functionality automagically. http://chrestomanci.org/cgi-bin/man/...ml?jack_load+1

Hit enter and you will get a bunch of errors in qjackctl's messages, specifically, something about the client being too slow. After a bit, this will stop. If it doesn't, ctrl+c the jack_load command, stop the server (stop button in qjackctl) and set frames/period to something higher and then start it up again. Then try the jack_load command again.

It should work. If it doesn't, let me know I'll try to help out.

As for me, it works but due to the 64milisecond latency, I get can actually hear the lag between my playing the guitar and the output. With some tweaking, it could probably be lowered. I will update on this if I can get it to work.

Notes
I am unsure on the endurance of jack2 even without the added soundcard as it seems pretty iffy. I get keyboards, mice and screens freezing up now and again, sometimes for up to a minute. But it always seems to unfreeze itself after that. Be very watchful of jack. The moment ardour jams, it probably means jack died. If you have access to a shell, "killall qjackctl" followed by "killall jackd" will save you a lot of waiting time.

Now and again, jack2 will also get sync errors with the firebox. The only way to solve it is to kill it and restart it again. This method will also not unintialise the firebox so you will also need to unplug and replug the firewire cable to the firebox.

modprobe-ing ohci1394, raw1394 and sbp2 is also not needed as it's already done by fedora. So if you added these based on some tutorial, you can stop.

Like rokit, I have had much trouble running this without the realtime kernel. I ended up installing Fedora in another partition and this is what I have. As a result, I now have no graphics driver and everything looks weird. I will try to install ATI Catalyst 9,9 and if it works I'll post back. If I don't, assume it doesn't.

If I've missed anything out or you need more help, do let me know.

It's a lengthy post, I know, but I hope this is somewhat thorough.

Cheers,
fusionstream.


=============================

Unless you have an issue with how the screen will turn into a rainbow when switching screens or adjusting display settings, I would suggest you not install the official ati drivers with this kernel. This driver makes it look like the computer has a refresh rate of 20Hz. You're better off with no drivers. As mentioned in a previous thread, I have had issues with the 2.6.29.x kernels and ati drivers.

I will try the akmod catalyst as suggested by rokit to see if that will work, but as at now, if you do not experience the "rainbow" issue or you are alright with the default resolution, I would again, highly suggest that you not install this.

To install the official amd/ati catalyst, download it from the ati website.

Run the program from bash as root.
1) [root@coldstream2 Download]# bash ./ati*
2) Choose "Install Driver 8.65 on X.Org 7.4 or later release 64bit"
3) Accept the agreement and choose "Custom".
3.x) If you did not install the kernel-devel for whatever reason (yum install kernel-rt-devel), untick kernel module.
4) Continue install.
5) Open up a shell and as root, type
Code:
aticonfig --initial
6) As there is some problem with the driver, you will now need to enable the software cursor. (Software will draw the cursor for you instead of the graphics card). In a shell, type:
Code:
nano /etc/X11/xorg.conf
Under devices, add an entry:
Code:
Option    "SWCursor" "true"
so that it becomes something like:
Code:
Section "Device"
Identifier "aticonfig-Device[0]-0"
Driver "fglrx"
BusID "PCI:1:0:0"
Option "SWCursor" "true"
EndSection
7)Reboot your computer.

To access the Catalyst control center, as root, run:
Code:
amdcccle
Again, I would highly suggest that you NOT install this unless you have a really good reason.

No comments: