ly-fu - play or display lilypond snippets


Set the MIDI_EDITOR and SCORE_VIEWER environment variables to suitable MIDI playing and PDF opening utilities, or adjust the source to your liking.

  $ export MIDI_EDITOR=timidity
  $ export SCORE_VIEWER=xpdf
  $ ly-fu --instrument=banjo c des ees c des bes c aes
  $ ly-fu  -i=trumpet --open "c8 g'4 c,8 g'4 c,8 g'2"
  $ echo c e g | ly-fu -

Or, to instead save the generated lilypond somewhere:

  $ ly-fu --show-code e e e c1 >


Plays and possibly displays lilypond snippets entered at the command line. The MIDI_EDITOR environment variable should be set to a program that can play MIDI files, and the SCORE_VIEWER optionally set to a PDF viewer. (Or edit the source code as necessary.) and in particular the Learning and Notation manuals should be consulted to understand the lilypond syntax.


This program currently supports the following command line switches:


Assume lilypond absolute notation.


Set MIDI instrument (see lilypond docs and ZSH compdef script).


Specify the lilypond language to use, by default the lilypond default of nederlands. If using note names from Music::PitchNum::German,

  ... | ly-fu --language=deutsch ...

may be of some use. "Note names in other languages" in the lilypond notation reference contains the full list of supported languages.


Save the MIDI and other various files (they are unlinked by default).


Show the score via the SCORE_VIEWER program.

--partial=lilypond fragment

A lilypond fragment played once at the beginning.


Specify what note the input is relative to.


How many times to repeat the (non-partial) input.


Make the staff a lilypond RhythmicStaff instead of the usual one.


Prints the generated lilypond data to standard out, then exits the program. The score is not shown, nor the music played.


Do not play the MIDI.


Kluge sleep before unlinking temporary files (might be handy if SCORE_VIEWER is slow to start).


What the tempo is (in quarter notes, e.g. 120 or the like).


Show output from lilypond and the MIDI player.


NOTE This program makes heavy use of temporary files. On a shared system, the lilypond generated output files might introduce /tmp security problems (arbitrary file clobber or unlink against the user running the code). These can be avoided by employing a private temporary directory, for example by pointing the TMPDIR environment variable to such a directory.

A ZSH completion script is available in the zsh-compdef/ directory of the App::MusicTools distribution. Install this to a $fpath directory.



Copyright 2012 Jeremy Mates

This program is distributed under the (Revised) BSD License: