From c2d44e3a71b2d031305abede97a53f6e5fcf832b Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sun, 1 Aug 2004 11:04:13 +0000 Subject: [PATCH] input/test fixes --- ChangeLog | 63 ++ Documentation/topdocs/NEWS.texi | 11 + Documentation/user/changing-defaults.itely | 127 +++ Documentation/user/notation.itely | 770 +++++++++++++++--- .../user/programming-interface.itely | 4 +- .../beam-dir-functions.ly | 2 +- .../lyric-hyphen-retain.ly | 0 input/{test => regression}/markup-score.ly | 0 input/{test => regression}/no-staff.ly | 0 input/regression/repeat-unfold-all.ly | 16 +- input/regression/trill-spanner.ly | 12 + input/test/chord-names-no-inversions.ly | 20 - input/test/crescendi.ly | 23 - input/test/feathered-beam.ly | 26 - input/test/figured-bass-alternate.ly | 25 - input/test/gourlay.ly | 22 - input/test/gregorian-scripts.ly | 1 - input/test/harmonic.ly | 18 - input/test/hshift.ly | 24 - input/test/improv.ly | 51 -- input/test/ligature-vaticana.ly | 2 +- input/test/lyrics-melisma-faster.ly | 33 - input/test/lyrics-melisma-variants.ly | 57 -- input/test/move-accidentals.ly | 39 - input/test/polymetric-differing-notes.ly | 54 -- input/test/polymetric.ly | 49 -- input/test/repeat-shorter-bracket.ly | 42 - input/test/repeat.ly | 31 - input/test/scheme-interactions.ly | 27 - input/test/script-priority.ly | 29 - input/test/script-stack.ly | 15 - input/test/separate-staccato.ly | 22 - input/test/spanner-after-break-tweak.ly | 30 - input/test/stem-length.ly | 15 - input/test/tie-cross-voice.ly | 21 - input/test/time-signature-double.ly | 35 - input/test/time.ly | 188 ----- input/test/timing.ly | 33 - input/test/trill.ly | 30 - input/test/unfold-all-repeats.ly | 28 - lily/dynamic-text-spanner.cc | 2 +- lily/score.cc | 6 +- lily/time-signature.cc | 21 +- lily/timing-engraver.cc | 2 +- lily/trill-spanner-engraver.cc | 157 ++++ ly/engraver-init.ly | 1 + ly/music-functions-init.ly | 9 + ly/property-init.ly | 12 + ly/spanners-init.ly | 7 +- scm/define-grobs.scm | 12 + scm/define-markup-commands.scm | 18 +- scm/define-music-types.scm | 47 +- scm/document-backend.scm | 8 +- scm/lily.scm | 2 + 54 files changed, 1114 insertions(+), 1185 deletions(-) rename input/{test => regression}/beam-dir-functions.ly (99%) rename input/{test => regression}/lyric-hyphen-retain.ly (100%) rename input/{test => regression}/markup-score.ly (100%) rename input/{test => regression}/no-staff.ly (100%) create mode 100644 input/regression/trill-spanner.ly delete mode 100644 input/test/chord-names-no-inversions.ly delete mode 100644 input/test/crescendi.ly delete mode 100644 input/test/feathered-beam.ly delete mode 100644 input/test/figured-bass-alternate.ly delete mode 100644 input/test/gourlay.ly delete mode 100644 input/test/harmonic.ly delete mode 100644 input/test/hshift.ly delete mode 100644 input/test/improv.ly delete mode 100644 input/test/lyrics-melisma-faster.ly delete mode 100644 input/test/lyrics-melisma-variants.ly delete mode 100644 input/test/move-accidentals.ly delete mode 100644 input/test/polymetric-differing-notes.ly delete mode 100644 input/test/polymetric.ly delete mode 100644 input/test/repeat-shorter-bracket.ly delete mode 100644 input/test/repeat.ly delete mode 100644 input/test/scheme-interactions.ly delete mode 100644 input/test/script-priority.ly delete mode 100644 input/test/script-stack.ly delete mode 100644 input/test/separate-staccato.ly delete mode 100644 input/test/spanner-after-break-tweak.ly delete mode 100644 input/test/stem-length.ly delete mode 100644 input/test/tie-cross-voice.ly delete mode 100644 input/test/time-signature-double.ly delete mode 100644 input/test/time.ly delete mode 100644 input/test/timing.ly delete mode 100644 input/test/trill.ly delete mode 100644 input/test/unfold-all-repeats.ly create mode 100644 lily/trill-spanner-engraver.cc diff --git a/ChangeLog b/ChangeLog index 1469d5a4a2..6928db16e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,69 @@ 2004-08-01 Han-Wen Nienhuys + * input/regression/beam-dir-functions.ly: move from test/ + + * Documentation/user/notation.itely (Feathered beams): new node. + + * Documentation/user/changing-defaults.itely (Difficult tweaks): + new node + + * input/regression/lyric-hyphen-retain.ly: move to regression. + + * input/regression/harmonic.ly: fold into manual + + * input/test/{hshift,move-accidentals,crescendi,feathered-beam, + stem-length,chord-names-no-inversions}.ly: remove + + * input/test/tie-cross-voice.ly: move to regression. + + * Documentation/user/notation.itely (Running trills): new node. + + * scm/define-grobs.scm (all-grob-descriptions): new grob TrillSpanner + + * scm/define-music-types.scm (music-descriptions): add TrillSpanEvent + + * lily/trill-spanner-engraver.cc: new file. + + * input/regression/trill-spanner.ly: new file. + + * input/test/timing.ly: fold into manual. + + * input/test/time.ly: remove + + * input/test/trill.ly: remove + + * input/test/time-signature-double.ly: fold into manual + + * input/test/separate-staccato.ly: remove + + * input/test/spanner-after-break-tweak.ly: fold into manual. + + * input/test/script-priority.ly: fold into manual. + + * input/test/scheme-interactions.ly: remove. + + * input/test/unfold-all-repeats.ly (mel), + input/test/repeat.ly,input/test/repeat-shorter-bracket.ly, + input/test/polymetric-differing-notes.ly input/test/polymetric.ly: + fold into manual. + + * input/regression/no-staff.ly: move from input/test/ + + * input/regression/markup-score.ly: move from input/test/ + + * input/test/lyrics-melisma-faster.ly: fold into manual + + * input/test/lyrics-melisma-variants.ly: fold into manual + + * Documentation/user/notation.itely (Popular music): new node. + + * input/test/gourlay.ly: remove + + * input/test/improv.ly: fold into manual. + + * input/test/figured-bass-alternate.ly (fl): remove + * lily/dynamic-text-spanner.cc (print): new file. * scm/define-grobs.scm (all-grob-descriptions): add DynamicTextSpanner diff --git a/Documentation/topdocs/NEWS.texi b/Documentation/topdocs/NEWS.texi index 3725900b0c..a02d93777b 100644 --- a/Documentation/topdocs/NEWS.texi +++ b/Documentation/topdocs/NEWS.texi @@ -7,6 +7,17 @@ @unnumbered New features in 2.3 since 2.2 @itemize @bullet + +@item Running trills now have their own spanner and event. They are +started and stopped with +@example + @var{note}\startTrillSpan + @var{note}\stopTrillSpan +@end example + +@item There is a new markup commands @code{\postscript} that takes a +string that is dumped as verbatim postscript. + @item The melody for a @code{\lyricsto} text can be changed during a melody by setting the @code{associatedVoice} property. diff --git a/Documentation/user/changing-defaults.itely b/Documentation/user/changing-defaults.itely index 5aa5be1ef5..710a996f1c 100644 --- a/Documentation/user/changing-defaults.itely +++ b/Documentation/user/changing-defaults.itely @@ -451,6 +451,10 @@ arts = { s4-. s4-> } >> @end lilypond +With this mechanism, it is possible to define an Urtext (original +edition), with the option put several distinct articulations on the +same notes. + @cindex @code{\context} @cindex creating contexts @@ -1053,6 +1057,7 @@ layout property name: * Navigating the program reference:: * Layout interfaces:: * Determining the grob property:: +* Difficult tweaks:: @end menu @@ -1430,6 +1435,107 @@ also be deduced from the program reference, for the page for the Fingering_engraver is part of contexts: @dots{} @b{@internalsref{Voice}} @end quotation +@node Difficult tweaks +@subsection Difficult tweaks + +There are two classes of difficult adjustments. First, when there are +several of the same objects at one point, and you want to adjust only +one. For example, if you want to change only one note head in a chord. + +In this case, the @code{\applyoutput} function must be used. The +next example defines a Scheme function @code{set-position-font-size} +that sets the @code{font-size} property, but only +on objects that have @internalsref{note-head-interface} and are at the +right Y-position. + +@lilypond[verbatim] +#(define ((set-position-font-size pos size) grob origin current) + (let* + ((interfaces (ly:grob-property grob 'interfaces)) + (position (ly:grob-property grob 'staff-position))) + (if (and + + ; is this a note head? + (memq 'note-head-interface interfaces) + + ; is the Y coordinate right? + (= pos position)) + + ; then do it. + (set! (ly:grob-property grob 'font-size) size)))) + +\relative { + c + \applyoutput #(set-position-font-size -2 4) + +} +@end lilypond + +@noindent +A similar technique can be used for accidentals. In that case, the +function should check for @code{accidental-interface}. + +Another difficult adjustment is the appearance of spanner objects, +such as slur and tie. Initially, only one of these objects is created, +and they can be adjust with the normal mechanism. However, in some +cases the spanners cross line breaks. If this happens, these objects +are cloned. A separate object is created for every system that it is +in. These are clones of the original object and inherit all +properties, including @code{\override}s. + +In other words, an @code{\override} always affects all pieces of a +broken spanner. To change only one part of a spanner at a line break, +it is necessary to hook into the formatting process. The +@code{after-line-breaking-callback} property contains the Scheme procedure +that is called after line breaks have been determined, and layout +objects have been split over different systems. + +In the following example, we define a procedure +@code{my-callback}. This procedure + +@itemize @bullet +@item +determines if we have been split across line breaks +@item +if yes, retrieves all the split objects +@item +checks if we are the last of the split objects +@item +if yes, it sets @code{extra-offset}. +@end itemize + +This procedure is installed into @internalsref{Tie}, so the last part +of broken tie is translated up. + + +@lilypond[verbatim,raggedright] +#(define (my-callback grob) + (let* ( + + ; have we been split? + (orig (ly:grob-original grob)) + + ; if yes, get the split pieces (our siblings) + (siblings (if (ly:grob? orig) (ly:spanner-broken-into orig) '() ))) + + + (if (and (>= (length siblings) 2) + (eq? (car (last-pair siblings)) grob)) + (ly:grob-set-property! grob 'extra-offset '(-2 . 5)) + ))) + +\relative c'' { + \override Tie #'after-line-breaking-callback = + #my-callback + c1 ~ \break c2 ~ c +} +@end lilypond + + +When applying this trick, the new @code{after-line-breaking-callback} +should also call the old @code{after-line-breaking-callback}, if there +is one. For example, if using this with @code{Slur}, +@code{Slur::after_line_breaking} should also be called. @node Fonts @section Fonts @@ -1651,6 +1757,7 @@ be moved with layout properties such as @code{padding} and + @seealso Init files: @file{scm/new-markup.scm}. @@ -1672,6 +1779,7 @@ for formatting. @menu * Text encoding:: +* Nested scores:: * Overview of text markup commands:: @end menu @@ -1710,6 +1818,25 @@ are passed to the output back-end verbatim. @cindex @TeX{} commands in strings +@node Nested scores +@subsection Nested scores + +It is possible to nest music inside markups, by adding a @code{\score} +block to markup expression. Such a score must contain a @code{\paper} +block. + +@lilypond[verbatim,raggedright] +\relative { + c4 d^\markup { + \score { + \relative { c4 d e f } + \paper { } + } + } + e f +} +@end lilypond + @node Overview of text markup commands diff --git a/Documentation/user/notation.itely b/Documentation/user/notation.itely index b8315699f9..08d601bcc1 100644 --- a/Documentation/user/notation.itely +++ b/Documentation/user/notation.itely @@ -24,8 +24,9 @@ somewhat familiar with LilyPond. * Rhythmic music:: * Piano music:: * Vocal music:: +* Other instrument specific notation:: * Tablatures:: -* Chord names:: +* Popular music:: * Orchestral music:: * Formatting cue notes:: * Ancient notation:: @@ -786,6 +787,7 @@ such as keys, clefs and time signatures. * Partial measures:: * Unmetered music:: * Bar lines:: +* Time administration:: * Controlling formatting of prefatory matter:: @end menu @@ -1013,6 +1015,9 @@ Examples: @inputfileref{input/regression,ottava.ly}, @code{set-octavation} will get confused when clef changes happen during an octavation bracket. + + + @node Time signature @subsection Time signature @cindex Time signature @@ -1032,8 +1037,20 @@ command The symbol that is printed can be customized with the @code{style} property. Setting it to @code{#'()} uses fraction style for 4/4 and -2/2 time. There are many more options for its layout. See -@inputfileref{input/test,time.ly} for more examples. +2/2 time, + +@lilypond[fragment,verbatim] +\time 4/4 c'1 +\time 2/2 c'1 +\override TimeSignature #'style = #'() +\time 4/4 c'1 +\time 2/2 c'1 +@end lilypond + + + +There are many more options for its layout. See @ref{Ancient time +signatures} for more examples. This command sets the property @code{timeSignatureFraction}, @@ -1229,6 +1246,49 @@ in every context, and that type is determined by the property Examples: @inputfileref{input/test,bar-lines.ly}, + +@node Time administration +@subsection Time administration + +Time is administered by the @internalsref{Time_signature_engraver}, +which usually lives in the @internalsref{Score} context. +The bookkeeping deals with the following variables + +@table @code +@item currentBarNumber + the measure number +@item measureLength + the length of the measures in the current time signature. For a 4/4 + time this is 1, and for 6/8 it is 3/4. +@item measurePosition + the point within the measure where we currently are. This quantity + is reset to 0 whenever it exceeds @code{measureLength}. When that happens, + @code{currentBarNumber} is incremented. +@item timing + if set to true, the above variables are updated for every time + step. When set to false, the engraver stays in the current measure + indefinitely. +@end table + +Timing can be changed by setting any of these variables explicitly. +In the next example, the 4/4 time signature is printed, but +@code{measureLength} is set to 5/4. After a while, the measure is +shortened by 1/8, by setting @code{measurePosition} to -3/8 at 2/4 in +the measure, so the next bar line will fall at 2/4 + 3/8. + +@lilypond[verbatim] +{ + \set Score.measureLength = #(ly:make-moment 5 4) + c1 c4 + c1 c4 + c4 c4 + \set Score.measurePosition = #(ly:make-moment -3 8) + b8 b b + c4 c1 +} +@end lilypond + + @node Controlling formatting of prefatory matter @subsection Controlling formatting of prefatory matter @@ -1807,6 +1867,7 @@ possible. * Text spanners:: * Analysis brackets:: * Articulations:: +* Running trills:: * Fingering instructions:: * Text scripts:: * Grace notes:: @@ -2095,6 +2156,29 @@ c\fermata c^\fermata c_\fermata @lilypondfile[quote,raggedright]{script-chart.ly} + +The vertical ordering of scripts is controlled with the +@code{script-priority} property. The lower this number, the closer it +will be put to the note. In this example, the +@internalsref{TextScript} (the sharp symbol) first has the lowest +priority, so it is put lowest in the first example. In the second, the +prall trill (the @internalsref{Script}) has the lowest, so it on the +inside. When two objects have the same priority, the order in which +they are entered decides which one comes first. + + +@lilypond[verbatim] +\relative g''{ + \once \override TextScript #'script-priority = #-100 + a4^\prall^\markup { \sharp } + + \once \override Script #'script-priority = #-100 + a4^\prall^\markup { \sharp } +} +@end lilypond + + + @refcommands @cindex @code{\scriptUp} @@ -2114,6 +2198,33 @@ These note ornaments appear in the printed output but have no effect on the MIDI rendering of the music. + +@node Running trills +@subsection Running trills + +Long running trills are made with @code{\startTrillSpan} and +@code{\stopTrillSpan}, + + +@lilypond[verbatim] +\relative \new Voice { + << { c1 \startTrillSpan } + { s2. \grace { d16[\stopTrillSpan e] } } >> + c4 } +@end lilypond + +@refcommands + +@code{\startTrillSpan}, +@cindex @code{\startTrillSpan} +@code{\stopTrillSpan}. +@cindex @code{\stopTrillSpan} + +@seealso + +Program reference: @internalsref{TrillSpanner}, +@internalsref{TrillSpanEvent}. + @node Fingering instructions @subsection Fingering instructions @@ -2607,6 +2718,23 @@ staff. This can be adjusted by setting the @code{voltaOnThisStaff} property @inputfileref{input/regression,volta-multi-staff.ly}, @inputfileref{input/regression,volta-chord-names.ly} +It is possible to shorten volta brackets +by setting @code{voltaSpannerDuration}. In the next example, the +bracket only lasts one measure, which is a duration of 3/4. + + + +@lilypond[verbatim,raggedright] +\relative c''{ + \time 3/4 + c c c + \set Staff.voltaSpannerDuration = #(ly:make-moment 3 4) + \repeat "volta" 5 { d d d } + \alternative { { e e e f f f } + { g g g } } +} +@end lilypond + @refbugs A nested repeat like @@ -2639,10 +2767,38 @@ example by setting @code{Score.measurePosition} or entering @cindex expanding repeats -For instructions on how to expand repeats for MIDI output, see the -example file @inputfileref{input/test,unfold-all-repeats.ly}. +An advantage of the unified syntax for repeats, is that all repeats +may be played out for the MIDI output. This is achieved by +applying the @code{\unfoldrepeats} music function. + +@lilypond[verbatim,raggedright] +\new Staff + \unfoldrepeats { + \repeat tremolo 8 {c'32 e' } + \repeat percent 2 { c''8 d'' } + \repeat volta 2 {c'4 d' e' f'} + \alternative { + { g' a' a' g' } + {f' e' d' c' } + } + \bar "|." + } +@end lilypond +When creating a score file using @code{\unfoldrepeats} for midi, then +it is necessary to make two @code{\score} blocks. One for MIDI, with +unfolded repeats, and one for notation, eg. +@example + \score @{ + @var{..music..} + \paper @{ .. @} + @} + \score @{ + \unfoldrepeats @var{..music..} + \midi @{ .. @} + @} +@end example @node Manual repeat commands @subsection Manual repeat commands @@ -2676,6 +2832,7 @@ c4 c4 @end lilypond + @seealso Program reference: @internalsref{VoltaBracket}, @internalsref{RepeatedMusic}, @@ -3394,6 +3551,7 @@ the following sections are about. @menu * Entering lyrics:: * The Lyrics context:: +* Flexibility in alignment:: * More stanzas:: * Ambitus:: @end menu @@ -3601,16 +3759,6 @@ Here is an example demonstrating manual lyric durations, } >> @end lilypond - - - -When multiple stanzas are put on the same melody, it can happen that -two stanzas have melismata in different locations. This can be -remedied by switching off melismata for one -@internalsref{Lyrics}. This is achieved by setting -the @code{ignoreMelismata} property to @code{#t}. An example is shown -in @inputfileref{input/regression,lyric-combine-new.ly}. - @cindex SATB @cindex choral score @@ -3642,62 +3790,158 @@ inserted by hand. For proper processing of extender lines, the -@internalsref{Lyrics} and @internalsref{Voice} should be + @internalsref{Lyrics} and @internalsref{Voice} should be linked. This can be achieved either by using @code{\lyricsto} or by setting corresponding names for both contexts. The latter is explained in @ref{More stanzas}. @c TODO: document \new Staff << Voice \lyricsto >> bug -@node More stanzas -@subsection More stanzas +@node Flexibility in alignment +@subsection Flexibility in alignment -@cindex phrasing, in lyrics +Often, different stanzas of one song are put to one melody in slightly +differing ways. Such variations can still be captured with +@code{\lyricsto}. -The lyrics should be aligned with the note heads of the melody. To -achieve this, each line of lyrics should be marked to correspond with -the melodic line. This is done automatically when @code{\lyricsto}, -but it can also be done manually. +One possibility is that the text has a melisma in one stanza, but +multiple syllables in another one. One solution is to make the faster +voice ignore the melisma. This is done by setting +@code{ignoreMelismata} in the Lyrics context. + +There has one tricky aspect. The setting for @code{ignoreMelismata} +must be set one syllable @emph{before} the non-melismatic syllable +in the text, as shown here, + +@lilypond[verbatim,raggedright] +<< + \relative \context Voice = "lahlah" { + \set Staff.autoBeaming = ##f + c4 + \slurDotted + f8.[( g16]) + a4 + } + \new Lyrics \lyricsto "lahlah" { + more slow -- ly + } + \new Lyrics \lyricsto "lahlah" { + \set ignoreMelismata = ##t % applies to "fas" + go fas -- ter + \unset ignoreMelismata + still + } +>> +@end lilypond + + +The @code{ignoreMelismata} applies to the syllable ``fas'', so it +should bev entered before ``go''. + +The reverse is also possible: making a lyric line slower than the +standard. This can be achieved by insert @code{\skip}s into the +lyrics. For every @code{\skip}, the text will be delayed another note. +For example, + +@lilypond[verbatim,raggedright] +\relative { c c g' } +\newlyrics { + twin -- \skip 4 + kle +} +@end lilypond + +More complex variations in text underlay are possible. It is possible +to switch the melody for a line of lyrics during the text. This is +done by setting the @code{associatedVoice} property. In the example + +@lilypond[raggedright] +<< + \relative \context Voice = "lahlah" { + \set Staff.autoBeaming = ##f + c4 + << + \context Voice = alternative { + \voiceOne + \times 2/3 { + + % show associations clearly. + \override NoteColumn #'force-hshift = #-3 + f8 f g + } + } + { + \voiceTwo + f8.[ g16] + \oneVoice + } >> + a8( b) c + + } + \new Lyrics \lyricsto "lahlah" { + Ju -- ras -- sic Park + } + \new Lyrics \lyricsto "lahlah" { + + % Tricky: need to set associatedVoice + % one syllable too soon! + \set associatedVoice = alternative % applies to "ran" + Ty -- + ran -- + no -- + \set associatedVoice = lahlah % applies to "rus" + sau -- rus Rex + } >> +@end lilypond + +@noindent +the text for the first stanza is set to a melody called ``lahlah'', + +@verbatim + \new Lyrics \lyricsto "lahlah" { + Ju -- ras -- sic Park + } +@end verbatim -To this end, give the @internalsref{Voice} context an identity -@example -\context Voice = duet @{ - \time 3/4 - g2 e4 a2 f4 g2. @} -@end example -Then set the @internalsref{Lyrics} contexts to names starting with -that identity followed by a dash. In the preceding example, the -@internalsref{Voice} identity is @code{duet}, so the identities of the -@internalsref{Lyrics}s are marked @code{duet-1} and @code{duet-2} +The second stanza initially is set to the @code{lahlah} context, but +for the syllable ``ran'', it switches to a different melody. +This is achieved with @example - \context Lyrics = "duet-1" @{ - Hi, my name is Bert. @} - \context Lyrics = "duet-2" @{ - Ooooo, ch\'e -- ri, je t'aime. @} + \set associatedVoice = alternative @end example -@c \lyricsto in the example below is pointless, given subject of the -@c section. +@noindent +Here, @code{alternative} is the name of the @code{Voice} context +containing the triplet. +Again, the command must be one syllable too early, before ``Ty'' in +this case. + +@verbatim + \new Lyrics \lyricsto "lahlah" { + \set associatedVoice = alternative % applies to "ran" + Ty -- + ran -- + no -- + \set associatedVoice = lahlah % applies to "rus" + sau -- rus Rex + } +@end verbatim + +@noindent +The underlay is switched back to the starting situation by assigning +@code{lahlah} to @code{associatedVoice}. + + + + +@node More stanzas +@subsection More stanzas + +@cindex phrasing, in lyrics -The complete example is shown here -@lilypond[quote,raggedright,verbatim] - << - \relative c'' \context Voice = duet { - \time 3/4 - g2 e4 a2 f4 g2. } - << - \lyricsto "duet" \new Lyrics { - \set vocalName = "Bert" - Hi, my name is Bert. } - \lyricsto "duet" \new Lyrics { - \set vocalName = "Ernie" - Ooooo, ch\'e -- ri, je t'aime. } - >> - >> -@end lilypond @cindex stanza number @cindex singer's names @@ -3706,21 +3950,35 @@ The complete example is shown here Stanza numbers can be added by setting @code{stanza}, e.g. @lilypond[quote,verbatim,relative=2] -<< - \context Voice = duet { - \time 3/4 g2 e4 a2 f4 g2. } - \lyricsto "duet" \new Lyrics { +\context Voice { + \time 3/4 g2 e4 a2 f4 g2. +} \newlyrics { \set stanza = "1. " - Hi, my name is Bert. } ->> + Hi, my name is Bert. +} \newlyrics { + \set stanza = "2. " + Oh, che -- ri, je t'aime +} @end lilypond -This example also demonstrates how names of the singers can be added -using @code{vocalName} analogous to instrument annotations for staves. -A short version may be entered as @code{vocNam}. +These numbers are put just before the start of first syllable. + +Names of singers can also be added. They are printed at the start of +the line, just like instrument names. They are created by setting +@code{vocalName}. A short version may be entered as @code{vocNam}. -To make empty spaces in lyrics, use @code{\skip}. +@lilypond[quote,verbatim,relative=2] +\context Voice { + \time 3/4 g2 e4 a2 f4 g2. +} \newlyrics { + \set vocalName = "Bert " + Hi, my name is Bert. +} \newlyrics { + \set vocalName = "Ernie " + Oh, che -- ri, je t'aime +} +@end lilypond @seealso @@ -3799,6 +4057,30 @@ Examples: @inputfileref{input/regression,ambitus.ly}, There is no collision handling in the case of multiple per-voice ambitus. +@node Other instrument specific notation +@section Other instrument specific notation + +@menu +* Harmonic notes:: +@end menu + +@node Harmonic notes +@subsection Harmonic notes + +@cindex artificial harmonics +@cindex harmonics + +Artificial harmonics are notated with a different notehead style. They +are entered by +marking the harmonic pitch with @code{\harmonic}. + +@lilypond[raggedright,verbatim] +{ + 4 +} +@end lilypond + + @node Tablatures @section Tablatures @@ -3905,8 +4187,20 @@ No guitar special effects have been implemented. Program reference: @internalsref{Tab_note_heads_engraver}. +@node Popular music +@section Popular music + + + +@menu +* Chord names:: +* Chords mode:: +* Printing chord names:: +* Improvisation:: +@end menu + @node Chord names -@section Chord names +@subsection Chord names @cindex Chords LilyPond has support for both printing chord names. Chords may be @@ -4214,6 +4508,37 @@ may result in strange chord names when chords are entered with the @code{< .. >} syntax. +@node Improvisation +@subsection Improvisation + +Improvisation is sometimes denoted with slashed note heads. Such note +heads can be created by adding a @internalsref{Pitch_squash_engraver} +to the @internalsref{Staff} or @internalsref{Voice} context. Then, the +following command + +@example + \set squashedPosition = #0 + \override NoteHead #'style = #'slash +@end example + +@noindent +switches on the slashes. + +There are shortcuts @code{\improvisationOn} (and an accompanying +@code{\improvisationOff}) for this command sequence. They are used in +the following example + +@lilypond[verbatim,raggedright] +\new Staff \with { + \consists Pitch_squash_engraver +} \transpose c c' { + e8 e g a a16(bes)(a8) g \improvisationOn + e8 + ~e2~e8 f4 fis8 + ~fis2 \improvisationOff a16(bes) a8 g e +} +@end lilypond + @node Orchestral music @@ -5406,51 +5731,48 @@ command, @code{n} and @code{m} have to be chosen according to the following table @lilypond[quote] -\score { - { - \set Score.timing = ##f - \set Score.barAlways = ##t - s_\markup { "$\\backslash$time 4/4" } - ^\markup { " " \musicglyph #"timesig-neomensural4/4" } - s - s_\markup { "$\\backslash$time 2/2" } - ^\markup { " " \musicglyph #"timesig-neomensural2/2" } - s - s_\markup { "$\\backslash$time 6/4" } - ^\markup { " " \musicglyph #"timesig-neomensural6/4" } - s - s_\markup { "$\\backslash$time 6/8" } - ^\markup { " " \musicglyph #"timesig-neomensural6/8" } - \break - s_\markup { "$\\backslash$time 3/2" } - ^\markup { " " \musicglyph #"timesig-neomensural3/2" } - s - s_\markup { "$\\backslash$time 3/4" } - ^\markup { " " \musicglyph #"timesig-neomensural3/4" } - s - s_\markup { "$\\backslash$time 9/4" } - ^\markup { " " \musicglyph #"timesig-neomensural9/4" } - s - s_\markup { "$\\backslash$time 9/8" } - ^\markup { " " \musicglyph #"timesig-neomensural9/8" } - \break - s_\markup { "$\\backslash$time 4/8" } - ^\markup { " " \musicglyph #"timesig-neomensural4/8" } - s - s_\markup { "$\\backslash$time 2/4" } - ^\markup { " " \musicglyph #"timesig-neomensural2/4" } - \break - } - \paper { - indent = 0.0 - raggedright = ##t - \context { - \Staff - \remove Staff_symbol_engraver - \remove Clef_engraver - \remove Time_signature_engraver - } +\paper { + indent = 0.0 + raggedright = ##t + \context { + \Staff + \remove Staff_symbol_engraver + \remove Clef_engraver + \remove Time_signature_engraver } +} { + \set Score.timing = ##f + \set Score.barAlways = ##t + s_\markup { "$\\backslash$time 4/4" } + ^\markup { " " \musicglyph #"timesig-neomensural4/4" } + s + s_\markup { "$\\backslash$time 2/2" } + ^\markup { " " \musicglyph #"timesig-neomensural2/2" } + s + s_\markup { "$\\backslash$time 6/4" } + ^\markup { " " \musicglyph #"timesig-neomensural6/4" } + s + s_\markup { "$\\backslash$time 6/8" } + ^\markup { " " \musicglyph #"timesig-neomensural6/8" } + \break + s_\markup { "$\\backslash$time 3/2" } + ^\markup { " " \musicglyph #"timesig-neomensural3/2" } + s + s_\markup { "$\\backslash$time 3/4" } + ^\markup { " " \musicglyph #"timesig-neomensural3/4" } + s + s_\markup { "$\\backslash$time 9/4" } + ^\markup { " " \musicglyph #"timesig-neomensural9/4" } + s + s_\markup { "$\\backslash$time 9/8" } + ^\markup { " " \musicglyph #"timesig-neomensural9/8" } + \break + s_\markup { "$\\backslash$time 4/8" } + ^\markup { " " \musicglyph #"timesig-neomensural4/8" } + s + s_\markup { "$\\backslash$time 2/4" } + ^\markup { " " \musicglyph #"timesig-neomensural2/4" } + \break } @end lilypond @@ -5461,36 +5783,49 @@ select ancient time signatures. Supported styles are incipit of transcriptions of mensural pieces. The @code{mensural} style mimics the look of historical printings of the 16th century. -@inputfileref{input/test,time.ly} gives an overview over all available -ancient and modern styles. +The following examples shows the differences in style, +@lilypond[raggedright] +{ + \time 2/2 + c1^\markup { \hspace #-2.0 \typewriter default } + + \override TimeSignature #'style = #'numbered + \time 2/2 + c1^\markup { \hspace #-2.0 \typewriter numbered } + + \override TimeSignature #'style = #'mensural + \time 2/2 + c1^\markup { \hspace #-2.0 \typewriter mensural } + + \override TimeSignature #'style = #'neomensural + \time 2/2 + c1^\markup { \hspace #-2.0 \typewriter neomensural } + \override TimeSignature #'style = #'single-digit + \time 2/2 + c1^\markup { \hspace #-2.0 \typewriter single-digit } +} +@end lilypond @seealso -Program reference: @ref{Time signature} gives a general introduction into the use of time -signatures. +This manual: @ref{Time signature} gives a general introduction into +the use of time signatures. @refbugs -Mensural signature glyphs are mapped to time fractions in a hard-wired -way. This mapping is sensible, but still arbitrary: given a mensural -time signature, the time fraction represents a modern meter that -usually will be a good choice when transcribing a mensural piece of -music. For a particular piece of mensural music, however, the mapping -may be unsatisfactory. In particular, the mapping assumes a fixed -transcription of durations (e.g. brevis = half note in 2/2, i.e. 4:1). -Some glyphs (such as the alternate glyph for 6/8 meter) are not at all -accessible through the @code{\time} command. - -Mensural time signatures are supported typographically, but not yet -musically. The internal representation of durations is -based on a purely binary system; a ternary division such as 1 brevis = -3 semibrevis (tempus perfectum) or 1 semibrevis = 3 minima (cum -prolatione maiori) is not correctly handled: event times in ternary -modes will be badly computed, resulting e.g. in horizontally -misaligned note heads, and bar checks are likely to erroneously fail. - -The syntax and semantics of the @code{\time} command for mensural -music is subject to change. +Ratios of note durations do not change with the time signature. For +example, the ratio of 1 brevis = 3 semibrevis (tempus perfectum) must +be made by hand, by setting + +@example + breveTP = #(ly:make-duration -1 0 3 2) +@end example + +@noindent +This sets breveTP to 3/2 times 2 = 3 times a whole note. + +The @code{old6/8alt} symbol (an alternate symbol for 6/8) is not +addressable with @code{\time}. Use a @code{\markup} instead @node Custodes @subsection Custodes @@ -6686,10 +7021,154 @@ support for contemporary notation in LilyPond is limited. @menu +* Polymetric notation:: * Clusters:: * Fermatas:: @end menu +@node Polymetric notation +@subsection Polymetric notation + +Double time signatures are not supported explicitly, but they can be +faked. In the next example, the markup for the time signature is +created with a markup text. This markup text is inserted in the +@internalsref{TimeSignature} grob. + +@lilypond[verbatim,raggedright] + +% create 2/4 + 5/8 +tsMarkup =\markup { + \number { + \column < "2" "4" > + \musicglyph #"scripts-stopped" + \bracket \column < "5" "8" > + } +} + +{ + \override Staff.TimeSignature #'print-function = #Text_item::print + \override Staff.TimeSignature #'text = #tsMarkup + \time 3/2 + c'2 \bar ":" c'4 c'4. +} +@end lilypond + +Each staff can also have its own time signature. This is done by +moving the @internalsref{Timing_engraver} to @internalsref{Staff} +context. + +@verbatim +\paper{ + \context{ + \Score + \remove "Timing_engraver" + } + \context{ + \Staff + \consists "Timing_engraver" + } +} +@end verbatim + + +Now, each staff has its own time signature. +@verbatim +<< + \new Staff { + \time 3/4 + c4 c c | c c c | + } + + \new Staff { + \time 2/4 + c4 c | c c | c c + } + \new Staff { + \time 3/8 + c4. c8 c c c4. c8 c c + } +>> +@end verbatim + +@lilypond[raggedright] +\paper{ + \context{ + \Score + \remove "Timing_engraver" + } + \context{ + \Staff + \consists "Timing_engraver" + } +} + +\relative c' << + \new Staff { + \time 3/4 + c4 c c | c c c | + } + + \new Staff { + \time 2/4 + c4 c | c c | c c + } + \new Staff { + \time 3/8 + c4. c8 c c c4. c8 c c + } +>> +@end lilypond + + +A different form of polymetric notation is where note lengths have +different values across staves. + +This notation can be created by setting a common time signature for +each staff but replacing it manually using +@code{timeSignatureFraction} to the desired fraction. Then the printed +durations in each staff are scaled to the common time signature. +The latter is done with @code{\compressmusic}, which is similar to +@code{\times}, but does not create a tuplet bracket. + + +In this example, music with the time signatures of 3/4, 9/8 and 10/8 are +used in parallel. In the second staff, shown durations are multiplied by +2/3, so that 2/3 * 9/8 = 3/4, and in the third staff, shown durations are +multiplied by 3/5, so that 3/5 * 10/8 = 3/4. + +@lilypond[raggedright,verbatim] +\relative c' << + \new Staff { + \time 3/4 + c4 c c | c c c | + } + \new Staff { + \time 3/4 + \set Staff.timeSignatureFraction = #'(9 . 8) + \compressmusic #'(2 . 3) + \repeat unfold 6 { c8[ c c] } + } + \new Staff { + \time 3/4 + \set Staff.timeSignatureFraction = #'(10 . 8) + \compressmusic #'(3 . 5) + { \repeat unfold 2 { c8[ c c] } + \repeat unfold 2 { c8[ c] } + | c4. c4. \times 2/3 { c8 c c } c4 } + } +>> +@end lilypond + + + + +@refbugs + +When using different time signatures in parallel, the spacing is +aligned vertically, but bar lines distort the regular spacing. + + + @node Clusters @subsection Clusters @@ -6773,6 +7252,29 @@ supported See @ref{Articulations} for general instructions how to apply scripts such as fermatas to notes. +@node Feathered beams +@subsection Feathered beams + +Feathered beams are not supported natively, but they can be faked by +forcing two beams to overlap. Here is an example, + +@lilypond[raggedright] +\relative \new Staff << + \new Voice + { + \stemUp + \once \override Voice.Beam #'positions = #'(0 . 0.5) + c8[ c c c c ] + } + \new Voice { + \stemUp + \once \override Voice.Beam #'positions = #'(0 . -0.5) + c[ c c c c] + } +>> +@end lilypond + + @node Educational use @section Educational use diff --git a/Documentation/user/programming-interface.itely b/Documentation/user/programming-interface.itely index 48c0470e91..b8d66709d5 100644 --- a/Documentation/user/programming-interface.itely +++ b/Documentation/user/programming-interface.itely @@ -292,8 +292,8 @@ above by the internal equivalent of Other applications of @code{\applymusic} are writing out repeats automatically (@inputfileref{input/test,unfold-all-repeats.ly}), saving keystrokes (@inputfileref{input/test,music-box.ly}) and -exporting -LilyPond input to other formats (@inputfileref{input/test,to-xml.ly}) +exporting LilyPond input to other formats +(@inputfileref{input/test,to-xml.ly}) @seealso diff --git a/input/test/beam-dir-functions.ly b/input/regression/beam-dir-functions.ly similarity index 99% rename from input/test/beam-dir-functions.ly rename to input/regression/beam-dir-functions.ly index ec33b289ad..a3b50a2629 100644 --- a/input/test/beam-dir-functions.ly +++ b/input/regression/beam-dir-functions.ly @@ -1,4 +1,4 @@ - +% junkme? \version "2.3.8" \header { texidoc = "@cindex Beam Dir Functions diff --git a/input/test/lyric-hyphen-retain.ly b/input/regression/lyric-hyphen-retain.ly similarity index 100% rename from input/test/lyric-hyphen-retain.ly rename to input/regression/lyric-hyphen-retain.ly diff --git a/input/test/markup-score.ly b/input/regression/markup-score.ly similarity index 100% rename from input/test/markup-score.ly rename to input/regression/markup-score.ly diff --git a/input/test/no-staff.ly b/input/regression/no-staff.ly similarity index 100% rename from input/test/no-staff.ly rename to input/regression/no-staff.ly diff --git a/input/regression/repeat-unfold-all.ly b/input/regression/repeat-unfold-all.ly index 821731207e..2c60dd88bc 100644 --- a/input/regression/repeat-unfold-all.ly +++ b/input/regression/repeat-unfold-all.ly @@ -1,20 +1,18 @@ \version "2.3.4" -\header { texidoc = "Volta repeats may be unfolded through the Scheme - function @code{unfold-repeats}." +\header { texidoc = "Volta repeats may be unfolded through the music + function @code{\unfoldrepeats}." } nots = \relative c' { c4 \repeat volta 2 c4 \alternative { d e } } +\paper {raggedright = ##t} -\score { - \context Voice { - \nots - \bar "||" - \applymusic #unfold-repeats \nots - } - \paper {raggedright = ##t} +\context Voice { + \nots + \bar "||" + \unfoldrepeats \nots } diff --git a/input/regression/trill-spanner.ly b/input/regression/trill-spanner.ly new file mode 100644 index 0000000000..e41ef923a2 --- /dev/null +++ b/input/regression/trill-spanner.ly @@ -0,0 +1,12 @@ +\header { + texidoc = "Trill spanner" +} + +\version "2.3.9" +\paper { + raggedright = ##T +} +\relative \new Voice { + << { c1 \startTrillSpan } + { s2. \grace { d16[\stopTrillSpan e] } } >> + c4 } diff --git a/input/test/chord-names-no-inversions.ly b/input/test/chord-names-no-inversions.ly deleted file mode 100644 index 32eba56cad..0000000000 --- a/input/test/chord-names-no-inversions.ly +++ /dev/null @@ -1,20 +0,0 @@ -\version "2.3.8" -\header { texidoc= "@cindex Chord Names No Inversions -Since there are several interpretations for recognizing -chord names, the lowest note is the bass note of a chord and the inversion -of the chord is found accordingly. " } - -scheme = { - 1 - - -} - -\score { - << - \context ChordNames \scheme - \context Staff \scheme - >> - \paper { raggedright = ##t} -} - diff --git a/input/test/crescendi.ly b/input/test/crescendi.ly deleted file mode 100644 index 375090bedf..0000000000 --- a/input/test/crescendi.ly +++ /dev/null @@ -1,23 +0,0 @@ - -\version "2.3.8" -\header{ - texidoc="@cindex Crescendi -Crescendi can be printed in a number of different ways. -" } -\score{ -\relative c''{ -a1\fff\> a\pp\! -a\< a\! -\set crescendoText = \markup { \italic \bold "cresc." } -\set crescendoSpanner = #'dashed-line -a\mf\< a a\! -a\< a\! -} -\paper{ -raggedright = ##t -} -\midi{ -\tempo 1 = 60 -} -} - diff --git a/input/test/feathered-beam.ly b/input/test/feathered-beam.ly deleted file mode 100644 index ef3c134146..0000000000 --- a/input/test/feathered-beam.ly +++ /dev/null @@ -1,26 +0,0 @@ -\version "2.3.8" \header { - - texidoc = "A hack to create feathered -beams: manually make two beams overlap. This uses tuplets to -condense the spacing." - - } -\paper { raggedright = ##t } - -\relative \new Staff << - \new Voice - { - \stemUp - \once \override Voice.Beam #'positions = #'(0 . 0.5) - \once \override Voice.TupletBracket #'number-visibility = ##f - \times 1/2 { c8[ c c c c c c c] - } - } - \new Voice { - \stemUp - \once \override Voice.Beam #'positions = #'(0 . -0.5) - \once \override Voice.TupletBracket #'number-visibility = ##f - \times 1/2 { c[ c c c c c c c] } - } ->> - diff --git a/input/test/figured-bass-alternate.ly b/input/test/figured-bass-alternate.ly deleted file mode 100644 index 712b27905c..0000000000 --- a/input/test/figured-bass-alternate.ly +++ /dev/null @@ -1,25 +0,0 @@ -\header -{ -texidoc = "An alternate method to make bass figures is to use -@code{markup} texts." -} -\version "2.3.8" - -nat = \markup { \natural } -sh = \markup { \smaller \raise #0.6 \sharp } -fl = \markup { \flat } - -\score { - \context Voice { - \clef bass - \override TextScript #'font-family = #'number - \override TextScript #'font-size = #-6 - \override TextScript #'baseline-skip = #1.4 - - dis4_\markup { 6 } - - c_\markup { 7 } - d_\markup { \column < { 6 \sh } \bracket { \nat } >} - ais_\markup { \column < 6 5 \bracket { 3 \sh } >} - } -} diff --git a/input/test/gourlay.ly b/input/test/gourlay.ly deleted file mode 100644 index db8309b31c..0000000000 --- a/input/test/gourlay.ly +++ /dev/null @@ -1,22 +0,0 @@ -\version "2.3.8" -\header{ - - texidoc="@cindex Gourlay - -The breaking of line works also with polyphony. This is taken from -Gourlay's paper on breaking lines. " - -} - -\score{ - \context Staff \relative c'' << - { \stemUp d2 d | d d | d4 d2. | \break c1 } - \\ - { \stemDown g4 g g g | \times 2/3 { g2 g2 g2 } | g4. g8 g2 | c1 } - >> - \paper{ - raggedright = ##t - } -} - - diff --git a/input/test/gregorian-scripts.ly b/input/test/gregorian-scripts.ly index 8cb300dbbe..7dffe7e400 100644 --- a/input/test/gregorian-scripts.ly +++ b/input/test/gregorian-scripts.ly @@ -1,6 +1,5 @@ \version "2.3.8" \header { - title = "Gregorian Scripts" texidoc = "@cindex Gregorian Scripts Here is demonstrated a preliminary support of Gregorian Scripts: diff --git a/input/test/harmonic.ly b/input/test/harmonic.ly deleted file mode 100644 index 3c01eff8b3..0000000000 --- a/input/test/harmonic.ly +++ /dev/null @@ -1,18 +0,0 @@ -\version "2.3.8" -\header { - texidoc ="@cindex Artificial Harmonics - -Artificial harmonics are notated with a different notehead style, by -marking the harmonic pitch with @code{\harmonic}." - -} - -\score { - { - 4 - } - \paper { - raggedright=##t - } -} - diff --git a/input/test/hshift.ly b/input/test/hshift.ly deleted file mode 100644 index 797c6c5f69..0000000000 --- a/input/test/hshift.ly +++ /dev/null @@ -1,24 +0,0 @@ -\version "2.3.8" -\header { texidoc = "@cindex Horizontal Shift -Notes may be manually horizontally shifted. " } - -shiftI = \override NoteColumn #'horizontal-shift = #0 -shiftII = \override NoteColumn #'horizontal-shift = #1 -shiftIII = \override NoteColumn #'horizontal-shift = #2 -shiftIV = \override NoteColumn #'horizontal-shift = #3 -shiftV = \override NoteColumn #'horizontal-shift = #4 - -\score { - \context Voice \relative c { - - \context Staff << - \new Voice {\stemUp \shiftI g'' } - \new Voice {\stemUp \shiftII e } - \new Voice {\stemUp \shiftIII c } - \new Voice {\stemUp \shiftIV a } - \new Voice {\stemUp \shiftV f } - >> - } - \paper { raggedright = ##t } -} - diff --git a/input/test/improv.ly b/input/test/improv.ly deleted file mode 100644 index 689af59a99..0000000000 --- a/input/test/improv.ly +++ /dev/null @@ -1,51 +0,0 @@ -\version "2.3.8" -\header { - - texidoc = -" - -In improvisation, noteheads do not have a pitch, and have different -shapes. In this example, this is achieved by adding -@code{Pitch_squash_engraver} and setting @code{squashedPosition} when the -improvisation is active. - -" - -} - - -improOn = { - \set squashedPosition = #0 - \override NoteHead #'style = #'slash -} - -improOff = { - \unset squashedPosition - \revert NoteHead #'style -} - -global = { s1*3 \bar "|." } - -\score { - << - \context ChordNames \chords { - e8*7:m7 a2.:m7 bes4:m7 b1:m7 e8:m - } - << - \context Voice = melo \transpose c c' { - e8 e g a a16(bes)(a8) g \improOn - e8 - ~e2~e8 f4 fis8 - ~fis2 \improOff a16(bes) a8 g e - } - >> - >> - \paper { - \context { - \Voice - \consists Pitch_squash_engraver - } - raggedright = ##t - } -} - diff --git a/input/test/ligature-vaticana.ly b/input/test/ligature-vaticana.ly index 17f5d1156d..bd7db894b1 100644 --- a/input/test/ligature-vaticana.ly +++ b/input/test/ligature-vaticana.ly @@ -1,7 +1,7 @@ \version "2.3.8" \header { texidoc = "@cindex Ancient Vaticana -Vaticana ligature uses four staff lines, special clef, an notes +Vaticana ligature uses four staff lines, special clef, and calligraphic notes. " } diff --git a/input/test/lyrics-melisma-faster.ly b/input/test/lyrics-melisma-faster.ly deleted file mode 100644 index ea86ba3efd..0000000000 --- a/input/test/lyrics-melisma-faster.ly +++ /dev/null @@ -1,33 +0,0 @@ -\header -{ - texidoc = "A faster lyrics line may be set to a melismatic melody by -setting @code{ignoreMelismata}. A tricky aspect is that ignoreMelismata -must be set a syllable too soon." - -} - - -\paper { - raggedright = ##t -} - -\version "2.3.8" - -<< - \relative \context Voice = "lahlah" { - \set Staff.autoBeaming = ##f - c4 - \slurDotted - f8.[( g16]) - a4 - } - \new Lyrics \lyricsto "lahlah" { - more slow -- ly - } - \new Lyrics \lyricsto "lahlah" { - \set ignoreMelismata = ##t % applies to "fas" - go fas -- ter - \unset ignoreMelismata - still - } ->> diff --git a/input/test/lyrics-melisma-variants.ly b/input/test/lyrics-melisma-variants.ly deleted file mode 100644 index 3c43ee41c2..0000000000 --- a/input/test/lyrics-melisma-variants.ly +++ /dev/null @@ -1,57 +0,0 @@ -\header { - -texidoc = "You can switch the Voice context for a lyrics melody - during a lyrics line using @code{associatedVoice}. Here, the - syllables \"rannosau\" are set to triplets. - -A tricky aspect is that @code{associatedVoice} needs to be changed one -syllable too soon. - -" -} - -\paper { - raggedright = ##t -} - -\version "2.3.8" - -<< - \relative \context Voice = "lahlah" { - \set Staff.autoBeaming = ##f - c4 - << - \context Voice = alternative { - \voiceOne - \times 2/3 { - - % show associations clearly. - \override NoteColumn #'force-hshift = #-3 - f8 f g - } - } - { - \voiceTwo - f8.[ g16] - \oneVoice - } >> - a8( b) c - - } - \new Lyrics \lyricsto "lahlah" \lyrics { - Ju -- ras -- sic Park - } - \new Lyrics \lyricsto "lahlah" \lyrics { - - % Tricky: need to set associatedVoice - % one syllable too soon! - \set associatedVoice = alternative % applies to "ran" - Ty -- - ran -- - no -- - \set associatedVoice = lahlah % applies to "rus" - sau -- rus Rex - } >> - - - diff --git a/input/test/move-accidentals.ly b/input/test/move-accidentals.ly deleted file mode 100644 index 75be4ad897..0000000000 --- a/input/test/move-accidentals.ly +++ /dev/null @@ -1,39 +0,0 @@ -\version "2.3.8" - -% possible rename to scheme- or something like that. -gp -\header { texidoc= "@cindex Scheme Manual Accidentals -The positions of accidentals may be manually set by incorporating -some Scheme code. " } - -#(define (make-acc-position-checker pos) - (lambda (elt) - (and - (not (eq? #f (memq 'accidental-interface - (ly:grob-property elt 'interfaces)))) - (eq? (ly:grob-property - (ly:grob-parent elt 1) 'staff-position) pos)))) - -\score { - \context Voice \relative c'' { - c2. - << -\set Staff.AccidentalPlacement = \turnOff -\context Staff \applyoutput #(outputproperty-compatibility (make-acc-position-checker 9) - 'extra-offset '(-1 . 0)) -\context Staff \applyoutput #(outputproperty-compatibility (make-acc-position-checker 5) - 'extra-offset '(-2 . 0)) -\context Staff \applyoutput #(outputproperty-compatibility (make-acc-position-checker 3) - 'extra-offset '(-3 . 0)) -\context Staff \applyoutput #(outputproperty-compatibility (make-acc-position-checker 2) - 'extra-offset '(-4 . 0)) - d!4 - eis - gis - d'! - >> - } - \paper { - raggedright = ##t - } -} - diff --git a/input/test/polymetric-differing-notes.ly b/input/test/polymetric-differing-notes.ly deleted file mode 100644 index 3e8a3e8d9c..0000000000 --- a/input/test/polymetric-differing-notes.ly +++ /dev/null @@ -1,54 +0,0 @@ -\version "2.3.8" - -\header{ texidoc=" - -@cindex polymetric music - -@cindex scaling durations - -It is possible to have multiple time signatures, each one in an own staffs, -at the same time, and have even a proper vertical alignment of the different -durations. This is done, firstly, by setting a common time signature for -each staff but replacing it manually using @code{timeSignatureFraction} to -the desired fraction, and secondly, by scaling the printed durations to -the actual, polymetric durations. - -In this example, music with the time signatures of 3/4, 9/8 and 10/8 are -used in parallel. In the second staff, shown durations are multiplied by -2/3, so that 2/3 * 9/8 = 3/4, and in the third staff, shown durations are -multiplied by 3/5, so that 3/5 * 10/8 = 3/4. - -" - -} - -#(define ((scale-music-function fraction) x) - (ly:music-compress x (ly:make-moment (car fraction) (cdr fraction)))) - - - - -\score { - \relative c' << - \new Staff { - \time 3/4 - c4 c c | c c c | - } - \new Staff { - \time 3/4 - \set Staff.timeSignatureFraction = #'(9 . 8) - \applymusic #(scale-music-function '(2 . 3)) - \repeat unfold 6 { c8[ c c] } - } - - \new Staff { - \time 3/4 - \set Staff.timeSignatureFraction = #'(10 . 8) - \applymusic #(scale-music-function '(3 . 5)) - { \repeat unfold 2 { c8[ c c] } - \repeat unfold 2 { c8[ c] } - | c4. c4. \times 2/3 { c8 c c } c4 } - } - >> - \paper { raggedright = ##t } -} diff --git a/input/test/polymetric.ly b/input/test/polymetric.ly deleted file mode 100644 index 976f2c62ca..0000000000 --- a/input/test/polymetric.ly +++ /dev/null @@ -1,49 +0,0 @@ -\version "2.3.8" - -\header{ texidoc="@cindex Time Signature Multiple - -@cindex polymetric music - -You can have multiple time signatures occuring at the same time. - -This is done by moving the timing engraver to staff context. Also, -@code{Staff} should be given the alias @code{Timing} to make @code{\\time} -command work correctly. The spacing is aligned vertically, although the bar -lines seem to distort the regular spacing. - -" } - -%% Multiple time signatures seem not to be printed, however. -%% Should print bar lines according to the time signature of each staff. -HJJ - -\score{ - \relative c' << - \new Staff { - \time 3/4 - c4 c c | c c c | - } - - \new Staff { - \time 2/4 - c4 c | c c | c c - } - \new Staff { - \time 3/8 - c4. c8 c c c4. c8 c c - } - >> - - \paper{ - raggedright = ##t - \context{ - \Score - \remove "Timing_engraver" - } - \context{ - \Staff - \consists "Timing_engraver" - - } - } -} - diff --git a/input/test/repeat-shorter-bracket.ly b/input/test/repeat-shorter-bracket.ly deleted file mode 100644 index cc34d5021e..0000000000 --- a/input/test/repeat-shorter-bracket.ly +++ /dev/null @@ -1,42 +0,0 @@ -\version "2.3.8" -\header{ - texidoc=" - -@cindex shorter volta bracket - -By setting @code{voltaSpannerDuration}, the horizontal length of a volta -bracket can be shortened. - -" - -} - - -\score { - << - \context Staff \relative c''{ - c c c c - % coda-klugde: let volta span only one bar - \set Staff.voltaSpannerDuration = #(ly:make-moment 1 1) - \repeat "volta" 5 { d d d d } - \alternative { { e e e e f f f f } - { g g g g } } - } - \context Lyrics \lyrics{ - intro1 - \repeat fold 5 { } - \alternative { - { chorus1 one verse1 } - { chorus1 two verse1 } - { chorus1 three verse } - { chorus1 four verse } - } - five1 - } - >> - \paper{ raggedright = ##t } -} - - - % - diff --git a/input/test/repeat.ly b/input/test/repeat.ly deleted file mode 100644 index af612f5ff4..0000000000 --- a/input/test/repeat.ly +++ /dev/null @@ -1,31 +0,0 @@ -\version "2.3.8" - -% possible rename to lyric-repeat or repeat-lyric. - -\header{ texidoc = "@cindex Repeat Lyrics -Alternate lyrics can be used, as well as alternate notes for repeats. " -} - -%% Syntax << { aaa } { bbb } >> seems not to work in lyrics. -%% The notes are lyrics do not match syntactically here. - HJJ - -\score{ - << - \context Staff \relative c'{ - c d e f - \repeat "volta" 2 { g a b c } - \alternative { { c b a g } { f e d c } } - } - \context Lyrics \lyrics { - De eer- ste << { maat } { moet } >> - \repeat fold 2 { } - \alternative { - { en dan twee keer } - { een koe- plet _ } - } - en dan nog dit er ach- ter aan - } - >> - \paper{raggedright=##t} -} - diff --git a/input/test/scheme-interactions.ly b/input/test/scheme-interactions.ly deleted file mode 100644 index d20567ca31..0000000000 --- a/input/test/scheme-interactions.ly +++ /dev/null @@ -1,27 +0,0 @@ -\version "2.3.8" -\header { texidoc = "@cindex Scheme Interactions -Using @code{ly:export}, the result of Scheme expressions can be passed -as LilyPond input. Within a Scheme expression, you can use, define or -change the corresponding variables. In this example, the D-s and E-s are -generated using scheme functions, and between there are manually -(without Scheme) entered C-s. - -" } - -foo = \transpose c c { d''4-. } -bra = \transpose c c { e'4-. } - - -\score { - \context Voice \relative c' { - c4 - #(ly:export (make-sequential-music (list foo foo foo ))) - #(begin (define baz (make-simultaneous-music (list foo bra))) - (empty-music)) - c4 - \baz - c4 - } - \paper {raggedright=##t} -} - diff --git a/input/test/script-priority.ly b/input/test/script-priority.ly deleted file mode 100644 index 9dbe9fa438..0000000000 --- a/input/test/script-priority.ly +++ /dev/null @@ -1,29 +0,0 @@ - -\version "2.3.8" - -\header { texidoc = "@cindex Script Priority -Relative placements of different script types can be controlled -by overriding @code{script-priority}. - -In this example, accidentals are put either below or above other -script symbols. - -" -} - - -\score{ - \context Staff \relative g''{ - - \override Score.TextScript #'script-priority = #-100 - a4^\prall^\markup { \sharp } - - - \override Score.Script #'script-priority = #-100 - \revert Score.TextScript #'script-priority - - a4^\prall^\markup { \sharp } - } - \paper { raggedright = ##t} -} - diff --git a/input/test/script-stack.ly b/input/test/script-stack.ly deleted file mode 100644 index c3dc4375e9..0000000000 --- a/input/test/script-stack.ly +++ /dev/null @@ -1,15 +0,0 @@ - -\version "2.3.8" - -\header { texidoc = "@cindex Stacked Text Articulation -Text and articulations may be stacked on top of each other. " -} - -\score { - \relative c' { - c2_"geen gedonder"_"jij gaat onder" - c2^^^.^|^"down"^"up" - } - \paper { raggedright = ##t} -} - diff --git a/input/test/separate-staccato.ly b/input/test/separate-staccato.ly deleted file mode 100644 index d0da7c1120..0000000000 --- a/input/test/separate-staccato.ly +++ /dev/null @@ -1,22 +0,0 @@ - -\version "2.3.8" -% possible rename. -gp - -\header { texidoc="@cindex Seperate Staccato -You can enter notes and articulations separately, and merge -them into one thread. In this example, a repead series of staccato dots -is attached to the notes." -} - -staccatos = { s4-. s-. s-. s s } - -music = \relative c' { c4 d e f g a b c d e } - -\score { - \context Voice << - \music - \repeat unfold 2 \staccatos - >> - \paper{raggedright=##t} -} - diff --git a/input/test/spanner-after-break-tweak.ly b/input/test/spanner-after-break-tweak.ly deleted file mode 100644 index a6f1528afe..0000000000 --- a/input/test/spanner-after-break-tweak.ly +++ /dev/null @@ -1,30 +0,0 @@ - -\version "2.3.8" - -\header { texidoc = "@cindex Spanner after break - -In order to selectively change the properties of spanners after -a line break, Scheme code must be used. In thas manner, the tie -after the line break in this example is moved around. " - - } - -#(define (my-callback grob) - (let* ( - (o (ly:grob-original grob)) - (b (if (ly:grob? o) (ly:spanner-broken-into o) '() ))) - - ;; Call the equivalent of Tie::after_line_breaking - ;; if you're using this for other grob-types. - - (if (and (>= (length b) 2) (eq? (car (last-pair b)) grob)) - (ly:grob-set-property! grob 'extra-offset '(-2 . 5)) - ))) - -\paper { raggedright = ##t } - -\relative c'' { - \override Tie #'after-line-breaking-callback = - #my-callback - c1 ~ \break c2 ~ c -} diff --git a/input/test/stem-length.ly b/input/test/stem-length.ly deleted file mode 100644 index 4a39d6c6b2..0000000000 --- a/input/test/stem-length.ly +++ /dev/null @@ -1,15 +0,0 @@ - -\version "2.3.8" - -\header{ texidoc = "@cindex Stem Length -The length of stems can be altered. " -} - -\score { - \context Voice \relative c { - g''4 \override Stem #'length = #14 g4 - \override Stem #'length = #3 g4 g,,4 - } - \paper { raggedright = ##t } -} - diff --git a/input/test/tie-cross-voice.ly b/input/test/tie-cross-voice.ly deleted file mode 100644 index 489d179b9c..0000000000 --- a/input/test/tie-cross-voice.ly +++ /dev/null @@ -1,21 +0,0 @@ -\version "2.3.8" - - - -\header { - texidoc = "Cross voice ties can be faked by using transparent noteheads." - } - - -\score { -\context Staff { -\relative c'' << - { - \once \override Stem #'transparent = ##t - b8~ b8 } - \\ - { b[ g8] } ->> -} -\paper { raggedright = ##t } -} diff --git a/input/test/time-signature-double.ly b/input/test/time-signature-double.ly deleted file mode 100644 index aec8dc521e..0000000000 --- a/input/test/time-signature-double.ly +++ /dev/null @@ -1,35 +0,0 @@ - -\version "2.3.8" - -\header { texidoc= " - -@cindex Double time signature -@cindex markup -@cindex Time signature, double. - - -Double time -signatures are not supported explicitly, but they can be faked with -markups and overriding formatting routines. " } - -tsMarkup = -\markup { - \number { - \column < "6" "4" > - \musicglyph #"scripts-stopped" - \bracket \column < "3" "2" > - }} - - -\score { \relative c' - { - \override Staff.TimeSignature #'print-function = #Text_item::print - \override Staff.TimeSignature #'text = #tsMarkup - - - \time 3/2 - c2 c c - - } - \paper{ raggedright = ##t} -} diff --git a/input/test/time.ly b/input/test/time.ly deleted file mode 100644 index a1322934de..0000000000 --- a/input/test/time.ly +++ /dev/null @@ -1,188 +0,0 @@ - -\version "2.3.9" -% TODO: This file could be old. Ask about it later. -gp - -\header { texidoc = "@cindex Time - -The different styles for time signatures are shown in this file. - -" -} - - -%{ - -two examples what might be expected. -- jr - -TODO: The former "old6/8alt" is currently not addressable. This will -be fixed by introducing an additional style property that switches -between various mensural diminution styles. -- jr - -TODO: Style "1xxx" really should be a special case of style -"numbered". In other words, style "1xxx" should be removed, and a new -property "denominator-style" should be introduced, with values -"numbered" (which should be equivalent to the current "numbered" -style), "none" (which should be equivalent to the current "1xxx" -style), and "notehead" (which should place a proper notehead to the -right side of the nominator). -- jr - - -**************** - -IMPORTANT NOTE: The current selection scheme for time signature -symbols is not flexible enough for future extensions such as various -flavours of early mensural notation or complex signatures as in -contemporary music. Therefore, the semantics of time-signature -properties will quite definitely change, and maybe the syntax of the -\time request will possibly be extended. See the input file for TODOs. - -**************** - -%} - -\score { - \context Voice \relative c { - % LilyPond doesn't understand 'default =>> it does what you want - \override Staff.TimeSignature #'style = #'default - \time 1/1 - c''1^"TimeSignature style = \#'default" - \time 2/2 - c1 - \time 2/4 - c2 - \time 4/8 - c2 - \time 3/4 - c2. - \time 4/4 - c1 - \time 5/4 - c2. c2 - \time 6/4 - c1. - \time 3/2 - c1. - \time 7/4 - c1 c2. - \time 8/4 - c\breve - \time 9/4 - c2. c2. c2. - \break - \override Staff.TimeSignature #'style = #'mensural - \time 1/1 - c1^"TimeSignature style = \#'mensural" - \time 2/2 - c1 - \time 2/4 - c2 - \time 4/8 - c2 - \time 3/4 - c2. - \time 4/4 - c1 - \time 5/4 - c2. c2 - \time 6/4 - c1. - \time 3/2 - c1. - \time 7/4 - c1 c2. - \time 8/4 - c\breve - \time 9/4 - c2. c2. c2. - \time 6/8 - c2. - \time 9/8 - c4. c4. c4. - \break - \override Staff.TimeSignature #'style = #'neomensural - \time 1/1 - c1^"TimeSignature style = \#'neo\_mensural" - \time 2/2 - c1 - \time 2/4 - c2 - \time 4/8 - c2 - \time 3/4 - c2. - \time 4/4 - c1 - \time 5/4 - c2. c2 - \time 6/4 - c1. - \time 3/2 - c1. - \time 7/4 - c1 c2. - \time 8/4 - c\breve - \time 9/4 - c2. c2. c2. - \time 6/8 - c2. - \time 9/8 - c4. c4. c4. - \break - \override Staff.TimeSignature #'style = #'numbered - \time 1/1 - c1^"TimeSignature style = \#'numbered" - \time 2/2 - c1 - \time 2/4 - c2 - \time 4/8 - c2 - \time 3/4 - c2. - \time 4/4 - c1 - \time 5/4 - c2. c2 - \time 6/4 - c1. - \time 3/2 - c1. - \time 7/4 - c1 c2. - \time 8/4 - c\breve - \time 9/4 - c2. c2. c2. - \break - % If the style starts with a '1', you get this style - \override Staff.TimeSignature #'style = #'1style - \time 1/1 - c1^"TimeSignature style = \#'1xxx" - \time 2/2 - c1 - \time 2/4 - c2 - \time 4/8 - c2 - \time 3/4 - c2. - \time 4/4 - c1 - \time 5/4 - c2. c2 - \time 6/4 - c1. - \time 3/2 - c1. - \time 7/4 - c1 c2. - \time 8/4 - c\breve - \time 9/4 - c2. c2. c2. - } - \paper { } - \midi { } -} - diff --git a/input/test/timing.ly b/input/test/timing.ly deleted file mode 100644 index c61cb653c6..0000000000 --- a/input/test/timing.ly +++ /dev/null @@ -1,33 +0,0 @@ - -\version "2.3.8" -% possible rename to bar-something. - -\header{ texidoc = "@cindex Bar Length - -You can alter the length of bars by setting explicitly -@code{measureLength} or by resetting @code{measurePosition}. " -} - -\score { - \context Voice \relative c { - - - % \set Score.measurePosition = #(ly:make-moment -1 4) - \partial 4 - c''4 c4 c4 c2 c1 - \cadenzaOn c8[ d e f] g[ a b c b c b c] - \cadenzaOff - c4 c4 c4 c4 - \set Score.measureLength = #(ly:make-moment 5 4) - - c1 c4 - c1 c4 - c4 c4 - \set Score.measurePosition = #(ly:make-moment -3 8) - b8 b b - c4 c1 - - } - \paper { raggedright= ##t} -} - diff --git a/input/test/trill.ly b/input/test/trill.ly deleted file mode 100644 index 5042e9c51c..0000000000 --- a/input/test/trill.ly +++ /dev/null @@ -1,30 +0,0 @@ -\version "2.3.8" - -\header { texidoc="@cindex Trill -The extended trill may be produced using @code{TextSpanner} with @code{trill} -spanner style. -" -} - -\paper { raggedright = ##t} - - -{ - \stemDown - \override Stem #'transparent = ##t - \override TextSpanner #'dash-fraction = #0.0 - \override TextSpanner #'dash-period = #1.0 - \override TextSpanner #'edge-height = #'(0 . 1.5) - \override TextSpanner #'edge-text = #'("bla " . "") - a\startTextSpan b c a\stopTextSpan - - - %% TODO: should have trill spanner. - \override TextSpanner #'style = #'trill - \override TextSpanner #'edge-height = #'(0 . 0) - \override TextSpanner #'edge-text - = #(cons (make-musicglyph-markup "scripts-trill") "") - a\startTextSpan b c a\stopTextSpan -} - - diff --git a/input/test/unfold-all-repeats.ly b/input/test/unfold-all-repeats.ly deleted file mode 100644 index 682eaa121e..0000000000 --- a/input/test/unfold-all-repeats.ly +++ /dev/null @@ -1,28 +0,0 @@ -\version "2.3.8" -% regression. -gp - -\header { -texidoc = "Applying the standard function @code{unfold-repeats} unfolds -recursively all repeats for a correct MIDI output." -} - - -mel = \context Staff { - \repeat tremolo 8 {c'32 e' } - \repeat percent 2 { c''8 d'' } - \repeat volta 2 {c'4 d' e' f'} - \alternative { - { g' a' a' g' } - {f' e' d' c' } - } - \bar "|." -} - -\score { { - \mel \break - \applymusic #unfold-repeats \mel - } -} - - - diff --git a/lily/dynamic-text-spanner.cc b/lily/dynamic-text-spanner.cc index b5f47629b2..b47edf2182 100644 --- a/lily/dynamic-text-spanner.cc +++ b/lily/dynamic-text-spanner.cc @@ -141,7 +141,7 @@ Dynamic_text_spanner::print (SCM smob) } ADD_INTERFACE (Dynamic_text_spanner, - "crescendo-text-spanner-interface", + "dynamic-text-spanner-interface", "A text spanner for crescendo texts", "dash-period dash-fraction edge-text style thickness"); diff --git a/lily/score.cc b/lily/score.cc index 14fbb43a40..8e26e425cd 100644 --- a/lily/score.cc +++ b/lily/score.cc @@ -83,6 +83,7 @@ Score::Score (Score const &s) ly_import_module (header_, s.header_); } + LY_DEFINE (ly_run_translator, "ly:run-translator", 2, 0, 0, (SCM mus, SCM output_def), "Process @var{mus} according to @var{output_def}. " @@ -268,7 +269,6 @@ LY_DEFINE (ly_score_embedded_format, "ly:score-embedded-format", SCM_ASSERT_TYPE (sc, score, SCM_ARG1, __FUNCTION__, "Score"); SCM_ASSERT_TYPE (od, paper, SCM_ARG2, __FUNCTION__, "Output_def"); - SCM lines = SCM_EOL; Output_def * score_def = 0; /* UGR, FIXME, these are default \paper blocks once again. They @@ -278,7 +278,7 @@ LY_DEFINE (ly_score_embedded_format, "ly:score-embedded-format", score_def = sc->defs_[i]; if (!score_def) - return lines; + return scm_c_make_vector (0, SCM_EOL); score_def = score_def->clone (); SCM prot = score_def->self_scm (); @@ -289,7 +289,7 @@ LY_DEFINE (ly_score_embedded_format, "ly:score-embedded-format", score_def->parent_ = od; SCM context = ly_run_translator (sc->music_, score_def->self_scm ()); - lines = ly_format_output (context, scm_makfrom0str ("")); + SCM lines = ly_format_output (context, scm_makfrom0str ("")); scm_remember_upto_here_1 (prot); return lines; diff --git a/lily/time-signature.cc b/lily/time-signature.cc index 8342607fa1..d79f96735a 100644 --- a/lily/time-signature.cc +++ b/lily/time-signature.cc @@ -41,17 +41,13 @@ Time_signature::print (SCM smob) } Stencil m; - if (ly_c_symbol_p (st)) + if (st == ly_symbol2scm ("single-digit")) { - String style (ly_scm2string (scm_symbol_to_string (st))); - if (style[0]=='1') - { - m = numbered_time_signature (me, n, 0); - } - else - { - m = special_time_signature (me, st, n, d); - } + m = numbered_time_signature (me, n, 0); + } + else if (ly_c_symbol_p (st)) + { + m = special_time_signature (me, st, n, d); } else m = numbered_time_signature (me, n,d); @@ -151,10 +147,9 @@ ADD_INTERFACE (Time_signature, "time-signature-interface", " typeset with mensural style mensuration marks. All other time\n" " signatures are written with two digits.\n" "\n" -" @item @code{1xxx}\n" +" @item @code{single-digit" " All time signatures are typeset with a single\n" -" digit, e.g. 3/2 is written as 3. (Any symbol starting\n" -" with the digit @code{1} will do.)\n" +" digit, e.g. 3/2 is written as 3.\n" " @end table\n" "\n" "See also the test-file @file{input/test/time.ly}.\n", diff --git a/lily/timing-engraver.cc b/lily/timing-engraver.cc index 2c12f4166a..eebfe748af 100644 --- a/lily/timing-engraver.cc +++ b/lily/timing-engraver.cc @@ -111,5 +111,5 @@ ENTER_DESCRIPTION (Timing_engraver, /* creats*/ "", /* accepts */ "", /* acks */ "", -/* reads */ "timeSignatureFraction automaticBars whichBar barAlways defaultBarType skipBars timing measureLength measurePosition currentBarNumber", +/* reads */ "automaticBars whichBar barAlways defaultBarType skipBars timing measureLength measurePosition currentBarNumber", /* write */ ""); diff --git a/lily/trill-spanner-engraver.cc b/lily/trill-spanner-engraver.cc new file mode 100644 index 0000000000..6bfd91ba6b --- /dev/null +++ b/lily/trill-spanner-engraver.cc @@ -0,0 +1,157 @@ +/* + trill-spanner-engraver.cc -- implement Trill_spanner_engraver + + source file of the GNU LilyPond music typesetter + + (c) 2000--2004 Jan Nieuwenhuizen +*/ + +/* + C&P from text-spanner.cc + + - todo: ending should be detected automatically? a new note + automatically is the end of the trill? + + */ + +#include "note-column.hh" +#include "item.hh" +#include "side-position-interface.hh" +#include "engraver.hh" + +class Trill_spanner_engraver : public Engraver +{ +public: + TRANSLATOR_DECLARATIONS (Trill_spanner_engraver); +protected: + virtual void finalize (); + virtual void acknowledge_grob (Grob_info); + virtual bool try_music (Music *); + virtual void stop_translation_timestep (); + virtual void process_music (); + +private: + Spanner *span_; + Spanner *finished_; + Music *current_req_; + Drul_array req_drul_; + void typeset_all (); +}; + + +Trill_spanner_engraver::Trill_spanner_engraver () +{ + finished_ = 0; + current_req_ = 0; + span_ =0; + req_drul_[START] = 0; + req_drul_[STOP] = 0; +} + +bool +Trill_spanner_engraver::try_music (Music *m) +{ + if (m->is_mus_type ("trill-span-event")) + { + Direction d = to_dir (m->get_property ("span-direction")); + req_drul_[d] = m; + return true; + } + + return false; +} + +void +Trill_spanner_engraver::process_music () +{ + if (req_drul_[STOP]) + { + if (!span_) + { + req_drul_[STOP]->origin ()->warning (_ ("can't find start of trill spanner")); + } + else + { + finished_ = span_; + span_ = 0; + current_req_ = 0; + } + } + + if (req_drul_[START]) + { + if (current_req_) + { + req_drul_[START]->origin ()->warning (_ ("already have a trill spanner")); + } + else + { + current_req_ = req_drul_[START]; + span_ = make_spanner ("TrillSpanner", req_drul_[START]->self_scm ()); + Side_position_interface::set_axis (span_, Y_AXIS); + req_drul_[START] = 0; + } + } +} + +void +Trill_spanner_engraver::acknowledge_grob (Grob_info info) +{ + Spanner * spans[2] ={span_, finished_}; + for (int i = 0; i < 2 ; i++) + { + if (spans[i] && Note_column::has_interface (info.grob_)) + { + Side_position_interface::add_support (spans[i], info.grob_); + add_bound_item (spans[i], dynamic_cast (info.grob_)); + } + } +} + +void +Trill_spanner_engraver::typeset_all () +{ + if (finished_) + { + if (!finished_->get_bound (RIGHT)) + { + Grob* e = unsmob_grob (get_property ("currentMusicalColumn")); + finished_->set_bound (RIGHT, e); + } + finished_ = 0; + } +} + +void +Trill_spanner_engraver::stop_translation_timestep () +{ + if (span_ && !span_->get_bound (LEFT)) + { + Grob* e = unsmob_grob (get_property ("currentMusicalColumn")); + span_->set_bound (LEFT, e); + } + + typeset_all (); + req_drul_[START] = 0; + req_drul_[STOP] = 0; +} + +void +Trill_spanner_engraver::finalize () +{ + typeset_all (); + if (span_) + { + current_req_->origin ()->warning (_ ("unterminated trill spanner")); + span_->suicide (); + span_ = 0; + } +} + +ENTER_DESCRIPTION (Trill_spanner_engraver, +/* descr */ "Create trill spanner from a Music.", +/* creats*/ "TrillSpanner", +/* accepts */ "trill-span-event", +/* acks */ "note-column-interface", +/* reads */ "", +/* write */ ""); diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 1c9ddec642..95020e6caf 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -168,6 +168,7 @@ \consists "Arpeggio_engraver" \consists "Multi_measure_rest_engraver" \consists "Text_spanner_engraver" + \consists "Trill_spanner_engraver" \consists "Grob_pq_engraver" \consists "Forbid_line_break_engraver" diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly index e644e203ea..6392d0933a 100644 --- a/ly/music-functions-init.ly +++ b/ly/music-functions-init.ly @@ -34,6 +34,15 @@ breathe = #(def-music-function (location) () 'origin location 'elements (list (make-music 'BreathingSignEvent)))) + +unfoldrepeats = #(def-music-function (location music) (ly:music?) + (unfold-repeats music)) + +compressmusic = #(def-music-function + (location fraction music) (number-pair? ly:music?) + (ly:music-compress music (ly:make-moment (car fraction) (cdr fraction)))) + + %% \mytag #'foo { ... } ==> OK %% c-\mytag #'foo ^4 ==> KO %{ diff --git a/ly/property-init.ly b/ly/property-init.ly index 3741d33ab8..44f9381311 100644 --- a/ly/property-init.ly +++ b/ly/property-init.ly @@ -180,3 +180,15 @@ semiGermanChords = { \set chordRootNamer = #(chord-name->german-markup #f) \set chordNoteNamer = #note-name->german-markup } + + + +improvisationOn = { + \set squashedPosition = #0 + \override NoteHead #'style = #'slash +} + +improvisationOff = { + \unset squashedPosition + \revert NoteHead #'style +} diff --git a/ly/spanners-init.ly b/ly/spanners-init.ly index 781cd31df8..e8acaa1a0c 100644 --- a/ly/spanners-init.ly +++ b/ly/spanners-init.ly @@ -9,11 +9,16 @@ decr = #(make-span-event 'DecrescendoEvent START) enddecr = #(make-span-event 'DecrescendoEvent STOP) endcr = #(make-span-event 'CrescendoEvent STOP) + startTextSpan = #(make-span-event 'TextSpanEvent START) stopTextSpan = #(make-span-event 'TextSpanEvent STOP) -% TODO: junkme! +startTrillSpan = #(make-span-event 'TrillSpanEvent START) +stopTrillSpan = #(make-span-event 'TrillSpanEvent STOP) + + +% STOP: junkme! cresc = { #(ly:export (make-event-chord (list cr))) \set crescendoText = \markup { \italic "cresc." } diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index be74cb9f77..2a7e5ef9cd 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -1137,6 +1137,18 @@ (direction . 1) (meta . ((interfaces . (text-spanner-interface side-position-interface font-interface spanner-interface)))) )) + (TrillSpanner + . ( + (print-function . ,Dynamic_text_spanner::print) + (edge-text . ,(cons (make-musicglyph-markup "scripts-trill") + "")) + (style . trill) + (staff-padding . 1.0) + (padding . 0.5) + (direction . 1) + (Y-offset-callbacks . (,Side_position_interface::aligned_side)) + (meta . ((interfaces . (text-spanner-interface side-position-interface font-interface spanner-interface)))) + )) (OttavaBracket . ( diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm index 1419de4df8..e3777d7d9a 100644 --- a/scm/define-markup-commands.scm +++ b/scm/define-markup-commands.scm @@ -18,12 +18,18 @@ (def-markup-command (score paper props score) (ly:score?) (let* - ((systems (ly:score-embedded-format score paper)) - (1st (vector-ref systems 0)) - (stencil (ly:paper-system-stencil 1st)) ) - - (ly:stencil-align-to! stencil Y CENTER) - stencil)) + ((systems (ly:score-embedded-format score paper))) + + (if (= 0 (vector-length systems)) + (begin + (ly:warn "No systems found in \\score markup. Did you forget \\paper?") + empty-markup) + (begin + (let* + ((stencil (ly:paper-system-stencil (vector-ref systems 0)))) + + (ly:stencil-align-to! stencil Y CENTER) + stencil))))) (def-markup-command (simple paper props str) (string?) "A simple text string; @code{\\markup @{ foo @}} is equivalent with diff --git a/scm/define-music-types.scm b/scm/define-music-types.scm index 724de3993e..acb25a3095 100644 --- a/scm/define-music-types.scm +++ b/scm/define-music-types.scm @@ -124,14 +124,16 @@ Syntax: (internal-class-name . "Event") (types . (general-music event busy-playing-event)) )) - (StartPlayingEvent + (ContextChange . ( - (description . "Used internally to signal beginning of notes.") + (description . "Change staffs in Piano staff. - (internal-class-name . "Event") - (types . (general-music event start-playing-event)) +Syntax @code{\\translator Staff = @var{new-id}}.") + (internal-class-name . "Music") + (iterator-ctor . , Change_iterator::constructor) + (types . (general-music translator-change-instruction)) )) - + (ClusterNoteEvent . ( (description . "A note that is part of a cluster.") @@ -439,6 +441,17 @@ Syntax @code{r4} for a quarter rest. ") (internal-class-name . "Event") (types . (general-music event rhythmic-event rest-event)) )) + (RevertProperty + . ( + (description . "The opposite of @ref{OverrideProperty}: remove a +previously added property from a graphical object definition + ") + + (internal-class-name . "Music") + (types . (general-music layout-instruction)) + (iterator-ctor . , Pop_property_iterator::constructor) + )) + (SequentialMusic . ( (description . "Music expressions concatenated. @@ -504,17 +517,14 @@ Syntax NOTE( and )NOTE") (types . (general-music span-event slur-event)) )) - (RevertProperty + (StartPlayingEvent . ( - (description . "The opposite of @ref{OverrideProperty}: remove a -previously added property from a graphical object definition - ") + (description . "Used internally to signal beginning of notes.") - (internal-class-name . "Music") - (types . (general-music layout-instruction)) - (iterator-ctor . , Pop_property_iterator::constructor) + (internal-class-name . "Event") + (types . (general-music event start-playing-event)) )) - + (OutputPropertySetMusic . ( (description . "Set grob properties in objects @@ -535,14 +545,11 @@ Syntax @code{\\outputproperty @var{predicate} @var{prop} (types . (general-music span-event text-span-event)) )) - (ContextChange + (TrillSpanEvent . ( - (description . "Change staffs in Piano staff. - -Syntax @code{\\translator Staff = @var{new-id}}.") - (internal-class-name . "Music") - (iterator-ctor . , Change_iterator::constructor) - (types . (general-music translator-change-instruction)) + (description . "Start a trill spanner tr~~~") + (internal-class-name . "Event") + (types . (general-music span-event trill-span-event)) )) (TimeScaledMusic diff --git a/scm/document-backend.scm b/scm/document-backend.scm index ca5217ec34..45d7cf7d4a 100644 --- a/scm/document-backend.scm +++ b/scm/document-backend.scm @@ -94,10 +94,9 @@ (define (grob-doc description) "Given a property alist DESCRIPTION, make a documentation node." - + (let* - ( - (metah (assoc 'meta description)) + ((metah (assoc 'meta description)) (meta (cdr metah)) (name (cdr (assoc 'name meta))) (ifaces (map lookup-interface (cdr (assoc 'interfaces meta)))) @@ -108,8 +107,7 @@ node." (engravers (filter (lambda (x) (engraver-makes-grob? name x)) all-engravers-list)) (namestr (symbol->string name)) - (engraver-names (map symbol->string (map ly:translator-name engravers))) - ) + (engraver-names (map symbol->string (map ly:translator-name engravers)))) (make #:name namestr diff --git a/scm/lily.scm b/scm/lily.scm index a6346dc89a..1e4ef64b95 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -120,6 +120,8 @@ (define-public (collect-music-for-book parser music) (collect-scores-for-book parser (ly:music-scorify music))) + + ;;;;;;;;;;;;;;;; ; alist -- 2.39.5