From 39602a47ea7188b6a248c0e63e7bd326bf3e1b81 Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 26 Mar 2002 22:14:47 +0000 Subject: [PATCH] lilypond-1.1.54 --- Documentation/tex/engraving.bib | 10 ++ Documentation/topdocs/INSTALL.yo | 34 +++-- Documentation/topdocs/index.yo | 2 +- input/test/chord-table.ly | 2 +- input/test/notemode-chords.ly | 5 +- input/test/perform-grace.fly | 5 + input/test/perform-tie.fly | 2 +- input/test/rhythm-lyric.ly | 12 ++ input/test/rhythm-melody.fly | 1 + input/test/rhythm.ly | 5 + input/twinkle.ly | 92 ++++++------ lily/audio-element.cc | 1 + lily/audio-item.cc | 13 ++ lily/auto-beam-engraver.cc | 2 + lily/chord-name-engraver.cc | 2 +- lily/grace-iterator.cc | 13 +- lily/grace-performer-group.cc | 7 +- lily/grace-position-performer.cc | 124 ++++++++++++++++ lily/include/audio-element.hh | 3 + lily/include/audio-item.hh | 5 + lily/include/grace-iterator.hh | 2 + lily/include/lily-proto.hh | 2 + lily/include/midi-item.hh | 3 +- lily/include/midi-walker.hh | 2 +- lily/include/music-iterator.hh | 3 + lily/include/music-list-iterator.hh | 1 + lily/include/music-list.hh | 5 + lily/include/music-wrapper-iterator.hh | 1 + lily/include/music-wrapper.hh | 1 + lily/include/music.hh | 1 + lily/include/my-lily-parser.hh | 3 + lily/include/new-repeated-music.hh | 1 + lily/include/note-performer.hh | 3 + lily/include/re-rhythmed-music.hh | 27 ++++ lily/include/relative-music.hh | 1 + lily/include/request-iterator.hh | 2 + lily/include/sequential-music-iterator.hh | 1 + lily/include/transposed-music.hh | 1 + lily/midi-item.cc | 7 +- lily/midi-walker.cc | 4 +- lily/music-iterator.cc | 5 + lily/music-list-iterator.cc | 6 + lily/music-list.cc | 52 ++++++- lily/music-sequence.cc | 5 + lily/music-wrapper-iterator.cc | 6 + lily/music-wrapper.cc | 7 +- lily/music.cc | 6 + lily/my-lily-lexer.cc | 1 + lily/my-lily-parser.cc | 9 +- lily/note-performer.cc | 54 ++++++- lily/re-rhythmed-music.cc | 41 ++++++ lily/relative-octave-music.cc | 7 +- lily/repeated-music.cc | 11 ++ lily/request-iterator.cc | 23 ++- lily/sequential-music-iterator.cc | 34 +++++ lily/tie-performer.cc | 10 +- lily/transposed-music.cc | 8 +- ly/performer.ly | 55 ++++--- mutopia/E.Satie/gnossienne-4.ly | 32 +++- mutopia/F.Schubert/standchen.ly | 171 ++++++++-------------- scripts/abc-2-ly.py | 110 ++++++++++---- 61 files changed, 804 insertions(+), 260 deletions(-) create mode 100644 input/test/perform-grace.fly create mode 100644 input/test/rhythm-lyric.ly create mode 100644 input/test/rhythm-melody.fly create mode 100644 input/test/rhythm.ly create mode 100644 lily/grace-position-performer.cc create mode 100644 lily/include/re-rhythmed-music.hh create mode 100644 lily/re-rhythmed-music.cc diff --git a/Documentation/tex/engraving.bib b/Documentation/tex/engraving.bib index ab4099acce..bfa65238d3 100644 --- a/Documentation/tex/engraving.bib +++ b/Documentation/tex/engraving.bib @@ -79,6 +79,16 @@ work for music notation issues as one is likely to get. MB}, isbn = {ISBN 3-7957-2886-x}, } +{willemze, + note = {A comprehensive overview of music theory; +the (Dutch) authority on general music theory}, + year = {1964-1993}, + title = {Algemene muziekleer}, + author = {Theo Willemze}, + publisher = {Aula, Het Spectrum}, + address = {Utrecht}, + isbn = {ISBN 90-274-1817-9}, +} @Book {hader48, diff --git a/Documentation/topdocs/INSTALL.yo b/Documentation/topdocs/INSTALL.yo index 0c9e54d424..e4d9dc3412 100644 --- a/Documentation/topdocs/INSTALL.yo +++ b/Documentation/topdocs/INSTALL.yo @@ -100,19 +100,18 @@ conversion tools. itemize( it()xpmtoppm (from the Portable Bitmap Utilities) (For RedHat Linux users: it is included within the package libgr-progs). -it()Bib2html lurl(http://pertsserver.cs.uiuc.edu/~hull/bib2html.) - Which, in turn depends on man2html for proper installation. -man2html can be had from lurl(http://askdonald.ask.uni-karlsruhe.de/hppd/hpux/Networking/WWW/Man2html-1.05). + the original is at +lurl(ftp://ftp.x.org/contrib/utilities/netpbm-1mar1994.p1.tar.gz) - TeTeX users should not forget to rerun texhash. -) +it()pnmtopng, which is also in libgr-progs for RedHat. The original is +at +lurl(ftp://swrinde.nde.swri.edu/pub/png/applications/pnmtopng-2.37.2.tar.gz).i -Building the website requires pnmtopng. The version of file(pnmtopng) -that is distributed with RedHat 5.1 and 5.2 contains a bug: pnmtopng -is dynamically linked to the wrong version of libpng. Recompile it -from source, and make sure that the pnmtopng binary is linked -statically to the libpng that is included in libgr. RedHat 6.0 does -not have this problem. +The version of file(pnmtopng) that is distributed with RedHat 5.1 and +5.2 contains a bug: pnmtopng is dynamically linked to the wrong +version of libpng. Recompile it from source, and make sure that the +pnmtopng binary is linked statically to the libpng that is included in +libgr. RedHat 6.0 does not have this problem. verb( tar xzf libgr-2.0.13.tar.gz make @@ -123,6 +122,17 @@ verb( tar xzf libgr-2.0.13.tar.gz You can then install the new pnmtopng into /usr/local/bin/ +it()Bib2html lurl(http://pertsserver.cs.uiuc.edu/~hull/bib2html.) + Which, in turn depends on man2html for proper installation. +man2html can be had from lurl(http://askdonald.ask.uni-karlsruhe.de/hppd/hpux/Networking/WWW/Man2html-1.05). + + TeTeX users should not forget to rerun texhash. +) + +You also have to install file(buildscripts/out/ps-to-gifs) in a +directory that is in the path. + + sect(CONFIGURING and COMPILING) to install GNU LilyPond, simply type: @@ -292,7 +302,7 @@ verb( rpm -i /usr/src/redhat/RPMS/i386/lilypond-x.y.z ) -Precompiled i386 eRedHat RPMS are available from +Precompiled i386 RedHat RPMS are available from lurl(http://linux.umbc.edu/software/lilypond/rpms/). diff --git a/Documentation/topdocs/index.yo b/Documentation/topdocs/index.yo index 804d96aeb9..7cc1afc560 100644 --- a/Documentation/topdocs/index.yo +++ b/Documentation/topdocs/index.yo @@ -71,7 +71,7 @@ it()url(FAQ)(DOEXPAND(docdir)/DOEXPAND(outdir)/faq.html) it()url(Mailing Lists)(DOEXPAND(docdir)/DOEXPAND(outdir)/mail.html) it()url(All of the LilyPond documentation)(DOEXPAND(docdir)/DOEXPAND(outdir)/index.html) it()url(The DOC++ documentation of the C++ sources.)(DOEXPAND(depth)/docxx/index.html) -it()url(The installation instructions)(DOEXPAND(tops)/INSTALL.html) +it()url(The installation instructions)(INSTALL.html) ) nsect(Sites) diff --git a/input/test/chord-table.ly b/input/test/chord-table.ly index 907782915f..c2b30c2c92 100644 --- a/input/test/chord-table.ly +++ b/input/test/chord-table.ly @@ -5,7 +5,7 @@ enteredby = "jcn"; } tab = \notes\transpose c'''\chords{ - c1 c-m c-4 c-m4 c-5+ c-5- c-m5- c-5-.5+ c-6\break %c-m6\break + c1 c-m c-4 c-m.4 c-5+ c-5- c-m.5- c-5-.5+ c-6\break %c-m6\break } \score{ diff --git a/input/test/notemode-chords.ly b/input/test/notemode-chords.ly index 5b26d4c1c2..a096409a42 100644 --- a/input/test/notemode-chords.ly +++ b/input/test/notemode-chords.ly @@ -2,7 +2,10 @@ \score{ \notes \transpose c''{ - @c1@ @c-7@ @c-7^5@-1-3 +% 1.1.53: @x@ syntax dropped +% if you want fingering, write chord explicitily; eg < c1-1 e-2 g-3 > +% @c1@ @c-7@ @c-7^5@-1-3 + \chords { c1 c-7 c-7^5 } } } diff --git a/input/test/perform-grace.fly b/input/test/perform-grace.fly new file mode 100644 index 0000000000..c24ded8cb8 --- /dev/null +++ b/input/test/perform-grace.fly @@ -0,0 +1,5 @@ +\context Voice=VoiceOne +\property Voice.graceFraction = "1/4" +\grace c8 d4 d d d d +\property Voice.graceFraction = "1/2" +\grace { e16 f e f } d4 d d d d diff --git a/input/test/perform-tie.fly b/input/test/perform-tie.fly index 484f1368c5..5bd1eca9aa 100644 --- a/input/test/perform-tie.fly +++ b/input/test/perform-tie.fly @@ -1,2 +1,2 @@ -c8 c c ~ c c c c ~ c ~ c ~ c ~ c c c +c8 c c ~ c c c c ~ c ~ c ~ c c c %\grace { d16 c16 d16 } c8 diff --git a/input/test/rhythm-lyric.ly b/input/test/rhythm-lyric.ly new file mode 100644 index 0000000000..b9413ec88f --- /dev/null +++ b/input/test/rhythm-lyric.ly @@ -0,0 +1,12 @@ +text = \lyrics { Feel the rhy- thm } + +melody = \notes { + e4. d8 e4. c8 +} + +\score{ + < + \context Voice \notes\relative c'' \melody + \context Lyrics \rhythm \melody \text + > +} diff --git a/input/test/rhythm-melody.fly b/input/test/rhythm-melody.fly new file mode 100644 index 0000000000..7365625e35 --- /dev/null +++ b/input/test/rhythm-melody.fly @@ -0,0 +1 @@ +\rhythm { 4. 8 8. 16 } { c'' d e f } diff --git a/input/test/rhythm.ly b/input/test/rhythm.ly new file mode 100644 index 0000000000..c4125e26a3 --- /dev/null +++ b/input/test/rhythm.ly @@ -0,0 +1,5 @@ +\score{ + \context Voice \notes\relative c''{ + c4. 8 4. 8 + } +} diff --git a/input/twinkle.ly b/input/twinkle.ly index 1f5c15fa1b..168558215f 100644 --- a/input/twinkle.ly +++ b/input/twinkle.ly @@ -16,7 +16,8 @@ traditional song in various languages. %} %{ -Tested Features: lyrics, interleaving lyrics and staffs, repeats +Tested Features: lyrics, interleaving lyrics and staffs, repeats, + auto beaming, applying new rhythm on lyrics %} \version "1.1.52"; @@ -52,12 +53,12 @@ global = \notes { } tekst = \lyrics{ - Al-4 tijd is Kort- jak- je ziek,2 - midden4 "in de" week maar "'s zon-" dags niet.2 - "'s Zon-"4 dags gaat ze naar de kerk,2 - met4 een boek vol zil- ver werk.2 - Al-4 tijd is Kort- jak- je ziek,2 - mid-8 den in de week4 maar "'s zon-" dags niet.2 + Al- tijd is Kort- jak- je ziek, " " + midden "in de" week maar "'s zon-" dags " " niet. + "'s Zon-" dags gaat ze naar de kerk, " " + met een boek vol zil- ver " " werk. " " + Al- tijd is Kort- jak- je ziek, " " + midden "in de" week maar "'s zon-" dags " " niet. } @@ -67,64 +68,73 @@ tekst. Mogen wij ook af en toe ergens op afgeven? %} hegedraagjetekst = \lyrics{ - Al-4 tijd zuigt Bill Gates mijn piek,2 - "\TeX"4 is slecht- ser dan mu- ziek.2 - "'s Zon-"4 dags gaat het door een raam,2 - Weet4 dat ik me er- voor schaam.2 - Al-4 tijd zuigt Bill Gates mijn piek,2 - "\TeX"4 is slecht- ser dan mu- ziek.2 + Al- tijd zuigt Bill Gates mijn piek, " " + "\TeX" is slecht- ser dan mu- " " ziek. + "'s Zon-" dags gaat het door een raam, " " + Weet dat ik me er- voor " " schaam. + Al- tijd zuigt Bill Gates mijn piek, " " + "\TeX" is slecht- ser dan mu- " " ziek. } texte = \lyrics{ \property Lyrics . textStyle" = "italic" % \property Lyrics . textStyle" = "roman" - Ah!4 vous dir- ai- je ma- man2 - Ce4 qui cau- se mon tour- ment2 - Pa-4 pa veut que je rai- son- ne - Comm' u- ne gran- de per- son- ne - Moi je dis que les bon- bons2 - Va-4 lent mieux que la rai- son2 + Ah! vous dir- ai- je ma- man " " + Ce qui cau- se mon tour- " " ment + Pa- pa veut que je rai- son- ne + Comm' u- ne gran- de per- " " son- ne + Moi je dis que les bon- bons " " + Va- lent mieux que la rai- " " son } texti = \lyrics{ \property "Lyrics"."textStyle" = "roman" - Twin-4 kle, twin- kle, lit- tle star,2 - How4 I won- der what you are.2 - Up4 a- bove the world so high,2 - Like4 a dia- mond in the sky.2 - Twin-4 kle, twin- kle, lit- tle star,2 - How4 I won- der what you are!2 + Twin- kle, twin- kle, lit- tle star, " " + How I won- der what you " " are. + Up a- bove the world so high, " " + Like a dia- mond in the " " sky. " " + Twin- kle, twin- kle, lit- tle star, " " + How I won- der what you " " are! } textii = \lyrics{ - When4 the bla- zing sun is gone,2 - When4 he no- thing shines up- on,2 - Then4 you show your lit- tle light,2 - Twin-4 kle, twin- kle, all the night.2 - Twin-4 kle, twin- kle, lit- tle star,2 - How4 I won- der what you are!2 - + When the bla- zing sun is gone, " " + When he no- thing shines up- " " on, + Then you show your lit- tle light, " " + Twin- kle, twin- kle, all the " " night. " " + Twin- kle, twin- kle, lit- tle star, " " + How I won- der what you " " are! } textiii = \lyrics{ - Then4 the tra- veler in the dark2 - Thanks4 you for your ti- ny spark;2 - He4 could not see which way8 to8 go,2 - If4 you did not twin- kle so.2 - Twin-4 kle, twin- kle, lit- tle star,2 - How4 I won- der what you are!2 + Then the tra- veler in the dark " " + Thanks you for your ti- ny " " spark; + He could not see which way to go, + If you did not twin- kle " " so. " " + Twin- kle, twin- kle, lit- tle star, " " + How I won- der what you " " are! } \score{ < \context Staff=i \repeat semi 2 < \global\melody > - \context Lyrics=top \context LyricVoice \repeat fold 2 {} \alternative { \tekst \texte } + \context Lyrics=top \context LyricVoice + \repeat fold 2 {} + \alternative { + \rhythm \melody \tekst + \rhythm \melody \texte + } \context GrandStaff < \context Staff=ii \repeat semi 2 < \global\melody > \context Staff=iii \repeat semi 2 < \global\accompany > > - \context Lyrics =bottom \context LyricVoice \repeat fold 3 {} - \alternative { \texti \textii \textiii } + \context Lyrics =bottom \context LyricVoice + \repeat fold 3 {} + \alternative { + \rhythm \melody \texti + \rhythm \melody \textii + \rhythm \melody \textiii + } > \paper{ gourlay_maxmeasures = 14.0; diff --git a/lily/audio-element.cc b/lily/audio-element.cc index 717e2b0ea1..b815918423 100644 --- a/lily/audio-element.cc +++ b/lily/audio-element.cc @@ -11,6 +11,7 @@ Audio_element::Audio_element () { + grace_b_ = false; } Audio_element::~Audio_element() diff --git a/lily/audio-item.cc b/lily/audio-item.cc index f48f92179c..2e4e98747c 100644 --- a/lily/audio-item.cc +++ b/lily/audio-item.cc @@ -24,9 +24,22 @@ Audio_note::Audio_note (Musical_pitch p, Moment m, int transposing_i) { pitch_ = p; length_mom_ = m; + tied_ = 0; transposing_i_ = transposing_i; } +void +Audio_note::tie_to (Audio_note* t) +{ + tied_ = t; + Audio_note* first = t; + while (first->tied_) + first = first->tied_; + first->length_mom_ += length_mom_; + length_mom_ = 0; +} + + Audio_key::Audio_key (Key_def const& k) { key_ = k; diff --git a/lily/auto-beam-engraver.cc b/lily/auto-beam-engraver.cc index acca44ad5a..f80d36ec65 100644 --- a/lily/auto-beam-engraver.cc +++ b/lily/auto-beam-engraver.cc @@ -311,6 +311,8 @@ Auto_beam_engraver::acknowledge_element (Score_element_info info) { shortest_mom_ = mom; consider_end_and_begin (); + if (!stem_l_arr_p_) + return; } shortest_mom_ = mom; } diff --git a/lily/chord-name-engraver.cc b/lily/chord-name-engraver.cc index e730763fcf..487514ff26 100644 --- a/lily/chord-name-engraver.cc +++ b/lily/chord-name-engraver.cc @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1998--1999, 1999 Jan Nieuwenhuizen + (c) 1998--1999 Jan Nieuwenhuizen */ #include "chord-name-engraver.hh" diff --git a/lily/grace-iterator.cc b/lily/grace-iterator.cc index f93e13e942..b291cf29d7 100644 --- a/lily/grace-iterator.cc +++ b/lily/grace-iterator.cc @@ -11,6 +11,11 @@ #include "global-translator.hh" #include "warn.hh" +Grace_iterator::~Grace_iterator () +{ + // child_iter_p_ = 0; +} + void Grace_iterator::construct_children () { @@ -41,7 +46,13 @@ Grace_iterator::do_process_and_next (Moment m) } Moment -Grace_iterator::next_moment () const +Grace_iterator::next_moment () const +{ + return 0; +} + +Music* +Grace_iterator::next_music_l () { return 0; } diff --git a/lily/grace-performer-group.cc b/lily/grace-performer-group.cc index 65d4cdef7f..004c7a4923 100644 --- a/lily/grace-performer-group.cc +++ b/lily/grace-performer-group.cc @@ -45,13 +45,14 @@ Grace_performer_group::do_removal_processing () } void -Grace_performer_group::announce_element (Audio_element_info inf) +Grace_performer_group::announce_element (Audio_element_info info) { - announce_info_arr_.push (inf); + announce_info_arr_.push (info); // do not propagate to top - announce_to_top_.push (inf); + announce_to_top_.push (info); //inf.elem_l_->set_elt_property (grace_scm_sym, SCM_BOOL_T); + info.elem_l_->grace_b_ = true; } void diff --git a/lily/grace-position-performer.cc b/lily/grace-position-performer.cc new file mode 100644 index 0000000000..41cee8065e --- /dev/null +++ b/lily/grace-position-performer.cc @@ -0,0 +1,124 @@ +/* + grace-position-performer.cc -- implement Grace_position_performer + + source file of the GNU LilyPond music typesetter + + (c) 1999 Jan Nieuwenhuizen + + */ + +#include "performer.hh" +#include "audio-item.hh" +#include "global-translator.hh" + +class Grace_position_performer : public Performer +{ +public: + Grace_position_performer (); + +protected: + Link_array graces_; + Link_array notes_; + + VIRTUAL_COPY_CONS (Translator); + virtual void acknowledge_element (Audio_element_info); + virtual void process_acknowledged (); + virtual void do_post_move_processing (); + Global_translator* global_translator_l (); +}; + +ADD_THIS_TRANSLATOR (Grace_position_performer); + +Grace_position_performer::Grace_position_performer () +{ +} + +void +Grace_position_performer::acknowledge_element (Audio_element_info i) +{ + if (Audio_note * n = dynamic_cast (i.elem_l_)) + { + if (i.elem_l_->grace_b_) + graces_.push (n); + else + notes_.push (n); + } +} + +void +Grace_position_performer::process_acknowledged () +{ + if (graces_.size ()) + { + // we're above grace-engraver-group, so we cannot tell + // grace-iterator. note-performer should add moments. + //Global_translator* global_l = global_translator_l (); + Moment delay_mom = Moment (1, 8); + if (notes_.size ()) + { + Moment shortest_mom = notes_[0]->length_mom_; + for (int i=1; i < notes_.size (); i++) + shortest_mom = shortest_mom length_mom_; + + Rational grace_fraction_rat (1, 2); + Scalar prop = get_property ("graceFraction", 0); + if (prop.length_i ()) + grace_fraction_rat = prop.to_rat (); + + delay_mom = shortest_mom * grace_fraction_rat; + for (int i=0; i < notes_.size (); i++) + { + Audio_note* n = notes_[i]; + n->length_mom_ -= delay_mom; + n->delayed_mom_ = delay_mom; + n->delayed_until_mom_ = now_mom () + delay_mom; + //global_l->add_moment_to_process (n->delayed_until_mom_); + } + notes_.clear (); + } + + Moment grace_length_mom; + for (int i=0; i < graces_.size (); i++) + grace_length_mom += graces_[i]->length_mom_; + + Rational grace_factor_rat = delay_mom / grace_length_mom; + + for (int i=0; i < graces_.size (); i++) + { + Audio_note* n = graces_[i]; + n->length_mom_ *= grace_factor_rat; + if (i) + { + Audio_note* p = graces_[i-1]; + n->delayed_mom_ = p->delayed_mom_ + p->length_mom_; + n->delayed_until_mom_ = now_mom () + n->delayed_mom_; + //global_l->add_moment_to_process (n->delayed_until_mom_); + } + } + graces_.clear (); + } +} + +Global_translator* +Grace_position_performer::global_translator_l () +{ + Translator *t = this; + Global_translator *global_l =0; + do + { + t = t->daddy_trans_l_ ; + global_l = dynamic_cast (t); + } + while (!global_l); + + return global_l; +} + + +void +Grace_position_performer::do_post_move_processing () +{ + graces_.clear (); + notes_.clear (); +} + diff --git a/lily/include/audio-element.hh b/lily/include/audio-element.hh index 16955f4027..c629bcd2b1 100644 --- a/lily/include/audio-element.hh +++ b/lily/include/audio-element.hh @@ -19,6 +19,9 @@ public: virtual ~Audio_element (); void print () const; + + // should we use a scm list? + bool grace_b_; protected: virtual void do_print () const; diff --git a/lily/include/audio-item.hh b/lily/include/audio-item.hh index 5c4f8ebce6..1c0dac33d3 100644 --- a/lily/include/audio-item.hh +++ b/lily/include/audio-item.hh @@ -57,9 +57,14 @@ class Audio_note : public Audio_item public: Audio_note (Musical_pitch p, Moment m, int transposing_i = 0); + void tie_to (Audio_note*); + Musical_pitch pitch_; Moment length_mom_; + Moment delayed_mom_; + Moment delayed_until_mom_; int transposing_i_; + Audio_note* tied_; }; class Audio_text : public Audio_item diff --git a/lily/include/grace-iterator.hh b/lily/include/grace-iterator.hh index 5d63bcf603..77d5cd75b7 100644 --- a/lily/include/grace-iterator.hh +++ b/lily/include/grace-iterator.hh @@ -15,9 +15,11 @@ class Grace_iterator : public Music_wrapper_iterator { public: + ~Grace_iterator (); virtual void construct_children () ; virtual void do_process_and_next (Moment); Moment next_moment () const; + Music* next_music_l (); }; diff --git a/lily/include/lily-proto.hh b/lily/include/lily-proto.hh index e78946882c..a4cbf4e77b 100644 --- a/lily/include/lily-proto.hh +++ b/lily/include/lily-proto.hh @@ -62,6 +62,7 @@ struct Change_iterator; struct Change_translator; struct Chord; struct Chord_name_engraver; +struct CHyphen_req; struct Clef_change_req; struct Clef_item; struct Clef_engraver; @@ -197,6 +198,7 @@ struct Rational; struct Request; struct Request_column; struct Relative_octave_music; +struct Re_rhythmed_music; struct Repeat_engraver; struct Repeated_music; struct Repeated_music_iterator; diff --git a/lily/include/midi-item.hh b/lily/include/midi-item.hh index 6a64b0b93d..f24322e107 100644 --- a/lily/include/midi-item.hh +++ b/lily/include/midi-item.hh @@ -134,12 +134,11 @@ public: /** Turn a note off */ -class Midi_note_off : public Midi_item +class Midi_note_off : public Midi_note { public: Midi_note_off (Midi_note*); - int pitch_i () const; virtual String str () const; Midi_note* on_l_; diff --git a/lily/include/midi-walker.hh b/lily/include/midi-walker.hh index 20d1f95ff9..f732324ece 100644 --- a/lily/include/midi-walker.hh +++ b/lily/include/midi-walker.hh @@ -13,7 +13,7 @@ #include "lily-proto.hh" #include "moment.hh" -struct Midi_note_event : PQueue_ent +struct Midi_note_event : PQueue_ent { bool ignore_b_; Midi_note_event(); diff --git a/lily/include/music-iterator.hh b/lily/include/music-iterator.hh index c6a8e9a7d8..9d2a68f689 100644 --- a/lily/include/music-iterator.hh +++ b/lily/include/music-iterator.hh @@ -74,6 +74,9 @@ public: /// Find the next interesting point in time. virtual Moment next_moment() const; + /// Return next Music item + virtual Music* next_music_l (); + ///Are we finished with this piece of music? virtual bool ok() const; diff --git a/lily/include/music-list-iterator.hh b/lily/include/music-list-iterator.hh index 341b103608..7385230fcf 100644 --- a/lily/include/music-list-iterator.hh +++ b/lily/include/music-list-iterator.hh @@ -21,6 +21,7 @@ public: virtual void construct_children (); virtual Moment next_moment () const; + virtual Music* next_music_l (); virtual bool ok () const; protected: diff --git a/lily/include/music-list.hh b/lily/include/music-list.hh index 5f40c5dc6b..e00d9633ec 100644 --- a/lily/include/music-list.hh +++ b/lily/include/music-list.hh @@ -19,6 +19,7 @@ class Music_list : public Cons_list { public: Musical_pitch do_relative_octave (Musical_pitch, bool); + Music_iterator* do_rhythm (Music_iterator*); void add_music (Music*); Music_list (Music_list const&); Music_list (); @@ -38,6 +39,7 @@ public: VIRTUAL_COPY_CONS(Music); Musical_pitch do_relative_octave (Musical_pitch p, bool b); + Music_iterator* do_rhythm (Music_iterator*); virtual void transpose (Musical_pitch ); virtual void compress (Moment); void add_music (Music *music_p); @@ -48,6 +50,7 @@ public: protected: virtual Musical_pitch to_relative_octave (Musical_pitch); + virtual Music_iterator* to_rhythm (Music_iterator*); virtual void do_print() const; }; @@ -62,6 +65,7 @@ public: Simultaneous_music(Music_list *); virtual Musical_pitch to_relative_octave (Musical_pitch); + virtual Music_iterator* to_rhythm (Music_iterator*); virtual Moment length_mom () const; }; @@ -76,6 +80,7 @@ public: VIRTUAL_COPY_CONS(Music); virtual Musical_pitch to_relative_octave (Musical_pitch); + virtual Music_iterator* to_rhythm (Music_iterator*); Request_chord(); }; diff --git a/lily/include/music-wrapper-iterator.hh b/lily/include/music-wrapper-iterator.hh index f691270056..deee350913 100644 --- a/lily/include/music-wrapper-iterator.hh +++ b/lily/include/music-wrapper-iterator.hh @@ -26,6 +26,7 @@ public: virtual void construct_children () ; virtual Moment next_moment () const; + virtual Music* next_music_l (); virtual bool ok () const; protected: diff --git a/lily/include/music-wrapper.hh b/lily/include/music-wrapper.hh index f01a39ff9a..7e87040acf 100644 --- a/lily/include/music-wrapper.hh +++ b/lily/include/music-wrapper.hh @@ -33,6 +33,7 @@ public: virtual Moment length_mom () const; virtual ~Music_wrapper (); virtual Musical_pitch to_relative_octave (Musical_pitch); + virtual Music_iterator* to_rhythm (Music_iterator*); virtual void compress (Moment); }; diff --git a/lily/include/music.hh b/lily/include/music.hh index 0bd1e966d0..30ae02fddb 100644 --- a/lily/include/music.hh +++ b/lily/include/music.hh @@ -33,6 +33,7 @@ public: virtual Musical_pitch to_relative_octave (Musical_pitch); + virtual Music_iterator* to_rhythm (Music_iterator*); /// The duration of this piece of music virtual Moment length_mom () const; diff --git a/lily/include/my-lily-parser.hh b/lily/include/my-lily-parser.hh index 5207978087..ddd55c7517 100644 --- a/lily/include/my-lily-parser.hh +++ b/lily/include/my-lily-parser.hh @@ -15,6 +15,7 @@ #include "lily-proto.hh" #include "lily-proto.hh" #include "duration.hh" +#include "musical-pitch.hh" #include "string.hh" #include "array.hh" #include "input.hh" @@ -36,6 +37,7 @@ public: public: Duration default_duration_; + Musical_pitch default_pitch_; Scope *default_header_p_; bool first_b_; int fatal_error_i_; @@ -69,6 +71,7 @@ private: Simultaneous_music* get_word_element (String, Duration*); String notename_str (Melodic_req* melodic); void set_last_duration (Duration const *); + void set_last_pitch (Musical_pitch const *); friend int yyparse (void*); }; diff --git a/lily/include/new-repeated-music.hh b/lily/include/new-repeated-music.hh index 5cf2ff3166..0f4caed5bd 100644 --- a/lily/include/new-repeated-music.hh +++ b/lily/include/new-repeated-music.hh @@ -61,6 +61,7 @@ public: Music_sequence * alternatives_p_; virtual Musical_pitch to_relative_octave (Musical_pitch); + virtual Music_iterator* to_rhythm (Music_iterator*); /// The duration of this piece of music virtual Moment length_mom () const; diff --git a/lily/include/note-performer.hh b/lily/include/note-performer.hh index bfd49375c1..0536786d81 100644 --- a/lily/include/note-performer.hh +++ b/lily/include/note-performer.hh @@ -25,10 +25,13 @@ protected: virtual bool do_try_music (Music *req_l) ; virtual void do_print () const; virtual void do_pre_move_processing (); + virtual void process_acknowledged (); + Global_translator* global_translator_l (); private: Array note_req_l_arr_; Array note_p_arr_; + Array delayed_p_arr_; }; #endif // NOTE_PERFORMER_HH diff --git a/lily/include/re-rhythmed-music.hh b/lily/include/re-rhythmed-music.hh new file mode 100644 index 0000000000..4c258a7be9 --- /dev/null +++ b/lily/include/re-rhythmed-music.hh @@ -0,0 +1,27 @@ +/* + re-rhythmed-music.hh -- declare Re_rhythmed_music + + source file of the GNU LilyPond music typesetter + + (c) 1999 Jan Nieuwenhuizen + + */ + +#ifndef RE_RHYTHMED_MUSIC_HH +#define RE_RHYTHMED_MUSIC_HH + +#include "music-wrapper.hh" + +class Re_rhythmed_music : public Music_wrapper +{ +public: + void do_print () const; + Re_rhythmed_music (Music*, Music*); + + VIRTUAL_COPY_CONS(Music); + virtual Music_iterator* to_rhythm (Music_iterator*); +}; + + +#endif /* RE_RHYTHMED_MUSIC_HH */ + diff --git a/lily/include/relative-music.hh b/lily/include/relative-music.hh index 2d7cff937b..179362c593 100644 --- a/lily/include/relative-music.hh +++ b/lily/include/relative-music.hh @@ -22,6 +22,7 @@ public: VIRTUAL_COPY_CONS(Music); virtual Musical_pitch to_relative_octave (Musical_pitch); + virtual Music_iterator* to_rhythm (Music_iterator*); }; diff --git a/lily/include/request-iterator.hh b/lily/include/request-iterator.hh index bbc1a522d9..0b35c447d6 100644 --- a/lily/include/request-iterator.hh +++ b/lily/include/request-iterator.hh @@ -22,6 +22,7 @@ class Request_chord_iterator : public Music_iterator { */ Moment elt_length_mom_; bool last_b_; + Cons* cursor_; public: Request_chord_iterator (); @@ -30,6 +31,7 @@ public: protected: virtual void do_process_and_next (Moment); virtual Moment next_moment() const; + virtual Music* next_music_l (); virtual void construct_children(); virtual bool ok() const; virtual void do_print() const; diff --git a/lily/include/sequential-music-iterator.hh b/lily/include/sequential-music-iterator.hh index f4810c836c..bfab2b805f 100644 --- a/lily/include/sequential-music-iterator.hh +++ b/lily/include/sequential-music-iterator.hh @@ -23,6 +23,7 @@ public: virtual void construct_children (); virtual Moment next_moment () const; + virtual Music* next_music_l (); virtual bool ok () const; protected: diff --git a/lily/include/transposed-music.hh b/lily/include/transposed-music.hh index f6c1e13021..ce1314a78d 100644 --- a/lily/include/transposed-music.hh +++ b/lily/include/transposed-music.hh @@ -23,6 +23,7 @@ public: VIRTUAL_COPY_CONS(Music); virtual Musical_pitch to_relative_octave (Musical_pitch); + virtual Music_iterator* to_rhythm (Music_iterator*); }; #endif /* TRANSPOSED_MUSIC_HH */ diff --git a/lily/midi-item.cc b/lily/midi-item.cc index b52ca3cf16..703a66ff21 100644 --- a/lily/midi-item.cc +++ b/lily/midi-item.cc @@ -431,6 +431,7 @@ Midi_note::str () const } Midi_note_off::Midi_note_off (Midi_note* n) + : Midi_note (n->audio_l_) { on_l_ = n; channel_i_ = n->channel_i_; @@ -445,12 +446,6 @@ Midi_note_off::Midi_note_off (Midi_note* n) i += 0x10; } -int -Midi_note_off::pitch_i () const -{ - return on_l_->pitch_i (); -} - String Midi_note_off::str () const { diff --git a/lily/midi-walker.cc b/lily/midi-walker.cc index c0afd12f15..48c408aaa7 100644 --- a/lily/midi-walker.cc +++ b/lily/midi-walker.cc @@ -66,7 +66,7 @@ Midi_walker::do_start_note (Midi_note* note_p) e.val = new Midi_note_off (note_p); e.key = stop_mom; stop_note_queue.insert (e); - + output_event (ptr->audio_column_l_->at_mom (), note_p); } @@ -86,7 +86,7 @@ Midi_walker::do_stop_notes (Moment max_mom) } Moment stop_mom = e.key; - Midi_note_off* note_p = e.val; + Midi_note* note_p = e.val; output_event (stop_mom, note_p); } diff --git a/lily/music-iterator.cc b/lily/music-iterator.cc index e975d300a9..b3e99c8f63 100644 --- a/lily/music-iterator.cc +++ b/lily/music-iterator.cc @@ -90,6 +90,11 @@ Music_iterator::next_moment() const return 0; } +Music* +Music_iterator::next_music_l () +{ + return 0; +} void Music_iterator::process_and_next (Moment m) diff --git a/lily/music-list-iterator.cc b/lily/music-list-iterator.cc index d5e4bbff61..2be250faea 100644 --- a/lily/music-list-iterator.cc +++ b/lily/music-list-iterator.cc @@ -38,6 +38,12 @@ Music_list_iterator::next_moment () const return 0; } +Music* +Music_list_iterator::next_music_l () +{ + return 0; +} + bool Music_list_iterator::ok () const { diff --git a/lily/music-list.cc b/lily/music-list.cc index 36087d65c4..3b9c830fba 100644 --- a/lily/music-list.cc +++ b/lily/music-list.cc @@ -7,9 +7,11 @@ */ #include "music-list.hh" +#include "music-wrapper.hh" #include "musical-pitch.hh" #include "request.hh" #include "musical-request.hh" +#include "music-iterator.hh" #include "main.hh" #include "killing-cons.tcc" @@ -44,19 +46,30 @@ Sequential_music::length_mom () const return cumulative_length (); } - Musical_pitch Simultaneous_music::to_relative_octave (Musical_pitch p) { return do_relative_octave (p, true); } +Music_iterator* +Simultaneous_music::to_rhythm (Music_iterator* r) +{ + return do_rhythm (r); +} + Musical_pitch Music_sequence::do_relative_octave (Musical_pitch p, bool b) { return music_p_list_p_->do_relative_octave (p, b); } +Music_iterator* +Music_sequence::do_rhythm (Music_iterator* r) +{ + return music_p_list_p_->do_rhythm (r); +} + Musical_pitch Music_list::do_relative_octave (Musical_pitch last, bool ret_first) { @@ -75,6 +88,15 @@ Music_list::do_relative_octave (Musical_pitch last, bool ret_first) return retval; } +Music_iterator* +Music_list::do_rhythm (Music_iterator* r) +{ + for (Cons *i = head_; i ; i = i->next_) + { + r = i->car_->to_rhythm (r); + } + return r; +} Music_list::Music_list (Music_list const &s) : Cons_list (s) @@ -114,6 +136,34 @@ Request_chord::to_relative_octave (Musical_pitch last) return last; } +Music_iterator* +Request_chord::to_rhythm (Music_iterator* it) +{ + for (Cons* i = music_p_list_p_->head_; i ; i = i->next_) + { + if (Rhythmic_req* r= dynamic_cast (i->car_)) + { + for (Music*m = it->next_music_l (); m; m = it->next_music_l ()) + { +#if 0 + // is it sane to assume we don't want rests on lyrics/in rhythm? + if (dynamic_cast (r) + || dynamic_cast (r) + || dynamic_cast (r)) + { + continue; + } +#endif + if (Rhythmic_req* d= dynamic_cast (m)) + { + r->duration_ = d->duration_; + return it; + } + } + } + } + return it; +} Music_list::Music_list () { diff --git a/lily/music-sequence.cc b/lily/music-sequence.cc index 60e6459a20..6b074c5b16 100644 --- a/lily/music-sequence.cc +++ b/lily/music-sequence.cc @@ -63,6 +63,11 @@ Music_sequence::to_relative_octave (Musical_pitch p) return do_relative_octave (p, false); } +Music_iterator* +Music_sequence::to_rhythm (Music_iterator* r) +{ + return do_rhythm (r); +} Moment Music_sequence::maximum_length () const diff --git a/lily/music-wrapper-iterator.cc b/lily/music-wrapper-iterator.cc index f25dd82f39..03fefdd44e 100644 --- a/lily/music-wrapper-iterator.cc +++ b/lily/music-wrapper-iterator.cc @@ -56,3 +56,9 @@ Music_wrapper_iterator::next_moment () const return child_iter_p_->next_moment (); } +Music* +Music_wrapper_iterator::next_music_l () +{ + return child_iter_p_->next_music_l (); +} + diff --git a/lily/music-wrapper.cc b/lily/music-wrapper.cc index dff9d1fc87..4512e26fc2 100644 --- a/lily/music-wrapper.cc +++ b/lily/music-wrapper.cc @@ -50,13 +50,18 @@ Music_wrapper::length_mom () const return element_p_->length_mom (); } - Musical_pitch Music_wrapper::to_relative_octave (Musical_pitch p) { return element_p_->to_relative_octave (p); } +Music_iterator* +Music_wrapper::to_rhythm (Music_iterator* r) +{ + return element_p_->to_rhythm (r); +} + Music* Music_wrapper::element_l () const { diff --git a/lily/music.cc b/lily/music.cc index c7bd75a435..1d137e4524 100644 --- a/lily/music.cc +++ b/lily/music.cc @@ -54,6 +54,12 @@ Music::to_relative_octave (Musical_pitch m) return m; } +Music_iterator* +Music::to_rhythm (Music_iterator* r) +{ + return r; +} + void Music::transpose (Musical_pitch ) { diff --git a/lily/my-lily-lexer.cc b/lily/my-lily-lexer.cc index d0521d2240..1da40f6b55 100644 --- a/lily/my-lily-lexer.cc +++ b/lily/my-lily-lexer.cc @@ -60,6 +60,7 @@ static Keyword_ent the_key_tab[]={ {"remove", REMOVE}, {"repeat", REPEAT}, {"repetitions", REPETITIONS}, + {"rhythm", RHYTHM}, {"scm", SCM_T}, {"scmfile", SCMFILE}, {"score", SCORE}, diff --git a/lily/my-lily-parser.cc b/lily/my-lily-parser.cc index b787e2a8d5..46f09be711 100644 --- a/lily/my-lily-parser.cc +++ b/lily/my-lily-parser.cc @@ -28,6 +28,7 @@ My_lily_parser::My_lily_parser (Sources * source_l) source_l_ = source_l; lexer_p_ = 0; default_duration_.durlog_i_ = 2; + default_pitch_ = Musical_pitch (5*7, 0); error_level_i_ = 0; fatal_error_i_ = 0; @@ -95,14 +96,18 @@ My_lily_parser::parser_error (String s) exit_status_i_ = 1; } - - void My_lily_parser::set_last_duration (Duration const *d) { default_duration_ = *d; } +void +My_lily_parser::set_last_pitch (Musical_pitch const* p) +{ + default_pitch_ = *p; +} + // junk me Simultaneous_music* My_lily_parser::get_word_element (String s, Duration * duration_p) diff --git a/lily/note-performer.cc b/lily/note-performer.cc index 5542c8e693..1f88de4aad 100644 --- a/lily/note-performer.cc +++ b/lily/note-performer.cc @@ -9,6 +9,8 @@ #include "note-performer.hh" #include "musical-request.hh" #include "audio-item.hh" +#include "audio-column.hh" +#include "global-translator.hh" #include "debug.hh" @@ -39,7 +41,7 @@ Note_performer::do_process_requests () if (!prop.empty_b () && prop.isnum_b ()) transposing_i = prop; - while(note_req_l_arr_.size ()) + while (note_req_l_arr_.size ()) { Note_req* n = note_req_l_arr_.pop (); Audio_note* p = new Audio_note (n->pitch_, n->length_mom (), transposing_i); @@ -50,15 +52,65 @@ Note_performer::do_process_requests () } } +void +Note_performer::process_acknowledged () +{ +} + +Global_translator* +Note_performer::global_translator_l () +{ + Translator *t = this; + Global_translator *global_l =0; + do + { + t = t->daddy_trans_l_ ; + global_l = dynamic_cast (t); + } + while (!global_l); + + return global_l; +} + + void Note_performer::do_pre_move_processing () { + + // why don't grace notes show up here? + // --> grace notes effectively do not get delayed + Global_translator* global_l = global_translator_l (); + for (int i=0; i < note_p_arr_.size (); i++) + { + Audio_note* n = note_p_arr_[i]; + if (Moment m= n->delayed_until_mom_) + { + global_l->add_moment_to_process (m); + delayed_p_arr_.push (n); + note_p_arr_[i] = 0; + note_p_arr_.del (i); + i--; + } + } + + Moment now = now_mom (); for (int i=0; i < note_p_arr_.size (); i++) { play_element (note_p_arr_[i]); } note_p_arr_.clear (); note_req_l_arr_.clear (); + for (int i=0; i < delayed_p_arr_.size (); i++) + { + Audio_note* n = delayed_p_arr_[i]; + if (n->delayed_until_mom_ <= now) + { + play_element (n); + delayed_p_arr_[i] = 0; + delayed_p_arr_.del (i); + i--; + } + } } bool diff --git a/lily/re-rhythmed-music.cc b/lily/re-rhythmed-music.cc new file mode 100644 index 0000000000..e2ba452819 --- /dev/null +++ b/lily/re-rhythmed-music.cc @@ -0,0 +1,41 @@ +/* + re-rhythmed-music.cc -- implement Re_rhythmed_music + + source file of the GNU LilyPond music typesetter + + (c) 1999 Jan Nieuwenhuizen + + */ + +#include "re-rhythmed-music.hh" +#include "music-iterator.hh" +#include "global-translator.hh" + +// urg +class Foo_translator : public Global_translator +{ +}; + +Music_iterator* +Re_rhythmed_music::to_rhythm (Music_iterator* r) +{ + return r; +} + +Re_rhythmed_music::Re_rhythmed_music (Music* m, Music* r) + : Music_wrapper (m) +{ + Music_iterator* i = Music_iterator::static_get_iterator_p (r); + Global_translator*t = new Foo_translator (); + i->init_translator (r, t); + i->construct_children (); + element_l ()->to_rhythm (i); +} + +void +Re_rhythmed_music::do_print () const +{ + Music_wrapper::do_print (); +} + + diff --git a/lily/relative-octave-music.cc b/lily/relative-octave-music.cc index 7f66ab6a6b..dc0fc9906c 100644 --- a/lily/relative-octave-music.cc +++ b/lily/relative-octave-music.cc @@ -16,11 +16,16 @@ Relative_octave_music::to_relative_octave (Musical_pitch) return last_pitch_; } +Music_iterator* +Relative_octave_music::to_rhythm (Music_iterator* r) +{ + return element_l ()->to_rhythm (r); +} Relative_octave_music::Relative_octave_music(Music*p,Musical_pitch def) : Music_wrapper (p) { - last_pitch_ = element_l()->to_relative_octave (def); + last_pitch_ = element_l ()->to_relative_octave (def); } void diff --git a/lily/repeated-music.cc b/lily/repeated-music.cc index d00a932107..6436be9bfa 100644 --- a/lily/repeated-music.cc +++ b/lily/repeated-music.cc @@ -66,6 +66,17 @@ Repeated_music::to_relative_octave (Musical_pitch p) return p; } +Music_iterator* +Repeated_music::to_rhythm (Music_iterator* r) +{ + if (repeat_body_p_) + r = repeat_body_p_->to_rhythm (r); + + if (alternatives_p_) + r = alternatives_p_->do_rhythm (r); + return r; +} + void Repeated_music::transpose (Musical_pitch p) diff --git a/lily/request-iterator.cc b/lily/request-iterator.cc index ca103ee062..9cbf798a4b 100644 --- a/lily/request-iterator.cc +++ b/lily/request-iterator.cc @@ -30,6 +30,8 @@ Request_chord_iterator::elt_l () const Request_chord_iterator::Request_chord_iterator () { last_b_ = false; + // cursor_ = elt_l ()->music_p_list_p_->head_; + cursor_ = 0; } @@ -39,8 +41,6 @@ Request_chord_iterator::ok() const return (elt_length_mom_ && !last_b_) || first_b_; } - - Moment Request_chord_iterator::next_moment() const { @@ -50,6 +50,25 @@ Request_chord_iterator::next_moment() const return m; } +Music* +Request_chord_iterator::next_music_l () +{ + if (first_b_) + { + cursor_ = elt_l ()->music_p_list_p_->head_; + first_b_ = false; + } + else + { + if (cursor_) + cursor_ = cursor_->next_; + } + if (cursor_) + return cursor_->car_; + else + return 0; +} + void Request_chord_iterator::do_print() const { diff --git a/lily/sequential-music-iterator.cc b/lily/sequential-music-iterator.cc index a50a0de9a5..a6602b7709 100644 --- a/lily/sequential-music-iterator.cc +++ b/lily/sequential-music-iterator.cc @@ -127,6 +127,40 @@ Sequential_music_iterator::next_moment() const return iter_p_->next_moment() + here_mom_; } +Music* +Sequential_music_iterator::next_music_l () +{ + if (!iter_p_) + return 0; + + while (1) + { + if (Music* m = iter_p_->next_music_l ()) + { + return m; + } + else + { + // urg FIXME: grace-iterator::next_music_l () fools me! + if (dynamic_cast (iter_p_)) + iter_p_ = 0; + leave_element (); + + if (cursor_) + { + start_next_element (); + set_sequential_music_translator (); + } + else + { + delete iter_p_; + iter_p_ = 0; + return 0; + } + } + } +} + bool Sequential_music_iterator::ok() const { diff --git a/lily/tie-performer.cc b/lily/tie-performer.cc index 0d7d5a0257..f33e9efaac 100644 --- a/lily/tie-performer.cc +++ b/lily/tie-performer.cc @@ -121,14 +121,8 @@ Tie_performer::do_pre_move_processing () for (int i=0; i< tie_p_arr_.size (); i++) { //play_element (tie_p_arr_[i]); - /* - urg. - doesn't work for c ~ c ~ c - */ - tie_p_arr_[i]->note_l_drul_[LEFT]->length_mom_ += - tie_p_arr_[i]->note_l_drul_[RIGHT]->length_mom_; - tie_p_arr_[i]->note_l_drul_[RIGHT]->length_mom_ = 0; - } + tie_p_arr_[i]->note_l_drul_[RIGHT]->tie_to (tie_p_arr_[i]->note_l_drul_[LEFT]); + } tie_p_arr_.clear (); } diff --git a/lily/transposed-music.cc b/lily/transposed-music.cc index 2445dc80c3..f6de2eb3b3 100644 --- a/lily/transposed-music.cc +++ b/lily/transposed-music.cc @@ -17,8 +17,6 @@ Transposed_music::Transposed_music (Music *p, Musical_pitch pit) p->transpose (pit); } - - void Transposed_music::do_print () const { @@ -35,4 +33,10 @@ Transposed_music::to_relative_octave (Musical_pitch p) return p; } +Music_iterator* +Transposed_music::to_rhythm (Music_iterator* r) +{ + return r; +} + diff --git a/ly/performer.ly b/ly/performer.ly index f9eafe68e2..184f18144f 100644 --- a/ly/performer.ly +++ b/ly/performer.ly @@ -1,7 +1,7 @@ % % setup for Request->Element conversion. Guru-only % -\translator { +StaffContext = \translator { \type "Staff_performer"; \name Staff; \accepts Voice; @@ -13,7 +13,8 @@ \consists "Key_performer"; \consists "Time_signature_performer"; -} +}; +\translator { \StaffContext } %% urg, why (needs praeludium-*.ly) these? \translator @@ -29,25 +30,33 @@ \consists "Note_performer"; \name VoiceThree; } -\translator -{ +\translator { \type "Performer_group_performer"; \consists "Note_performer"; \name VoiceOne; } -\translator -{ +VoiceContext = \translator { \type "Performer_group_performer"; \name Voice; +% All notes fall to Grace if you leave Thread out (huh?) + \consists "Grace_position_performer"; + \accepts Thread; + \accepts Grace; +}; +\translator { \VoiceContext } + +GraceContext = \translator { + \type "Performer_group_performer"; + \name Thread; \consists "Note_performer"; \consists "Tie_performer"; -% \accepts Grace; -} +}; +\translator { \GraceContext } \translator { \type "Grace_performer_group"; - \name "Grace"; + \name Grace; \consists "Note_performer"; \consists "Tie_performer"; weAreGraceContext = "1"; @@ -60,20 +69,24 @@ } -\translator -{ +GrandStaffContext = \translator { \type "Performer_group_performer"; - \accepts Staff; \name GrandStaff; -} + \accepts Staff; +}; +\translator { \GrandStaffContext } -\translator {\type "Performer_group_performer"; - \accepts Staff; \name "PianoStaff";} +PianoStaffContext = \translator { + \type "Performer_group_performer"; + \name "PianoStaff"; + \accepts Staff; +}; +\translator { \PianoStaffContext } \translator { \type "Performer_group_performer"; \consists "Lyric_performer"; -\name LyricVoice; + \name LyricVoice; } \translator{ @@ -87,16 +100,15 @@ \name Lyrics; \consists "Time_signature_performer"; } -\translator -{ +\translator { \type Performer_group_performer; \name StaffGroup; \accepts Staff; } -\translator { - \type "Score_performer"; +ScoreContext = \translator { + \type "Score_performer"; \name Score; instrument = "bright acoustic"; @@ -107,5 +119,6 @@ \accepts StaffGroup; \accepts ChoirStaff; \consists "Swallow_performer"; -} +}; +\translator { \ScoreContext } diff --git a/mutopia/E.Satie/gnossienne-4.ly b/mutopia/E.Satie/gnossienne-4.ly index ca23359ef7..d9d499c9b3 100644 --- a/mutopia/E.Satie/gnossienne-4.ly +++ b/mutopia/E.Satie/gnossienne-4.ly @@ -26,6 +26,7 @@ global = \notes { melody = \notes\relative c''{ \clef violin; \property Voice.verticalDirection = 1 + \property Voice.graceFraction = "1/4" r2 r r r2 r r r4 a'8--(\< a-- a-- a-- c-- \!b-- a--\> gis f \!e @@ -112,9 +113,9 @@ accompany = \notes \relative c{ \property Voice.verticalDirection = 1 \property Voice.scriptVerticalDirection = 1 \melody - } + } \context AutoSwitchContext \accompany - > + > } \paper { gourlay_maxmeasures = 4.; @@ -138,8 +139,8 @@ accompany = \notes \relative c{ } \translator { \ScoreContext - \accepts AutoSwitchGrandStaff; - } + \accepts "AutoSwitchGrandStaff"; + } \translator{ \type "Engraver_group_engraver"; \name AutoSwitchGrandStaff; @@ -158,14 +159,31 @@ accompany = \notes \relative c{ slurVerticalDirection = 1; verticalDirection = -1; beamAutoEnd = "1/2"; - } + } \translator { \type "Engraver_group_engraver"; - \name "AutoSwitchContext"; + \name AutoSwitchContext; \consists "Staff_switching_translator"; - } } + } \midi { \tempo 4 = 54; + \translator { + \ScoreContext + \accepts "AutoSwitchGrandStaff"; + } + \translator { + \type "Performer_group_performer"; + \name AutoSwitchGrandStaff; + \accepts "AutoSwitchContext"; + \accepts "Staff"; + } + \translator { + \type "Staff_performer"; + \name AutoSwitchContext; + \accepts "Voice"; + \consists "Key_performer"; + \consists "Time_signature_performer"; + } } } diff --git a/mutopia/F.Schubert/standchen.ly b/mutopia/F.Schubert/standchen.ly index c124113668..46aabb538b 100644 --- a/mutopia/F.Schubert/standchen.ly +++ b/mutopia/F.Schubert/standchen.ly @@ -11,7 +11,7 @@ copyright = "public domain"; } %{ - Tested Features@ multivoice accents lyrics chords piano music + Tested Features: multivoice accents lyrics chords piano music multiple \paper{}s in one \score Note: Original key F. %} @@ -69,104 +69,62 @@ vocalThrough = \notes\relative c{ e2 r4 | } -lyricVerse1 = \lyrics{ -% 5 - \times 2/3 { Lei-4 se8 } fleh-4. en8 | - \times 2/3 { mei-4 ne8 } Lie-4 der8 " "8 | - Durch4. die8 \times 2/3 { Nacht4 zu8 } | - dir;2 " "4 | - " "2.*2 -%{ " "4 " " " " | - " " " " " " |%} -% 11 - \times 2/3 { In4 den8 } stil-4. len8 | - \times 2/3 { Hain4 her-8 } nie-4. der8 | - Lieb-4. chen,8 \times 2/3 { komm4 zu8 } | - mir!2 " "4 | - " "2.*2 -%{ " "4 " " " " | - " " " " " " |%} -% 17 - Fl\"us-8. ternd16 schlan-4. ke8 | - Wip-8. fel16 rau-4. schen8 | - \times 2/3 { In4 des8 } Mon-4. des8 | - Licht;2. | - \times 2/3 { In4 des8 } Mon-4. des8 | - Licht;2. | -% 23 - Des8. Ver-16 r\"a-4. thers8 | - feind-8. lich16 Lau-4. schen8 | - \times 2/3 { F\"urch-4 te8 } Hol-4. de8 | - nicht2. | - \times 2/3 { f\"urch-4 te8 } Hol-4. de8 | - nicht.2. | +lyricVerseOne = \lyrics{ + Lei- " " se fleh- en 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 + 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. } -lyricVerse2 = \lyrics{ -% 5 - \times 2/3 { H\"orst4 die8 } Nach-4. ti-8 - \times 2/3 { gal-4 len8 } schla-4 gen?8 " "8 - ach!4. sie8 \times 2/3 { fleh-4 en8 } - dich,2 " "4 - " "2.*2 -%{ " "4 " " " " - " "4" " " " -%} -% 11 - \times 2/3 { Mit4 der8 } T\"o-4. ne8 - \times 2/3 { s\"u-4 "\ss en"8 } Kla-4. gen8 - Fleh-4. en8 \times 2/3 { sie4 f\"ur8 } - mich2 " "4 - " "2.*2 -%{ " "4" " " " - " "4" " " " -%} -% 17 - Sie-8. ver-16 stehn4. des8 - Bus-8. ens16 Seh-4. nen8 - \times 2/3 { Ken-4 nen8 } Lieb-4. es-8 - schmerz,2. - \times 2/3 { Ken-4 nen8 } Lieb-4. es-8 - schmerz.2. +lyricVerseTwo = \lyrics{ + H\"orst " " die Nach- ti- gal- " " len schla- gen? " " + Ach! sie fleh- " " en dich, " " + " " + " " + Mit " " der T\"o- ne s\"u- " " "\ss en" Kla- gen + Fleh- en sie " " f\"ur mich. " " + " " + " " + Sie- ver- "steh'n" des Bus- ens Seh- nen + Ken- " " nen Lieb- es- schmerz, + Ken- " " nen Lieb- es- schmerz. -% 23 - R\"uh-8. ren16 mit4. den8 - Sil-8. ber-16 t\"o-4. nen8 - \times 2/3 { jed-4 es8 } wei-4. che8 - Herz,2. - \times 2/3 { jed-4 es8 } wei-4. che8 - Herz.2. + R\"uh- ren mit den Sil- ber- t\"o- nen + Jed- " " es wei- che Herz, + Jed- " " es wei- che Herz. } lyricThrough = \lyrics{ -% 37 - La\ss8. auch16 dir8. die16 Brust8. be-16 | - we-4 gen " " | - Lieb-4. chen,8 h\"o-8. re16 | - mich!2 " "4 | - Be-4. bend8 \times 2/3 { harr'4 ich8} | - dir8. ent-16 ge-4 gen!8 " "8 | - " "2. | - " "2. | - \times 2/3 { Komm4 be-8 } gl\"u4. cke8 | - mich!2. | - \times 2/3 { Komm4 be-8 } gl\"u4. cke8 | - mich,2. __ | - " "2 be-4 | - gl\"u-2. | - cke2. | - mich!2 " "4 | + La\ss auch dir die Brust be- we- gen " " + Lieb- chen, h\"o- 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! } trebleIntro = \notes\relative c{ - r8^"\bf m\\\"a\\\ss ig"\pp | + r8^"\bf M\\\"a\\ss ig"\pp | r8 | r8 | r8 | \break } -trebleVerse1 = \notes\relative c{ +trebleVerseOne = \notes\relative c{ %5 r8 | r8 | @@ -274,7 +232,7 @@ bassIntro = \notes\relative c{ r4 | } -bassVerse1 = \notes\relative c{ +bassVerseOne = \notes\relative c{ % \clef bass; \property Voice.dynamicDir=1 %5 @@ -362,24 +320,13 @@ global = \notes{ } -lyricFour = \lyrics{ - " "2.*4 -%{ " "4 " " " " - " " " " " " - " " " " " " - " " " " " "%} -} - -allLyrics = { - \time 3/4; -% \skip 4 * 12; - \lyricFour - \lyricVerse1 -% \skip 4 * 24; - \lyricFour - \lyricFour - \lyricVerse2 - \lyricThrough +allLyrics = \lyrics { + " "4 * 12 + \rhythm \vocalVerse \lyricVerseOne + " "4 * 12 + " "4 * 12 + \rhythm \vocalVerse \lyricVerseTwo + \rhythm \vocalThrough \lyricThrough } lyricStaff = \context Lyrics = lyric< @@ -390,7 +337,6 @@ vocals = \notes{ \clef treble; % certainly no auto-beaming for vocals \property Voice.beamAuto=0 - \property Voice.dynamicDir = \up \skip 4 * 12; @@ -410,9 +356,9 @@ treble = { \clef treble; \property Voice.beamAutoBegin=0 \trebleIntro - \trebleVerse1 + \trebleVerseOne \trebleEentje - \trebleVerse1 + \trebleVerseOne \trebleThrough } @@ -424,9 +370,9 @@ trebleStaff = \context Staff = treble< bass = { \clef bass; \bassIntro - \bassVerse1 + \bassVerseOne \bassEentje - \bassVerse1 + \bassVerseOne \bassThrough } @@ -455,12 +401,9 @@ grandStaff = \context PianoStaff < { \notes { \grandStaff } } > \paper { -% \translator { \OrchestralScoreContext } -% \translator { \OrchestralPartStaffContext } \translator { \HaraKiriStaffContext } } -%broken 1.1.51 -% \midi{ -% \tempo 4 = 54; -% } + \midi{ + \tempo 4 = 54; + } } diff --git a/scripts/abc-2-ly.py b/scripts/abc-2-ly.py index 342b3d2d2c..dd4bcf2637 100644 --- a/scripts/abc-2-ly.py +++ b/scripts/abc-2-ly.py @@ -23,9 +23,12 @@ except: header = {} +lyrics = [] +voices = [] global_voice_stuff = [] default_len = 4 global_key = [0] * 7 # UGH +names = ["One", "Two", "Three"] DIGITS='0123456789' HSPACE=' \t' @@ -51,6 +54,12 @@ class Rational: pass +def dump_global (): + print ("global = \\notes{") + for i in global_voice_stuff: + print (i); + print ("}") + def dump_header (hdr): print '\\header {' @@ -58,6 +67,36 @@ def dump_header (hdr): print '%s = "%s";\n'% (k,hdr[k]) print '}' +def dump_lyrics (): + for i in range (len (lyrics)): + print ("verse%s = \\lyrics {" % names [i]) + print (lyrics [i]) + print ("}") + +def dump_voices (): + for i in range (len (voices)): + print ("voice%s = \\notes {" % names [i]) + print (voices [i]) + print ("}") + +def dump_score (): + print ("\\score{") + print (" \\notes<") + print (" \\global") + for i in range (len (voices)): + print (" \\context Staff=%s \\voice%s" % + (names [i], names [i])) + for i in range (len (lyrics)): + j = i + if j >= len (voices): + j = len (voices) - 1 + print (" \\context Lyrics=%s \\rhythm \\voice%s \\verse%s" % + (names [i], names [j], names [i])) + print (" >") + dump_header (header) + #print "%%%s" % global_voice_stuff, 1 + print ("}") + def set_default_length (s): m = re.search ('1/([0-9]+)', s) if m: @@ -70,11 +109,11 @@ def gulp_file(f): n = i.tell () i.seek (0,0) except: - print 'can\'t open file: ' + f + '\n' + sys.stderr.write ("can't open file: %s\n" % f) return '' s = i.read (n) if len (s) <= 0: - print 'gulped empty file: ' + f + '\n' + sys.stderr.write ("gulped emty file: %s\n" % f) i.close () return s @@ -191,7 +230,7 @@ def try_parse_tuplet_begin (str, state): str = str[1:] state.parsing_tuplet = 1 - print '\\times %s {' % tup_lookup[dig] + voices_append ("\\times %s {" % tup_lookup[dig]) return str def try_parse_group_end (str, state): @@ -199,14 +238,30 @@ def try_parse_group_end (str, state): str = str[1:] if state.parsing_tuplet: state.parsing_tuplet = 0 - print '}' + voices_append ("}") return str def header_append (key, a): s = '' if header.has_key (key): s = header[key] + "\n" - header [key ] = s + a + header [key] = s + a + +def lyrics_append (a): + i = len (lyrics) - 1 + if i < 0: + i = 0 + if len (lyrics) <= i: + lyrics.append ('') + lyrics [i] = lyrics [i] + a + "\n" + +def voices_append (a): + i = len (voices) - 1 + if i < 0: + i = 0 + if len (voices) <= i: + voices.append ('') + voices [i] = voices [i] + a + "\n" def try_parse_header_line (ln): m = re.match ('^(.): *(.*)$', ln) @@ -239,8 +294,11 @@ def try_parse_header_line (ln): header ['subtitle'] = a if g == 'L': set_default_length (ln) - - + if g == 'W': + if not len (a): + lyrics.append ('') + else: + lyrics_append (a); return m def pitch_to_mudela_name (name, acc): @@ -369,9 +427,10 @@ def try_parse_note (str, parser_state): - print '%s%s%s' % (pitch_to_mudela_name(notename, acc + global_key[notename]) , octave_to_mudela_quotes (octave), - duration_to_mudela_duration ((num,den), default_len, current_dots)) - + voices_append ("%s%s%s" % + (pitch_to_mudela_name (notename, acc + global_key[notename]), + octave_to_mudela_quotes (octave), + duration_to_mudela_duration ((num,den), default_len, current_dots))) slur_end =0 if str[0] == ')': slur_begin = 1 @@ -434,22 +493,22 @@ def try_parse_bar (str): sys.stderr.write ("warning: repeat kludge\n") bs = '|:' if bs: - print '\\bar "%s";' % bs + voices_append ('\\bar "%s";' % bs) str = str[1:] if str and str[:2] == '[|': sys.stderr.write ("warning: thick-thin bar kludge\n") - print '\\bar "||";' + voices_append ('\\bar "||";') str = str[2:] if str and str[:2] == ':|': sys.stderr.write ("warning: repeat kludge\n") - print '\\bar ":|:";' + voices_append ('\\bar ":|:";') str = str[2:] if str and str[:2] == '::': sys.stderr.write ("warning: repeat kludge\n") - print '\\bar ":|:";' + voices_append ('\\bar ":|:";') str = str[2:] return str @@ -458,11 +517,11 @@ def try_parse_bar (str): def try_parse_chord_delims (str): if str and str[0] == '[': str = str[1:] - print '<' + voices_append ('<') if str and str[0] == ']': str = str[1:] - print '>' + voices_append ('>') return str @@ -470,11 +529,11 @@ def try_parse_chord_delims (str): def try_parse_grace_delims (str): if str and str[0] == '{': str = str[1:] - print '\\grace { ' + voices_append ('\\grace { ') if str and str[0] == '}': str = str[1:] - print '}' + voices_append ('}') return str @@ -548,14 +607,11 @@ for opt in options: for f in files: if f == '-': f = '' - - print ("\\score{") - print (" <") - print (" \\context Staff=one \\notes {") parse_file (f) - print (" }") - print (" >") - dump_header (header) - print "%%%s" % global_voice_stuff, 1 - print ("}") + + dump_global () + dump_lyrics () + dump_voices () + dump_score () + -- 2.39.5