Template:Tscore

From Wikisource
Jump to navigation Jump to search
Template documentation[view] [edit] [history] [purge]

Twklstar.gif DRAFTTwklstar.gif

This template/module is under construction. It may be used for merging multiple parts of score-based music from Page namespace into a single music page in main namespane as well as for manual setting of staff width.

Usage[edit]

{{Tscore
 | start    = 
 | cont     = 
 | next     = 
 | score    = 
 | width    = 
 | debug    = 
 | layout   = 
 | lvarOne  = 
 | lvarTwo  = 
 | ...
 | svarOne  = 
 | svarTwo  = 
 | ...
}}

Parameters[edit]

  • start (optional): unique identifier for merging multiple pages with {{Tscore}} template, used on first page of music; if set, next also should be set.
  • cont (optional): same identifier as for start, used on subsequent pages.
  • next (optional): name of the next page in Page namespace that music from current page is continued on; the "Page:" prefix may be omitted. It is required if start is set.
  • score (required): score code; note that vertical lines | shold be replaced by {{!}}. Extra variables containing music (s-variables) or lyrics (l-variables) can be used as \sVariableName and \lVariableName; see below.
  • width {optional): staff line width (in milimeters); defaults to 180 as in standard <score>. Note, that for Page namespace width is now limited to 120.
  • layout {optional): extra layout settings for <score>; you may need to set indent = 0\cm here to avoid first line indentation that is default in Lilypond.
  • debug {optional): set it to 1 to dump the code provided to lilypond; used only for debugging
  • lvariable (where variable is an arbitrary sequence of letters) (optional): arbitrary variables used for merging multiple parts of lyrics across pages; values of the same lvariable are concatenated across subsequent pages, when generating music in main namespace. Number of variables is not limitted, The values must be set in all subsequent pages that are merged (even if empty on some of them)
  • svariable (where variable is an arbitrary sequence of letters) (optional): arbitrary variables used for merging multiple parts of music (notes) across pages; values of the same svariable are concatenated across subsequent pages, when generating music in main namespace. Number of variables is not limitted, The values must be set in all subsequent pages that are merged (even if empty on some of them)

Remarks[edit]

  1. You may not use vertical lines | in music code when using this template; use {{!}} instead
  2. You may not use other templates in music / lyrics code on all pages but first (wikicode of subsequent pages is parsed using LUA parser that may be mislead by such templates)
  3. You may not use pairs of unseparated brackets: {{, }} in Lilypond code; separate them with a space: { {, } }.
  4. When displaying in main (or another except Page) namespace, the whole (merged) music is displayed as it is on first page (the one with start parameter). Templates from subsequent pages displays as empty (this is similar to {{hws}} / {{hwe}} behaviour).
  5. You should use the \relative Lilypond clause carefully; otherwise the results of merged music code may be shofted of one or move octaves. The safast is to set the base for \relative on next page to the absolute value of last note at the previous page in each context (each svariable) or not use this clause at all.
  6. The midi music generation and vorbis player are always set on

Examples[edit]

Setting width[edit]

{{Tscore
|score = \new Staff { \time 4/4 \relative c { c4 d e f {{!}} g a b c {{!}} d e f g \bar "{{!}}." } }
|width = 60
}}

\paper { #(set-paper-size "a4") }
\header { tagline = ##f }
\version "2.22.0"
\score {
\midi { }
\layout { line-width = #60
}
\new Staff { \time 4/4 \relative c { c'4 d e f | g a b c | d e f g \bar "|." } } }

No first line indentation[edit]

{{Tscore
|score = \new Staff { \time 4/4 \relative c { c4 d e f {{!}} g a b c {{!}} d e f g \bar "{{!}}." } }
|layout = indent = 0\cm
}}

\paper { #(set-paper-size "a4") }
\header { tagline = ##f }
\version "2.22.0"
\score {
\midi { }
\layout { line-width = #180
indent = 0\cm}
\new Staff { \time 4/4 \relative c { c'4 d e f | g a b c | d e f g \bar "|." } } }

Using a variable[edit]

{{Tscore
|sThisIsMyVariable = c'4 d e f {{!}} g a b c {{!}} d e f g \bar "{{!}}."
|score = \new Staff { \time 4/4 \relative c \sThisIsMyVariable }
|layout = indent = 0\cm
}}

sThisIsMyVariable = { c'4 d e f | g a b c | d e f g \bar "|." }

\paper { #(set-paper-size "a4") }
\header { tagline = ##f }
\version "2.22.0"
\score {
\midi { }
\layout { line-width = #180
indent = 0\cm}
\new Staff { \time 4/4 \relative c \sThisIsMyVariable } }

More variables[edit]

{{Tscore
|sBeginning = c'4 d e f {{!}} g a b c {{!}}
|sVolta = d e f g
|sAltOne = a2 b
|sAltTwo = a,2 r
|sEnd = b4 c d r \bar "{{!}}."
|score = \new Staff { \time 4/4 \relative c { \sBeginning \repeat volta 2 \sVolta \alternative { \sAltOne \sAltTwo } \sEnd } }
|layout = indent = 0\cm
}}

sAltTwo = { a,2 r }

sAltOne = { a2 b }

sEnd = { b4 c d r \bar "|." }

sVolta = { d e f g }

sBeginning = { c'4 d e f | g a b c | }

\paper { #(set-paper-size "a4") }
\header { tagline = ##f }
\version "2.22.0"
\score {
\midi { }
\layout { line-width = #180
indent = 0\cm}
\new Staff { \time 4/4 \relative c { \sBeginning \repeat volta 2 \sVolta \alternative { \sAltOne \sAltTwo } \sEnd } } }

Merging[edit]

The following split code is equivalent to the above example:

  • page #1
{{Tscore
|start=SomeMergedMusic
|next=page #2
|sBeginning = c'4 d e f {{!}} g a b c {{!}}
|sVolta =
|sAltOne =
|sAltTwo =
|sEnd =
|score = \new Staff { \time 4/4 \relative c { \sBeginning \repeat volta 2 \sVolta \alternative { \sAltOne \sAltTwo } \sEnd } }
|layout = indent = 0\cm
}}

sAltTwo = {  }

sAltOne = {  }

sEnd = {  }

sVolta = {  }

sBeginning = { c'4 d e f | g a b c | }

\paper { #(set-paper-size "a4") }
\header { tagline = ##f }
\version "2.22.0"
\score {
\midi { }
\layout { line-width = #180
indent = 0\cm}
\new Staff { \time 4/4 \relative c { \sBeginning \repeat volta 2 \sVolta \alternative { \sAltOne \sAltTwo } \sEnd } } }


  • page #2
{{Tscore
|cont=SomeMergedMusic
|sBeginning =
|sVolta = d e f g
|sAltOne = a2 b
|sAltTwo = a,2 r
|sEnd = b4 c d r \bar "{{!}}."
|score = \new Staff { \time 4/4 \override Staff.TimeSignature #'transparent = ##t \relative c'' { \repeat volta 2 \sVolta \alternative { \sAltOne \sAltTwo } \sEnd } }
|layout = indent = 0\cm
}}

sAltTwo = { a,2 r }

sAltOne = { a2 b }

sEnd = { b4 c d r \bar "|." }

sVolta = { d e f g }

sBeginning = {  }

\paper { #(set-paper-size "a4") }
\header { tagline = ##f }
\version "2.22.0"
\score {
\midi { }
\layout { line-width = #180
indent = 0\cm}
\new Staff { \time 4/4 \override Staff.TimeSignature #'transparent = ##t \relative c'' { \repeat volta 2 \sVolta \alternative { \sAltOne \sAltTwo } \sEnd } } }
  • Note: different code for score on page #2: especially different base for \relative