Help:Score: Difference between revisions

Content deleted Content added
Hatnote
 
(11 intermediate revisions by 8 users not shown)
Line 1:
{{Wikipedia how-to|H:SCORE}}
{{redirect|WP:SCORE|information about how to format the score results of competitions|Wikipedia:Manual of Style/Dates and numbers#Numbers as figures or words}}
The {{tag|score}} element in wikitext displays a musical score out of GNU [[LilyPond]] (the default) or [[ABC notation|ABC]] markup syntax. It also produces a [[Help:Media (MIDI)|MIDI file]] of the music and optionally displays an audio player that plays the music. It is implemented by the [[mw:Extension:Score|Score extension]] for [[MediaWiki]], available across Wikipedia languages.
 
Line 89 ⟶ 90:
[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)
|]
Line 102 ⟶ 103:
=== Pitch ===
To display a note, type the letter (<code>a b c</code> 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{{Music|flat}} is simply written as <code>es</code>. The simple [[Accidental (music)|accidental]]s are thus <code>ais bis cis dis eis fis gis</code> for the sharps and <code>aes bes ces des es fes ges</code> for the flats. English language editors may prefer to include the line <code>\language "english"</code> in the script, after which <code>s</code> for sharp and <code>f</code> for flat can be used: <code>as bs cs ds es fs gs</code> and <code>af bf cf df ef ff gf</code>. Double sharps are formed with the suffix <code>isis</code> and double flats with <code>eses</code>, or in English notation with <code>ss</code> or <code>x</code> and <code>ff</code>. 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, '''<code>ca</code>''' would be displayed as <score>\new Staff \with { \remove "Time_signature_engraver" }{ca}</score> or <score>\new Staff \with { \remove "Time_signature_engraver" }{\clef bass ca}</score>.
 
Use the apostrophe (<code>'</code>) to go up an octave and a comma (<code>,</code>) to go an octave down. Middle C would be '''<code>c'</code>''' <score>\new Staff \with { \remove "Time_signature_engraver" }{ c'}</score>.
 
<syntaxhighlight lang="LilyPondlilypond">
<score lang="lilypond" vorbissound="1">
{
a,, c, e, a, c e a c' % Middle C
Line 124 ⟶ 125:
</syntaxhighlight>
 
<score lang="lilypond" vorbissound="1">
{
a,, c, e, a, c e a c' %Middle C
Line 136 ⟶ 137:
</score>
 
A much easier way is to use relative coding. If you include <code>\relative</code> 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 <code>\relative</code> tag. ("Closest" ignores sharps and flats.) Use <code>'</code> to go up an extra octave and <code>,</code> to go down.<syntaxhighlight lang="lilypond">
<score raw="1"
\relative c'
title "French Horn"
{
b g ges | d dis g ees | g bis f fes d | g ees b ais | d c8 a4 e! | g f \pp e g des \fermata % Other accents used often
}
</score>
</syntaxhighlight>gives
 
<scoresyntaxhighlight lang="lilypond" audio="1">
<score lang="lilypond" vorbissound="1">
\relative c' {\set Staff.midiInstrument = #"french horn"
\set Staff.midiMinimumVolume = #0.7
\set Staff.midiMaximumVolume = #1.0
\tempo "Andante"
\tempo 4 = 80
\transposition c
\key g \major
\time 4/4
b g ges | d dis g ees | g bis f fes d | g ees b ais | d c8 a4 e! | g f \pp e g des \fermata % Other accents ussed often
\bar "|-"
}
\addlyrics {
Un, deux, trois, qua -- tro,
Cinc, six, siet, eit, non, dex. I, do, tim,
Char, panch, sey, sat, at, no, des. Pa a mi -- da.
}
</score><syntaxhighlight lang="LilyPond">
<score lang="lilypond" vorbis="1">
\relative c' {
e f <c e g>2
Line 176 ⟶ 152:
</syntaxhighlight>
 
<score lang="lilypond" vorbissound="1">
\relative c' {
e f <c e g>2
Line 193 ⟶ 169:
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 Gb major:
 
<syntaxhighlight lang="LilyPondlilypond">
<score lang="lilypond" vorbissound="1">
\relative c' {
\key ges \major
Line 207 ⟶ 183:
</score>
</syntaxhighlight>
<score lang="lilypond" vorbissound="1">
\relative c' {
\key ges \major
Line 242 ⟶ 218:
| es
| eh
| rowspan=2 | !
| !
| ih
| is
Line 253 ⟶ 229:
| f
| qf
|!
| qs
| s
Line 263 ⟶ 238:
 
'''German:'''
<syntaxhighlight lang="LilyPondlilypond">
<score lang="lilypond" vorbissound="1"> {
 
\overrideomit Score.TimeSignature
#'stencil = ##f
\relative c'' {
\time 4/4
Line 276 ⟶ 250:
 
'''English:'''
<syntaxhighlight lang="LilyPondlilypond">
<score lang="lilypond" vorbissound="1"> {
 
\overrideomit Score.TimeSignature
#'stencil = ##f
\relative c'' {
\time 4/4
Line 290 ⟶ 263:
 
'''Both result in:'''
<score lang="lilypond" vorbissound="1"> {
 
\overrideomit Score.TimeSignature
#'stencil = ##f
\relative c'' {
\time 4/4
Line 303 ⟶ 275:
==== Transpose and transposition ====
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:
<syntaxhighlight lang="LilyPondlilypond">
\transpose frompitch topitch musicexpr
</syntaxhighlight>
For example:
<syntaxhighlight lang="LilyPondlilypond">
<score lang="lilypond" vorbissound="1">\transpose c es {
\relative c' {
\key c \major \time 4/4
Line 317 ⟶ 289:
</syntaxhighlight>
Results in:
<score lang="lilypond" vorbissound="1">\transpose c es {
\relative c' {
\key c \major \time 4/4
Line 326 ⟶ 298:
 
MIDI output can be transpositioned with the <code>\transposition <pitch></code> command. The French horn (in C) motif from the opening of Schubert's [[Symphony No. 9 (Schubert)|last symphony]], transpositioned one octave down:
<syntaxhighlight lang="LilyPondlilypond">
<score sound="1">
\relative c' { \set Staff.midiInstrument = #"french horn"
Line 352 ⟶ 324:
}
</score>
The <code>\transposition</code> command is mainly intended for scores that incolveinvolve transposing instruments not set in concert pitch.
<syntaxhighlight lang="LilyPondlilypond">
<score sound="1">
\new GrandStaff <<
Line 408 ⟶ 380:
 
[[Tuplet]]s are indicated using the <code>\times</code> command, for example <code>\times 2/3 {c8 c c}</code> gives a triplet of three eight-notes (quavers).
<syntaxhighlight lang="LilyPondlilypond">
<score lang="lilypond" vorbissound="1">
\relative c''{b1 b2 b4 b8 c r4 b4. r8 \times 2/3 {a8 g f}}
</score>
</syntaxhighlight>
 
<score lang="lilypond" vorbissound="1">
\relative c''{b1 b2 b4 b8 c r4 b4. r8 \times 2/3 {a8 g f}}
</score>
Line 424 ⟶ 396:
For some music examples, removing the time signature may be desirable; the code <code>\remove "Time_signature_engraver"</code> can be used in that case:
 
<syntaxhighlight lang="LilyPondlilypond">
<score>
{
Line 448 ⟶ 420:
The software occasionally combines beamed notes in places that are not desired or look awkward. To override the automatic beams, use <code>\noBeam</code> between the notes that would otherwise be beamed: <code>g a b \noBeam g</code>. To turn off beaming for many notes, use <code>\autoBeamOff</code> and then <code>\autoBeamOn</code>.
 
<syntaxhighlight lang="LilyPondlilypond">
<score>
\relative c'' {
Line 471 ⟶ 443:
You can add lyrics to the score using <code>\addlyrics</code>. See the [http://www.lilypond.org/doc/v2.22/Documentation/learning/aligning-lyrics-to-a-melody LilyPond Manual] for more information about how to align the lyrics to the score.
 
<syntaxhighlight lang="LilyPondlilypond">
<score raw="1" lang="lilypond">
\header {
Line 530 ⟶ 502:
Chord names can be added as a separate ChordNames staff as follows:
 
<syntaxhighlight lang="LilyPondlilypond">
<score lang="lilypond" vorbissound="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
}
Line 548 ⟶ 520:
</syntaxhighlight>
 
<score lang="lilypond" vorbissound="1">
<<
\new ChordNames \chordmode {
Line 591 ⟶ 563:
 
=== Accents and other symbols ===
There are a number of symbols to attach to notes, such as <code>\fermata-^</code>. There are also <code>{e-> f-- g-+ a-. b-^\fermata c-_ d-!}</code>
 
<syntaxhighlight lang="LilyPondlilypond">
<score>
\relative c' {
e-> f-- g-+ a-.
b-^\fermata c-_ d-! e\fermata-^
}
</score>
Line 606 ⟶ 578:
\relative c' {
e-> f-- g-+ a-.
b-^\fermata c-_ d-! e\fermata-^
}
</score>
 
===Color===
<syntaxhighlight lang="LilyPondlilypond">
<score lang="lilypond" vorbissound="1">
{
\overrideomit Score.TimeSignature #'stencil = ##f
\relative c' {
\clef treble
Line 623 ⟶ 595:
</syntaxhighlight>
produces
<score lang="lilypond" vorbissound="1">
{
\overrideomit Score.TimeSignature #'stencil = ##f
\relative c' {
\clef treble
Line 637 ⟶ 609:
*The sound of each midi-instrument supported by LilyPond can be heard at [[v:Music/Software/Lilypond/MIDI]]
{{markupv|title=From ''[[The Rite of Spring]]''
|markup=<syntaxhighlight lang="LilyPondlilypond">
<score sound="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 } }
Line 645 ⟶ 617:
}}
{{markupv
|markup=<syntaxhighlight lang="LilyPondlilypond">
<score sound="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>
</syntaxhighlight>
|renders= {{:The Rite of Spring|sacrificialdancescore}}
|renders=<score sound="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>
}}
 
Line 656 ⟶ 628:
To indicate a repeated section, prefix it with <code>\repeat volta 2</code>. The MIDI and audio will only play once unless you add <code>\unfoldRepeats</code>, which will also "unfold" the score. To avoid this you must duplicate the score, once for layout and once for MIDI, for example:
{{markupv
|markup=<syntaxhighlight lang="LilyPondlilypond">
<score raw="1" sound="1">
\header { tagline = "" }
Line 689 ⟶ 661:
Metronome marks, as shown above, may be hidden with <code>\set Score.tempoHideNote = ##t</code>.
{{markupv|title=From ''[[St Matthew Passion]]''
|markup=<syntaxhighlight lang="LilyPondlilypond">
<score sound="1">
{ \new ChoirStaff <<
Line 720 ⟶ 692:
</score>
For more intricate details, see [http://lilypond.org/doc/v2.22/Documentation/notation/setting-the-staff-size "Setting the staff size"] in the LilyPond manual.
 
===Overall size===
A simpler method to change the overall size of a score is to use the [[CSS]] property <code>zoom</code>. Using <code><nowiki><div style="zoom: 70%;"></nowiki></code>, the above example renders as:
<div style="zoom: 70%;"><score sound>
{ \new ChoirStaff <<
\new Staff <<
\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 \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"}
>> >> }
</score></div>
 
==Image frame==
Line 735 ⟶ 718:
 
For example:
:<syntaxhighlight lang="xmlwikitext">{{Image frame
|content = <score>
\relative c' {
Line 749 ⟶ 732:
{{Image frame|content=<score>
{
\overrideomit Score.TimeSignature #'stencil = ##f
\relative c' {
\clef treble \time 4/4
Line 759 ⟶ 742:
<score>
{
\overrideomit Score.TimeSignature #'stencil = ##f
\relative c' {
\clef treble \time 4/4
Line 769 ⟶ 752:
<score>
{
\overrideomit Score.TimeSignature #'stencil = ##f
\relative c' {
\clef treble \time 4/4
Line 777 ⟶ 760:
 
{{tl|Image frame}} may also be used to group score images together. The text below creates the group of images to the right:
<syntaxhighlight lang="xmlwikitext">
{{Image frame|content=<score>
{
\overrideomit Score.TimeSignature #'stencil = ##f
\relative c' {
\clef treble \time 4/4
Line 790 ⟶ 773:
<score>
{
\overrideomit Score.TimeSignature #'stencil = ##f
\relative c' {
\clef treble \time 4/4
Line 800 ⟶ 783:
<score>
{
\overrideomit Score.TimeSignature #'stencil = ##f
\relative c' {
\clef treble \time 4/4
Line 809 ⟶ 792:
 
== See also ==
{{Wikisource-multi|caption=[[Wikisource]] has complementary help pages at|Help:Sheet music|Help:LilyPond}}
 
=== Math ===
<math id="Anzam">f(n) = \begin{cases} n/2, & \text{if }n\text{ is even} \\ 3n+1, & \text{if }n\text{ is odd} \end{cases}
\begin{align} f(x) & = (a+b)^2 \\ & = a^2+2ab+b^2 \\ \end{align}
\begin{alignat}{2} f(x) & = (a+b)^2 \\ & = a^2+2ab+b^2 \\ \end{alignat}
\begin{array}{lcl} z & = & a \\ f(x,y,z) & = & x + y + z \end{array}
\begin{array}{lcr} z & = & a \\ f(x,y,z) & = & x + y + z \end{array}
\begin{cases} 3x + 5y + z \\ 7x - 2y + 4z \\ -6x + 3y + 2z \end{cases}
\begin{array}{|c|c|c|} a & b & S \\ \hline 0&0&1\\ 0&1&1\\ 1&0&1\\ 1&1&0\\ \end{array}
A \xleftarrow{n+\mu-1} B \xrightarrow[T]{n\pm i-1} C
\overbrace{ 1+2+\cdots+100 }^{5050}
\underbrace{ a+b+\cdots+z }_{26}
{}_pF_q\left({a_1, \ldots, a_p \atop b_1, \ldots, b_q}; z\right)</math>{{wikisourcehas|complementary help pages at|[[s:Help:Sheet music|Help:Sheet music]]}}
* [[Wikipedia:Lyrics and poetry]]
* [[Special:PagesWithProp/score]], pages where {{Tag|score}} is used, or [[:Category:Pages using the Score extension]]
Line 830 ⟶ 801:
* [[s:de:Benutzer:Sinuhe20/Spielwiese|Sinuhe20/Spielwiese]] presents dozens of helpful examples, even for those who cannot read the German headings.
* A collection demonstrating some advanced features of LilyPond are at [[User:Michael Bednarek/LilyPond]].
* The German Tutorial [[Wikiversity:de:Kurs:Lilypond für Wikis]] waiting to be translated into English.
**[https://de-m-wikiversity-org.translate.goog/wiki/Kurs:Lilypond_f%C3%BCr_Wikis?_x_tr_sl=de&_x_tr_tl=en&_x_tr_hl=de&_x_tr_pto=wapp Translated by Google]
 
== External links ==
* [http://www.lilypond.org/manuals.html LilyPond notation documentation]
* [https://lilypond.org/doc/v2.22/Documentation/notation-big-page.html Complete LilyPond v2.22.0 manual] {{dot}} [https://lilypond.org/doc/v2.22/Documentation/notation.pdf (in PDF)].
* [https://lilypond.org/snippets.html LilyPond code snippets]