Jump to content
MediaWiki

Estensione:Score

From mediawiki.org
This page is a translated version of the page Extension:Score and the translation is 52% complete.
Outdated translations are marked like this.
This code base is maintained by the Reader Experience team. Code review only for UBNs or security fixes.
L'estensione Score richiede la creazione di un servizio esterno, Shellbox , per elaborare in modo sicuro le partiture musicali tramite il software LilyPond. Prima di installare questa estensione, è bene leggere le informazioni in #Security concerns e il 2021 security advisory.
Manuale sulle Estensioni MediaWiki
Score
Stato della release: stabile
Implementazione Etichetta
Descrizione Permette la resa di spartiti musicali con LilyPond.
Autore(i) Alexander Klauer, Étienne Beaulé
Versione 0.3.0 (2019年03月23日)
MediaWiki 1.36+
PHP 5.3+
  • $wgScoreDirectory
  • $wgScoreSoundfont
  • $wgScoreFluidsynth
  • $wgScoreLame
  • $wgScoreEnvironment
  • $wgScoreLilyPond
  • $wgWikibaseMusicalNotationLineWidthInches
  • $wgScoreImageMagickConvert
  • $wgScoreLilyPondFakeVersion
  • $wgScoreFileBackend
  • $wgScoreTrim
  • $wgScoreGhostscript
  • $wgScoreMaxLength
  • $wgMusicalNotationEnableWikibaseDataType
  • $wgScoreOfferSourceDownload
  • $wgScoreDebugOutput
  • $wgScoreUseSvg
  • $wgScorePath
  • $wgScoreAbc2Ly
  • $wgScoreDisableExec
score
Licence GNU General Public License 3.0 or later
Scaricare
README.md
Traduci l'estensione Score se è disponibile su translatewiki.net
Problemi Compiti aperti · Riportare un bug

L'estensione Score permette il rendering di spartiti musicali come immagini PNG utilizzando LilyPond e può anche trasformarli in file audio e MIDI.

Installazione

See the extension's README.md for detailed installation instructions.
  • Download and move the extracted Score folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:
    cdextensions/
    gitclonehttps://gerrit.wikimedia.org/r/mediawiki/extensions/Score
    
  • Aggiungi il seguente codice al tuo $LocalSettings (preferibilmente alla fine):
    wfLoadExtension( 'Score' );
    $wgScoreTrim = true;
    $wgImageMagickConvertCommand = '/usr/bin/convert';
    $wgShellboxUrl = '... address to Shellbox ...';
    $wgShellboxSecretKey = '... your secret key ...';
    
  • Create a subdirectory named lilypond in your $wgUploadDirectory (usually the directory named images in your MediaWiki directory). Make sure the directory is writable by your Web server.
  • Yes Done – Naviga in Special:Version nella tua wiki per verificare che l'estensione sia stata installata correttamente.

Prerequisiti

Si raccomanda l'installazione dei seguenti pacchetti:

  • LilyPond
  • Ghostscript
  • ImageMagick
  • FluidSynth
  • Firejail

Questa estensione utilizza il programma LilyPond per visualizzare gli spartiti musicali, quindi è necessario prima installare LilyPond. (Special:Version mostra la versione di LilyPond installata). Se si installa LilyPond da un pacchetto e non dai sorgenti, sarà installato anche Ghostscript, poiché LilyPond dipende da quest'ultimo. ImageMagick dovrebbe essere installato per fare in modo che le immagini vengano ritagliate, poiché le immagini prodotte dall'estensione contengono una quantità eccessiva di spazio bianco.

Per ragioni di sicurezza, si raccomanda vivamente di installare firejail per limitare ulteriormente ciò che LilyPond e Ghostscript possono fare se utenti non attendibili sono autorizzati a modificare la propria wiki.

L'estensione è anche in grado di creare file audio dai file MIDI generati da LilyPond. Se si vuole utilizzare questa funzionalità, è necessario avere installato Extension:TimedMediaHandler .

FluidSynth è il programma preferito per convertire i file MIDI in file audio, tuttavia è supportato anche TiMidity++.

Problemi di sicurezza

Usa il programma Shellbox per mettere in sicurezza LilyPond in modo da proteggere la propria wiki!

LilyPond files can run arbitrary code on the server. Se non ci si può fidare in modo assoluto di tutti coloro che hanno i privilegi di modifica nella propria wiki, è fortemente consigliabile impostare delle limitazioni a LilyPond utilizzando 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.

Osservazioni

Questa estensione esegue diversi comandi in una Shellbox per ragioni di sicurezza. In caso di errori "out of memory" (memoria non disponibile), è necessario incrementare $wgMaxShellMemory .

Configurazione

Alcuni dei parametri di configurazione globale dell'estensione sono elencati qui di seguito.

$wgScoreLilyPond

Imposta $wgScoreLilyPond sul percorso del tuo eseguibile LilyPond (tipicamente /usr/bin/bin/lilypond o /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

Il <codice>$wgScoreTrim</codice> è un booleano che ha come valore predefinito <codice>$wgUseImageMagick</codice>. Se true, le immagini PNG del punteggio risultante vengono tagliate con ImageMagick. Se non si desidera il trimming, o non si vuole installare ImageMagick, impostare $wgScoreTrim su false 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

Impostare $wgScoreAbc2Ly sul percorso eseguibile del convertitore da ABC a LilyPond (tipicamente /usr/bin/abc2ly o /usr/local/bin/abc2ly).

$wgScoreFluidsynth

Impostare $wgScoreFluidsynth sul percorso del proprio eseguibile Fluidsynth (tipicamente /usr/bin/fluidsynth o /usr/local/bin/fluidsynth).

$wgScoreSoundfont

Impostare $wgScoreSoundfont sul percorso del file soundfont (tipicamente /usr/share/sounds/sf2/FluidR3_GM.sf2 o /usr/share/sounds/sf2/FluidR3_GS.sf2).

$wgScoreLame

Impostare $wgScoreLame sul percorso del proprio eseguibile Lame (tipicamente /usr/bin/lame o /usr/local/bin/lame). Richiesto se il file audio generato deve essere un MP3.

Uso

Dopo l'installazione, puoi semplicemente incorporare le notazioni LilyPond nel tuo wikitesto fra due tag ‎<score>...‎</score>. Per esempio:

<scorelang="lilypond">\relativec'{fdfadfedcisaciseagfe}</score>

rende:

È inoltre possibile specificare gli attributi dei tag di punteggio nella forma generale

<scoreattribute1="value1"attribute2="value2">...</score>.

Per esempio:

<scoresound="1"lang="lilypond">\relativec'{\setStaff.midiInstrument="tenor sax"fdfadfedcisaciseagfe}</score>

rende:

Attributes

Sono disponibili i seguenti attributi:

Attributi Valori concessi Effetti
lang ABC, lilypond (default) Permette di scegliere con quale notazione inserire gli spartiti. Per esempio, per usare la notazione ABC, si dovrebbe scrivere:
<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 (rimosso) Questa opzione era utilizzata per controllare se l'immagine dello spartito era collegata a un file MIDI.
override_midi Nome di un file conosciuto, cioè se viene dato override_midi="name", [[File:name]] non produce un collegamento rosso (deprecato) È preferibile aggiungere un link wiki a [[File:superior midi filename.mid]] dopo aver chiuso il tag ‎</score>.
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 (deprecato) 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 (deprecato) 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 (deprecato) Alias for sound.

Il linguaggio LilyPond

I testi possono essere aggiunti in questo modo:

<scorelang="lilypond"sound="1">
\relativec''{\time4/4\keyc\major
c4g8ga4grb^>c^>r\bar"|."}
\addlyrics{Shaveandahair--cut:twobits.}
</score>

Per gli utenti avanzati, il comando \set Staff.midiInstrument può essere usato per cambiare lo strumento MIDI per il suono.

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.

Riconoscimenti

L'originale Extension:LilyPond è stato scritto da Johannes E. Schindelin.

See also

Questa estensione viene utilizzata su uno o più progetti Wikimedia. Ciò probabilmente significa che l'estensione è stabile e funziona abbastanza bene da essere utilizzata da siti Web ad alto traffico. Cerca il nome di questa estensione nei file di configurazione CommonSettings.php e InitialiseSettings.php di Wikimedia per vedere dove è installato. Un elenco completo delle estensioni installate su un particolare wiki può essere visto sulla pagina Special:Version del wiki.

AltStyle によって変換されたページ (->オリジナル) /