lilypond-user
[Top][All Lists]
Advanced

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

Thanks to David Nalesnik and Jan-Peter Voigt


From: Jay Vara
Subject: Thanks to David Nalesnik and Jan-Peter Voigt
Date: Sun, 28 Sep 2014 15:30:25 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

I wanted to get bar lines after each sub-meter of a compound meter, and 
to have Completion_heads_engraver recognize these bar lines and split 
and tie notes as needed.

Thanks to David and Jan-Peter, I was able to change their 
doubleBarlinesAfterTimeSig engraver to achieve this effect. I still have 
a little more work to do since some of the moment variables currently 
have fixed values. 

The engraver works well as seen in the code below. Again, I do not 
really understand the significance of why, for example time-signature is 
set to '() although it does not change in the engraver. Also, when I 
tried to change the variable last-fraction to last-bnum, it resulted in 
a syntax error, even after changing the #f to #0. Perhaps someone may 
know the answer to this.

Here is the modified engraver. Currently, it sets up timings of 3/4, 5/4 
and 2/4 and puts a double bar at the end of the three measures. Also 
notice how the double notes are split and tied across the bar lines. 
Pretty cool, I would say.

\version "2.18.0"

%{
  Based on a Scheme engraver that places
  double bar lines before time signature changes
  Provided by Jan-Peter Voigt
  Presumably written by David Nalesnik
%}
last-bnum = #0
fs = #(ly:make-moment 3 4)
rs = #(ly:make-moment 2 4)
ts = #(ly:make-moment 5 4)

alternateTiming =
#(lambda (context)
   (let ((time-signature '()) ;not sure why this time-signature is set 
to '()
         (last-fraction #f)) ;not sure why I can not change last-
fraction to last-bnum

     `((process-music
        . ,(lambda (trans)
             (let ((bnum (ly:context-property context 
'currentBarNumber)))

               (format #t "bnum = ~a measurelength ~a ~%" bnum 
(ly:context-property context 'measureLength))
               (case (modulo bnum 3)
                 ((1) (ly:context-set-property! context 'measureLength 
fs)
                   (if (> bnum last-bnum) (ly:context-set-property! 
context 'whichBar "||") )
                   (set! last-bnum bnum))
                 ((0) (ly:context-set-property! context 'measureLength 
rs))
                 ((2) (ly:context-set-property! context 'measureLength 
ts)))

               )
             ))

       (stop-translation-timestep
        . ,(lambda (trans)
             (set! time-signature '()))))
     ))



music = {
  \compoundMeter #'((3 4) (5 4) (2 4) )
  \relative c' {c d e2 f g4 a2 b c4 b2 a g4 f2 e d c d e f g a b c}


}

\score {
  \new Staff \music

  \layout {
    \context {
      \Score
      \consists #alternateTiming
    }
    \context {
      \Voice
      \remove Note_heads_engraver
      \remove Rest_engraver
      \consists Completion_heads_engraver
      \consists Completion_rest_engraver
    }
  }
}
\paper {
  indent = 0\cm

}







reply via email to

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