At the Sounding Edge: Music Notation Software for Linux, Part 3

Know how to use TeX or LaTeX? Looking for professional-grade music publication software?

In this month's stop on our tour of Linux music notation programs, we
look at the MusiXTeX music typesetting software. MusiXTeX was created by
Daniel Taupin, Ross Mitchell and Andreas Egler. MusiXTeX currently is
maintained by Christian Mondrup and other volunteers.

MusiXTeX is a set of macros and fonts that provide extensions for music
publication with the TeX typesetting software. TeX is a powerful text
processing system for UNIX/Linux, originally designed for high-quality
typesetting of scientific and engineering articles and books. It puts special
emphasis on representing the symbols and graphics found in algebraic
equations and other mathematics formulae. This special graphics capability
made TeX a natural choice for a high-quality typesetting system for music.

A Few Words About Installing TeX
The TeX system is non-trivial to install, and I recommend using
the package installation system for your distribution to automate
the process. Details of installing TeX are available on the primary
TeX-related Web sites (see this article's Resources). I refer
the reader to those sites for complete instructions on building and
configuring the TeX system. This stage is non-optional: you must have
a working TeX installation before you can set up and use your MusiXTeX

Note: Linux users are more likely to acquire and install TeX in its
incarnation as LaTeX, which is functionally identical to TeX. Throughout
this profile I simply refer to TeX, with the understanding that LaTeX
also is referenced.

Installing And Configuring MusiXTeX
Go to the main MusiXTeX Web site, download and unpack the
musixtex-Txxx.tar.gz tarball in your home directory and then enter your
new MusiXTeX source directory. The MusiXTeX package is made up mostly
of TeX-compatible macro files, so there is no build procedure. The
entire process is described on the MusiXTeX Web site, but I will point
out that it is wisest to follow the instructions for setting up what
is called a "private" installation in the /usr/local file
hierarchy. Become the root user and then copy the distribution files into
the recommended directories as follows:

/usr/local/share/texmf 	;;; Create this directory first
/usr/local/share/texmf/tex/musixtex/ ;;; Copy all files from the tex subdirectory of your MusiXTeX distribution 
/usr/local/share/texmf/doc/musixtex/ ;;; Copy all files from the doc subdirectory
/usr/local/share/texmf/fonts/source/musixtex/ ;;; Copy all files from the mf subdirectory
/usr/local/share/texmf/fonts/tfm/musixtex/ ;;; Copy all files from the tfm subdirectory

Create the required directories if they do not already exist. After
placing the macros and fonts in their proper directories, run the
following commands (as root) to update your TeX environment:

mktexlsr /usr/local/share/texmf 

If your TeX installation does not include the mktexlsr command, try
replacing it with texhash. If neither command exists, then your
TeX installation is incomplete and must be upgraded before you can
successfully install MusiXTeX.

Now you need to build and install musixflx, a required tool that must be
compiled from the musixflx.c file found in the system/c-source directory
of your MusiXTeX distribution. Fortunately, compiling the utility is
easy. Enter the system/c-sources directory and issue the following

	gcc musixflx.c -o musixflx

Copy the musixflx binary to /usr/local/bin. Now your MusiXTeX system
is installed completely and is ready for use. By the way, the version of
MusiXTeX profiled in this article is the stable version T112. A beta
version T113 also is available at the time of this writing, but it was
not tested for this review.

MusiXTeX Documentation

To view the extensive MusiXTeX manual, enter
/usr/local/share/texmf/doc/musixtex and issue the following command:

xdvi musixdoc.dvi

For a printable PostScript file, run this command:

dvips musixdoc.dvi -o

Using MusiXTeX
Preparing a MusiXTeX score source file is similar to the process of
preparing a Web page using a mark-up language such as HTML. The following
example demonstrates some basic features of a properly written MusiXTeX
source file:

    			% This is a comment.
\input musixtex		% You must include this line

\parindent10mm		% Staff and meter configuration

\startextract		% Set up notes, barlines, beaming, etc.
\Notes\ibu0f0\qb0{cge}\tbu0\qb0g|\hl j\en
\Notes\ibu0f0\qb0{cge}\tbu0\qb0g|\ql l\sk\ql n\en
\Notes\ibu0f0\qb0{dgf}|\qlp i\en
\Notes\ibu0f0\qb0{cge}\tbu0\qb0g|\hl j\en


Unfortunately, a MusiXTeX source file is only partially readable by
musicians. In particular, the Note statements are rather complex.
These explanations from the MusiXTeX manual, however, should help clarify the
actions of the typesetting commands in the example above:

\ibu0f0 begins an upper beam, aligned on the f, reference number 0, slope 0
\tbu0 terminates this beam before writing the second g (\qb0g)
\qb.. indicates a note belonging to a beam
\sk sets a space between the two quarter notes in the right hand, so that 
	the second quarter note is aligned with the third eighth-note in the left hand
\qlp indicates a dotted quarter note (p = point)
\ibbl1j3 starts a double beam aligned on the C (j) with a slope of 15%

Although the semantics and syntax still are somewhat difficult, you can
see how MusiXTeX represents musical symbols and syntax. Consult the
MusiXTeX manual for a complete description of the language details.

After all of the required preparations are finished, actually using MusiXTeX to create a
printable score is rather anticlimactic. Enter the example code fragment
in your favorite text editor, and save it as fragment.tex. then, run the
following command:

	tex fragment.tex

This command will create a DVI file named fragment.dvi that can be
viewed directly with the xdvi utility or converted to a PostScript file
with the dvips program. Figure 1 shows the resulting PostScript view.
Figure 1. A Simple MusiXTeX Example
As Figure 1 demonstrates, MusiXTeX produces excellent output in the
PostScript format. It also is capable of excellent PDF output, but to
do so requires fonts and utilities not described in this profile. See
the MusiXTeX Web site for details regarding the preparation of MusiXTeX
files for eventual realization as PDF output.

By now it should be clear that MusiXTeX is not a composer's assistant. It
has been designed for quality of output, and its input language is
sometimes difficult to understand. Nevertheless, MusiXTeX does achieve its
goal of high-quality printable music scores, as you can see in Figure 2.
Figure 2. A More Complex MusiXTeX Example
The source code for the score seen in Figure 2 can be found in a set of
MusiXTeX examples prepared by Daniel Taupin, available from the MusiXTeX
Web site.

MusiXTeX's Family and Friends

A variety of helper applications have evolved to alleviate MusiXTeX's
rather complex usage. Therefore, before leaving this profile, let's briefly view
the PMX MusiXTeX preprocessor and the Mux2D GUI for MusiXTeX source


Don Simons' PMX is a type of programming utility called a preprocessor.
It is
designed to make the entry of MusiXTeX source code faster and easier
by presenting MusiXTeX's features in a more easily comprehended
form. Download and installation details are available from the MusiXTeX
Web site, so here I present only a basic example for PMX.
The following source code presents a simple PMX file:

% nv noinst mtrnuml mtrdenl mtrnump mtrdenp xmtrnum0 isig npages nsyst musicsize fracindent
  2  2      4       4       4       4       0        0    1      1     20        0.07

e23   c   | g43 a f g | e43 d e f | g43 a f g /
c44 d e f | g44 a b c | c24   e   | g44 a b c /

The first two uncommented lines include a variety of setup parameters,
defined as follows:

nv       number of staves
noinst   number of instruments
mtrnuml/mtrdenl  logical time signature numerator and denominator
mtrnump/mtrdenp  printed time signature numerator and denominator (if 0 set to logical values) 
xmtrnum0  number of beats in partial first measure, i.e. pickup notes
isig     number of sharps or flats in key signature (positive integer equals sharps, negative equals flats)
npages   number of pages
nsyst    number of systems
musicsize  height of staff in points (20 or 16)
fracindent left indentation of the first system (decimal fraction of total line width)

The syntax is critically sensitive. If you remove one of the empty lines
before the bt directive, the PMX compiler will halt with a fatal error.

After the two empty lines we have clef ordering, starting with the lowest
staff, and an indicator for the target directory:

bt   bass, then treble clef
./   directory path for resulting TeX file (in this instance, the current directory)

After this setup block, we finally get to the note data. Here we can see that
PMX is considerably more transparent than MusiXTeX's native language
elements, defining the basic note element as follows:

note name, duration, octave

If no values follow the note name the, note takes its duration and octave
from the preceding element. Simple bar lines are indicated with the |
symbol, the end bar by the / character (forward slash).

To create a TeX output file, copy the above code as ex1.pmx and process
it in these stages:

pmx ex1.pmx
tex ex1.tex
xdvi ex1.dvi

Figure 3 displays the results as seen in the xdvi viewer.
Figure 3. Simple Output from PMX
Figure 4 shows off a more advanced example from the PMX source
package. The author thoughtfully has included a number of helpful example
files with the PMX sources. I suggest that interested readers study
these examples carefully to get the best results from the system. In
addition to the examples, excellent documentation of the PMX system
exists as a full manual and a as reference card, both in PDF format.
Figure 4. A More Complex PMX Example
PMX also can prepare a MIDI file of your score for "proofing by
so you can hear your score before committing it to print.
Lukas Gratzmacher's Mux2D provides a convenient graphic interface for
the creation of MusiXTeX source files. It is similar to the Denemo
utility for LilyPond, designed as a helper application and not as
a full-featured notation editor. Nevertheless, Mux2D can be a great
help to those of us for whom MusiXTeX is simply too difficult to use
directly. Complete instructions regarding installation and configuration
details are available from the Mux2D Web site, so we take only a
glimpse of Mux2D in action here.

Figure 5 shows Mux2D at work. Notes and other score elements are entered
and modified from the computer keyboard and menu dialogs. The interface
is easy to learn, with the definition for each key indicated in the
lower left corner of the display.
Figure 5. Mux2D, a GUI for MusiXTeX
Files created with Mux2D can be loaded and saved in the program's native
MXD format. You also can export your work in TeX format for processing
with MusiXTeX. The following TeX code was created by the example seen
in Figure 5:

%%% TeX file with MusiXTeX code
%%% generated by MuX2d

\input musixtex
\input musixext






Figure 6 illustrates the results after processing this code in TeX
and converting the resulting DVI file to PostScript. As you can see,
the rather simple graphics seen in Figure 5 have been replaced by the
excellent MusiXTeX symbols.
Figure 6. A Mux2D File Converted to TeX and PostScript
Closing Comments
MusiXTeX is free and open-source software licensed under the GPL. It
is being maintained and users continue to contribute scores and code.
An active mailing list provides a forum for questions and suggestions
regarding MusiXTeX, PMX, Mux2D and other members of the MusiXTeX
family. If you're looking for publication-quality output for your work,
and you're ready to tackle TeX--or already know how to use it--you
should look into MusiXTeX.

Next month I'll present another TeX-based music typesetting program,
the awesome LilyPond. See you then!

MusiXTeX and PMX


The TeX Users Group
(a good starting point for TeX newbies)

Music Notation at

Dave Phillips is a musician, teacher and writer living in Findlay, Ohio.
He has been an active member of the Linux audio community since his
first contact with Linux in 1995. He is the author of The Book of Linux
Music & Sound
, as well as numerous articles in
Linux Journal. He can be reached at


Similis sum folio de quo ludunt venti.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I'm a Lily user ...

David Asorey's picture

Hi, Dave.
Excellent article!
I'm a convinced Lilypond user, but I have some curiosity about MusiXTex. Reading your examples, I think that, IMHO, the syntax for Lilypond is easier and requires less typing.
Is there some advantages for using MusiXTex instead of Lilypond or is more a personal taste question?.

Author's reply

Anonymous's picture

I think it's a matter of personal preference. The main MusiXTeX site indicates that people do still use MusiXTeX, but I think LilyPond has taken TeX-based music typesetting much further, thanks to its clearer syntax and language elements. LilyPond will be profiled in the next installment, I'll get further into its attractions then. :)

LilyPond is not TeX-based

Han-Wen Nienhuys's picture

LilyPond is not TeX-based. Please don't say it is, since it perputuates a common misunderstanding.

To get an idea of the activity level of musictex, you can have a look on
the tex-music mailing list, and compare it with the LilyPond user list. I think the latter has 5 to 10 times as much traffic.


Author's reply

Anonymous's picture

Well, to be accurate I didn't say LilyPond was TeX-based, I said that it's taken TeX-based music typesetting much further than MusiXTeX. But the statement does imply that LP is inherently related to TeX, which it is not, as you point out.

The next installment of this series should make every LP user happy. It might even please its developers (Hi to Han-wen and Jan!).



Oh the shame (author's reply)

Anonymous's picture

Ach, my bad, in the article I *did* refer to LilyPond as TeX-based. Apologies to the LP folks! I may never recover from the stigma... ;-)

Best anyway,


The article mentions Mux2D,

Anonymous's picture

The article mentions Mux2D, a gui frontend to musixtex and denemo, which does a similar job with lilypond. Yet no mention of the vastly superior noteedit program, which can export to both of this formats, among others.

Author's reply

Anonymous's picture

NoteEdit will be profiled in the next installment of this series. However, I agree that it should have been mentioned in this installment too. NE exports to PMX and MusiXTeX, and it is indeed a superior program. Hopefully you'll read next month's installment for a little more info re: NoteEdit.

two errors and corrections (Author's addenda)

Anonymous's picture

There are a couple of errors that snuck into the article during the layout, one important, the other a minor misspelling.

In the first PMX code example there should be two blank lines before the bt statement. As the text correctly indicates, PMX will fail to process the example as it appears in the article. The spaces are mandatory.

Second, the author of Mux2D is Lukas Gruetzmacher (not Gratzmacher). Darn those pesky umlauts... ;)


Dave Phillips

An additional correction

Andy Behrens's picture

The tempo marking in the Debussy piece should read Modérément, not Modérémemt.

One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix