Score examples: Difference between revisions

From ZMOG test wiki (master branch)
Jump to navigation Jump to search
No edit summary
No edit summary
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
Some Score examples, using SVG output.
== Testing ==
 
[[Raw score output]]
 
=== T289399 inline usage ===
 
[https://phabricator.wikimedia.org/T289399 T289399] allows for inline use, by rendering music in a <code><nowiki><span></nowiki></code> element instead of the usual <code><nowiki><div></nowiki></code>. So for example, this example from the [https://en.wikisource.org/wiki/Page:A_Dictionary_of_Music_and_Musicians_vol_2.djvu/695 cited page] on WikiSource <score inline> { \new Staff \with { \override StaffSymbol #'line-count = #1 } { \omit Score.TimeSignature \time 6/4 \omit Score.Clef { \override Stem.length-fraction = #0.4 b'2 r } } } </score> should now form part of the text flow.
 
Without specifying the <code>inline</code> parameter, Score displays in a div, as usual: <score> { \new Staff \with { \override StaffSymbol #'line-count = #1 } { \omit Score.TimeSignature \time 6/4  \omit Score.Clef { \override Stem.length-fraction = #0.4 b'2 r } } } </score>
 
With sound requested, inline <score sound="1" inline="1"> { \new Staff \with { \override StaffSymbol #'line-count = #1 } { \omit Score.TimeSignature \time 6/4 \omit Score.Clef { \override Stem.length-fraction = #0.4 b'2 r } } } </score> does not display audio controls, otherwise: <score sound="1"> { \new Staff \with { \override StaffSymbol #'line-count = #1 } { \omit Score.TimeSignature \time 6/4 \omit Score.Clef { \override Stem.length-fraction = #0.4 b'2 r } } } </score>
 
=== T60688 staff instrument name bug ===
 
Task [https://phabricator.wikimedia.org/T60688 T60688] staff with name "Clarinet" displays as "inet" instead of "Clarinet":
 
<score>
 
\new PianoStaff <<
  \set PianoStaff.instrumentName = #"Clarinet"
  \context Staff = "up" { c'1 }
  \context Staff = "down" { \clef bass c1 }
>>
 
</score>
 
Conclusion: cannot reproduce with Lilypond 2.23.82 and Score from recent master using SVG output (see [[Special:Version]]).
 
== Example Scores for SVG output ==


From [https://en.wikipedia.org/wiki/Cadence Cadence]:
From [https://en.wikipedia.org/wiki/Cadence Cadence]:
Line 5: Line 33:
<score lang="lilypond">
<score lang="lilypond">
   \new PianoStaff <<  
   \new PianoStaff <<  
       \new Staff <<
       \new Staff <<  
         \new Voice \relative c'' {
         \new Voice \relative c'' {
             \stemUp \clef treble \key e \minor \time 4/4
             \stemUp \clef treble \key e \minor \time 4/4
Line 16: Line 44:
             >>  
             >>  
     \new Staff <<
     \new Staff <<
         \new Voice \relative c' {
         \new Voice \relative c' {  
             \stemUp \clef bass \key e \minor \time 4/4
             \stemUp \clef bass \key e \minor \time 4/4
             \partial2 g8 a b4 c b cis b8 a! gis1
             \partial2 g8 a b4 c b cis b8 a! gis1
Line 40: Line 68:
     c'1 as2 bes2 c2 c2 es2 d2 c1 es1 f2 es2
     c'1 as2 bes2 c2 c2 es2 d2 c1 es1 f2 es2
     d2 c2 c2 bes2 c1 c1 f2 d2 es2 g2 f2 es2 f1
     d2 c2 c2 bes2 c1 c1 f2 d2 es2 g2 f2 es2 f1
     f1 bes,2 c2 d2 es2 f2 d2 c1 c1 bes2 as2 bes2 g2
     f1 bes,2 c2 d2 es2 f2 d2 c1 c1 bes2 as2 bes2 g2
     as2 bes2 g1 f1 as2 bes2 c2 as2 bes2 g2 f1
     as2 bes2 g1 f1 as2 bes2 c2 as2 bes2 g2 f1
}
}
Line 50: Line 78:
     }
     }
}</score>
}</score>
== Testing raw input ==
;Note: this requires safe mode to be disabled.
From [https://en.wikipedia.org/wiki/Keyboard_Sonata,_K._141_(Scarlatti) Keyboard Sonata, K. 141 (Scarlatti)], testing raw=1:
<score raw="1">
\version "2.18.2"
\header {
  tagline = ##f
}
% thèmes
temaRep = { \repeat unfold 6 { d16 } \repeat unfold 6 { f } \repeat unfold 6 { e } \repeat unfold 6 { d } \repeat unfold 6 { e } \repeat unfold 6 { a }
  % ms. 7
  d16 bes a g f e | f g a d, e cis }
temaBass = { < d g a d >8 r8 r8 | q r8 r8 | < a' cis e a >8 r8 r8 | < bes cis d g >8 r8 r8 | < a d e a >8 r8 r8 |
  % ms. 6
  < f a d >8 r8 r8 | < g bes d g >8 r8 r8 | < a d f >4 < a e' g >8 }
temaBassG = { < d g a d >8 r8 r8 | q r8 r8 | < a' d e a >8 r8 r8 | < bes d g >8 r8 r8 | < a d e a >8 r8 r8 |
  % ms. 6
  < f a d >8 r8 r8 | < g bes d g >8 r8 r8 | < a d f >4 < a e' g >8 }
% petites notes
trillD = { \tag #'print { d8.\trill } \tag #'midi { e32 d e d~ d } }
trillG = { \tag #'print { g8.\trill } \tag #'midi { a32 g a g~ g } }
upper = \relative c'' {
  \clef treble
  \key d \minor
  \time 3/8
  \tempo 4. = 80
  % \tempo 8 = 210
  \set Staff.midiInstrument = #"harpsichord"
  s8*0^"Allegro" \temaRep | d16 bes a g f e { \relative c' \temaRep } | d4. | \repeat unfold 2 { a''4.~ | a16 e cis a g' e } |
  % ms. 23
  a4. | bes16 g d bes g bes | g'4. | a16 f c a f a |
  % ms. 27
  f'4. | g16 e c g e g | e'4. | f16 d a f d f | f' e d c bes a |
  % ms. 32
  bes'16 a g f e d | \repeat unfold 2 { cis16 d \trillD cis32 d | e f g16 \trillG f32 g } |
  % ms. 37
  a16 e cis a e cis | \change Staff = "lower" a16 e cis a e cis | \tempo 8 = 130  a4.
}
lower = \relative c {
  \clef bass
  \key d \minor
  \time 3/8
  \set Staff.midiInstrument = #"harpsichord"
    % **************************************
    \temaBass | << { d8 } \\ { d,4 s8 } >>
    \relative c, \temaBassG < d, d' >4.
    % ms. 19
    \repeat unfold 2 { a'''16 f d a f d | a4. }
    a''16 f d a f d | g,4.
    g''16 e c g e c | f,4.
    f''16 d bes f d bes | e,4.
    e''16 cis a e cis a | d,4.
    << { d''4. | \repeat unfold 5 { g4. } a8 } \\ { d,,8 e f | g a bes | \repeat unfold 4 { a8 bes4 } a8 } >>
    s4
    s4. | s4.
}
thePianoStaff = \new PianoStaff <<
    \set PianoStaff.instrumentName = #"Clav."
    \new Staff = "upper" \upper
    \new Staff = "lower" \lower
  >>
\score {
  \keepWithTag #'print \thePianoStaff
  \layout {
      #(layout-set-staff-size 17)
    \context {
      \Score
    \override SpacingSpanner.common-shortest-duration = #(ly:make-moment 1/2)
      \remove "Metronome_mark_engraver"
    }
  }
}
\score {
  \keepWithTag #'midi \thePianoStaff
  \midi { }
}
</score>
== Multi-page output ==
Mozart's Alla turca, from Mutopia (raw=1)
<score raw="1">
\version "2.23.14"
\header {
  title = "Rondo Alla Turca"
  subtitle = "Turkish March"
  composer = "W. A. Mozart"
  piece = "Allegretto"
  mutopiatitle = "Sonate Opus KV 331 - Rondo Alla Turca"
  mutopiacomposer = "MozartWA"
  mutopiainstrument = "Piano"
  mutopiaopus = "KV 331"
  style = "Classical"
  license = "Public Domain"
  source = "IMSLP"
  maintainer = "Rune Zedeler and Chris Sawer"
  maintainerEmail = "chris@mutopiaproject.org"
footer = "Mutopia-2015/08/13-108"
copyright =  \markup { \override #'(baseline-skip . 0 ) \right-column { \sans \bold \with-url "http://www.MutopiaProject.org" { \abs-fontsize #9  "Mutopia " \concat { \abs-fontsize #12 \with-color #white \char ##x01C0 \abs-fontsize #9 "Project " } } } \override #'(baseline-skip . 0 ) \center-column { \abs-fontsize #11.9 \with-color #grey \bold { \char ##x01C0 \char ##x01C0 } } \override #'(baseline-skip . 0 ) \column { \abs-fontsize #8 \sans \concat { " Typeset using " \with-url "http://www.lilypond.org" "LilyPond" " by " \maintainer " " \char ##x2014 " " \footer } \concat { \concat { \abs-fontsize #8 \sans{ " Placed in the " \with-url "http://creativecommons.org/licenses/publicdomain" "public domain" " by the typesetter " \char ##x2014 " free to distribute, modify, and perform" } } \abs-fontsize #13 \with-color #white \char ##x01C0 } } }
tagline = ##f
}
\include "deutsch.ly"
dynamics = {
  s4\p s2*4
  s2*3 s4 s4\mp s2*2
  s2*5 s4 s4\p
  s2*2 s2\cresc s8\fz s8\p s4 s2*2
  s2 s4 s8\f s8 s2*3
  s2*4 s4 s4\p
  s2*2 s2\< s2\>
  s2\! s2*2 s4 s4\f
  s2*5
  s2*2 s4 s4\p s2*2
  s2\< s4\! s4\cresc s2\> s2 s2\p
  s4 s4\f s2*4
  s2*3 s4 s4\p
  s2*5
  s2*2 s4 s4\mp s2*3
  s2*4 s4 s4\p s2
  s2 s2\cresc s8\fz s8\p s4 s2*3
  s4 s4\f s2*3
  s2*4
  s4 s2 s2\f s2 s2
  s2*3 s2\f s2
  s2*4
  s2\p s2*3
  s2*3 s2\f
  s2*5
  s2*3 s2\f s4 s4\ff s2
}
righta = \transpose c c'' {
  h,16-4( a, gis, a,-1 |
  c8)-.-3 r d16-3( c h, c |
  e8)-.-4 r f16-4( e dis e-1 |
  h-4 a gis a h a gis a |
  c'4)\accent a8-.-2 c'-.-4 |
  \grace { g!32[( a)] } h8-.-> <fis a>-.-2-4 <e g>-. <fis a>-. |
  \grace { g32[( a)] } h8-.-> <fis a>-.-2-4 <e g>-. <fis a>-. |
  \grace { g32[( a)] } h8-.-> <fis a>-.-4 <e g>-. <dis fis>-.-2-4 |
  e4--
}
rightaa = \transpose c c'' {
  h,16( a, gis, a, |
  c8)-. r d16( c h, c |
  e8)-. r f16( e dis e |
  h a gis a h a gis a |
  c'4*1/2) s8 a8-.-2 h-. |
  c'-.\accent h-. a-.-1  gis-.-2 a-. e-. f-.-4 d-.-2 |
  c4-- h,8.-2\trill( a,32 h, |
  a,4)--
}
rightb = \transpose c c'' {
  <c e>8[-.-1-3 <d! f!>-.] |
  <e g>-.-1-3 <e g>-. a16-4( g f e) |
  << { d4\accent-4 } \\ { h,8-2( g,) } >> <c e>8-. <d! f!>-. |
  <e g>-. <e g>-. a16-4( g f e) |
  <h, d>4\accent---2-4 <a, c>8-.-1-3 <h, d>-. |
  <c e>-.-1-3 <c e>-. f16-4( e d c) |
  << { h,4\accent-4 } \\ { gis,8-2( e,) } >> <a, c>8-. <h, d>-. |
  <c e>-. <c e>-. f16( e d c) |
  <gis, h,>4\accent---2-4
}
rightc = \relative c''' {
  <a a,>8-. <h h,>-. |
  <cis cis,>4\accent\tenuto <a a,>8-. <h h,>-. <cis cis,>-.\accent <h h,>-. <a a,>-. <gis gis,>-. |
  <fis fis,>-. <gis gis,>-. <a a,>-. <h h,>-. <gis gis,>-4( <e e,>)-. <a a,>8-. <h h,>-. |
  <cis cis,>4\accent\tenuto <a a,>8-. <h h,>-. <cis cis,>-.\accent <h h,>-. <a a,>-. <gis gis,>-. |
  <fis fis,>-. <h h,>-. <gis gis,>-. <e e,>-. |
  <a a,>4\tenuto
}
rightco = \relative c'' {
  a16( a' h, h' |
  cis,\accent cis') r8 a,16( a' h, h' cis, cis' h, h' a, a' gis, gis') |
  fis,( fis' gis, gis' a, a' h, h' gis, gis' e, e') a,16( a' h, h' |
  cis,\accent cis') r8 a,16( a' h, h' cis, cis' h, h' a, a' gis, gis') |
  fis,( fis' h, h' gis, gis' e, e'
}
rightcoa = \transpose c c' {
  <a a'>4)
}
rightcoat = \transpose c c' {
  <a a'>4\tenuto )
  << { cis''8. cis''16 } \\ { cis'4 } >>
}
rightd = \relative c''' {
  cis16-3( d cis h a h a gis-3 fis a gis fis |
  eis fis gis eis cis-2 dis eis cis |
  fis-4 eis-1 fis gis a gis a-1 h |
  cis his cis his cis d cis h) |
  a( h a gis-3 fis a gis fis |
  e! fis gis e cis-2 dis e cis |
  dis-3 e fis dis his-1 cis dis his |
  cis4--)
}
righte = \relative c''' {
  e,16-5( d! cis h! |
  a h cis d-1 e fis gis a) |
  a\accent-4( gis fis e) e-5( d cis h |
  a-1 h cis d-1 e fis gis a) |
  ais8\accent-3( h-.-4) e,16-5( d cis h |
  a h cis d-1 e fis gis a) |
  a\accent-4( gis fis e) e-4( d cis h |
  cis-3 e a,-1 cis-4 h d gis,-2 h-4 |
  a4)-- cis'16( d cis h a h a gis fis a gis fis |
  eis fis gis eis cis dis eis cis) |
  fis( eis fis gis a gis a h |
  cis-3 his cis his cis his cis ais-2 |
  d)-4( cis d cis d cis d cis |
  d cis h a gis-2 a h gis |
  a h cis fis,-2 eis fis gis eis fis4)--
}
strum = \transpose c c { <<
  { cis'2\accent } \\
  { <cis e a>4\arpeggio }
>>
}
rightf = \transpose c c'' {
  << \strum \\ { s4 } >> |
  \strum |
  d'16-4( cis')-. h-. cis'-. d'( cis')-. h-. cis' |
  <d' a fis>2\accent |
  \repeat unfold 4 { \grace d'8( <cis' a e>8)-. } |
  << { h4.-3( e'8)-. } \\ { <gis e>2 } >> |
  << \strum \\ s4 >> |
  \strum |
  d'16( cis')-. h-. cis'-. d'( cis')-. h-. cis' |
  <d' a fis>2\accent |
  \grace d'8( <cis' a e>2)-. |
  \repeat unfold 4 { \grace cis'8( <h gis e>8)-. } |
  a4-- \grace { e32[( a)] } cis'8.-.-4 cis'16 |
  \repeat unfold 2 { \grace { e32[( a)] } cis'2\accent } |
  d'16( cis')-. h-. cis'-. d'( cis')-. h-. cis' |
  d'2\accent |
  \repeat unfold 4 { \grace { d'8( } cis'8)-. } |
  h4.-2( e'8)-. |
  << \strum \\ s4 >> |
  \strum |
  d'16( cis')-. h-. cis'-. d'( cis')-. h-. cis' |
  <d' a fis>2\accent |
  \grace { d'8( } <cis' a e>2)-. |
  \repeat unfold 4 { \grace { cis'8( } <h gis e>8)-. } |
  <a, cis e a-->4. <cis cis'>8-. |
  <a, a-->4. <e e'>8-. |
  <a, a-->4. <cis cis'>8-. |
  <a, a>-. <cis cis'>8-. <a, a>-. <e e'>8-. |
  <a, a>4-. <a, cis e a >4-.( |
  <a, cis e a >4)-. r4
}
lefta = {
  r4 |
  a8(-5 <c' e'>)-. <c' e'>-. <c' e'>-. |
  a8( <c' e'>)-. <c' e'>-. <c' e'>-. |
  a8-. <c' e'>-. a8-. <c' e'>-. |
  a8( <c' e'>)-. <c' e'>-. <c' e'>-. |
  e-.-> <h e'>-. <h e'>-. <h e'>-. |
  e-.-> <h e'>-. <h e'>-. <h e'>-. |
  e-.-> <h e'>-. h,-. h-. |
  e4--
}
leftaa = {
  r4 |
  a8( <c' e'>)-. <c' e'>-. <c' e'>-. |
  a8( <c' e'>)-. <c' e'>-. <c' e'>-. |
  a8-. <c' e'>-. a8-. <c' e'>-. |
  f8( <a dis'>)-. <a dis'>-. <a dis'>-. |
  e-. <a e'>-.  d!-. <f h>-. |
  c-. <e a>-. d-. <f h>-. |
  <e a>-.-4-1 <e a>-. <e gis>-.-4-2 <e gis>-. |
  <a, a>4--
}
leftb = {
  \repeat unfold 2 { r4 | c8-. c'-. e-. e'-. | g4 }
  \repeat unfold 2 { r4 | a,8-. a-. c-. c'-. | e4 }
}
stra = {
  \grace { a,32[( cis  e)] }
  a8-.-> a-.
}
strd = {
  \grace { d,32[( fis,  a,)] }
  d8-.-> d-.
}
strdis = {
  \grace { dis,32[( fis,  a,)] }
  dis8-.-> dis-.
}
stre = {
  \grace { e,32[( gis,  h,)] }
e8-.-> e-.
}
stral = { \stra a8-. a-. }
strdl = { \strd d8-. d-. }
strel = { \stre e8-. e-. }
leftc = {
  r4 \stral \stral \strd \strdis \strel \stral \stral \strd \stre
}
leftd = \relative c {
  r4 |
  fis8-5( <a cis>)-. <a cis>-. <a cis>-. |
  gis8-4( <h cis>)-. <h cis>-. <h cis>-. |
  fis8( <a cis>)-. <a cis>-. <a cis>-. |
  eis8( <gis cis>)-. <gis cis>-. <gis cis>-. |
  fis8( <a cis>)-. <a cis>-. <a cis>-. |
  gis8( <cis e!>)-. <cis e>-. <cis e>-. |
  gis8( <dis' fis>)-. <dis fis>-. <dis fis>-. |
  <cis e>4--
}
lefte = \relative c' {
  r4 |
  a8( <cis e>)-. <cis e>-. <cis e>-. |
  h-. <d e>-. gis,-. <d' e>-. |
  a8( <cis e>)-. <cis e>-. <cis e>-. |
  e,8( <gis d'>)-. <gis d'>-. <gis d'>-. |
  a8( <cis e>)-. <cis e>-. <cis e>-. |
  h-. <d e>-. gis,-. <d' e>-. |
  a-.-1 fis-.-2 d-. e-. a,-. a'-. r4 |
  fis8( <a cis>)-. <a cis>-. <a cis>-. |
  gis8( <h cis>)-. <h cis>-. <h cis>-. |
  fis8( <a cis>)-. <a cis>-. <a cis>-. |
  cis,( <gis' cis>)-. <g cis>-. <fis cis'>-. |
  h,8( <fis' h>)-. <fis h>-. <fis h>-. |
  h,8( <gis'! h>)-. <gis h>-. <gis h>-. |
  cis,-. <fis a>-. cis-. <gis' h>-. <fis a>4--
}
leftf = {
  \stral \stral \stral \strdl \stral \strel \stral \stral \stral \strdl \stral \strel
  a16( e' cis' e' a e' cis'  e')
  \repeat unfold 6 { a16 e' cis' e' }
  \repeat unfold 2 { a16 fis' d' fis' }
  \repeat unfold 2 { a16 e' cis' e' }
  \repeat unfold 2 { e16 e' gis e' }
  \stral \stral \stral \strdl \stral \strel \stral \stral \stral \stra \stra
  a,4-. <a, cis e a  >-.( < a, cis e a >)-. r4
}
right = {
  \clef G
  \key a \minor
  \partial 4
  \repeat volta 2 { \righta }
  \repeat volta 2 { \rightb \rightaa }
  \key a \major
  \repeat volta 2 { \rightc }
  \repeat volta 2 { \rightd }
  \repeat volta 2 { \righte }
  \repeat volta 2 { \rightc }
  \key a \minor
  \repeat volta 2 { \righta }
  \repeat volta 2 { \rightb \rightaa }
  \key a \major
  % These repeat commands form a manual volta+alternative set for the
  % purpose of fixing a warning regarding an inability to end a volta
  % spanner. One other way to fix this is to have the alternative
  % clause encompass the entire 2nd alternative which has the
  % consequence of extending the volta line to the end of the
  % piece. (I tried shortening the line which worked but still gave
  % the warning.)
  \set Score.repeatCommands = #'(start-repeat)
  \rightco
  \set Timing.measureLength = #(ly:make-moment 1/4)
  \set Score.repeatCommands = #'((volta "1"))
  \rightcoa
  \set Score.repeatCommands = #'((volta #f) (volta "2") end-repeat)
  \set Timing.measureLength = #(ly:make-moment 2/4)
  \once\override Slur.positions = #'(4 . 4)
  \hideNotes \grace a'16.^( \unHideNotes
  \rightcoat
  \set Score.repeatCommands = #'((volta #f))
  \barNumberCheck #98
  \rightf
  \bar "|."
}
left = {
  \clef F
  \partial 4
  \repeat volta 2 { \lefta }
  \repeat volta 2 { \leftb \leftaa }
  \key a \major
  \repeat volta 2 { \leftc a,4^\tenuto }
  \repeat volta 2 { \leftd }
  \repeat volta 2 { \lefte }
  \repeat volta 2 { \leftc a,4^\tenuto }
  \key a \minor
  \repeat volta 2 { \lefta }
  \repeat volta 2 { \leftb \leftaa }
  \key a \major
  \leftc
  \set Timing.measureLength = #(ly:make-moment 1/4)
  a,4
  \set Timing.measureLength = #(ly:make-moment 2/4)
  \stra a8-. a8-.
  \leftf
  \bar "|."
}
\score {
  \new PianoStaff
  <<
    \new Staff {
      \time 2/4
      \right
    }
    \new Dynamics {
      \override DynamicTextSpanner.style = #'none
      \dynamics
    }
    \new Staff {
      \left
    }
  >>
  \layout {}
  \midi {}
}
</score>


== Note ==
== Note ==


* For scores on Wikipedia, see [https://en.wikipedia.org/wiki/Special:PagesWithProp?propname=score Special:PagesWithProp]
* For scores on Wikipedia, see [https://en.wikipedia.org/wiki/Special:PagesWithProp?propname=score Special:PagesWithProp]

Latest revision as of 21:54, 3 December 2026

Testing

Raw score output

T289399 inline usage

T289399 allows for inline use, by rendering music in a <span> element instead of the usual <div>. So for example, this example from the cited page on WikiSource segment of music notation generated by Score should now form part of the text flow.

Without specifying the inline parameter, Score displays in a div, as usual:

segment of music notation generated by Score

With sound requested, inline segment of music notation generated by Score does not display audio controls, otherwise:

segment of music notation generated by Score

T60688 staff instrument name bug

Task T60688 staff with name "Clarinet" displays as "inet" instead of "Clarinet":

segment of music notation generated by Score

Conclusion: cannot reproduce with Lilypond 2.23.82 and Score from recent master using SVG output (see Special:Version).

Example Scores for SVG output

From Cadence:

segment of music notation generated by Score

Multi-system input

From String Quartet No. 1 (Górecki)

segment of music notation generated by Score

Note