Help:Score
![]() | This help page is a how-to guide. It details processes or procedures of some aspect(s) of Wikipedia's norms and practices. It is not one of Wikipedia's policies or guidelines, and may reflect varying levels of consensus and vetting. |
The <score>...</score>
element displays a musical score out of GNU LilyPond (the default) or ABC markup syntax; see Extension:Score. It also produces a MIDI file of the music and optionally display an audio player that plays the music. This is part of MediaWiki, intended to be installable consistently across Wikipedia languages.
For details on the LilyPond syntax, see its notation documentation. A complete manual is here in HTML and here as PDF. As of August 2021[update], the extension on Wikipedia is using LilyPond v2.22.0 (check Special:Version for the current version). Changes to LilyPond since version 2.18 are documented here.
Importantly, note that the documented LilyPond syntax applies when the extension is invoked with <score raw="1">
. Calling just <score>
will invoke a simplified implementation that is not fully consistent with the LilyPond documentation.
Element attributes[edit]
Attribute | Description |
---|---|
lang="ABC" |
use ABC notation (see standard documentation; many parts newer than 1.6 are unsupported, so preview often) |
lang="lilypond" |
use LilyPond notation (default, see #Syntax) |
sound="1" |
add an audio player beneath the score image to play an automatically-generated Ogg Vorbis audio file |
raw="1" |
interpret the markup within the score tag as a complete LilyPond file, allowing more complex scores
|
midi="1" |
obsolete This used to control whether the score image links to an automatically-generated MIDI file; clicking the score now always shows a JavaScript pop-up with a link to the MIDI file. |
override_midi="…" |
deprecated replace the automatically-generated MIDI file by the given one |
override_audio="…" |
deprecated replace the automatically-generated audio file by the given one |
override_ogg="…" |
deprecated alias for override_audio
|
vorbis="1" |
deprecated alias for sound
|
If there is a MIDI file or audio file of superior quality to the MIDI or audio generated by the Score extension, you can provide a [[File::]]
wikilink to it after the closing </score>
tag.
Examples[edit]
Simple[edit]
<score>
{c' d' e' f' g' fis' es' cis' c'2}
</score>
gives
![{c' d' e' f' g' fis' es' cis' c'2}](http://webcf.waybackmachine.org/web/20220416025711im_/https://upload.wikimedia.org/score/l/j/ljl7r6ng2reh6n26lcw2e2q0kz8i3nh/ljl7r6ng.png)
Equivalent in ABC notation:
<score lang="ABC"> L:1/4 CDEF | G^F_E^C | C2 </score>
More elaborate[edit]
<score sound="1">
\transpose c g \relative c' { % display G for C, etc. and one octave higher
\key c \minor
\time 4/4
c4 e8 e g4 g % (text after the % is just a comment)
<c es g>2 <c es g> % angle brackets create chords
es4 d( c b) % parentheses create slurs
a4. r8 r8 a8 ~ a4 % r creates rests; ~ creates ties
e-- e-> e-. g\fermata % accents and other signs
\bar "|."
}
</score>
gives
![\transpose c g \relative c'{
\key c \minor
\time 4/4
c4 e8 e g4 g % (text after the % is just a comment)
<c es g>2 <c es g> % angle brackets create chords
es4 d( c b) % parentheses create slurs
a4. r8 r8 a8 ~ a4 % r creates rests; ~ creates ties
e-- e-> e-. g\fermata % accents and other signs
\bar "|."
}
% This is just a comment line.](http://webcf.waybackmachine.org/web/20220416025711im_/https://upload.wikimedia.org/score/g/w/gwvy7e1vxxoy88y2gohxx3abwb6ub49/gwvy7e1v.png)
Equivalent in ABC (pre-transposed due to differing semantics):
<score lang="ABC"> K: Gm M: 4/4 L: 1/4 G =B/2B/2 dd | % a comment [gbd']2 [gbd']2 | % square brackets create chords (not supported by abc2ly) b (ag^e) | % parentheses create slurs =e3/2 z/2 z/2 c/2-c % z creates rests; - creates ties !tenuto!=B LB .B HB % see standard section "Decorations" (not supported by abc2ly) |] </score>
Syntax[edit]
The score section must be surrounded by <score>...</score>
. The notes must be within a set of curly braces {...}
.
Comments in the markup start with a percentage sign %
and end at the end of the line.
Pitch[edit]
To display a note, type the letter (a b c
etc.) Separate each letter with a space. The bare note name refers to the natural note irrespective of key signature (see "setting the key" below).
These letters are as in English and Dutch, not as in German and many other continental languages (FYI: continental b means b flat and continental h means b - if you find that confusing, forget it).
Sharps and flats are formed by using the Dutch and German suffixes "is" and "es" respectively. To avoid "ees", the note E♭ is simply written as es
. The simple accidentals are thus ais bis cis dis eis fis gis
for the sharps and aes bes ces des es fes ges
for the flats. English language editors may prefer to include the line \language "english"
in the script, after which s
for sharp and f
for flat can be used: as bs cs ds es fs gs
and af bf cf df ef ff gf
. Double sharps are formed with the suffix isis
and double flats with eses
, or in English notation with ss
or x
and ff
. Semi-sharps, -flats and sesqui-sharps and -flats are also supported in both English and German. See: #Accidentals.
By default, each note name refers to the note below middle C. For example, c
would be displayed as
![\new Staff \with { \remove "Time_signature_engraver" }{c}](http://webcf.waybackmachine.org/web/20220416025711im_/https://upload.wikimedia.org/score/j/4/j4tw9v89ymj9lch21kn76p2qkrdut4t/j4tw9v89.png)
or
![\new Staff \with { \remove "Time_signature_engraver" }{\clef bass c}](http://webcf.waybackmachine.org/web/20220416025711im_/https://upload.wikimedia.org/score/c/t/ctuuu1zclr3651tn6o21hzfn6b2yyiu/ctuuu1zc.png)
.
Use the apostrophe ('
) to go up an octave and a comma (,
) to go an octave down. Middle C would be c'
![\new Staff \with { \remove "Time_signature_engraver" }{ c'}](http://webcf.waybackmachine.org/web/20220416025711im_/https://upload.wikimedia.org/score/5/j/5jauvleatqcd21kcyx55vtdwoxrgb2d/5jauvlea.png)
.
<score lang="lilypond" vorbis="1">
{
a,, c, e, a, c e a c' % Middle C
e' a' c'' e'' a'' c''' e''' g''' \bar "||"
aes'' bes'' gis'' dis'' aeses'' beses'' gisis'' disis'' \bar "||"
aeh'' beseh'' gih'' disih'' \bar "||"
\language "english"
af'' bf'' gs'' ds'' aff'' bff'' gss'' bx'' \bar "||"
aqf'' btqf'' gqs'' dtqs''
}
</score>
![{
a,, c, e, a, c e a c' %Middle C
e' a' c'' e'' a'' c''' e''' g''' \bar "||"
aes'' bes'' gis'' dis'' aeses'' beses'' gisis'' disis'' \bar "||"
aeh'' beseh'' gih'' disih'' \bar "||"
\language "english"
af'' bf'' gs'' ds'' aff'' bff'' gss'' bx'' \bar "||"
aqf'' btqf'' gqs'' dtqs''
}](http://webcf.waybackmachine.org/web/20220416025711im_/https://upload.wikimedia.org/score/i/w/iw1gsmftwfkgizyrz3fsrnsw1z7ui00/iw1gsmft.png)
A much easier way is to use relative coding. If you include \relative
before the braces, each note will refer to the note closest to the previous one, and the first one will refer to the note closest to the one mentioned after the \relative
tag. ("Closest" ignores sharps and flats.) Use '
to go up an extra octave and ,
to go down.
<score lang="lilypond" vorbis="1">
\relative c' {
e f <c e g>2
a'4( b c) c,
d8 e f16 g a b
c4. a8 e' f g, f r \autoBeamOff e d c
b4 a g b-> c2.-> r4
\bar "|."
}
</score>
![\relative c' {
e f <c e g>2
a'4( b c) c,
d8 e f16 g a b
c4. a8 e' f g, f r \autoBeamOff e d c
b4 a g b-> c2.-> r4
\bar "|."
}](http://webcf.waybackmachine.org/web/20220416025711im_/https://upload.wikimedia.org/score/m/i/mios9402trucq4uivlvehfr4e3atp88/mios9402.png)
Setting the key[edit]
By default there is no key signature (no sharps or flats). You can indicate the key with \key g \major
, \key c \minor
, or even a mode such as \key c \dorian
or \key c \mixolydian
. The key can be changed at any point.
Keep in mind that even with a key signature, you must still include sharps (-is) and flats (-es) for each individual note name. If you omit one, it will be considered a natural. For example, this is the key of C# major:
<score lang="lilypond" vorbis="1">
\relative c' {
\key cis \major
\time 6/8
% Notes with -is suffixes indicating sharps
cis8 dis eis fis gis ais
% Notes without accidentals (naturals)
b c d e f g
}
</score>
![\relative c' {
\key cis \major
\time 6/8
% Notes with -is suffixes indicating sharps
cis8 dis eis fis gis ais
% Notes without accidentals (naturals)
b c d e f g
}](http://webcf.waybackmachine.org/web/20220416025711im_/https://upload.wikimedia.org/score/l/a/laxpns7hpchg82nluzzjwkad4uyftc3/laxpns7h.png)
Accidentals[edit]
Accidentals may be indicated by following the note name with the appropriate text:
![]() |
![]() |
♭ | ![]() |
♮ | ![]() |
♯ | ![]() |
![]() | |
---|---|---|---|---|---|---|---|---|---|
De | eses | eseh | es | eh | ! | ih | is | isih | isis |
En | ff | tqf | f | qf | qs | s | tqs | ss or x |
Note that E♭ is "es" alone, rather than "ees". "q" and "tq" refer to "quarter" and "three-quarter" (rather than "hf" for "half flat" and "thf" for "three-half flat"), as in "quarter tone". However, the "quarter flat/sharp" is not a quarter of a flat/sharp, but instead half of a flat/sharp, and the "three-quarter flat/sharp" is 1.5 flats not 0.75 flats. Notes outside of the quarter-tone scale are not supported.
German:
<score lang="lilypond" vorbis="1"> {
\override Score.TimeSignature
#'stencil = ##f
\relative c'' {
\time 4/4
aeses1 aeseh aes aeh a! aih ais aisih aisis
} }
</score>
English:
<score lang="lilypond" vorbis="1"> {
\override Score.TimeSignature
#'stencil = ##f
\relative c'' {
\time 4/4
\language "english"
aff1 atqf af aqf a! aqs as atqs ass
} }
</score>
Both result in:
![{
\override Score.TimeSignature
#'stencil = ##f
\relative c'' {
\time 4/4
\language "english"
aff1 atqf af aqf a! aqs as atqs ass
} }](http://webcf.waybackmachine.org/web/20220416025711im_/https://upload.wikimedia.org/score/a/9/a9oekxwlf7niq8q53om4zp9nwsz7wcd/a9oekxwl.png)
Transposition[edit]
If, for some reason, a piece needs to be transposed to a different key, it is possible to do so without having to transcribe it manually. This also affects the key signature. The syntax for this is:
\transpose frompitch topitch musicexpr
For example:
<score lang="lilypond" vorbis="1">\transpose c es {
\relative c' {
\key c \major \time 4/4
c4 d e f g a b c
}
}
</score>
Results in:
![\transpose c es {
\relative c' {
\key c \major \time 4/4
c4 d e f g a b c
}
}](http://webcf.waybackmachine.org/web/20220416025711im_/https://upload.wikimedia.org/score/0/y/0y3bgiv213as061pam3iovtz27uddy8/0y3bgiv2.png)
Rhythm[edit]
Note duration is indicated by a number following the pitch with no space between (a4 b8
). Use the number 1 for a whole note (breve), 2 for a half note (semibreve), 4 for a quarter note (crotchet), 8 for an eighth note (quaver), and so on. If a note does not have an explicit duration, it will either default to a quarter note or use the duration of the note preceding it.
Rests are indicated by using the letter r
instead of a pitch. Dotted notes are formed simply by following the duration number with a period (c4.
).
Tuplets are indicated using the \times
command, for example \times 2/3 {c8 c c}
gives a triplet of three eight-notes (quavers).
<score lang="lilypond" vorbis="1">
\relative c''{b1 b2 b4 b8 c r4 b4. r8 \times 2/3 {a8 g f}}
</score>
![\relative c''{b1 b2 b4 b8 c r4 b4. r8 \times 2/3 {a8 g f}}](http://webcf.waybackmachine.org/web/20220416025711im_/https://upload.wikimedia.org/score/f/a/famzz5p9g1qfj1rgxry0itzprdn9gxx/famzz5p9.png)
Setting the time signature[edit]
The default time signature is 4/4. To set another time signature, one may use the \time
command. For example to set the time signature to cut-time one would use \time 2/2
and waltz time would be \time 3/4
. The time signature may be changed at almost any point.
Removing the time signature[edit]
For some music examples, removing the time signature may be desirable; the code \remove "Time_signature_engraver"
can be used in that case:
<score>
{
\new Staff \with { \remove "Time_signature_engraver" }
<d' fis' a'>2
}
</score>
![{ \new Staff \with { \remove "Time_signature_engraver" } <d' fis' a'>2 }](http://webcf.waybackmachine.org/web/20220416025711im_/https://upload.wikimedia.org/score/6/k/6ka4xeftvaz7d2od0rzovndps2iurr2/6ka4xeft.png)
Pick up measure[edit]
The code \partial 4
will create a pickup measure (anacrusis) of one quarter note, \partial 4*2
would create a pickup measure of two quarter notes, etc. See an example in the Adding Lyrics section of this article.
Customizing beams[edit]
![\relative c'' {
\time 3/4
r4. g8 a8 b8
}](http://webcf.waybackmachine.org/web/20220416025711im_/https://upload.wikimedia.org/score/9/n/9n3s8qlzk7jgnu47eeqiq24aorqmnl3/9n3s8qlz.png)
The software occasionally combines beamed notes in places that are not desired or look awkward. To override the automatic beams, use \noBeam
between the notes that would otherwise be beamed: g a b \noBeam g
. To turn off beaming for many notes, use \autoBeamOff
and then \autoBeamOn
.
<score>
\relative c'' {
\time 3/4
r4. g8 \noBeam a8 b8
}
</score>
![\relative c'' {
\time 3/4
r4. g8 \noBeam a8 b8
}](http://webcf.waybackmachine.org/web/20220416025711im_/https://upload.wikimedia.org/score/3/8/38np7kjyvialow0b84b4ubu12fcgh3b/38np7kjy.png)
To manually beam notes, use square brackets inserting the first one after the first note to be beamed: a8 b[ c d e] f
. This would beam the notes b, c, d, and e, but leave the first and last notes without beams.
![\relative c''{a8 b[ c d e] f}](http://webcf.waybackmachine.org/web/20220416025711im_/https://upload.wikimedia.org/score/f/n/fnrum0vdsgo1t7d60fv3mu45mjd16w6/fnrum0vd.png)
Adding lyrics[edit]
You can add lyrics to the score using \addlyrics
. See the LilyPond Manual for more information about how to align the lyrics to the score.
<score raw="1" lang="lilypond">
\header {
tagline = "" % no footer
title = "Good Morning"
composer = "trad."
}
\relative g' {
\key g \major \time 3/4
\partial 4 d
e d g
fis2 d4
e d a'
g2 d4
d' b g
fis e c'
b g a
g2 \fermata
\bar "|."
}
\addlyrics {
Good mor -- ning to you,
Good mor -- ning to you,
Good mor -- ning dear chil -- dren,
Good mor -- ning to all.
}
</score>
![\header {
tagline = "" % no footer
title = "Good Morning"
composer = "trad."
}
\relative g' {
\key g \major \time 3/4
\partial 4 d
e d g
fis2 d4
e d a'
g2 d4
d' b g
fis e c'
b g a
g2 \fermata
\bar "|."
}
\addlyrics {
Good mor -- ning to you,
Good mor -- ning to you,
Good mor -- ning dear chil -- dren,
Good mor -- ning to all.
}](http://webcf.waybackmachine.org/web/20220416025711im_/https://upload.wikimedia.org/score/s/u/sujrptarno5z9wr9kadgp21haavoru8/sujrptar.png)
Adding chord names[edit]
Chord names can be added as a separate ChordNames staff as follows:
<score lang="lilypond" vorbis="1">
<<
\new ChordNames \chordmode {
\set chordChanges = ##t % Only display chord when there is a change (e.g., don't repeat the Am here)
a4:m a4:m |% measure 1 - A7 would be a:7
g2 |% measure 2
}
\new Staff \relative c''{
\key a \dorian
\time 2/4
a8 a16 a a8 a16 a |% measure 1
b8 a g4 |% measure 2
}
>>
</score>
![<<
\new ChordNames \chordmode {
\set chordChanges = ##t
a4:m a4:m |% measure 1
g2 |% measure 2
}
\new Staff \relative c''{
\key a \dorian
\time 2/4
a8 a16 a a8 a16 a |% measure 1
b8 a g4 |% measure 2
}
>>](http://webcf.waybackmachine.org/web/20220416025711im_/https://upload.wikimedia.org/score/1/6/168z5okkuj893on7uzgycrjg8se32y0/168z5okk.png)
Note:
The letter s
can be used in the ChordNames staff in place of r
(the code for a rest) when there is no chord.
An r
will result in an explicit "No Chord" notation
![<<\new ChordNames \chordmode {r2} \new Staff \with { \remove "Time_signature_engraver" } \relative c''{c}>>](http://webcf.waybackmachine.org/web/20220416025711im_/https://upload.wikimedia.org/score/a/7/a798ep5ovnm6ltpixwohr2j0l9gimoi/a798ep5o.png)
, whereas the s
will result in correct spacing, but no chord name notation will appear.
Accents and other symbols[edit]
There are a number of symbols to attach to notes, such as \fermata
. There are also {e-> f-- g-+ a-. b-^ c-_ d-!}
<score>
\relative c' {
e-> f-- g-+ a-.
b-^ c-_ d-! e\fermata
}
</score>
producing
![\relative c' {
e-> f-- g-+ a-.
b-^ c-_ d-! e\fermata
}](http://webcf.waybackmachine.org/web/20220416025711im_/https://upload.wikimedia.org/score/a/n/an7pj2tbubg2qa339dve18b2ufye0bm/an7pj2tb.png)
Color[edit]
<score lang="lilypond" vorbis="1">
{
\override Score.TimeSignature #'stencil = ##f
\relative c' {
\clef treble
\time 7/4 \once \override NoteHead.color = #red c4 d \once \override NoteHead.color = #red e f \once \override NoteHead.color = #red g a b \time 2/4 c2 \bar "||"
\time 4/4 <c, e g>1 \bar "||"
} }
</score>
produces
![{
\override Score.TimeSignature #'stencil = ##f
\relative c' {
\clef treble
\time 7/4 \once \override NoteHead.color = #red c4 d \once \override NoteHead.color = #red e f \once \override NoteHead.color = #red g a b \time 2/4 c2 \bar "||"
\time 4/4 <c, e g>1 \bar "||"
} }](http://webcf.waybackmachine.org/web/20220416025711im_/https://upload.wikimedia.org/score/0/0/00pn0r4587np6z9ya9xnbi2pq51qj24/00pn0r45.png)
MIDI instruments[edit]
MIDI instrument sounds can be assigned with \set Staff.midiInstrument = #"instrument"
as documented in section A6 of LilyPond's Notation Reference. Trial and error may be necessary: some instruments may not work unless the # is omitted, and some may not work with or without the #.
Markup |
|
Renders as | ![]() |
Markup |
|
Renders as | ![]() |
Hiding tempo[edit]
Metronome marks, as shown above, may be hidden with \set Score.tempoHideNote = ##t
.
Markup |
|
Renders as | ![]() |
Individual staff sizes[edit]
Individual staff sizes can be changed with \with{ \magnifyStaff #nn }
. Using \with{ \magnifyStaff #2/3 }
after each instance of \new Staff
, the example above renders as:
![{\new ChoirStaff <<
\new Staff \with{ \magnifyStaff #2/3 } <<
\new Voice \relative c'' { \set Score.tempoHideNote = ##t \tempo 8 = 120 \stemUp \clef treble \key fis \minor \time 3/8 s4. | <gis' dis>8^.^( <gis dis>^. <gis dis>^.) | s4. | <fis cis>8^.^( <fis cis>^. <fis cis>^.) | s4. | fis16^( eis dis cis) <b' gis>8^. | <a fis>^. r r | s4 }
\new Voice \relative c'' { \stemDown cis8[ d] cis | bis4. | b!32_([ cis d16 cis8)] b | ais4. | b8 a![_( gis)] | a fis[_( eis)] | fis \grace { e(} d4) | cis } \addlyrics { Buß - und Reu,– Buß4 und8 Reu– knirscht das Sün- den- herz ent- zwei }
\new Staff \with{ \magnifyStaff #2/3 } \relative c { \clef bass \key fis \minor \time 3/8 fis4.~_"Bar 13" | fis8 gis16( fis eis dis) | eis4. | e!8 fis16( e d cis) | d8( cis b) | cis4.~ | cis8 b16( a gis fis) | eis ^"173 bars"}
>> >> }](http://webcf.waybackmachine.org/web/20220416025711im_/https://upload.wikimedia.org/score/q/n/qnngtcj3nhu97p0tv1vh0wfjq9wsl1z/qnngtcj3.png)
For more intricate details, see "Setting the staff size" in the LilyPond manual.
Image frame[edit]
Alignment[edit]
![\relative c' {
\clef treble \time 7/4 \hide Staff.TimeSignature
c4 d e f g a b c2
}](http://webcf.waybackmachine.org/web/20220416025711im_/https://upload.wikimedia.org/score/i/f/ifnvb0nesgw27k9l6t926etv44yfz99/ifnvb0ne.png)
Use {{Image frame}} to align scores to the left, center, or right.
For example:
{{Image frame |content = <score> \relative c' { \clef treble \time 7/4 \hide Staff.TimeSignature c4 d e f g a b c2 } </score> |width=|caption = Diatonic scale on C, a "white note" scale }}
results in the image to the right.
Grouping[edit]
![{
\override Score.TimeSignature #'stencil = ##f
\relative c' {
\clef treble \time 4/4
e4^\markup { Enharmonic genus } feh geses a b ceh deses e
} }](http://webcf.waybackmachine.org/web/20220416025711im_/https://upload.wikimedia.org/score/k/k/kk2ex9g0tio4820p748q197i0l0qk9m/kk2ex9g0.png)
![{
\override Score.TimeSignature #'stencil = ##f
\relative c' {
\clef treble \time 4/4
e4^\markup { Chromatic genus } f ges a b c des e
} }](http://webcf.waybackmachine.org/web/20220416025711im_/https://upload.wikimedia.org/score/s/j/sjafkg727t8rbf053izt98zybnwf1k8/sjafkg72.png)
![{
\override Score.TimeSignature #'stencil = ##f
\relative c' {
\clef treble \time 4/4
e4^\markup { Diatonic genus } f g a b c d e
} }](http://webcf.waybackmachine.org/web/20220416025711im_/https://upload.wikimedia.org/score/m/c/mc7h1clkb3dikqc0n97sh1j7coyfcjb/mc7h1clk.png)
{{Image frame}} may also be used to group score images together. The text below creates the group of images to the right:
{{Image frame|content=<score>
{
\override Score.TimeSignature #'stencil = ##f
\relative c' {
\clef treble \time 4/4
e4^\markup { Enharmonic genus } feh geses a b ceh deses e
} }
</score>
<score>
{
\override Score.TimeSignature #'stencil = ##f
\relative c' {
\clef treble \time 4/4
e4^\markup { Chromatic genus } f ges a b c des e
} }
</score>
<score>
{
\override Score.TimeSignature #'stencil = ##f
\relative c' {
\clef treble \time 4/4
e4^\markup { Diatonic genus } f g a b c d e
} }
</score>|width=300|caption=The three genera of the Dorian [[octave species]] on E}}
See also[edit]
![]() |
Wikisource has complementary help pages at: |
- Wikipedia:Lyrics and poetry
- Special:PagesWithProp/score, pages where
<score>...</score>
is used - Pages with errors are shown in Category:Pages with score rendering errors
- For some of the history of attempts to add LilyPond support, see Wikipedia:GNU LilyPond support/historical proposal
- Help:Music
- {{Music}}
- Sinuhe20/Spielwiese presents dozens of helpful examples, even for those who cannot read the German headings