Audio on Linux weekend…



For most people here in the US, this last weekend was known as Labor Day weekend, for me though… it was more like Audio on Linux weekend. I’ve mentioned before that I use my computer for most EVERYTHING and that’s not far off…. I have watched movies on the PC, I’ve recorded multitrack audio, captured tv shows to disc, and of course, work…. database server, digitial photos/editing, test web sites, word documents, test various hardware, etc. etc. test software, etc…. vmware…. oh the list could keep going and going and going…. Well, sometimes it seems that optimizing the machine for one thing comes at the expense of another. Since I had to swap out the system board on the main machine (massively failing probably due to overheating…. multiple pci slots had failed, etc….) I hadn’t had a chance to see why some things didn’t work the way I used to….


First off, the tvcard would freeze the system promptly on attempting to open xawtv or tvtime. I began to wonder if the card had somehow been damaged in the previous board. But…. that wasn’t my primary goal. I had decided it was time to get my old Ensoniq AudioPCI installed again and bypass the onboard sound because I really wanted to do a bit more audio work on the pc again. (It’s been a while since I’ve had things set for good audio workflow…) Unfortunately, the system froze just after X loaded with the soundcard in… I thought maybe the card was the culprit before, when I realized that I had the same problem with the tvcard. So, I tried multiple slots and no joy. I ran across this hardware stability guide hosted over at IBM which suggested that an IRQ conflict could be part of my problem…. I did a “cat /proc/interrupts” and sure enough, even though I had all PCI devices…. Sound and video were sharing an interrupt and the tv capture was sharing an interrupt with video when the sound card wasn’t present. Why? Shouldn’t pci interrupts be able to share better? I had always thought so…. I went through bios and tried varying settings to no benefit…

I booted up my Ubuntu livecd and things worked, EVERYTHING…. hmmm…. maybe I should finally make the plunge over to KUBUNTU…. no there’s got to be some reason.

I even wondered if something like the M-Audio Audiophile 2496 MIDI Digital Recording Interface might help solve the problem…. (although I searched for and found a soundblaster live 5.1 with midi/game port.) But…. I hoped to resolve things without ordering something new.

Finally, I looked at my lilo.conf settings…. for the default boot options I had…. append=”acpi=off mem=nopentium splash=silent resume=/dev/hda6 agp=off” (legacy of troubleshooting the previous boards problems.) I remember distinctly disabling things when the old board was acting up…. so I removed acpi=off and agp=off and everything worked on the next boot. Now, instead of shared IRQ’s…. I get this with cat /proc/interrupts….

cat /proc/interrupts
CPU0
0: 30011895 IO-APIC-edge timer
1: 8594 IO-APIC-edge i8042
8: 0 IO-APIC-edge rtc
9: 0 IO-APIC-level acpi
12: 100306 IO-APIC-edge i8042
14: 297646 IO-APIC-edge ide0
15: 269355 IO-APIC-edge ide1
17: 2615384 IO-APIC-level nvidia
18: 43 IO-APIC-level Ensoniq AudioPCI
19: 16 IO-APIC-level btaudio, bttv0
20: 0 IO-APIC-level ehci_hcd:usb3
21: 0 IO-APIC-level ohci_hcd:usb2
22: 3123744 IO-APIC-level ohci_hcd:usb1, eth0
NMI: 0
LOC: 30012167
ERR: 0
MIS: 0

So… that dragon slayed, I have my nicer sound card in (well it is better than the onboard…) it’s time to look at some audio programs. Now, under linux there are a confusing array of sound choices…. For starters, at the lowest layer, there are OSS and ALSA sound drivers for most cards. (Well, supposedly ALSA support is more limited, but I’ve never run into problems.) OSS is the older driver approach and is usually straightforward. The quality is not as good for audio purposes though (and only one program at a time can use the sound card…) So, I was interested in using ALSA drivers (the ubuntu cd did by default.) The only real problem with ALSA is that some programs don’t recognize ALSA sound devices and either require that there are OSS emulated devices, or that the program is run with an Alsa OSS wrapper program…. “aoss myoldprogram” But… many programs have alsa plugins, and for that matter, the major sound systems (arts/esd and jack) can deal with alsa just fine.

Sound systems?? yes… that’s the next layer. Think of the sound system as “air traffic control” that sits between the audio driver and programs. These systems (arts/esd and jack) provide different approaches to that task. For most recording specific software on linux jack is THE sound system to use. In fact, some audio software doesn’t run without it. (Some does, but would rather not…) Jack is the most sophisticated in many respects surrounding semi-pro/pro audio on linux and “just worked” when I had the alsa driver setup. Now there was a time, when programs that wanted jack to be running would expect you to start it seperately. I recall ardour and rosegarden4 complaining because jack wasn’t available some years back, but these days, they both offer to start jack if it’s not found running.

What’s really neat about jack is it can act as a virtual patch bay in your linux system. Outputs from jack enabled programs can be “plugged in” to inputs of other jack enabled programs (effects software/recordng software/etc.) It seems that talking about it is an abstract concept, USING it – things start to make sense fairly quickly. So, anyway after spending an hour or two troubleshooting my interrupt conflicts and another couple minutes changing to the alsa drivers I was ready to revisit all the audio options on linux.

One of the first things I wanted to do was to test the midi functionality of the card – timidity is a softsynth and was required since the onboard midi isn’t usable with the linux driver. However it should be noted that external midi on the ensoniq audiopci IS supported. I was able to record midi and audio input both from the digital piano that I have hooked in via rosegarden4. There are a lot of things to like about rosegarden. In features it reminds me of powertracks pro audio from pgmusic. (Before the move to linux powertracks was my main audio application.) I updated rosegarden to the latest version and played around with it a while… The biggest frustration I saw with rosegarden right off was no built in wave editor for the audio files (and I didn’t see a way to export audio tracks, but later discovered that rosegarden kept them in wav format.)

For quite a while audacity had been my multitrack tool of choice under linux and so I wanted to take a look at that as well. Unfortunately, even after installing a version that supported ALSA devices, it would crash when attempting to play or record anything. I went back to the old release, back to the new, tried the OSS sound device again, etc. but… ultimately I found this was a Mandriva 2006 limitation and found advice to alter the /etc/security/limits.conf file so that the line

@audio – rt_priority 50

should read
@audio – rt_priority 100
instead…. that worked and audacity was able to play back my old sound files (although it refused to work at anything other than 48000 hz sampling.) I also discovered that I couldn’t launch it with jack running (segmentation fault.) So, I did more testing of audacity with jack shut off and was able to record, but got quite a loud crackling in the playback. It’s a shame really, audacity had a nice clean easy to use interface, but this time around the quality was very poor. At first I thought it was hardware noise, but on review it only showed up on an obnoxious scale in audacity. The version of audacity that supports ALSA directly uses portaudio v19 and is still in beta form. I found some suggestions that the noise may be related to that in some of audacities forums. They said that there have been some big improvements in cvs since the latest release of the beta branch, but I didn’t bother to follow up further. (There was talk of a new release hopefully in the early part of September, so maybe in a few days I’ll be able to try out an official new release.)

So, at this point I experimented with vmware and installing powertracks pro audio in a windows xp virtual machine to see how well that worked. VMware doesn’t do alsa… (of course…) so… I had to search and find ways to make it work. The suggestion was along the lines of aoss (which didn’t work.) I did find some other approaches. This did work for me (using vmware server 1.0.1 by the way.) Find vmware-vmx which on my system was in /usr/lib/vmware/bin and I copied it to /usr/lib/vmware/bin/vmware-vmx-working – then I created a wrapper script called vmware-vmx in it’s old location, the contents need to look like this….

#!/bin/sh
export LD_PRELOAD=libaoss.so.0.0.0
exec /usr/lib/vmware/bin/vmware-vmx-working “$@”

Very simple and YES it works. I was able to both play and record audio in a virtual machine with reasonable quality. I tried MIDI functionality and the software synth in XP worked, but the keyboard input didn’t. I did find information suggesting that this isn’t supported in VMware. The most convincing reasoning seemed to be clock speed issues, which would cause problems with MIDI – realistically, even the soft synth had “strange” problems from time to time – speed irregularities. (Fast then slow, then fast again, etc.) So, maybe sometime I’ll revisit powertracks in wine.

But, I wasn’t done yet (not by a long shot.) What I’ve just passed along is what I spent part of Friday evening and a bit of Saturday afternoon with. Just little fragments of time. I spent MOST all of Monday looking at/working with ardour and found myself greatly liking it. I remember looking at ardour once before and not really getting much success from it. Maybe it was the old OSS drivers and JACK (or lack of Jack) that did me in and sent me to the simpler interface of audacity. But this time I was convinced to put it through it’s paces. Now the interface (ardour 0.99 is based on GTK (1)) is a bit different. But the initial screen tells you how to get your project started. (Start a new session via the session menu.) One thing that’s a bit unusual is you start a session, THEN you add tracks to it (by default 0 tracks in a session.) But after a few half starts just to test the recording quality (which was very nice – no extra audio artifacts.) I sat down to do a bit more serious test with a hymn I’ve found myself playing quite a bit lately.

I fired up the trusty old tascam portastudio as my mixer and laid down a piano track directly into ardour. In the process I did hear some distortion, but it could have been from the odd audio setup that I’ve got (no distortion in reviewing the recording.) Let me see if I can explain – the digital piano has line out, which goes to the tascam and then into the pc. The pc speaker out, goes into the in of the piano (yes it uses the piano speakers for output.) I had headphones plugged into the digital piano (so I was monitoring the direct audio and the routed through the pc audio.) I did try adjusting that a bit by muting the track that I was recording and that seemed to help, but I may need to rethink my monitoring setup.

During the recording process I did hear the occasional skip and lag as the play head moved through the song and would go to the next “page” in the track window. After observing this on playback I disabled the feature to draw the wave as it records and to follow the play head and that seemed to help (although I DID have other things running in the background that I then closed as well (firefox/akregator (rss reader.)) Really, for best performance you should shut down EVERYTHING not necessary for recording. I did a bit more aggressive shutting down before I went back and added a brief organ track to see if that improved the skipping. It did – I had nice, smooth playback and recording.

Next I added a weak scratch vocal track for the melody and set off to play with the results. For one, it’s easy to import an existing audio clip. It appears as though it needs to be in wav format already (mp3’s were declined.) Also, for best results it ought to be the same bit rate as the project. (I used sndfile-resample for this task.) The only sample I ran into an obvious need to do this was a 22 khz sample that sounded like chipmunks chatting instead of normal voice. One thing that I’ve found fascinating about ardour is the way it deals with audio clips and the non-destructive editing philosophy. Not only do they have the non-destructive idea right they’ve got the implementation right too. When I record audio for track one, it’s considered 1.1, then if I punch in/out a small section (to fix a rough spot..) that layer get’s called 1.2 (both options are still accessible.) I could retake the entire track as 1.3, or import audio into the track as 1.4, these “objects” could then be deleted, changed or moved to another track as needed. It is possible too to purge your unused clips, but I like the layered approach in the user interface – it really makes the process of “picking and choosing” from various takes and punch ins. What had me liking ardour even more is the use of wav files as the storage container – so ALL of the clips are accessible via other software. NICE.

Ardour does not yet have midi sequencer capabilities, which is probably the only thing that has me thinking I’ll be using other software as a compliment to it. As a DAW (digital Audio Workstation) or multitrack recording application it excels though. I’ve just scratched the surface. Things got more interesting as I worked with the mixer. For starters, you get a traditional-looking studio console resembling mixer with a strip for each channel in your project (session) and a strip for each bus as well. Of course, near the top you’ve got the typically solo/mute and record buttons (record selects the track to be recorded to when record/play are pushed.) You can also adjust the speed of a track, or add prefader effects (black box under the record button), add effects postfader (black box underneath fader). Of course, you can adjust the volume with the fader (and nice VU meter btw), or pan your track (left-right slide – typically the small black bar underneath the postfader box.)

Of course, you can adjust inputs and outputs for each track as well and in the effects boxes you can add inserts and sends too. I’ve got to admit it’s been so long since I’ve worked a true mixing board, it took me a bit to brush up on why I would want a send/insert – with the dizzying array of plugins available I’m still a bit overwhelmed at the choices. In contrast to powertracks I’d like to make a couple of comparisons – with powertracks, effects are “applied to a track” which usually meant the entire track was altered, with ardour, effects are applied during playback/mixing and can be bypassed, leaving your original track untouched. (Of course, it would be possible to take track one, apply affects and record the output to track 2 it appears.) Just thinking through it, I would think you could record with effects initially as well. (Although, the audio engineer in me REALLY wants the purest/best signal possible on disk and then tinker later.)

Plugins and effects though are an area I haven’t delved into much detail yet. They don’t “just come” with ardour. Ardour supports ladspa plugins. Ladspa is supported by a large number of linux audio programs (rosegarden). In fact, there is a program called jack-rack that can act as an effects box, using jack to patch from ardour to the effects box, and back (or on to another program.) I do like the possibility of using effects internal within ardour though. The biggest collection of ladspa plugins I’ve found are the cmt-plugins (although I’ve installed just about everything I’ve found, including tap-plugins.) The command listplugins in the console can show what ladspa pluigns are installed.

Under windows there are vst plugins. You might be surprised to know that a number of these can be used via wine and a package called dssi-vst. After a vst plugin is run by vsthost it seems to be added to the list of options rosegarden (type vst) – although to work with ardour it appears that you need to launch it standalone with vsthost and then use jack to patch in/out. (Page dedicated to listing compatible vst plugins) Just playing with the effects possibilities and patching sends and inserts into busses to tinker took hours Monday. I think I could probably waste a whole week trying different effects on the scratch vocal that I put down looking for something to make it sound less like a scratch vocal. (We’ll fix it in the mix…)

So, now you know how I spent most of my weekend. (And what I may be playing with the rest of the week.) Hopefully though, now that I’m more familiar with ardour, I’ll feel like I can sit down and do some recording a bit at a time.

Just realized that ardour can support vst plugins via fst (freest), it needs to be compile with that support. Also, I have halfway mentioned another plugin standard DSSI – (large listing of free vst plugins might be found here).

A few things I didn’t mention Powertracks is available from PGMusic for Windows/Mac and it does have some good features ($49). (Sequencing/Audio Recording/notation). Also Audacity is available for Windows/Mac/Linux (Audio recording only).

BTW – I think this last look at ardour really has me seeing a good way to put a dual-monitor setup to use.

   Send article as PDF   

Similar Posts