Extension:Score
|
Score Release status: experimental |
|||
|---|---|---|---|
| Implementation | Tag | ||
| Description | Tag extension to render musical scores with LilyPond | ||
| Author(s) | GrafZahlTalk | ||
| Last version | 0.1 (21 December 2011) | ||
| MediaWiki | 1.18.0 (v0.1) | ||
| PHP | 5.3.3 (v0.1) | ||
| License | GPL3 | ||
| Download | Version 0.1.zip Version 0.1.tgz Download snapshot (Git master)
Git [?]: repo summary • tree • code changes SVN [?]: checkout-url • tree • code changes README |
||
|
|||
|
|||
|
|||
|
Check usage (experimental) |
|||
Warning: The documentation on this page refers to the current SVN head of the Score extension. If you download version 0.1, refer to the README file.
Contents |
[edit] What can this extension do?
This extension can render musical scores as PNG images using LilyPond.
[edit] Acknowledgements
- The original Extension:LilyPond was written by Johannes E. Schindelin.
- This extension is based on a code review of Extension:LilyPond by Tim Starling.
- The original Extension:ABC was written by River Tarnell.
[edit] Usage
After setup, you can embed simple LilyPond notation into your wikitext using the score tags. For example:
<score>\relative c' { f d f a d f e d cis a cis e a g f e }</score>
yields:
You may also specify attributes to the score tags in the general form
<score attribute1="value1" attribute2="value2">…</score>.
The following attributes are available:
| Attribute | Allowed values | Effect |
|---|---|---|
| lang | ABC, lilypond (default) | Sets the score language. For example, to provide a score in ABC notation, you might use
<score lang="ABC"> X:1 M:C L:1/4 K:C C, D, E, F,|G, A, B, C|D E F G|A B c d| e f g a|b c' d' e'|f' g' a' b'|] </score>. |
| midi | 0 (default), 1 | If set to 1, the rendered image(s) will be embedded into a hyperlink to an appropriate MIDI file. |
| override_midi | Known file name, that is, if override_midi="name" is given, [[File:name]] does not yield a red link. |
Uses the specified MIDI file instead of generating one with LilyPond. Use this attribute together with the midi attribute (see above) or the vorbis attribute (see below). This attribute is useful if you already have a MIDI file whose quality is superior to what would be generated by LilyPond. |
| override_ogg | Known file name, that is, if override_ogg="name" is given, [[File:name]] does not yield a red link. |
Embeds the media specified by the file name in the HTML below the score image(s). This is an alternative to the vorbis attribute (see below). It can, for example, be useful if you have a suitable Ogg/Vorbis file of superior quality compared with the auto-generated Ogg/Vorbis file the vorbis attribute yields. Of course, you can still omit both attributes in this case and add the file manually to the page, if you prefer. |
| raw | 0 (default), 1 | If set to 1, the score code is interpreted as a complete LilyPond file. Use this option if you want to create more complex scores. If the score language (lang attribute) is not set to lilypond, this attribute is ignored. |
| vorbis | 0 (default), 1 | If set to 1, an Ogg/Vorbis file will be generated for the score, provided you installed and configured Extension:OggHandler. An Ogg/Vorbis player will be embedded in the HTML below the score image(s). |
[edit] Prerequisites
This extension uses LilyPond to render score images, so you need a working LilyPond installation. If you want the extension to trim the score files for you, you will also need ImageMagick.
The extension is also capable of creating Ogg/Vorbis files from the MIDI files generated by LilyPond. If you want to make use of this functionality, you need to have Extension:OggHandler installed.
Version 0.1 of this extension was tested with MediaWiki 1.18.0 and LilyPond 2.12.3. The current SVN snapshot might require a newer version of MediaWiki and/or LilyPond.
[edit] Download instructions
Use the extension distributor. You can also download a tarball from GitHub: [1], or as a zipped file: [2]. The score master branch on GitHub works with a stable version of MediaWiki, but may not yet have the newest features in it.
[edit] Installation
- Change to the
extensionsdirectory of your MediaWiki installation. - Create a new subdirectory named
Score. - Copy the files
Score.php,Score.body.phpandScore.i18n.phpfrom the distribution into the new subdirectory. Make sure they are readable by your webserver. If you do not create this directory, the Score extension will attempt to create it for you with the rights available to it. - Create a subdirectory named
lilypondin your $wgUploadDirectory (usually the directory namedimagesin in your MediaWiki directory). Make sure the directory is writable by your webserver. - Add the following to LocalSettings.php:
require_once("$IP/extensions/Score/Score.php"); $wgScoreLilyPond = '/path/to/your/lilypond/executable'; /* required */ $wgScoreAbc2Ly = '/path/to/your/abc2ly/executable'; /* if you want ABC to LilyPond conversion */ $wgScoreTimidty = '/path/to/your/timidty/executable'; /* if you want MIDI to Vorbis conversion */ $wgScoreTrim = true; /* Set to false if you don't want score trimming */
[edit] Configuration parameters
Currently, the extension has the following global configuration parameters.
[edit] $wgScoreLilyPond
Set $wgScoreLilyPond to the path to your LilyPond executable (typically /usr/bin/lilypond or /usr/local/bin/lilypond).
[edit] $wgScoreTrim
The $wgScoreTrim is a boolean which defaults to the value of $wgUseImageMagick. If true, the resulting score PNG images are trimmed with ImageMagick. If you don't want trimming, or don't want to install ImageMagick, set $wgScoreTrim to false.
[edit] $wgScoreAbc2Ly
Set $wgScoreAbc2Ly to the path of your ABC to LilyPond converter executable (typically /usr/bin/abc2ly or /usr/local/bin/abc2ly).
[edit] $wgScoreTimidity
Set $wgScoreTimidity to the path of your TiMidity++ executable (typically /usr/bin/timidity or /usr/local/bin/timidity).
[edit] Remarks
This extension runs various binaries on a shell. You may have to increase $wgMaxShellMemory if you get out of memory errors.
[edit] See also
- Extension:ABC
- Extension:LilyPond
- Code review by Tim Starling; this extension is based on it.
