lilypond-user
[Top][All Lists]
Advanced

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

Re: Four Bars per Line/System, again :)


From: David Nalesnik
Subject: Re: Four Bars per Line/System, again :)
Date: Sat, 19 May 2012 07:56:47 -0500

Hi again Janek,

On Sat, May 19, 2012 at 6:40 AM, David Nalesnik <address@hidden> wrote:
Hi Janek,

On Sat, May 19, 2012 at 4:27 AM, Janek Warchoł <address@hidden> wrote:
David,

a couple of thoughts:
- what about looping the break pattern?  I.e. \consists
#(custom-line-breaks-engraver '(2 3 4)) = \consists
#(custom-line-breaks-engraver '(2 3 4 2 3 4 2 3 4 ... 2 3 4))?

Great idea--this means that you can fix the number of bars per line by using a single number as your argument.  I'll see what I can do!

OK, this incorporates your idea of looping.  You specify a list as the argument of the function, and that grouping will loop until the end.  The example below shows how you would get four measures per line.  The score ends with whatever's left over, in this case the last two bars.

If you want to see the 2 3 4 pattern, do lthis:
\consists #(custom-line-breaks-engraver '(2 3 4))

Thanks for trying this out!  Please let me know if you run into any problems or have any more suggestions.

-David

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

\version "2.15.38"
                    
#(define (custom-line-breaks-engraver bar-list)
  (let* ((working-copy bar-list)
         (total (1+ (car working-copy))))
    (lambda (context)
      (make-engraver
        (acknowledgers ((paper-column-interface engraver grob source-engraver)
          (let ((internal-bar (ly:context-property context 'internalBarNumber)))
            (if (and (pair? working-copy)
                     (= (remainder internal-bar total) 0)
                     (eq? #t (ly:grob-property grob 'non-musical)))
                (begin
                  (set! (ly:grob-property grob 'line-break-permission) 'force)
                  (if (null? (cdr working-copy))
                      (set! working-copy bar-list)
                      (begin
                        (set! working-copy (cdr working-copy))))
                        (set! total (+ total (car working-copy))))))))))))
                       
\relative c' {
 \set Score.currentBarNumber = #4
   \repeat unfold 10 {
     \time 5/4
     c4 c c c c
     \time 3/4
     c c c
     \time 3/2
     c2 c c
   }
}

\layout {
  \context {
    \Score
    %\override NonMusicalPaperColumn #'line-break-permission = ##f
    \consists #(custom-line-breaks-engraver '(4))
  }
}

reply via email to

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