Help:Score
This page is a how-to guide, detailing processes or procedures of some aspect or aspects of Wikipedia's norms and practices. It is not one of Wikipedia's policies or guidelines. |
|
The <score>...</score>
element produces musical notation using GNU LilyPond (the default) or ABC markup syntax; see Extension:Score.
For details on the LilyPond syntax, see its notation documentation. The extension currently uses Lilypond v2.14.
Contents
Element attributes[edit]
Attribute | Description |
---|---|
lang="ABC" |
use ABC notation |
lang="lilypond" |
use Lilypond notation (default) |
midi="1" |
score image links to an automatically generated MIDI file |
vorbis="1" |
adds an audio player beneath the score image to play an automatically generated Ogg Vorbis file |
raw="1" |
the score code is interpreted as a complete LilyPond file to allow more complex scores (requires Lilypond notation) |
override_midi="…" |
replaces the automatically generated MIDI file by the given one |
override_ogg="…" |
replaces the automatically generated Ogg Vorbis file by the given one |
Examples[edit]
Simple
<score> {c' d' e' f' f' fes' eis' e'} </score>
gives
More elaborate
<score>
\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( ces 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
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.
Sharps are formed with the suffix is
(ais bis cis dis eis fis gis
).
Flats are formed with the suffix, except for E♭, for which the notation is simply "es" (aes bes ces des es fes ges
).
If the code includes the line '\language "english"' then sharps and flats may be formed from the suffixes s
and f
(fs bf
).
Double sharps are formed with the suffix isis
and double flats with eses
.
By default, each note name refers to the note below middle C. For example, c
would be displayed as or .
Use the apostrophe ('
) to go up an octave and a comma (,
) to go an octave down. Middle C would be c'
.
<score> { a,, c, e, a, c e a c' e' a' c'' e'' a'' c''' e''' g''' \bar "||" aes'' bes'' gis'' dis'' } </score>
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> \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>
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>
\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>
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> \relative c''{b1 b2 b4 b8 c r4 b4. r8 \times 2/3 {a8 g f}} </score>
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>
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]
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>
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.
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>
\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>
Adding chord names[edit]
Chord names can be added as a separate ChordNames staff as follows:
<score>
<<
\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>
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 , 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
MIDI instruments[edit]
MIDI instrument sounds can be assigned with \set Staff.midiInstrument = #"instrument"
as documented in section 3.5.2 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 |
<score vorbis="1">
\relative c'' { \set Staff.midiInstrument = #"bassoon" \clef treble \numericTimeSignature \time 4/4 \tempo "Lento" 4 = 50 \stemDown c4\fermata(_"solo ad lib." \grace { b16[( c] } b g e b' \times 2/3 { a8)\fermata } }
</score>
|
Renders as |
Markup |
<score vorbis="1">
{ \new PianoStaff <<
\new Staff \relative c'' { \set Staff.midiInstrument = #"violin" \clef treble \tempo 8 = 126 \time 3/16 r16 <d c a fis d>\f-| r16\fermata | \time 2/16 r <d c a fis d>-| \time 3/16 r <d c a fis d>8-| | r16 <d c a fis d>8-| | \time 2/8 <d c a fis>16-| <e c bes g>->-|[ <cis b aes f>-| <c a fis ees>-|] }
\new Staff \relative c { \set Staff.midiInstrument = #"violin" \clef bass \time 3/16 d,16-| <bes'' ees,>-| r\fermata | \time 2/16 <d,, d,>-| <bes'' ees,>-| | \time 3/16 d16-| <ees cis>8-| | r16 <ees cis>8-| | \time 2/8 d16\sf-| <ees cis>-|->[ <d c>-| <d c>-|] }
>> }
</score>
|
Renders as |
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}}