Extension:Score

From mediawiki.org
This page is a translated version of the page Extension:Score and the translation is 13% complete.
Outdated translations are marked like this.
미디어위키 확장 기능 설명서
Score
출시 상태: 안정
구현 태그
설명 릴리폰드로 악보를 렌더링할 수 있게 합니다.
만든 이 Alexander Klauer, Étienne Beaulé
최신 버전 0.3.0 (2019-03-23)
MediaWiki 1.36+
PHP 5.3+
라이선스 GNU General Public License 3.0 or later
다운로드
README.md
  • $wgScorePath
  • $wgScoreAbc2Ly
  • $wgScoreFluidsynth
  • $wgScoreLame
  • $wgScoreEnvironment
  • $wgScoreLilyPond
  • $wgWikibaseMusicalNotationLineWidthInches
  • $wgScoreImageMagickConvert
  • $wgScoreLilyPondFakeVersion
  • $wgScoreFileBackend
  • $wgScoreDirectory
  • $wgScoreTrim
  • $wgScoreGhostscript
  • $wgMusicalNotationEnableWikibaseDataType
  • $wgScoreOfferSourceDownload
  • $wgScoreMaxLength
  • $wgScoreDebugOutput
  • $wgScoreUseSvg
  • $wgScoreDisableExec
  • $wgScoreSafeMode
  • $wgScoreSoundfont
score
Quarterly downloads 24 (Ranked 125th)
Public wikis using 918 (Ranked 265th)
Score 확장 기능 번역 (translatewiki.net에서 가능한 경우)
이슈 미해결 작업 · 버그 보고

Score 확장 기능은 릴리폰드를 사용해서 악보를 PNG 이지지로 렌더링합니다. 또 음성 파일이나 MIDI 파일로 변환할 수도 있습니다.

Acknowledgements

  • 오리지널 Extension:LilyPond는 Johannes E. Schindelin에 의해서 만들어졌습니다.
  • 오리지널 Extension:ABC는 River Tarnell에 의해서 작성됐습니다.

사용법

설정 후에 ‎<score>...‎</score> 태그를 사용해서 간단한 LilyPond 기법을 당신의 위키텍스트로 넣을 수가 있습니다. 예를들면:

<score>\relative c' { f d f a d f e d cis a cis e a g f e }</score>

yields:

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

일반적인 형식으로 score 태그에 속성을 지정할 수도 있습니다.

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

예를들면:

<score sound="1">\relative c' { f d f a d f e d cis a cis e a g f e }</score>

yields:

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

다음 속성을 사용할 수 있습니다.

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 (removed) This used to control whether the rendered score image linked to a MIDI file.
override_midi Known file name, that is, if override_midi="name" is given, [[File:name]] does not yield a red link (구식화됨) 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 (구식화됨) 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 (구식화됨) 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/ko . An audio player will be embedded in the HTML after the score image(s).
vorbis 0 (default), 1 (구식화됨) Alias for sound.

The LilyPond language

가사는 다음과 같이 추가할 수가 있씁니다:

<score>
\relative c'' { \time 4/4 \key c \major 
c4 g8 g a4 g r b^> c^> r \bar "|." } 
\addlyrics { Shave and a hair -- cut: two bits. }
</score>
\relative c'' { \time 4/4 \key c \major 
  c4 g8 g a4 g r b^> c^> r \bar "|." } 
  \addlyrics { Shave and a hair -- cut: two bits. }

For advanced users, the \set Staff.midiInstrument command can be used to change the MIDI instrument for the sound.

Prerequisites

The following packages are recommended:

  • LilyPond
  • Ghostscript
  • ImageMagick
  • FluidSynth
  • Firejail

이 확장 기능은 LilyPond를 사용해서 악보 이미지를 묘사하는 것으로 LilyPond를 설치할 필요가 있습니다. 악보 파일을 트리밍하는 확장 기능이 필요할 경우에는 이미지매직도 필요합니다. 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.

확장 기능은 LilyPond에 의해 생성된 MIDI 파일에서 음성 파일을 작성할 수도 있습니다. 이 기능을 이용하려면 Extension:TimedMediaHandler를 설치할 필요가 있습니다.

FluidSynth is the preferred method to convert MIDI files to audio files, however TiMidity++ is also supported.

Security concerns

Use Shellbox to secure LilyPond to protect your wiki!

Score uses LilyPond in safe mode, however there are known unfixed safe mode escape vulnerabilities leading to arbitrary execution.

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. Keep safe mode enabled, even with containment as an extra layer of defense. Certain functionality will not work in safe mode, the fix for that is to modify LilyPond to allow that functionality in safe mode.

설치

See the extension's README.md for detailed installation instructions.
  • 파일을 다운로드하고 Score 폴더를 extensions/ 디렉토리에 넣어 주세요.
    개발자와 코딩 기여자는 Git을 이용해 확장기능을 다운받는 것이 좋습니다.cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Score
  • 아래의 코드를 LocalSettings.php 코드의 마지막에 추가합니다.
    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 완료 – 위키의 ‘Special:Version’에 이동해서, 확장기능이 올바르게 설치된 것을 확인합니다.

설정

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).

$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.

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.

Finding scores

Pages with scores on them will have the "score" page property set. Using Special:PagesWithProp, you can find pages that have scores. (Example query for the English Wikipedia.)

같이보기

  • Vexflow Open source SVG/Canvas music renderer