At the Sounding Edge: Music Notation Software, the Final Installment
This month we take a look at the FOMUS and MuseScore music notation programs. First, though, I want to announce again that the 4th annual international Linux Audio Conference will take place in Karlsruhe, Germany, April 27-30. If you're in the area, stop by the wonderful ZKM (Center for Art & Media Technologies) and check out the proceedings. The conference Web site includes detailed listings of the scheduled presentations and activities. The previous conferences have been great successes, and this one promises to be even better.
And now we return to our regularly scheduled programming.
David Psenicka's FOMUS (FOrmat MUSic) holds a unique position among LilyPond helper applications. In point of fact, FOMUS is much more than another front-end for LilyPond. According to its author, FOMUS has been designed "to facilitate the conversion of raw algorithmic output into readable music notation". FOMUS is a Lisp-based utility that can run in standalone mode or as an integral part of a more general composition program. In this article, I demonstrate FOMUS in both modes.
In essence, FOMUS does only one job, but it does that job very well. FOMUS takes the output from an algorithmic composition routine or a program such as Common Music and attempts to render that output into note names and intelligible rhythmic values. It then tries to put that information into the recognizable voices and staves of common music notation. FOMUS's notation primitives include clefs, ottava marks, articulations, text markings, time signatures and so forth.
A FOMUS program creates an output file formatted for importing directly into a music notation program. Current targets include Finale, Sibelius, Common Music Notation and, of course, LilyPond. FOMUS doesn't necessarily produce a perfect output file, and the user should assume that some editing will be required to perfect his or her score. However, FOMUS does most of the heavy lifting, and only a small amount of editing and layout work should be required to complete the score in your chosen target application.
FOMUS is available only from the CVS sources indicated on the FOMUS Web page. It should be usable on any platform that runs a supported Lisp, which includes Linux. Simply download the current package into your home directory--a new fomus directory will be created--and you're ready to roll.
Using FOMUS as a standalone program is easy. Start your Lisp interpreter--I use SBCL in the following examples--load FOMUS and tell Lisp that you intend to utilize the functions and routines found in FOMUS. Here's what the process looks like on my Demudi system:
FOMUS now is ready for use. The following example creates a chromatic scale from middle C to C an octave higher and formats its output for LilyPond:
;;; Example 1: FOMUS writes a chromatic scale (fomus ;;; FOMUS code coming through... :backend '(:lilypond :view t) ;;; Declare LilyPond as the target output format and automate the display. :parts ;;; Assign instruments, clefs, key signatures, etc., to staves (defaults used here). (list (make-part :name "Flute" :instr :flute :events ;;; The loop adds 1 to the initial note value on each repetition, (loop ;;; creating the chromatic scale seen in Figure 1. for off from 0 to 12 by 1 ;;; Set and increment the offset value (i.e., the event start-time). collect (make-note :off off ;;; Cook up a note with :off for the start-time, :dur and :note for duration and pitch. :dur (if (< off 12) 1 4) ;;; On the 12th iteration the duration changes to a whole note (1 = a quarter note). :note (+ 60 off) ;;; Start at MIDI note number 60 (middle C in the display), add the offset value on repetition. )))))
Figure 1 illustrates the result as seen in the GhostView Postscript viewer. The comments should clarify the mechanics of the code. Note that when the FOMUS ":view" keyword is set to "t" (true), your newly created LilyPond file will be compiled and displayed automatically. Also note that the examples here have been rendered by LilyPond 2.7.3.
Example 1 is a trivial example for the sake of explaining the structure of native FOMUS code. The next example makes things more interesting by introducing the use of random number generators for pitch and duration values:
;;; Example 2: Random notes for guitar (fomus :backend '(:lilypond :view t) :parts (list (make-part :name "Guitar" :instr :guitar :events (loop for basenote in '(40 48) nconc (loop for off = 0 then (+ off dur) and dur = (/ (1+ (random 4)) 2) while (< (+ off dur) 60) collect (make-note :voice '(1 2) :off off :dur dur :note (+ basenote (random 20))))))))
Thanks to the randomization routines, each subsequent run produces a unique score. Figure 2 displays a score created in one run of this code. Obviously, the score should be edited in LilyPond to add a title and other header information, reverse some stem directions and perhaps reassign some octave placements. All of these things can be accomplished quickly and easily in LilyPond itself.
By the way, FOMUS informs you if your notes are outside the range of your selected instruments, a welcome amenity for maintaining playability.
Our final example presents FOMUS used as a system in Rick Taube's Common Music, a powerful programming language for music composition.
;;; Example 3: Generating polyphony (in-package :cm) ;;; Makes Common Music functions available to the Lisp interpreter. (use-system :fomus :directory "/home/dlphilp/cm-systems/fomus/") ;;; Add the FOMUS functions to Common Music (defparameter *part* (new fms:part :instr :piano :partid 'pno)) (defun polygen (voice len minp maxp) ;;; These parameters (voice assignment, event length, minimum and maximum pitch) will be provided by the events statement. (process repeat len ;;; Repeat replaces the loop statement seen in the previous native Lisp examples. output (new fms:note ;;; Makes a new note on each loop iteration. :off (now) :voice voice :partid 'pno :note (between minp maxp) :dur 1/2) wait 1/2)) ;;; Wait for the duration of a half-note before repeating the process. (events (list (polygen '(1 2) 20 50 80) (polygen '(1 2) 20 40 70)) "test.ly" :parts *part* :view t) ;;; Generate event lists and send to target LilyPond file.
Figure 3 shows off the results. As in Example 2, the score still needs some attention in LilyPond.
Common Music and FOMUS are Lisp-based languages that blend nicely. Common Music is designed specifically to aid composers using the computer to work at what Rick Taube calls the metalevel, a level of organization he refers to as the "composition of the composition". This metalevel of music composition is a perfect fit for FOMUS. Common Music is rich in functions and routines for creating music from randomization procedures, aleatoric and chaotic processes, Markov tables and microtonality. Among its many flexibilities, Common Music includes the ability to target a variety of output formats. Currently supported targets include sound synthesis programs, such as Csound, Common Lisp Music and SuperCollider; real-time MIDI streams, including MidiShare and PortMIDI; graphic display programs, such as Common Music's Plotter; and notation encoders, including Common Music Notation and FOMUS. Support for FOMUS lends Common Music the ability to turn its output data directly into high-quality LilyPond scores without intermediate MIDI files or any other format conversion.
This brief profile merely hints at FOMUS's capabilities. To learn more about what FOMUS can do, visit its Web site, peruse the documentation and try out the software. Whether used alone or with Common Music, FOMUS is an excellent addition to any composer's computer-based toolkit.
Werner Schweer is well known to the Linux audio community as the author of the excellent MusE MIDI sequencer. A few versions ago, Werner decided to cut MusE's notation capabilities out of the sequencer and rewrite it as a standalone notation editor with graphics based on the Qt4 GUI toolkit. Thus began the saga of MuseScore.
MuseScore is an ambitious project that intends to provide Linux musicians with a true WYSIWYG music notation editor. Development is in its early stages, and the current 0.3 version is considered to be an alpha-stage project. However, MuseScore already is on its way to fulfilling its promise (see Figure 4). Among its more interesting working features, MuseScore supports TrueType fonts for its music symbols and imports and exports MIDI and MusicXML files. It also supports the JACK audio server and provides a hook to the excellent Fluidsynth soundfont synthesizer, for sounding your score without a JACK connection.
Note entry in MuseScore is similar to other GUI notation editors. An element is selected from a symbol palette, and then a mouse click on the staff places the element at the cursor location. The Layout menu gives the user considerable flexibility when deciding on the appearance of the page (Figure 5). In addition, multiple projects can be open simultaneously, and MIDI input is supported by way of the ALSA sequencer. MuseScore's JACK support lets you select your audio target of choice, so you can listen to your score played by your favorite Linux softsynth(s).
Alas, I can present only this glimpse of MuseScore. As might be expected at the alpha stage, the project is sometimes less than stable. Werner Schweer continues to develop it, though, and he welcomes all bug reports, suggestions and comments regarding MuseScore. If you'd like to see a WYSIWYG music notation editor for Linux, you should check out MuseScore and get involved with the project. Join the MuseScore mail-list, send in those bug reports and become a contributor to this unique software. The Linux music and sound community will love you for it.