Template:Tscore/sandbox
Appearance
This is the template sandbox page for Template:Tscore (diff). See also the companion subpage for test cases. |
This template uses Lua: |
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 namespace 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]- You may not use vertical lines
|
in music code when using this template; use {{!}} instead - 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)
- You may not use pairs of unseparated brackets:
{{
,}}
in Lilypond code; separate them with a space:{ {
,} }
. - 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).
- You should use the
\relative
Lilypond clause carefully; otherwise the results of merged music code may be shifted 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. - 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
}}
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
}}
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
}}
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
}}
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
}}
- 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
}}
- Note: different code for score on page #2: especially different base for
\relative