LaTeX

MusiXTEX

What you need!

So you want to write music scores with your computer? Before trying to learn the quite difficult language of MusiXTEX you should first know, what means LaTeX. You need some experience with this formatation language. If you are new to LaTeX, consider to write your music scores with other software, called scorewriter. In the Wikipedia-Article Scorewriter You will see many suggestions of computer programs, writing notes and scores. The most known programs are Sibelius and Finale. This are WYSYWYG-Editors and you have to pay for it (roughly 600 $).

The advantage of the Scorewriter I intruduce to you are: they are free, and you write them in every Ascii texteditor on every platform.

You need a working TeX installation. On Mac you simply download the MacTeX. This is a 2.4 GB download. Filename is: MacTeX.pkg. You get more information in the previous article LaTeX.


Getting started

I will introduce here some music examples step by step. Save the following code into a file called "exp_01.tex" into a folder "~/Documents/programming/latex/music_latex/"

 

LaTeX-File with Music: exp_01.tex
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
\documentclass[12pt]{article}
\usepackage[pdftex]{graphicx}
\usepackage{musixtex}
\begin{document}

\begin{abstract}
\noindent This Sonata is also called ``Sonata facile''. Compile with:

\begin{verbatim}
    pdflatex exp_02
    musixflx exp_02
    pdflatex exp_02
\end{verbatim}

\noindent into the shell.
\end{abstract}

\bigskip

\section{MOZART, Sonata KV 545, C-major}

\begin{music}
\nostartrule
\parindent10mm
\instrumentnumber{1} % a single instrument
\setname1{Piano} % whose name is "Piano"
\setstaffs1{2} % with two staffs
\generalmeter{\meterfrac44} % 4/4 meter chosen
\startextract % starting real score
\Notes\ibu0f0\qb0{cge}\tbu0\qb0g|\hl j\en
\Notes\ibu0f0\qb0{cge}\tbu0\qb0g|\ql l\sk\ql n\en
\bar
\Notes\ibu0f0\qb0{dgf}|\qlp i\en
\notes\tbu0\qb0g|\ibbl1j3\qb1j\tbl1\qb1k\en
\Notes\ibu0f0\qb0{cge}\tbu0\qb0g|\hl j\en
\bar
\zendextract
\end{music}
\end{document}
Commands in tcsh (Shell - Terminal)
1.
2.
3.
4.
5.
6.
tcsh
cd ~/Documents/programming/latex/music_latex/
pdflatex exp_01
musixflx !!^
pdflatex !!^
open !!^.pdf
Comment of tcsh commands
ad 1.
ad 2.
ad 3.
ad 4.

ad 5.
ad 6.

tcsh We change to the Shell in TCSH - just in case you are on bash
cd means "change directory" - we change to the folder of the file exp_01.tex
first run of pdflatex
!!^ this is a short cut in tcsh and means: !! the previous command, ^ first argument. So !!^ refers to the exp_01 of the previous command
We are running pdflatex for a second time
We are opening the file exp_01 plus the extension .pdf that means: exp_01.pdf