Extensão:Score
Estado de lançamento: estável |
|
|---|---|
| Implementação | Etiqueta |
| Descrição | Allows rendering of musical scores with LilyPond |
| Autor(es) | Alexander Klauer, Étienne Beaulé |
| Última versão | 0.3.0 (2019年03月23日) |
| MediaWiki | 1.36+ |
| PHP | 5.3+ |
|
|
|
score |
|
| Licence | GNU - Licença Pública Geral 3.0 ou superior |
| Transferência | README.md |
| Traduza a extensão Score se esta estiver disponível em translatewiki.net | |
| Problemas | Tarefas em aberto · Reportar um erro |
A extensão Score permite a representação de partituras através de imagens do tipo PNG usando o LilyPond, podendo transformar em arquivos de audio e MIDI.
Instalação
- See the extension's
README.mdfor detailed installation instructions.
- Exporte e coloque o ficheiro, ou ficheiros, num diretório chamado
Score, na sua pastaextensions/.
Developers and code contributors should install the extension from Git instead, using:cdextensions/ gitclonehttps://gerrit.wikimedia.org/r/mediawiki/extensions/Score - Acrescente o seguinte código ao fundo do ficheiro $LocalSettings:
wfLoadExtension( 'Score' ); $wgScoreTrim = true; $wgImageMagickConvertCommand = '/usr/bin/convert'; $wgShellboxUrl = '... address to Shellbox ...'; $wgShellboxSecretKey = '... your secret key ...';
- Crie uma pasta (diretório) chamado
lilypondem seu $wgUploadDirectory (geralmente o é chamadoimagesdentro da pasta MediaWiki). Make sure the directory is writable by your Web server. - Yes Pronto – Na página especial
Special:Versionda sua wiki verifique se a extensão foi instalada.
Pré-requisitos
The following packages are recommended:
- LilyPond
- Ghostscript
- ImageMagick
- FluidSynth
- Firejail
This extension uses LilyPond to render score images, so you need a working LilyPond installation (Special:Version displays the LilyPond version). If you install LilyPond from a package, Ghostscript will also be installed, since LilyPond depends on Ghostscript. ImageMagick should be installed to trim the images, otherwise they will contain an excessive amount of whitespace.
For security reasons, it is highly recommended to install firejail to further restrict what LilyPond and Ghostscript can do if untrusted users are allowed to edit your wiki.
The extension is also capable of creating audio files from the MIDI files generated by LilyPond. If you want to make use of this functionality, you need to have Extension:TimedMediaHandler installed.
FluidSynth is the preferred method to convert MIDI files to audio files, however TiMidity++ is also supported.
Security concerns
LilyPond files can run arbitrary code on the server. If you don't absolutely trust everyone who has editing privileges on your wiki, it is strongly recommended to set up containment of lilypond using Shellbox . See Shellbox#Server setup for details on how to set up the contained server, and below for configuring MediaWiki to use it. Also, ensure you're using a recent version of LilyPond (2.22.0+) or a distribution package (e.g. from Debian) that has security fixes.
Remarks
This extension runs various binaries in a Shellbox to provide some security. You may have to increase $wgMaxShellMemory if you get "out of memory" errors.
Configuration
Here are some of the extension's global configuration parameters.
$wgScoreLilyPond
Set $wgScoreLilyPond to the path to your LilyPond executable (typically /usr/bin/lilypond or /usr/local/bin/lilypond).
$wgScoreUseSvg
Set $wgScoreUseSvg to true to render scores as SVG in the browser.
Requires LilyPond version 2.24 or above, compiled with Cairo support (included by default since version 2.26).
$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.
$wgScoreAbc2Ly
Set $wgScoreAbc2Ly to the path of your ABC to LilyPond converter executable (typically /usr/bin/abc2ly or /usr/local/bin/abc2ly).
$wgScoreFluidsynth
Set $wgScoreFluidsynth to the path of your Fluidsynth executable (typically /usr/bin/fluidsynth or /usr/local/bin/fluidsynth).
$wgScoreSoundfont
Set $wgScoreSoundfont to the path of your soundfont file (typically /usr/share/sounds/sf2/FluidR3_GM.sf2 or /usr/share/sounds/sf2/FluidR3_GS.sf2).
$wgScoreLame
Set $wgScoreLame to the path of your Lame executable (typically /usr/bin/lame or /usr/local/bin/lame). Required if the generated audio file should be a MP3.
Uso
After setup, you can embed simple LilyPond notation into your wikitext inside a <score>...</score> tag. For example:
<scorelang="lilypond">\relativec'{fdfadfedcisaciseagfe}</score>
produz:
Também pode especificar os valores nas etiquetas score na forma geral.
<scoreattribute1="value1"attribute2="value2">...</score>.
Por exemplo:
<scoresound="1"lang="lilypond">\relativec'{\setStaff.midiInstrument="tenor sax"fdfadfedcisaciseagfe}</score>
produz:
Attributes
Os seguintes atributos estão disponíveis:
| Atributo | Valores permitidos | Effect |
|---|---|---|
| lang | ABC, lilypond (default) | Define o idioma da partitura. Por exemplo, para fornecer uma pontuação em notação ABC, você pode usar. <scorelang="ABC"> X:1 M:C L:1/4 K:C C,D,E,F,|G,A,B,C|DEFG|ABcd| efga|bc'd'e'|f'g'a'b'|] </score> |
| line_width_inches | Positive non-zero number, can have decimal places | Sets the width of the lines in the rendered score, by setting the line-width directive in the LilyPond paper settings. |
| midi | (removed) Isso é usado para controlar se a imagem da partitura renderizada está vinculada a um arquivo MIDI. | |
| override_midi | Known file name, that is, if override_midi="name" is given, [[File:name]] does not yield a red link |
(deprecated) Instead you can add a [[File:superior midi filename.mid]] wikilink after the closing </score> tag.Uses the specified MIDI file instead of generating one with LilyPond. Use this attribute together with the midi attribute (see before) or the sound attribute (see later). This attribute is useful if you already have a MIDI file whose quality is superior to what would be generated by LilyPond. |
| override_audio | Known file name, that is, if override_audio="name" is given, [[File:Name]] does not yield a red link |
(deprecated) Instead you can add a [[File:superior audio filename.oga]] wikilink after the closing </score> tag.Embeds the media specified by the file name in the HTML after the score image(s). This is an alternative to the sound attribute (see further). It can, for example, be useful if you have a suitable audio file of superior quality compared with the auto-generated audio file. Of course, you can still omit both attributes in this case and add the file manually to the page, if you prefer. |
| override_ogg | (deprecated) Doubly-deprecated alias for override_audio. | |
| 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. By default (when raw=0), provided code is wrapped in a \score{...} block, along with default \layout{...} and \midi{...} blocks, if not already provided.
|
| sound | 0 (default), 1 | If set to 1, an audio file will be generated for the score, provided you installed and configured Extension:TimedMediaHandler . An audio player will be embedded in the HTML after the score image(s). |
| vorbis | 0 (default), 1 | (deprecated) Alias for sound. |
A linguagem LilyPond
As letras podem ser adicionadas assim:
<scorelang="lilypond"sound="1"> \relativec''{\time4/4\keyc\major c4g8ga4grb^>c^>r\bar"|."} \addlyrics{Shaveandahair--cut:twobits.} </score>
Para usuários avançados, o comando \set Staff.midiInstrument pode ser usado para alterar o instrumento MIDI para o som.
Tracking category
Pages containing <score> tags are in the tracking category with message name score-use-category.
Visit Special:TrackingCategories to find the localized title of this category on your wiki and show the pages in it, for example w:Category:Pages using the Score extension on the English Wikipedia.
Agradecimentos
- A versão original Extension:LilyPond (LilyPond) foi escrita por 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.
See also
- Help:Score on English Wikipedia and Help:Sheet music on Wikisource have more examples of LilyPond syntax.
- Stable extensions/pt
- Tag extensions/pt
- ParserFirstCallInit extensions/pt
- ResourceLoaderRegisterModules extensions/pt
- SoftwareInfo extensions/pt
- WikibaseClientDataTypes extensions/pt
- WikibaseRepoDataTypes extensions/pt
- WikibaseRepoWbui2025InitResourceDependenciesHook extensions/pt
- GPL licensed extensions/pt
- Extensions in Wikimedia version control/pt
- All extensions/pt
- Extensions used on Wikimedia/pt
- Music editor extensions/pt
- Extensions with VisualEditor support/pt