A Linux Audio Christmas

Some interesting items showed up under Dave's Christmas tree, including a new book by some old friends, a laptop keyboard (music, not QWERTY), and an excellent Linux audio plugin for high-quality reverb. Dave must have been a very good boy last year.

The Audio Programming Book

Dr. Richard Boulanger has dedicated his life to the promotion of computer-based music, with a particular focus on the Csound audio/MIDI programming language. His resume includes work with the Who's Who of pioneering electroacoustic musicians and researchers, and his role as educator continues to bring new talents to greater awareness and achievement.

In the year 2000 Professor Boulanger - a.k.a. Dr. B, a.k.a. Rick - fulfilled one part of his mission when the MIT Press published The Csound Book. That book was a collaborative work that drew contributions from the leading lights of the Csound development and user communities. Rick edited those contributions into an organized and coherent presentation of Csound's many facets, from the details of its C source code to the design of rich synthesis and composition tools. Thanks to the good doctor's guidance and his own contributions The Csound Book is considered a fundamental text for serious students, and in this Csounder's opinion it's likely to remain so for a long time. 

Figure 1. The Audio Programming Book

Jump to 2010 and Rick's latest magnum opus The Audio Programming Book (Figure 1). With this volume Dr. B and co-editor Victor Lazzarini have published another fundamental work sure to provide a thorough course of study relevant now and for future generations of students, composers, and researchers. The Audio Programming Book gathers material from diverse domains - including mathematics, computer science, music, audio engineering, and digital signal analysis - and presents them in the unified context of audio programming in the C programming language (with a liberal dose of C++). The book's broad topics are arranged in this order :

  • C Programming Basics
  • Audio Programming Basics
  • Audio Programming Essentials
  • Spectral Audio Programming
  • Programming Csound Opcodes
  • Algorithmic Synthesis And Music Programming

Each general topic includes two or more articles that describe the topic with hands-on examples and projects. The emphasis is on use throughout the book, and the reader is well-advised to wear his thinking-cap as he proceeds. There's a reason this book isn't titled "Audio Programming For Dummies" - beginners are more than welcome as long as you're attentive and willing to learn as you go. Linux users are likely to have easy access to the recommended toolchains, but the C/C++ appears to be conscientiously cross-platform, and it is clear that great effort has gone into creating exemplary code that can be compiled on Linux, the Mac, and Windows systems. Csound is heavily favored as a production target, as might be expected from a group of expert contributors drawn from the Csound programming world, but the C/C++ sources should be as useful for other waveform compilers, e.g. SuperCollider3, PD, and Cmix/RtCmix.

The book is a true tome, and so far I've only hopped around in various chapters in the book. The authors are all well-versed in their topic fields, and the writing style is uniformly readable and clear. I don't typically expect a book like this one to be a comfortable read, but in this instance it's a real pleasure. For example, I had a great time reading Richard Dobson's chapter on programming in C. It's been years since I worked with the language, and even back then I only played around with it. However, I learned enough to write some useful score generators and other Csound helpers, and the experience was a great help when I wanted to learn other programming languages. Mr. Dobson's presentation re-inspired my interest in C, and I look forward to studying his chapter on audio programming in the language.

The book can be read straight through or it may be utilized on an "as needed" basis. Obviously a background in computer programming will let you get into the heart of the matter more quickly, and experienced coders can directly jump into the deep end. For the novice I suggest a careful study of the first two sections, then you can select the areas of greatest interest for your further studies. In my opinion, experience with scripting languages such as Tcl/Tk or Python can be valuable here, but it should be understood that programming in C/C++ will be a very different experience. The bottom line is clear: If you're new to C and/or C++ be sure to spend some time in the first two or three sections of this book.

Not much more to say about it now, except "Go ye forth and buy this book". In my opinion US$60 is a bargain for a hardcover book of nearly 900 pages (plus DVD), and if you need to deepen your knowledge in the domain of audio programming, then you need this book. Borrow the money from friends, take out a second mortgage, sell your car, but just buy it.

The Akai LPK25

I needed a USB keyboard for an article assignment, so my Christmas present to myself was an Akai LPK25 (Figure 2). This little charmer includes a transposable two-octave velocity-sensitive keyboard with a surprisingly powerful arpeggiator, and it all works out of the box with Ubuntu. Documentation is thin - a 7-page PDF that mostly refers to the configuration software. Fortunately that utility runs perfectly with Wine. Most of the keyboard's features are programmable from the unit, but the configuration editor accesses a few cool "extras". For example, the arpeggiator's clock source can be toggled between its internal clock or a MIDI clock stream from an external source. The feature worked perfectly with Ardour3, but alas, as far as I can tell there is no way to set the clock source without the editor.

Figure 2. The Akai LPK25

I'm not much of a keyboard player, and the feel of the keys is a bit stiff for me. It's not really a problem, I just have to remember to play a bit harder than I think I should. The only part of the unit that disappoints me is the USB connection. It's a mini-USB connection on the keyboard side, and it has a tendency to loosen. In that one regard the design is poor, and I have to rig a small supporting block under the plug to keep it from falling out. Otherwise, the hardware seems sturdy enough for use in the compleat Linux home studio.

Further documentation and examples of use can be found on YouTube. Check out the presentation by The DSP Project, it's a quick and thorough run-through of the unit's capabilities. Other videos are available - the LPK25 is a popular keyboard - and you're sure to find out everything you need to know about it in short order.

By the way, I purchased mine on eBay for about US$60. Akai's suggested retail price is US$129 but you can find them heavily discounted in most music stores, on-line or in the physical world.

Tom's IR

With a portfolio that includes the Aqualung music player and the TAP collection of LADSPA audio processing plugins, Tom Szilagyi is no stranger to Linux development. Recently he added a significant new contribution to the Linux audio community - an LV2 plugin simply named IR (Figure 3). Here's what its Website has to say about it :

"IR is a zero-latency, realtime, high performance signal convolver especially for creating reverb effects. Supports impulse responses with 1, 2 or 4 channels, in any soundfile format supported by libsndfile."

Figure 3. Tom Szilagyi's IR.

An impulse response file is a recording of the reverberant characteristics of an environment. The response is created by triggering a sound source that's loud but has virtually no sustain. A starter pistol or firecracker will do nicely, but anything will work as long as the sound of the impulse itself is very short. An impulse response file simply removes the portion of the recording that contains the impulse, leaving only the reverberations, i.e. the environment's acoustic response to the impulse signal.

The impulse response can be utilized in a process called convolution reverb, and here's where things get interesting for digital recordists. Convolution applies an impulse response to a digital audio recording and enhances it with the reverberant characteristics of the response's original acoustic environment. A similar process yields impulse responses taken from hardware reverberators. Thus, given the appropriate impulse response file I can make my home studio recordings sound as though they were made in the Taj Mahal or with a reverb unit far more expensive than I could ever afford. That's the attraction of convolution reverb, and you can check it out for yourself with Tom Szilagyi's IR.

I tested the latest code on 32-bit Ubuntu 10.04. I routinely build and test Ardour with support for LV2 plugins, so I had no problems with the toolchain. After installing the plugin I ran it on tracks in Ardour 2.8.11 and Ardour3 built from the latest SVN sources. Figure 3 shows off IR processing an impulse response from a Lexicon PCM90, a well-known hardware reverb unit. Alas, the figure can't illustrate IR's glitchless performance as I switch impulse responses. I didn't expect such smooth operation, and I am impressed. Sound quality depends on the quality of the impulse response, but fortunately there are plenty of response files available over the net. I've already collected hundreds, so I expect to be occupied with IR for quite a while.

By the way, when Tom announced IR on the LAD/LAU mail lists he referred to "standing on the shoulders of giants", particularly noting his use of the zita-convolver by Fons Adriaensen and the libsamplerate and libsnsdfile libraries by Erik de Castro Lopo. IR is an excellent example of audio software created with high-quality open-source components and some equally high-quality imagination. Thanks, Tom, we needed this one.


I hope your holidays were enjoyable too, and I hope you found some Linux audio-related gifts under your tree. I'll return soon with more news about a few more interesting gifts from the Santas of Linux audio development, and of course there's always more great stuff coming up. I'll do my best to let you know about it.

Load Disqus comments