Extension:LilyPond

What can this extension do?
This extension allows editors to collaboratively typeset music using LilyPond notation.

Usage
LilyPond notation can be embedded in wikitext, by enclosing it within  tags. For example, this code:

\relative c' { f d f a d f e d cis a cis e a g f e }

will yield this image:



If the notation is enclosed within  tags, the image will be clickable, and the link will download the MIDI file. Users' browsers may have to be configured to play MIDI files by means of plug-ins or external applications.

Another option is to use  tags. This allows full control over Lilypond settings, and it creates a full page of music. For example, this code:

\version "2.12.2" \header { title = "Mary Had a Little Lamb" tagline = ##f } \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:



Lilypond is very advanced and powerful. See the Lilypond documentation for more examples and a complete user's guide. The only restriction is that the notation will need to be compatible with Lilypond's  mode.

Setup
A one-off setup is needed by the wiki administrator.

No plug-ins or browser tweaks are needed in order to view and edit music notation. However, browser configuration may be necessary in order to listen to the MIDI files.

Prerequisites

 * PHP version 4.3.0. For earlier versions it will be necessary to install the GD library.
 * If not already present on your system, install LilyPond.

Installation
Copy the code in the "Code" section in a file called, into the   directory.

Parameters
None.

See optional user settings in the "Code" section.

Changes to LocalSettings.php
Add the following line at the bottom of your LocalSettings.php file. You can also define optional parameters before this line, as described in the "Code" section.

Why is this not available in Wikipedia?
You can install and use this extension in your wiki, but it is currently not available in Wikipedia. Many people would love to use this extension in Wikipedia and other large-footprint wikis that they have no control over. However, in its current form, this is unfortunately impossible due to security concerns.

This extension is using Lilypond's  mode, which according to the documentation "does not detect resource overuse. It is still possible to make the program hang indefinitely, for example by feeding cyclic data structures into the backend. Therefore, if using LilyPond on a publicly accessible webserver, the process should be limited in both CPU and memory usage." This extension is therefore not used in Wikipedia because it is considered a hazardous denial-of-service vector.

One way forward could be to use the Lilypond's  mode instead, which requires a more involved set-up.

Another promising possibility is to use wikitex and mod_tex, which would extend collaborative editing to other fields of human knowledge. Their development, however, seems to have stalled. See also Extension:WikiTeX.

Credits
The first version of the trimming function was produced by Dan Williams and Vanessa X.