lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

patch: auto-beaming for mixed duration


From: Eric Bullinger
Subject: patch: auto-beaming for mixed duration
Date: Wed, 08 Jan 2003 17:52:54 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01

Hello,

I have included a patch for lilypond 1.6.5 (cygwin) allowing arbitrary
auto-beaming.
 Simply use (e.g. for 8/8)
   \property Voice.autoBeamSettings \override #'(end * * 8 8) =
#(make-moment N 8)
 where N is the number in base 10 equal to the number of beam ending
positions in base measure length. So for positions at  the 7th,5th and
3rd eighth note, take 753 (base 8), (or 735, 357 etc.) and convert it to
base 10, which is N=491, see example.
 For N<measure length, auto-beaming works as before.

Maybe, a better way of entering the positions could be implemented, i.e.
something like add-make-moment.

Best,
 Eric
--- lilypond-1.6.5-1/lily/auto-beam-engraver.cc 2002-08-18 11:28:20.000000000 
+0200
+++ lilypond-1.6.5-1.eb1/lily/auto-beam-engraver.cc     2003-01-01 
15:13:29.000000000 +0100
@@ -5,6 +5,8 @@
   
   (c) 1999--2002 Jan Nieuwenhuizen <address@hidden>
   
+  Eric Bullinger 1.1.2003: added support for irregular auto-beaming 
+  
  */
 
 #include "beaming.hh"
@@ -18,6 +20,7 @@
 #include "engraver.hh"
 #include "item.hh"
 #include "spanner.hh"
+#include <math.h>
 
 /*
   TODO: figure what to do in grace?
@@ -185,7 +188,30 @@
          Moment length = * unsmob_moment (get_property ("measureLength"));
          pos = length - pos;
        }
-      r = pos.main_part_.mod_rat (moment.main_part_);
+      Moment length = * unsmob_moment (get_property ("measureLength"));
+      if (pos > length)
+       pos = 2*length - pos;
+      if (moment >= length && pos != 0) 
+       {
+         length = length / one_beat;
+         moment = moment / one_beat;
+         pos = pos / one_beat;
+         Moment moment_mod_length;
+         while (moment >= length)
+           {
+             moment_mod_length = moment.main_part_.mod_rat 
(length.main_part_); 
+             if( pos == moment_mod_length)
+               break;
+             else
+               moment = (moment-moment_mod_length) / length;
+           }   
+         if (pos == moment || pos == moment_mod_length )
+           r=0;
+         else
+           r = 1;
+       }
+      else
+       r = pos.main_part_.mod_rat (moment.main_part_);
     }
   else
     {
\version "1.4.10.jcn1"

\header {
        composer = "Eric Bullinger"
        footnotes = ""
        tagline = "Lily was here 1.5.6.eb1"
        title = "auto-beam-engraver test"
}

%%\include "MomBar_part.ly"

%%%%%%%%%%%%%%%%%%%%%%%%

notesOne = \notes \relative c''{
\key c \major   
\time 8/8

\partial 2..
d8 e f c d e f | c d e f c d e f | c d e f c d e f \bar "||"}

notesTwo = \notes \relative c''{
\key c \major   
\time 10/8

%\partial 2.. d8 e f c d e f | 
c d e f e c d e f e | \grace {c d d b } c d e f e c d e f e \bar "|."}
%%%%%%%%%%%%%%%%%%%%%%%%%%

\score{ \notes
        \context GrandStaff <
            \context Staff = sOne <
                \property Staff.instrument = "\\parbox{4eM}{2/8\\\\3-5-7/8}"
                \context Voice = vOne <
                    \notes {
                        \voiceOne 
                        \property Voice.autoBeamSettings \override #'(end * * 8 
8) = #(make-moment 2 8)
                        \property Voice.autoBeamSettings \override #'(end * * 
10 8) = #(make-moment 2 8)
                        \notesOne \break \notesTwo
}
                >
                \context Voice = vTwo <
                    \notes \transpose c{ 
                        \voiceTwo 
                        \property Voice.autoBeamSettings \override #'(end * * 8 
8) = #(make-moment 491 8)
                                % 491 (base 10) = 753 (base 8)
                        \property Voice.autoBeamSettings \override #'(end * * 
10 8) = #(make-moment 753 8)
                        \notesOne \break \notesTwo
                    }
                >
            >
        >
        \paper {
        }
    }













Attachment: auto-beam_engraver_example.ps.gz
Description: application/gzip


reply via email to

[Prev in Thread] Current Thread [Next in Thread]