Mobile Digital Audio WorkstationUpgrading my TabletPC to be a Linux digital audio workstation.
First Distro: Fedora 9
Second Distro: Fedora 8
Third Distro: Ubuntu 8.04
Final Distro: Fedora 8 (again)
Upgrading to a Low-Latency Kernel.
Getting the Tablet Working
Getting JACK Applications Working
Getting MP3s Working
Getting Xine Working
Getting Flash Working
USB Audio Devices
Recording through the Interface
Integrating external MIDI
More Respect for JACK
For Follow Up...
Hardware[28 May 2008] You can see my previous entry (Installing FC5, top right of this page) about how I got Fedora Core 5 working on my other laptop. Since then, I'd upgraded my laptop. I'd done more programming with the tablet, and wanted a beefier CPU, more memory, and a larger screen. I settled on a Toshiba Tecra M4 . User reviews on that site aren't particularly kind. I agree with reviewers who complain about heat and noise. The fan is very loud! And the machine gets very hot if I do something CPU-intensive. However, it is a very fast machine, and the large screen is wonderful. It was a good purchase (I got it used from a seller on eBay ). I'd gotten vanilla Fedora 5 and 7 installations working, but now I wanted to make more custom (aggressive?) changes to turn the Tecra M4 into a low-latency Linux digital audio workstation.
General ApproachWhat is a Digital Audio Workstation? For me, this is a machine that:
First Distro: Fedora 9The first step was to install a Linux distribution to use as a base. I wanted a reasonably up-to-date distribution. I've had good luck with Fedora , so I thought I'd try an upgrade to Fedora 9, the most recent version. I installed Fedora 9 from the install DVD. I disabled most of the install packages to keep it small. I've found I need to add a bunch of packages post-install using yum anyway, so I prefer to keep the initial install fast. Pretty quickly, I had Fedora up and running on the Tablet. The installer did a great job recognizing the screen, mouse, etc. No tweaking was required there. Of course, the tablet was not recognized or configured, but that's par for the course for Linux. But I wasn't going to worry about that yet. The next thing was to get a shell up. The Fedora 9 KDE application panel is very poor (why do open source window manager developers insist on copying Windows instead of just making something simple and usable?). Also, it is apparently not possible any longer to create links to programs in your taskbar? KDE only seems to support a few hardcoded "widgets", which I found useless. Why can't I just have a quick link to a shell? In general, Fedora 9 (at least the version I tried) was very raw. Also check out the Slashdot Fedora 9 announcement . It looks like most of my complaints about KDE were really due to the beta nature of KDE 4. Anyway, I found Konsole buried in the menus, and fired it up. Next: get the network working. The Tablet has an ethernet port, but who uses those anymore? I wanted to get the wireless card working. It detected my home wireless network just fine, but when I attemped to connect using iwconfig I got this error: "ipw2200: Failed to send SYSTEM_CONFIG: Already sending a command." A Google search recommended that I disable hardware cryptography for the device. However, that suggestion referenced a directory (/etc/modules.d) that doesn't seem to exist in Fedora 9. I spent a fair amount of time searching on the web and on my local Fedora 9 install, but was unable to determine how to tweak the ipw2200 modprobe options. So Fedora 9 was already shaping up to be painful. I'll try a later release of Fedora 9, or just wait until 10, when KDE 4 is further along. I decided to step back a version, and try Fedora 8.
Second Distro: Fedora 8[29 May 2008] I burned a Fedora 8 install DVD, and set it to work. At first, this fared even worse than Fedora 9. Whether using graphical or text mode for install, the boot would get about 30 seconds along and then hang saying "running /sbin/loader". At that point the machine would become unresponsive. I tried doing some Internet searches to discover what might be happening. The pre-burn checksum looked okay, and I wasn't really willing to burn another DVD on the off chance I'd happend to burn a bad disc. Searches turned up possible problems with acpi. Most results (such as this one ) recommended turning off acpi as part of the install options. And then users noted that they had problems getting wireless to work. I was about to give up entirely, but while I was searching, the laptop suddenly started responding. Apparently the /sbin/loader hang isn't permanent, it just locks up the machine for a minute or two. Based on other reading it seems to be a later-fixed kernel issue. So I started the Fedora 8 install. As my Plan C, I also burned an install disk for Ubuntu while I was waiting. After a while, I had the Tablet rebooting with Fedora 8. The install did something strange where the Tablet BIOS acted up on reboots, which worries me. However, I was overjoyed by two things:
Third Distro: Ubuntu 8.04I'd heard great things about Ubuntu from a coworker, so this seemed like a good time to try it out. I have gotten used to Fedora, and have an efficient setup, but I was willing to see if Ubuntu would work for me. The setup was painless and straightforward! I felt a bit uncomfortable without getting a chance to control the install, but it completed quickly and Ubuntu wins big points for keeping everything on a single install CD (and I don't think they cheated by using the network since the machine was unplugged and I don't think it figured out my wireless card). Also, Ubuntu booted noticeably quicker than Fedora (any release) on the Tablet. The tablet (stylus) wasn't recognized, nor did xrandr work. (For me, xrandr doesn't work unless it supports rotation). But that's par for the course with current Linux distros. Hooking up to my wireless network was a breeze. There was an icon on the task bar that was very intuitive. However, I must have mis-typed when installing because I couldn't log in as root from the terminal (!). That's the first time I've ever done that. I wasn't keen to go fix the root password. And in any case, I had already decided to switch back to Fedora 8. Why? Because for my digital audio workstation I'd probably want to use the low-latency kernel from PlanetCCRMA , and that only had documented support for Fedora 8. So I bid goodbye to a very smart-looking Ubuntu and went back to Fedora 8.
Final Distro: Fedora 8 (again)So it was back to Fedora 8. I was still kind of freaked out by the weird impact on my BIOS after the previous install. "weird impact on my BIOS": by this I mean I'd get a scary "TIMER INTERRUPT ERROR" on the screen any time I did a restart. If I tried accessing the BIOS when this happened, the laptop would hang. This is well ahead of the kernel startup, so I attributed it to the BIOS. However, hard reboots didn't display the error, nor did they lock if I accessed the BIOS. So I don't think it was part of the persisted BIOS? Anyway, it scared me. I figured it was related to the /sbin/loader lockups, so I did more research on installation options. You can perform various Google searches to find hints. I finally chose a single additional install option: nohz=off based on the Fedora wiki . As usual, I installed in text mode. I was happy to see the install skip past the /sbin/loader line very quickly! I like the default KDE setup! It is very clean, with a lot of space for the desktop, and a slim taskbar where I can configure my application launch buttons. However, the "TIMER INTERRUPT ERROR" returned on reboot. So something else in the Fedora 8 install was having a dangerous effect on my BIOS. Reading around about the problem (like this Google search ) indicated that it was fixed. So rather than mess with more kernel options I decided to run "yum upgrade". This should update the kernel. And in any case, I was planning on moving to the PlanetCCRMA kernel. The upgrade finished (an hour later) so I was ready for the next step.
Upgrading to a Low-Latency Kernel.As much as I love Linux, I have a technical day job and don't need to come home and mess with kernels. However, the Planet CCRMA software package has been very stable for me over the years, so I decided to try it on my laptop. Nowadays it is very easy in any case: just another yum install! I basically followed the instructions at the Planet CCRMA site: Fedora 8 - Planet CCRMA Installation Instructions . I'd already installed Fedora 8 and performed a "yum upgrade" (above) so the next step was to import the Planet CCRMA GPG key and repository, and then run "yum install planetccrma-core". The scary part, of course, is when you see "kernel-rt" install, since that after all is the realtime kernel. The PlanetCCRMA website recommends that after the install you "cross your fingers and reboot the machine." Yikes. One happy note: on reboot I noted that the "TIMER INTERRUPT ERROR" was gone. GRUB showed that I had a new planetccrma kernel, and happily booted it. I didn't notice any issues at all as Fedora 8 booted, and I logged into KDE just fine. As far as I could tell, the realtime kernel was working on my laptop perfectly.
Getting the Tablet Working[1 June 2008] [You can skip this section if you aren't using a Tablet] Great, I now had a working Fedora 8 installation, running on a low-latency kernel. But it is a very nice Tablet PC! So I wanted to get the stylus working. Previously (see my FC5 install on another tablet ), I'd had to download and (sometimes) build the wacom drivers. However, it looks like Fedora 8 includes the wacom drivers, at least according to this source (thinkwiki) . So all I had to do, theoretically, was just update my xorg.conf file so X11 would pick up the stylus. I had to make two changes. First, I had to define the new input devices in the config file: Section "InputDevice"
Option "Device" "/dev/ttyS0" # SERIAL ONLY
Option "Type" "stylus"
Option "ForceDevice" "ISDV4" # Tablet PC ONLY
Option "Device" "/dev/ttyS0" # SERIAL ONLY
Option "Type" "eraser"
Option "ForceDevice" "ISDV4" # Tablet PC ONLY
Option "Device" "/dev/ttyS0" # SERIAL ONLY
Option "Type" "cursor"
Option "ForceDevice" "ISDV4" # Tablet PC ONLY
Second, I had to tell the server object about the new inputs. I added three new lines to the "ServerLayout" section: InputDevice "stylus" "SendCoreEvents"
InputDevice "eraser" "SendCoreEvents"
InputDevice "cursor" "SendCoreEvents" Again, this is all from the thinkwiki page . However, my tablet was using serial port /dev/ttyS0, not S1. You can check the dmesg log to verify which port the tablet is using. With those changes, KDE was now accepting pen events.
Getting JACK Applications WorkingThe next step: get JACK running. As part of installing Planet CCRMA (above) you get access to the planetccrma repository (you can see it in the /etc/yum.repos.d directory). You'll also want QJackCtl , a handy UI widget that lets you control the JACK setup. You can install (or update) JACK and qjackctl using yum, like this: # yum install jack-audio-connection-kit qjackctl (remember--you have to run yum as root or with root permissions). Annoyingly, installing qjackctl required installing QT4 , which is a sizeable download. But I use the QT libraries a lot during development, so I figured now was as good a time as any to download. Once it all installed, I disabled the KDE sound system. I think it supports JACK but I didn't want to take any chances. [Later, I re-enabled the KDE sound system. I think my fear of the KDE sound system was from previous installs years ago. The Fedora 8 KDE sounds system supports JACK, and I haven't had any problems with it.] Then I started up JACK. I found I had to run qjackctl as root, or it couldn't start jackd (?). After I rebooted, however, I was able to run qjackctl from my regular user account. If you check the qjackctl logs when JACK starts, you'll see it is using the -R option (realtime).
Getting MP3s WorkingNothing is more embarrassing for a Linux user than not being able to play the most basic open-source media formats such as mp3 and mpeg. Yet that's exactly what happens out-of-the-box. I know there are various licensing reasons for this, but it is one of the most frustrating parts of installing a Linux distro. Anyone with a basic commercial operating system can just play their mp3s, visit web sites with Flash content, and have it all work. Somehow no one has figured out a way to make a distro do that. First thing: get mp3 support working! I linked to some of my mp3s on a remote server, and then attempted to play them by double-clicking them in Konqueror. This started up Amarok, which tried to guide me through a fairly heavyweight installation process, and then failed to play the mp3. I usually use xmms , since it is pretty lightweight and skinnable. I installed using yum install xmms xmms-jack So I'd have the JACK plugin. Of course, this still didn't play MP3's. In theory, getting mp3's to work is as simple as running yum install xmms-mp3 with the correct repository. Getting the correct repository is the trick: you don't want to pick up something that is incompatible with the PlanetCCRMA repository. Based on some searches, it appeared that the freshrpms repository should be compatible. It was recommended that I enable it, download what I need, and then disable it (!) so that my system wouldn't start pulling other packages from it. So for now, get freshrpms available as a distro by typing: rpm --import http://freshrpms.net/RPM-GPG-KEY-freshrpms
rpm -ivh http://ftp.freshrpms.net/pub/freshrpms/fedora/linux/8/freshrpms-release/freshrpms-release-1.1-1.fc.noarch.rpm (see instructions here ). Then go into the /etc/yum.repos.d/freshrpms.repo file and disable it by setting the "enabled=" line to be "enabled=0". Now you can install the xmms-mp3 package and enable the freshrpms repository just for that install by running yum install xmms-mp3 --enablerepo=freshrpms At this point, I rebooted. When the machine came up again, I was able to start qjackctl from a non-root user, and mp3 playback from xmms worked fine. Also, I was able to re-enable the KDE Sound System using JACK, and system sounds worked fine. Great!
Getting Xine WorkingNext: getting video working. In this day and age of video cameraphones, your laptop isn't much use unless you can connect and have it play various formats like mpeg, wmv, 3gp, etc. This was another install that required freshrpms. I installed by running (as root as always for yum): yum install xine --enablerepo=freshrpms I found that wasn't enough to make xine JACK-enabled (no audio), and I also wanted plugin support for Firefox. Fortunately, that's as easy as getting two additional packages: yum install xine-lib-extras xine-plugin --enablerepo=freshrpms Then I had to go into the xine setup, and set the audio driver to JACK. After that, playback of various audo + video formats worked fine.
RosegardenOkay, I now have a functional laptop with a low-latency kernel. Now for some composition tools! Rosegarden is my composition studio of choice, mostly by habit although there isn't much else for Linux that has such good integrated MIDI + digital audio support. Rosegarden is pretty easy to install once you have a Planet CCRMA setup. Just run: yum install rosegarden4 And you are set. Once it completed installing, I was able to run rosegarden from the command line just fine. I haven't tested it yet, however...
HydrogenNow for a good drum machine: Hydrogen . To install, just run: yum install hydrogen It installed pretty quickly, and then I was able to run hydrogen from the command line. To test Rosegarden and Hydrogen, I fired up hydrogen and then rosegarden, opened a MIDI file in Rosegarden, and played it. Hydrogen picked up the MIDI events and started playing them. Likewise, I could shut down Rosegarden, and just compose drum tracks in Hydrogren. Pretty good!
FluidSynthI also decided to try FluidSynth , just because a few other sites had recommended it. Again, it is an easy install: yum install fluidsynth fluid-soundfont qsynth Watch out! The soundfont package is huge (over 100 megs). But it downloaded for me reasonably quickly. You want the qsynth front end--it gives a nice UI for the fluidsynth engine. Then I was able to start Rosegardent and qsynth, open a MIDI track, and play it. The fluidsynth engine would pick up the MIDI events and play. NOTE: first I had to open a soundfont. The yum install (above) puts these in /usr/share/soundfonts. Just open the control panel in qsynth, click on the Soundfonts tab, and open the soundfonts. I couldn't get Rosegarden to drive both Hydrogen and FluidSynth at the same time. Once Hydrogen was involved, FluidSynth would stop responding, and I had to restart everything (without Hydrogen) for it to work. So clearly some hand-holding is needed when running multiple MIDI listeners. However, I was pretty happy to get FluidSynth up and running so easily. This was a good proof of concept.
USB Audio DevicesThe laptop is now working fine as a software-only device. What about adding a USB2.0 external interface to support high-quality audio i/o and MIDI? A lot of people recommend only using FireWire, not USB, since without FireWire you will experience latency. But I figure I can play with FireWire later, and get USB2.0 devices working with my setup first. What USB2.0 audio interface to get? I did some searches, and had the best luck at zzounds . I particularly liked the looks of the Tascam US-144 . In fact, I was all the way through their order process and was about to click "Confirm My Order" when I got cold feet. I decided to do a quick search and see if the US-144 would even work under Linux. Sure enough, the US-144 does NOT work under linux! So I abandoned that purchase, and kept looking. A few sites had recommended M-Audio for Linux support. So I looked at the M-Audio Fast Track Pro . It looked like a simple and reliable USB audio interface with some Linux support. However, once I found the LiveJournal review , I was a little leery. It is incredibly cheesy that someone would compensate for noisy electronics by throwing in a noise gate! But I saw a lot of references to people working successfully with this interface on various flavors of Linux, including Fedora 8. So I decided to buy one, if only so I could get some experience with an external interface, even if the quality wasn't great. I'm hoping that by the time I need a better interface there will be good Linux support for a range of FireWire devices. In the end, I found the Fast Track Pro for sale cheaper on Amazon.com , so I bought it there. Now I'm just waiting for the interface to show up! [4 June 2008] The interface showed up today! I plugged it in, and powered it up. A blue light came on. Yay. Next step: get it recognized by Alsa/Jack. That was partially working, since the QJackCtl setup window saw the Fast Track Pro available as hw:2. Also, if I ran % aplay -l I could see the Fast Track Pro listed as card 2, with both outputs available (channel 0 and 1). I could see the Midi ports show up under the QJackCtl connection window. But I couldn't see any audio/PCM ports available. ALSA was definitely happy with the device, since % aplay -D hw:2 test.wav seemed to work fine. JACK refused to acknowledge it. But then I realized that was just me being an idiot. Because I'd configured Jack to use the Fast Track Pro as the device, it was showing up in the Connections panel as "System". Once I realized that, I fired up XMMS, played an MP3, and heard music through the headphones I'd plugged into the Fast Track Pro. Awesome. Summary of configuration: I had to go into the QJackCtl settings panel, and select the Fast Track Pro as the Interface. Put another way: I didn't really have to do anything! It was pretty painless. Kudos to the many ALSA, OSS, and JACK developers out there. [Although see below: the actual configuration is a bit more complicated. But not too bad.] Later I hooked it up to my studio mixer and got decent quality audio out through my monitors from the TRS output (1/4" jack). Although this video didn't help much of my Linux troubleshooting, I did find it to be a good overview of the Fast Track Pro. [Annoyingly, YouTube isn't working well after I've gotten JACK set up--problems with the Flash plugin?]
Recording through the InterfaceOkay, now could I record audio? Getting recording to work wasn't as straightforward as playback. I could see the system capture ports on the QJackCtl connections window, and they were properly hooking up to the Rosegarden recording ports. But when I tried to record in Rosegarden, no sound was registered. Finally I found the problem. As this Ardor posting notes, the Fast Track Pro can act as separate devices. You need to configure it a bit (almost as if it was two different devices!) so you can record and playback smoothly. It was this picture (from the Ardor post) that finally clued me in: I had to configure the Input and Output devices in jack separately. For me, I ended up switching Interface back to "(default)", and then setting the Input Device to be "hw:0,1" and the Output Device to be "hw:0,0". Then I was able to record and playback from within Rosegarden! This was a bit complicated, but I grudgingly see the purpose: different interfaces and/or hardware configurations could result in funky input/output settings. JACK had to be generally configurable so that everyone's hardware would work. But after all, the point was to learn more about Linux audio configuration. So far, so good! The main take-away is that you need to learn how to configure your audio devices for JACK and recording/playback may be configured slightly differently.
Integrating external MIDII was almost finished with the initial install! The remaining step: getting MIDI to work. I have an external keyboard, so I hooked the MIDI in/out ports up to the Fast Track Pro. Within 30 seconds I was able to record MIDI tracks in Rosegarden, and play them back externally. Just for fun, I also recorded a MIDI track from the keyboard, then had it play back through to Hydrogen, so my piano notes came out as random percussion hits. Then I loaded a sample MIDI file into Rosegarden, and had it drive my external synth. Good. Most impressively, I was able to fire up QSynth, then hook up my external keyboard's MIDI out to the fluidsynth engine's MIDI in (again, using the QJackCtl Connections window). I shut down the volume on my external synth, played the keyboard, and fluidsynth produced the output sounds in realtime. I didn't notice any latency (JACK claimed a latency of 2.7ms), and I was able to pretty seamlessly drive the virtual synth from an external keyboard. Wow. One weirness: JACK didn't automatically hook up the MIDI in from the keyboard. So I had to manually do that in the QJackCtl connections window (ALSA tab).
More Respect for JACKPlaying with the recording and playback, and the MIDI connections, gave me a lot more respect for JACK. Having the ability to patch back and forth between different devices (real and virtual) was surprisingly easy. I also started to see the power of patching voices in and out using JACK connections. For instance, I could do a bunch of composing using an external keyboard and quickly switch over to an internal device for playback just by swapping out a patch cord in the QJackCtl connection window. Impressive! I went back to the JACK home page , and surfed through more of the documentation. This presentation is well worth perusing. I haven't yet listened to the audio track.
For Follow Up...With a basic stable distro, I intend to check out the following synthesis programs:
Post a commentWARNING: This is a very primitive comment posting. Stick to alphanumerics only! No quotes, brackets, etc.