Linux MIDI: A Brief Survey, Part 4

Looking ahead to the next generation of MIDI music-making software, including Improv, Q-Midi and Csound.

Q-Midi

Dr. Albert Graef describes his Q programming language as "a functional
programming language based on term rewriting". According to the
documentation, a Q program is "a collection of equations...used as
rewriting rules to simplify expressions". If this description is a bit
opaque for you, have no fear, the good doctor has supplied excellent
documentation and many practical examples through which you quickly
learn and appreciate the power of the Q language.

The Q package itself includes some basic MIDI routines, but the addition
of the Q-Midi module greatly expands those capabilities. In the Q-Midi
module, MIDI events are represented as symbolic data that should ease the
formulation of programs for manipulating and processing MIDI messages and
sequences. Q-Midi supports real-time MIDI I/O and the loading, editing
and playing of standard MIDI files, thanks to it being based on the GRAME
team's MidiShare, an excellent C library for cross-platform portable
MIDI programming.

The following code is taken from Dr. Graef's PDF introduction to
Q-Midi. It is an example of Q-Midi's use in algorithmic composition
based on a method of composing with dice, devised by the 18th century
composer Johann Kirnberger. Such methods were not new with Kirnberger,
but his technique lends itself nicely to expression through Q-Midi.

Kirnberger's method used the roll of the dice to determine which of 84
melodic fragments--the files in the midi directory--would be combined
to create the phrases for a dance form called a polonaise. Fragments
A are 6 measures long, fragments B are 8 bars long. The dice decide
which fragments are combined, and the final line of the code plays
the results.

At this time there is no GUI for the Kirnberger code, but Figure 2
illustrates the possibilities of Q combined with KDE/Qt. The basic
MIDI file player code is included as an example with the Q sources,
but QMidiPlayer is a separate source package that requires a full
installation of Q, the Q-Midi module and a recent version of KDE/Qt.

Figure 2. The QMidiPlayer GUI

Common Music

Its home page tells us that Common Music (CM) is:

an object-oriented music composition environment. It produces sound by transforming
a high-level representation of musical structure into a variety of
control protocols for sound synthesis and display. Common Music defines
an extensive library of compositional tools and an API through which
the composer can easily modify and extend the system.

Common Music's output types include scores formatted for the Csound and Common Lisp
Music sound synthesis languages, for the Common Music Notation system
and for MIDI as a file. It also can be rendered in real-time by way of MidiShare.

The following code creates a texture of self-similar motifs in an aural
simulation of the well-known Sierpinski triangle :

This fragment is located in the etc/examples/intro.cm file, a compendium of brief
CM programs that introduce many useful basic features of the language. By
utilizing the MidiShare system, you can render the fragment in real-time
simply by changing test.mid to
midi.port. Of course, you need
a MidiShare-aware synthesizer to connect with, such as the Fluidsynth
soundfont player launched with the following options :

fluidsynth --midi-driver=midishare --audio-driver=jack 8mbgmsfx.sf2

You also need to hook CM to the synthesizer. Figure 3 shows off CM
connected to QSynth (a GUI for Fluidsynth) by way of the MidiShare msconnect
utility. In this arrangement Fluidsynth is seen running with the JACK
audio driver, hence the appearance of QJackCtl.

Figure 3. Common Music, MidiShare and QSynth

As a language-based environment, Common Music development is most at
home in a Lisp-aware text editor, such as Emacs or X/Emacs. Users of
Common Music for the Macintosh have long enjoyed the use of a graphic
tool called the Plotter, which recently was ported to Linux. A new
rendering GUI (Figure 4) has been added to the Common Music CVS sources
that should make it easier to direct CM output to its various targets,
including the Plotter and, of course, MIDI.

Figure 4. Emacs, Common Music and the cmio Panel

Common Music has been in development for many years, and its author, Rick
Taube, has provided excellent documentation and tutorials for new and
experienced users. Recently, Rick published an outstanding book about
music composition with the computer, Notes From The
Metalevel (see
Resources below). His demonstration language of choice naturally is
Common Music. The system is included on the book's accompanying CD, so new
users can jump immediately into developing and testing their own CM code.

Thanks for great articles! I have a USB Midisport 2x2, but it doesn't seem to be easy to setup in linux. I need a new sound card anyway, so I'll buy one with MIDI support as well. In an earlier comment, it was mentioned that not all vendors provide specifications. Who are the good guys? Which cards should I consider for MIDI and audio? :)

I made my son laugh this morning - I went to wake him up and told him I had learned some new pieces on the electric piano last night. I dashed back to the music room, hit play in kmid and a beautiful Bach sonata thundered out. As I usually struggle with anything beyond "Twinkle Twinkle" he was impressed !

Rosegarden had compiled while I slept and we then successfully used the piano to input a couple of scales into Rosegarden turned them into notation, played them back as a trumpet on the computer.