Extension:LilyPond

What can this extension do?
You can typeset music with this extension.

Usage
Just enclose some music in LilyPond syntax in ... tags. For example, this code:

f, d f a d f e d cis a cis e a g f e

will yield this image:



If you enclose the music in ... tags, the image will be clickable, and the link will download the MIDI file.

Another option is to use ... tags, which creates a full page of music. for example, this code:

\version "2.10.29" \header { title = "Mary Had a Little Lamb" tagline = "" } \paper { ragged-right = ##t ragged-bottom = ##t indent = 0\mm } melody = \relative c' { e d c d | e e e e | d d e d | c1 | } text = \lyricmode { \set stanza = "1." Ma- ry had a lit- tle lamb, its fleece was white as snow. } \book{ \score{ << \new Voice = "one" { \melody } \new Lyrics \lyricsto "one" \text >>    \layout { } \midi { } }  \markup{ \wordwrap-string #"    Verse 2.     All the children laughed and played,     To see a lamb at school." } }

will yield this image:



Installation
Make sure you have LilyPond installed.

Then copy LilyPond.php into the extensions/ directory.

Parameters
None.

See optional user setting in code.

Modification for Trimming lilybook Images to an Appropriate Size
Users have reported that the lilypond produces page-sized images, no matter what the tagline in the header is. To solve this, add the following immediately before the last return statement in the code above:

Then append the following function to the end of the code: