From d9e57e198888ce00fbf9acd84c351356de94552f Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Thu, 15 Jan 2004 17:01:41 +0000 Subject: [PATCH] * lily/sequential-iterator.cc (run_always): implement run_always(). * input/mutopia/F.Schubert/standchen.ly: use newaddlyrics. * lily/event.cc (to_relative_octave): add octave-check. * Documentation/user/refman.itely (Line breaking): add noBreak. * scm/new-markup.scm (normalsize-markup): add function. (sans-markup): new function. --- ChangeLog | 8 ++ Documentation/topdocs/NEWS.texi | 13 +++ Documentation/user/refman.itely | 27 ++++- input/mutopia/F.Schubert/standchen.ly | 141 ++++++++++---------------- lily/accidental-placement.cc | 12 +++ lily/bar-number-engraver.cc | 2 +- lily/break-align-interface.cc | 2 +- lily/event.cc | 16 +++ lily/include/sequential-iterator.hh | 2 +- lily/parser.yy | 21 +++- lily/sequential-iterator.cc | 6 ++ lily/tie.cc | 4 +- mf/feta-bolletjes.mf | 64 ++++++++---- scm/define-music-properties.scm | 2 + scm/new-markup.scm | 2 +- 15 files changed, 207 insertions(+), 115 deletions(-) diff --git a/ChangeLog b/ChangeLog index 19bc31fda2..4e37cb824b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2004-01-15 Han-Wen Nienhuys + * lily/sequential-iterator.cc (run_always): implement run_always(). + + * input/mutopia/F.Schubert/standchen.ly: use newaddlyrics. + + * lily/event.cc (to_relative_octave): add octave-check. + + * Documentation/user/refman.itely (Line breaking): add noBreak. + * scm/new-markup.scm (normalsize-markup): add function. (sans-markup): new function. diff --git a/Documentation/topdocs/NEWS.texi b/Documentation/topdocs/NEWS.texi index d3cd476a21..f85b750578 100644 --- a/Documentation/topdocs/NEWS.texi +++ b/Documentation/topdocs/NEWS.texi @@ -18,6 +18,19 @@ Version 2.1.9 @itemize @bullet +@item +A more concise syntax for checking octaves was introduced. A note may +be followed by @code{=}@var{quotes} which indicates what its absolute +octave should be. In the following example, + +@example + \relative c'' @{ c='' b=' d,='' @} +@end example + +@noindent +the @code{d} will generate a warning, because a @code{d''} is +expected, but a @code{d'} is found. + @item There is a new mechanism for putting lyrics to melodies. With this mechanism, @code{LyricVoice}s can be put melodies individually, allowing for different melismatic sections in every diff --git a/Documentation/user/refman.itely b/Documentation/user/refman.itely index 046fd056da..b4a76cf3fa 100644 --- a/Documentation/user/refman.itely +++ b/Documentation/user/refman.itely @@ -635,8 +635,19 @@ additional @code{\relative} inside the @code{\transpose}. @subsection Octave check -Octave checks make octave errors easier to correct. -The syntax is +Octave checks make octave errors easier to correct: a note may be +followed by @code{=}@var{quotes} which indicates what its absolute +octave should be. In the following example, +@example + \relative c'' @{ c='' b=' d,='' @} +@end example + +@noindent +the @code{d} will generate a warning, because a @code{d''} is +expected, but a @code{d'} is found. In the output, the octave is +corrected this and the following notes. + +There is also a syntax that is separate from the notes. @example \octave @var{pitch} @end example @@ -8490,14 +8501,22 @@ point. For linebreaks at regular intervals use @code{\break} separated by skips and repeated with @code{\repeat}: @example -<< \repeat unfold 7 @{ s1 * 4 \break @} +<< \repeat unfold 7 @{ + s1 \noBreak s1 \noBreak + s1 \noBreak s1 \break @} @emph{the real music} >> @end example @noindent This makes the following 28 measures (assuming 4/4 time) be broken every -4 measures. +4 measures, and only there. + +@refcommands + +@code{\break}, @code{\noBreak} +@cindex @code{\break} +@cindex @code{\noBreak} @seealso diff --git a/input/mutopia/F.Schubert/standchen.ly b/input/mutopia/F.Schubert/standchen.ly index 7eb9d157fc..6d2b32b3fb 100644 --- a/input/mutopia/F.Schubert/standchen.ly +++ b/input/mutopia/F.Schubert/standchen.ly @@ -115,48 +115,48 @@ vocalThrough = \notes\relative c{ e2 r4 | } -lyricVerseOne = \lyrics{ +lyricVerseOne = \lyrics { Lei -- se fle -- hen mei -- ne Lie -- der durch die Nacht zu dir; in den stil -- len Hain her nie -- der, Lieb -- chen, komm zu mir! - Fl\"us -- ternd schlan -- ke Wip -- fel rau -- schen + Flüs -- ternd schlan -- ke Wip -- fel rau -- schen in des Mon -- des Licht, in des Mon -- des Licht; - des Ver -- r\"a -- ters feind -- lich Lau -- schen - f\"urch -- te, Hol -- de, nicht, - f\"urch -- te, Hol -- de, nicht. + des Ver -- rä -- ters feind -- lich Lau -- schen + fürch -- te, Hol -- de, nicht, + fürch -- te, Hol -- de, nicht. } lyricVerseTwo = \lyrics{ - H\"orst die Nach -- ti -- gal -- len schla -- gen? + Hörst die Nach -- ti -- gal -- len schla -- gen? ach! sie fle -- hen dich, - mit der T\"o -- ne s\"u -- "\ss en" Kla -- gen - fle -- hen sie f\"ur mich. + mit der Tö -- ne sü -- "\ss en" Kla -- gen + fle -- hen sie für mich. Sie -- ver -- "steh'n" des Bu -- sens Seh -- nen, ken -- nen Lieb -- es -- schmerz, ken -- nen Lieb -- es -- schmerz, - r\"uh -- ren mit den Sil -- ber -- t\"o -- nen + rüh -- ren mit den Sil -- ber -- tö -- nen jed -- es wei -- che Herz, jed -- es wei -- che Herz. } lyricThrough = \lyrics{ La\ss auch dir die Brust be -- we -- gen - Lieb -- chen, h\"o -- re mich! + Lieb -- chen, hö -- re mich! be -- bend harr' ich dir ent -- ge -- gen! - komm, be -- gl\"uk -- ke mich! - komm, be -- gl\"uk -- ke mich, __ - be -- gl\"uk -- ke mich! + komm, be -- glük -- ke mich! + komm, be -- glük -- ke mich, __ + be -- glük -- ke mich! } trebleIntro = \notes\relative c{ - r8^"\bf M\\\"a\\ss ig"\pp -. -. -. -. -. | + r8^"\bf Mäßig"\pp -. -. -. -. -. | r8 -. -. -. -. -. | r8 -. -. -. -. -. | r8 -. -. -. -. -. | @@ -380,20 +380,15 @@ global = \notes{ \bar "|." } -allLyrics = \lyrics { +allLyrics = { % maybe should be bigger by default, in grob-description.scm ? - \property Lyrics . LyricText \override #'font-size = #2 - \property Lyrics . LyricHyphen \override #'maximum-length = #1.5 - \context LyricsVoice = "leise-1" { \lyricVerseOne - \lyricVerseTwo - \lyricThrough + \newaddlyrics "leise" \new LyricsVoice { + \lyricVerseOne + \lyricVerseTwo + \lyricThrough } } -lyricStaff = \context Lyrics { - \allLyrics -} - -vocals = \context Voice \notes { +vocals = \context Voice = leise \notes { \clef treble % certainly no auto-beaming for vocals \autoBeamOff @@ -408,82 +403,58 @@ vocals = \context Voice \notes { R1 * 3/4 * 6 } -vocalStaff = \context Staff = vocal<< - \property Staff.midiInstrument = "synth voice" - \context Voice = "leise" << \global - \vocals >> ->> - -treble = { - \clef treble +trebleStaff = \context Staff = treble<< + \property Staff.midiInstrument = "acoustic grand" + \global + {\clef treble \property Voice.autoBeamSettings \override #'(begin * * * *) = #(ly:make-moment 0 1) \trebleIntro \trebleVerseOne \trebleEentje \trebleVerseOne - \trebleThrough -} + \trebleThrough } +>> -trebleStaff = \context Staff = treble<< +bassStaff = \context Staff = bass<< \property Staff.midiInstrument = "acoustic grand" \global - \treble ->> -bass = { \clef bass - \bassIntro + {\bassIntro \bassVerseOne \bassEentje \bassVerseOne - \bassThrough -} - -bassStaff = \context Staff = bass<< - \property Staff.midiInstrument = "acoustic grand" - \global - \bass ->> - -grandStaff = \context PianoStaff << - - \trebleStaff - \bassStaff + \bassThrough} >> \score{ - << - -%{ - Transpose as you like for your voice - Range untransposed is c' to f'' (for tenors and sopranos) - \transpose c' a gives a' to d'' (for basses, who sing an octave down) - - \addlyrics - \notes \transpose c' a \vocalStaff - \lyricStaff - \notes \transpose c' a \grandStaff -%} - - \addlyrics - \vocalStaff - \lyricStaff - \grandStaff + << + \new Staff << + \property Staff.midiInstrument = "synth voice" + %% insert \transpose if necessary, depending on voice range. + \global + \vocals >> - \paper { - % Use - % textheight = 280.\mm - % linewidth = 190.\mm - % to get this on 3 pages of a4. - - % Mandatory Mutopia settings yield 4 pages :( - textheight = 270.0\mm - linewidth = 180.0\mm - - \translator { \RemoveEmptyStaffContext } - } - \midi{ - \tempo 4 = 54 - } + \allLyrics + \context PianoStaff << + \trebleStaff + \bassStaff + >> + >> + \paper { + % Use + % textheight = 280.\mm + % linewidth = 190.\mm + % to get this on 3 pages of a4. + + % Mandatory Mutopia settings yield 4 pages :( + textheight = 270.0\mm + linewidth = 180.0\mm + + \translator { \RemoveEmptyStaffContext } + } + \midi{ + \tempo 4 = 54 + } } diff --git a/lily/accidental-placement.cc b/lily/accidental-placement.cc index d8bd7aaeb8..13aef52ad4 100644 --- a/lily/accidental-placement.cc +++ b/lily/accidental-placement.cc @@ -234,6 +234,18 @@ stagger_apes (Link_array *apes) */ +/* + TODO: there should be more space in the following situation + + + Natural + downstem + + |_ + | | X + |_| | + | | + + */ SCM Accidental_placement::position_accidentals (Grob * me) { diff --git a/lily/bar-number-engraver.cc b/lily/bar-number-engraver.cc index e2689a9482..5b6a134947 100644 --- a/lily/bar-number-engraver.cc +++ b/lily/bar-number-engraver.cc @@ -34,7 +34,7 @@ protected: virtual void acknowledge_grob (Grob_info); virtual void process_music (); void create_items (); - TRANSLATOR_DECLARATIONS( Bar_number_engraver ); + TRANSLATOR_DECLARATIONS(Bar_number_engraver ); }; diff --git a/lily/break-align-interface.cc b/lily/break-align-interface.cc index dcef533e75..4742c948a6 100644 --- a/lily/break-align-interface.cc +++ b/lily/break-align-interface.cc @@ -239,7 +239,7 @@ ADD_INTERFACE (Break_aligned_interface, "break-aligned-interface", "@table @code\n" "@item (minimum-space . @var{spc}))\n" " Pad space until the distance is @var{spc}\n" - "@item (fixed-space} . @var{spc})\n" + "@item (fixed-space . @var{spc})\n" " Set a fixed space\n" "@item (semi-fixed-space . @var{spc})\n" " Set a space. Half of it is fixed and half is stretchable. \n" diff --git a/lily/event.cc b/lily/event.cc index 75948dac04..ed0a826c69 100644 --- a/lily/event.cc +++ b/lily/event.cc @@ -61,6 +61,22 @@ Event::to_relative_octave (Pitch last) { Pitch new_pit = *old_pit; new_pit = new_pit.to_relative_octave (last); + + SCM check = get_mus_property ("absolute-octave"); + if (gh_number_p (check) && + new_pit.get_octave () != gh_scm2int (check)) + { + String s =_("Failed octave check, got: "); + s += new_pit.to_string (); + new_pit = Pitch (gh_scm2int (check), + new_pit.get_notename (), + new_pit.get_alteration ()); + + s += " expected "; + s += new_pit.to_string (); + origin ()->warning (s); + } + set_mus_property ("pitch", new_pit.smobbed_copy ()); return new_pit; diff --git a/lily/include/sequential-iterator.hh b/lily/include/sequential-iterator.hh index c9850c33a5..382a3211fe 100644 --- a/lily/include/sequential-iterator.hh +++ b/lily/include/sequential-iterator.hh @@ -69,7 +69,7 @@ public: protected: virtual void process (Moment); virtual Music_iterator *try_music_in_children (Music *) const; - + virtual bool run_always () const; protected: Moment here_mom_; Music_iterator * iter_; diff --git a/lily/parser.yy b/lily/parser.yy index 9018962644..077578e4b3 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -317,6 +317,7 @@ yylex (YYSTYPE *s, void * v) %type exclamations questions dots optional_rest %type bass_mod %type grace_head +%type oct_check %type context_mod_list %type lyric_element %type bass_number br_bass_figure bass_figure figure_list figure_spec @@ -1566,7 +1567,14 @@ direction_reqd_event: $$ = a; } ; - + +oct_check: + /**/ { $$ = SCM_EOL; } + | '=' { $$ = gh_int2scm (0); } + | '=' sub_quotes { $$ = gh_int2scm ($2); } + | '=' sup_quotes { $$ = gh_int2scm ($2); } + ; + sup_quotes: '\'' { $$ = 1; @@ -1917,21 +1925,26 @@ optional_rest: ; simple_element: - pitch exclamations questions optional_notemode_duration optional_rest { + pitch exclamations questions oct_check optional_notemode_duration optional_rest { Input i = THIS->pop_spot (); if (!THIS->lexer_->note_state_b ()) THIS->parser_error (_ ("Have to be in Note mode for notes")); Music *n = 0; - if ($5) + if ($6) n = MY_MAKE_MUSIC("RestEvent"); else n = MY_MAKE_MUSIC("NoteEvent"); n->set_mus_property ("pitch", $1); - n->set_mus_property ("duration", $4); + n->set_mus_property ("duration", $5); + if (gh_number_p ($4)) + { + int q = gh_scm2int ($4); + n->set_mus_property ("absolute-octave", gh_int2scm (q-1)); + } if ($3 % 2) n->set_mus_property ("cautionary", SCM_BOOL_T); diff --git a/lily/sequential-iterator.cc b/lily/sequential-iterator.cc index e8812c486e..b2c3126977 100644 --- a/lily/sequential-iterator.cc +++ b/lily/sequential-iterator.cc @@ -378,3 +378,9 @@ Sequential_iterator::try_music_in_children (Music *m) const } IMPLEMENT_CTOR_CALLBACK (Sequential_iterator); + +bool +Sequential_iterator::run_always () const +{ + return iter_ ? iter_->run_always () : false; +} diff --git a/lily/tie.cc b/lily/tie.cc index 8d5bee5149..846acaa28f 100644 --- a/lily/tie.cc +++ b/lily/tie.cc @@ -77,13 +77,15 @@ Tie::get_position (Grob*me) The direction of the Tie is more complicated (See [Ross] p136 and further). + + (what about linebreaks? ) + */ Direction Tie::get_default_dir (Grob*me) { Item * sl = head (me,LEFT) ? Rhythmic_head::get_stem (head (me,LEFT)) :0; Item * sr = head (me,RIGHT) ? Rhythmic_head::get_stem (head (me,RIGHT)) :0; - if (sl && sr) { if (get_grob_direction (sl) == UP diff --git a/mf/feta-bolletjes.mf b/mf/feta-bolletjes.mf index e65a03ff00..6cdf6b9290 100644 --- a/mf/feta-bolletjes.mf +++ b/mf/feta-bolletjes.mf @@ -183,55 +183,85 @@ fet_beginchar("Quart notehead", "2", "quarthead") black_notehead_width# := charwd; fet_endchar; +%%%%%%%%%%%%%%%% + fet_beginchar("Quart noteheadPQ", "2PQ", "quartheadPQ") draw_outside_ellipse (1.0 - puff_up_factor / 2.0, 32, 0.707, 0); fet_endchar; fet_beginchar("Quart noteheadAA", "2AA", "quartheadAA") - draw_outside_ellipse (1.2 - puff_up_factor / 2.0, 32, 0.707, 0); + draw_outside_ellipse (1.35 - puff_up_factor / 2.0, 32, 0.707, 0); fet_endchar; fet_beginchar("Quart noteheadAB", "2AB", "quartheadAB") - draw_outside_ellipse (1.3 - puff_up_factor / 2.0, 32, 0.707, 0); + draw_outside_ellipse (1.4 - puff_up_factor / 2.0, 32, 0.707, 0); fet_endchar; fet_beginchar("Quart noteheadAC", "2AC", "quartheadAC") - draw_outside_ellipse (1.4 - puff_up_factor / 2.0, 32, 0.707, 0); - + draw_outside_ellipse (1.45 - puff_up_factor / 2.0, 32, 0.707, 0); fet_endchar; + fet_beginchar("Quart noteheadAD", "2AD", "quartheadAD") draw_outside_ellipse (1.5 - puff_up_factor / 2.0, 32, 0.707, 0); - fet_endchar; + +fet_beginchar("Quart noteheadAD", "2AE", "quartheadAD") + draw_outside_ellipse (1.55 - puff_up_factor / 2.0, 32, 0.707, 0); +fet_endchar; + +fet_beginchar("Quart noteheadAD", "2AF", "quartheadAD") + draw_outside_ellipse (1.6 - puff_up_factor / 2.0, 32, 0.707, 0); +fet_endchar; +fet_beginchar("Quart noteheadAD", "2AG", "quartheadAD") + draw_outside_ellipse (1.65 - puff_up_factor / 2.0, 32, 0.707, 0); +fet_endchar; + + fet_beginchar("Quart noteheadBA", "2BA", "quartheadBA") - draw_outside_ellipse (1.2 - puff_up_factor / 2.0, 35, 0.707, 0); - + draw_outside_ellipse (1.35 - puff_up_factor / 2.0, 35, 0.707, 0); fet_endchar; fet_beginchar("Quart noteheadBB", "2BB", "quartheadBB") - draw_outside_ellipse (1.3 - puff_up_factor / 2.0, 35, 0.707, 0); + draw_outside_ellipse (1.4 - puff_up_factor / 2.0, 35, 0.707, 0); fet_endchar; fet_beginchar("Quart noteheadBC", "2BC", "quartheadBC") - draw_outside_ellipse (1.4 - puff_up_factor / 2.0, 35, 0.707, 0); + draw_outside_ellipse (1.45 - puff_up_factor / 2.0, 35, 0.707, 0); fet_endchar; fet_beginchar("Quart noteheadBD", "2BD", "quartheadBD") draw_outside_ellipse (1.5 - puff_up_factor / 2.0, 35, 0.707, 0); - fet_endchar; +fet_beginchar("Quart noteheadBD", "2BE", "quartheadBD") + draw_outside_ellipse (1.55 - puff_up_factor / 2.0, 35, 0.707, 0); +fet_endchar; +fet_beginchar("Quart noteheadBD", "2BF", "quartheadBD") + draw_outside_ellipse (1.6 - puff_up_factor / 2.0, 35, 0.707, 0); +fet_endchar; +fet_beginchar("Quart noteheadBD", "2BG", "quartheadBD") + draw_outside_ellipse (1.65 - puff_up_factor / 2.0, 35, 0.707, 0); +fet_endchar; + + + fet_beginchar("Quart noteheadCA", "2CA", "quartheadCA") - draw_outside_ellipse (1.2 - puff_up_factor / 2.0, 38, 0.707, 0); - + draw_outside_ellipse (1.35 - puff_up_factor / 2.0, 40, 0.707, 0); fet_endchar; fet_beginchar("Quart noteheadCB", "2CB", "quartheadCB") - draw_outside_ellipse (1.3 - puff_up_factor / 2.0, 38, 0.707, 0); - + draw_outside_ellipse (1.4 - puff_up_factor / 2.0, 40, 0.707, 0); fet_endchar; fet_beginchar("Quart noteheadCC", "2CC", "quartheadCC") - draw_outside_ellipse (1.4 - puff_up_factor / 2.0, 38, 0.707, 0); - + draw_outside_ellipse (1.45 - puff_up_factor / 2.0, 40, 0.707, 0); fet_endchar; fet_beginchar("Quart noteheadCD", "2CD", "quartheadCD") - draw_outside_ellipse (1.5 - puff_up_factor / 2.0, 38, 0.707, 0); + draw_outside_ellipse (1.5 - puff_up_factor / 2.0, 40, 0.707, 0); +fet_endchar; +fet_beginchar("Quart noteheadCD", "2CE", "quartheadCD") + draw_outside_ellipse (1.55 - puff_up_factor / 2.0, 40, 0.707, 0); +fet_endchar; +fet_beginchar("Quart noteheadCD", "2CF", "quartheadCD") + draw_outside_ellipse (1.6 - puff_up_factor / 2.0, 40, 0.707, 0); +fet_endchar; +fet_beginchar("Quart noteheadCD", "2CG", "quartheadCD") + draw_outside_ellipse (1.65 - puff_up_factor / 2.0, 40, 0.707, 0); fet_endchar; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/scm/define-music-properties.scm b/scm/define-music-properties.scm index fde1f61f61..c368355c2a 100644 --- a/scm/define-music-properties.scm +++ b/scm/define-music-properties.scm @@ -27,6 +27,8 @@ (music-property-description 'span-type string? "What kind of spanner should be created? TODO: consider making type into symbol") +(music-property-description 'absolute-octave integer? + "The absolute octave for a octave check note.") (music-property-description 'articulations music-list? "Articulation events specifically for this note.") (music-property-description 'articulation-type string? "key for script definitions alist. diff --git a/scm/new-markup.scm b/scm/new-markup.scm index 4fd60acdc0..3c2c55b4a8 100644 --- a/scm/new-markup.scm +++ b/scm/new-markup.scm @@ -53,7 +53,7 @@ for the reader. (define-public (simple-markup paper props . rest) "A simple text-string; @code{\\markup @{ foo @}} is equivalent with -@code{\markup @{ \simple #\"foo\" @}}. +@code{\\markup @{ \\simple #\"foo\" @}}. " (Text_item::interpret_markup paper props (car rest))) -- 2.39.2