Extension:LilyPond
|
|
WARNING: the code or configuration described here poses a major security risk.
Problem: Unmaintained and not very scalable, Code review here. |
|
LilyPond Release status: beta |
|
|---|---|
| Implementation | Tag |
| Description | This extension adds the option to typeset music |
| Author(s) | Johannes E. Schindelin |
| MediaWiki | 1.6+ |
| License | No license specified |
| Download | Download snapshot Subversion [Help] |
|
Check usage (experimental) |
|
Contents |
[edit] What can this extension do?
This extension allows editors to collaboratively typeset music using LilyPond notation.
[edit] Usage
LilyPond notation can be embedded in wikitext, by enclosing it within <lilypond>...</lilypond> tags. For example, this code:
<lilypond>\relative c' { f d f a d f e d cis a cis e a g f e }</lilypond>
will yield this image:
If the notation is enclosed within <lilymidi>...</lilymidi> 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 <lilybook>...</lilybook> tags. This allows full control over Lilypond settings, and it creates a full page of music. For example, this code:
<lilybook>
\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."
}
}
</lilybook>
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 safe mode.
[edit] 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.
[edit] 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.
[edit] Installation
Download a tarball or from svn into the extensions directory.
[edit] Changes to LocalSettings.php
Add the following line at the bottom of your LocalSettings.php file.
require_once("$IP/extensions/LilyPond.php");
You can also define optional parameters before this line, as described in the "Code" section.
[edit] Parameters
None.
See optional user settings in the source code.
[edit] 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 (e.g. bug 29630).
This extension is using Lilypond's safe 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 jail mode instead, which requires a more involved set-up.
Another possibility would be to create the file on an external server, and save it to the Commons only the source of Lilypond, the SVG and the Midi. For that the SVG-Export should be make possible. Unfortunately the implementation on a home computer is anything but simple. Very often the results can not be rendered by the Commons.
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.
[edit] Credits
The first version of the trimming function was produced by Dan Williams and Vanessa X.

