Musings From Studio Dave

by Dave Phillips
So now I'm a blogger. Well, this column has been a kind of journal anyway, a chronicle of my life and times in the world of Linux sound and music software, and hopefully it's as enjoyable for you to read as it is for me to write. You can expect little change from the style and content of my previous articles, despite my imminent bloggification, but in accord with the popular definitions of a blog I'll be a little less formal and sometimes a lot more personal. Not that there's much fuel for acrid controversy in the world of Linux sound and music software, but there are issues occasionally and I'd like to speak plainly regarding them.

I use Linux exclusively here at Studio Dave. I have a modest home studio that I use for music composition and recording, but it's also a central component in my teaching practice. Students are introduced to ear-training with Tom Cato's wonderful Solfege, they learn how to capture audio and manipulate it with the Audacity soundfile editor, and they read scores in standard notation beautifully rendered by the LilyPond music typesetter. They also see and hear the sophisticated control systems (e.g. XMMS, MPlayer, xine) I use to play their CDs, DVDs, and MP3 collections.

I enthusiastically promote the use of the computer as a powerful learning aid. Most of my students have computers running Windows, so I recommend software for that system. Happily, some of my favorite tools are available as cross-platform applications (e.g. Solfege, Audacity, LilyPond), and I recommend FSF-sanctified free software whenever possible. I'm not especially evangelistic about Linux, but I'll happily talk about it with anyone who shows an interest. However, students primarily come to me to learn about music, not computer operating systems.

Advanced composition students are more likely to get an introduction to Linux, particularly if they're bound for college or conservatory. Those students are likely to encounter programs such as Csound or SuperCollider, and I like demonstrating how nicely those programs run under Linux. The system's affordability is an added attraction for those students. Purchasing a Mac or WinXP system fully outfitted with Max/MSP, Pro Tools, and Cubase is a rather expensive proposition for the average student, and I like to advise such students that there are alternatives to expensive software and vendor lock-in.

One of my recent projects combined MIDI sequencing, multichannel audio recording, and music notation, all under Linux. By the way, the system is Demudi 1.3 based on Debian Etch, so it's a bit on the edge, but the examples shown here should be do-able under any similar Linux distribution with an optimized audio/video environment.

My student Sam is working on classical guitar technique. Recently we've been playing duet arrangements I've made from various solo pieces, and of course the printed pages of my arrangements have been typeset by LilyPond. Sam's mother plays the flute and his sister plays the harp, so I decided to write a simple piece for the trio of flute, harp, and guitar. I fired up my trusty Linux MIDI sequencing environment and went to work.

Figure 1: MIDI Composition at Studio Dave

Figure 1 illustrates my typical MIDI workspace, with Voyetra's ancient Sequencer Plus Gold running under DOSemu. Josep Andreu's midirgui routes the MIDI output from Sequencer Plus Gold to the excellent QSynth soundfont synthesizer running three instances of the synth engine. The audio output of the synthesizer runs through the wonderful Jack Rack effects processor, and QJackCtl manages the audio and MIDI connectivity.

Users of QSynth might note that I certainly didn't need to run three engines, that one would have been enough to handle a mere three channels of MIDI data with a relatively light texture and only a few continuous controller events. Ah, but I had further plans. I wanted to record each instrument to its own channel, so I separated (rechannelized) the MIDI output with midirgui to drive three QSynth engines, each with its own audio output port. Cool.

By the way, my current desktop machine is a lowly 800 MHz box that actually runs Ardour nicely, but if I just need a quick and easy multichannel recorder I just fire up ecasound. I love ecasound, it works perfectly, and it does just what I tell it to do :

	ecasound -c -f:s16_le,3,44100 -i:jack -o:gfhtrio2.wav
This invocation starts the session for interactive work (the -c option), indicates the file format (the -f switch), and sets the I/O options (JACK in, WAV out). After starting ecasound I make the necessary connections in QJackCtl, then I start the sequencer. When I finish I click the Stop button in QJackCtl to end the ecasound session. Neat and sweet.

Note that the file format definition translates to "signed, 16-bit, little-endian, 3 channels, 44.1 KHz sample rate", i.e., a 3-channel WAV file.

Now and then someone asks why I use such an antique MIDI sequencer instead of one of the fine native Linux MIDI sequencers. Well, Sequencer Plus is a powerful program for recording and editing MIDI data, and I spent many years mastering it. The program is intensely keyboard-centric, and after two decades of untutored practice I can compose with Sequencer Plus Gold as fast as I can type. I'm also happy to report that Sequencer Plus runs flawlessly under DOSemu.

Despite my enthusiasm, I don't recommend Sequencer Plus Gold to the modern Linux MIDI musician. There's no undo/redo, no audio file sequencing, no support from the manufacturer, and no source code. It's freeware now, but unless you've already invested the kind of time I've put into it you're likely to be much better off learning how to use one of the fine native Linux sequencers listed at the MIDI page.

As my work proceeded I realized that I was taking a lot of time to set everything up for each session. I had to route audio output from the QSynth engines to Jack Rack, and I had to make the MIDI connections from the sequencer to midirgui and from the channelizer to the QSynth engines. I quickly realized that I would save time if I could automate the signal routing and connectivity.

Linux audio folk now have the LASH session management software to help save and recall session configurations, but my application mix was LASH-ignorant (with the exception of Jack Rack). Ah, but Linux has magic at the command line, so I wrote this little script to open and prepare my sessions :

  xdosemu -input \r big.bat &
  midirgui -l /home/dlphilp/gfhtrio.midir &
  qjackctl &
  sleep 7
  qsynth &
  jack-rack /home/dlphilp/racks/plate2x2.rack &
After writing the script (which I named sequencer.scr) I made it executable with this command :

	chmod a+x sequencer.scr
The script demonstrates shell programming at its simplest, but it's a powerful helper. I added it to my Fluxbox menu so that I can launch my entire session with a single click, opening my workspace within seconds. I could further revise the sequencer batch file to load a particular piece at start-up, but I was working on three different pieces and wanted to make my file selection after the sequencer opened. Similar scripts can be written for other projects, and further amenities are easy to imagine and implement.

Within the script the order of operations is critical. Midirgui must be opened before QJackCtl for correct port numbering, and the sleep command must last long enough to make sure that QSynth and Jack Rack open after JACK is up and running. The command to open DOSemu receives a batch file that installs the DOS MIDI driver and opens Sequencer Plus. This part of the script could occur anywhere. Both midirgui and Jack Rack include command-line options to open specific files. QSynth retains its last settings, so it's ready to go upon opening.

QJackCtl's Patchbay is indispensable in this arrangement. I can save all my connections (MIDI and audio) as a patchbay profile for instant recall and reconnection, and if I select Activate Patchbay Persistence in the Setup/Options tab I can indicate which profile to activate at start-up. Profiles can be activated or deactivated with a single click, and a new profile may be loaded at any time.

My 1-click configuration manager encouraged participation by eliminating interaction with the necessary setup routines. I was more willing to work in brief periods, knowing that my workspace could be set-up and connected in an instant. As far as I'm concerned, learning even a little about Linux shell programming is time well-spent.

Regarding the music: I think it came out like I wanted, it's Gebrauchsmusik all the way. I converted the original WAV file with oggenc, so you can judge the results for yourself by listening to my Trio #2 in the free OGG compressed audio format.

Next step: LilyPond. The performers all read standard music notation, including scores I've produced with LilyPond. I'm familiar enough with LilyPond's basic features to produce a usable score without undue strain, so I figured that this step would be smooth and easy.

My, how wrong I can be.

I should mention that recently I upgraded to Xorg 7. Therein lies a tale of woe in itself, but for now I'll skip its gory details. Whatever else occurred during that upgrade something completely blew up my LilyPond installation, resulting in a Guile-related error. I decided to take the high road and recompile LilyPond. Oh, the mounting tribulations: First, I had to resolve some syntax errors in some of LilyPond's Python scripts. Alas, that fix did not resolve the Guile error, so I decided to upgrade Guile from 1.6.8 to 1.8.0.

Yet more woes. I had to compile and install the GNU MP before I could compile Guile 1.8. Not a big deal, and after installing GMP the Guile build proceeded without incident. Back to LilyPond, but first I sym-linked /usr/bin/python2.4 to /usr/bin/python, just in case I ran into more Python problems. Did I mention that I also received some Python syntax errors during the build ? Apparently they were version-related, upgrading to 2.4 eliminated the errors.

At last I could start compiling LilyPond with Guile 1.8.0, Python 2.4, and GCC 4.0.4. Voila, LilyPond 2.8.4 built without problems and I could proceed with my project. I hand-coded the score into LilyPondish, working directly from the sequencer's piano roll display. I know its sounds cumbersome, but it's fast and easy for me. Finally, I processed the LilyPond project file with only the --png flag added to the default option values. This last step created the PostScript, PDF, and PNG files at my Trio #2 LilyPond Page. That page also includes the MIDI file created with Sequencer Plus.

Last night I handed Sam the parts for the trio, along with an audio CD that contains the original WAV recording. The WAV file was edited with ReZound, the audio CD was burned with Gcombust. MIDI, audio, music notation, media, all managed by Linux.

Coming up: Studio Dave vs. Xorg 7, goings-on at, more reasons to love ecasound, Studio Dave's computer gets a major upgrade (my initiation into the AMD64 club), and random notes regarding some new and not-so-new Linux sound and music software. Stay tuned.

Load Disqus comments