Documentation: []

"Compiling Music" Section with basic notation and examples: []

Manual: [] Manuals are at info too.

Emacs and Lilypond

Lilypond sources provides some Elisp packages for Emacs. In Manjaro and several distributions, the lilypond package contains these files, and are placed at [file:/usr/share/emacs/site-lisp] directory after installing it.

To load the LilyPond mode use the following snippet:

(push "/usr/share/emacs/site-lisp" load-path)
(load-file "/usr/share/emacs/site-lisp/lilypond-init.el")

After loading the snippet, the LilyPond-mode is available to use.



Use `C-c C-c lilypond RET' to compile the file. To play the MIDI file use `C-c C-c midi RET'. The last command triggers two compilation commands (which may be considered as a bug in recent Emacs): the compilation with lilypond, and the MIDI player. Thus, it may appear the message "A compilation process is running; kill it? (y or n)", just wait until the current lilypond compilation is done, and press `y' to continue (which will not kill the process because it has already ended, it just continue with the player "compilation").

MIDI Export

Lilypond exports to MIDI when it find the `\midi { }' command inside the `\score { ... }'.

The score with the `\midi' is not exported to PDF, only to MIDI. Another score should be used to export a PDF too.

Lilypond will use the relevant part that a MIDI format and player can use. For instance: notes, chords, lyrics (song lyrics are shown while playing the song as if the player is signing), tempo, etc.

Lilypond basic template

This is a basic template to create a MIDI file with Lilypond.

\version "2.22.2"
\score {
  \relative c' {
    \tempo 4 = 160
    c4 d e f g a b c'
  \layout { }
  \midi { }


To play the MIDI file, a player or an output must be specified. In this case, the timidity++ player is used. Timidity can be used as a standalone program or as an output, but here is configured as standalone.

Install timidity++ and the required soundfont

pacman -S timidity++
pacman -S freepats-general-midi soundfont-fluid

Then, configure timidity to use a sound font. Just add the following lines into the config file.

echo 'soundfont /usr/share/soundfonts/freepats-general-midi.sf2' >> /etc/timidity/timidity.cfg
echo '# soundfont /usr/share/soundfonts/FluidR3_GM.sf2' >> /etc/timidity/timidity.cfg

Timidity is now ready to use. To play the file, execute like the following:


| timidity -OO the_file.midi


User interfaces are available with `-in' for terminal text interface, or `-ig' for GTK Graphical interface. For example, the following will open a graphical interface:


| timidity -OO -ig the_file.midi


More information: