Sometimes I have to put text on a path

Tuesday, July 26, 2011

How to post music with LaTeX (in blogger, in your site)? Producing the highest-quality sheet music possible: MusicXML, LilyPond.

Music notation.
3 languages : 
  • MusicXML, 
  • LilyPond,
  • LaTeX (best method if you want to add mathematics, statistics, physics, chemistry, bibliography, diagrams, special drawings...). 

MusicXML is a XML-based music notation file format As of July 2011, MusicXML is supported to varying degrees by over 150 notation programs. 
MusicXML 2.0 files serve the same role for interactive sheet music that MP3 files serve for recorded music.

You have many sites for music in MusicXML Format:
See an example: The rendering for all browser is flash!
Export music notation to MusicXML directly, just dowload compressed MusicXML code.

There are many freeware, and commercial applications
 Just one, a free cross-platform WYSIWYG music notation program: It offers an alternative to professional programs such as Sibelius and Finale. 


The Myriad Music Plug-In ( enables you to build Web pages in which music will be played or displayed.Music files are ".mus", ".myr" or ".mu3" files created with Melody Assistant or Harmony Assistant. MusicXML and Packed MusicXML files, ABC files (mono or multi musics) are also managed. 

With firefox 4+, try this interactive music sheet (HTML5 canvas):

One of LilyPond's goals is to produce scores that are engraved with traditional layout rules.
It uses a simple text notation for music input (more concise than LaTeX or musicXML), which LilyPond interprets and processes in a series of stages. In the final stage, music notation is output to PDF or other graphical formats, such as SVG or PNG. LilyPond also has the facility to generate MIDI files that correspond to the music notation output.

Kainhofer wrote the musicxml2ly Python script that comes bundled with Lilypond:
musicxml2ly converts MusicXML files to LilyPond syntax. 
Support for compressed MusicXML files (.mxl).

\( \TeX \)

There are many packages, for example: MusiXTeX is a suite of open source music engraving services (macros and fonts) that allow music typesetting in TeX:

I tried this LaTeX code (see below) with Knol equation editor, Google equation editor, codecogs ( These editors do not work: "equation too long"! I also tried Zoho: bad results...
With TeXshop ( the compilation arrived to pdf (transformed to png):

----------LaTeX code-------------






 \instrumentnumber{2} % 2 instruments

 \setstaffs 1{2} % instrument 1 (en bas) : 2 portées

 \setclef{1}{60} % clef de fa (6) en 1, clef de sol (0) en 2
 \generalmeter{\meterfrac{4}{4}} % mesure 4/4
 \setname 1{piano} %
 \setname 2{chant} %
 \parindent 10mm % pour éviter la collision de piano avec l'accolade
 % {{bleu|1re mesure}}
 \ha J | % chgt portée, même instr
 \zhu{c e}\hu g & % chgt instr ; pas d'espace entre } et \hu
 \islurd0c\ibu0d0\qb0{c c c}\tslur0d\tbu0\qb0d 
 \enotes % assure l'alignement
 \ha N | % chgt portée, même instr
 \zhu{g i}\hu k & % chgt instr
 \qa{e d} 
 \bar % après toutes les notes de la mesure, pour toutes les voix
 % {{bleu|2e mesure}}
 \qa J | 
 \zqu{c e}\qu g &
 \islurd0c\ibu0d0\qb0{c e} 
 \qa N |
 \zqu{g i}\qu k &
 \ha J | 
 \zhu{c e}\hu g &
 \ha c 



1 comment:

  1. Thank you for the thoughtful review. The main advantage of youtube html5 playerseems to be for embedding rich media such as audio and video in modern browsers. Although, the structure elements seem to be useful. CSS3 seems to be headed in the right direction, leaving many possibilities for implementation and creativity,