lilypond-user
[Top][All Lists]
Advanced

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

Re: dual time sigs


From: Jan Nieuwenhuizen
Subject: Re: dual time sigs
Date: 22 Oct 2001 12:38:31 +0200

Ian Bailey-Mortimer  <address@hidden> writes:

> I am arranging Bach's /Jesu, Joy of Man's Desiring/ for string quartet.
> It switches constantly between 3/4 and 9/8 time (i.e. 3 beats per bar,
> divided into either 2 or 3 quavers). (How) Can I get both time signatures
> to appear at the start (pref. with 9/8 in parentheses, as it is in the
> urtext I am basing it on).

Here's a quick hack, with most of the things you want -- but the
parentheses don't seem to work (does anyone see why?).  If/when they
do, they probably should be from a bigger font, because I've used the
accidental-parentheses.  Maybe we should have other sets of
parentheses too.



#(define break-align-space-alist
 (append
   ;; huh, why don't we get an unkown: (Time_signature Time_signature) pair?
 '(((Left_edge_item Time_signature) . (extra-space 7.0)))
   default-break-align-space-alist))

#(define (parenthesize-callback callback)
   "Construct a function that will do CALLBACK and add parentheses.
Example usage:

  \property Voice.NoteHead \\override #'molecule-callback
                      =
                      #(parenthesize-callback Note_head::brew_molecule)
                    
"

   
   (define (parenthesize-molecule grob)
     "This function adds parentheses to the original callback for
GROB.  The dimensions of the molecule is not affected.
"
     
     (let* ((fn (ly-get-default-font grob))
            (pclose (ly-find-glyph-by-name fn "accidentals-)"))
            (popen (ly-find-glyph-by-name fn "accidentals-("))
            (subject (callback grob))
            
            ;; remember old size
            (subject-dims (ly-get-molecule-extent subject 0)))

       ;; add parens
        (set! subject
             (ly-combine-molecule-at-edge 
              (ly-combine-molecule-at-edge subject 0 1 pclose 0.2)
              0 -1 popen  0.2))
        
        ;; revert old size.
        (ly-set-molecule-extent! subject 0 subject-dims)
        subject))
   parenthesize-molecule)

fakesig = \notes {
  \time 3/4
  s128
  % huh, no parentheses
  \property Staff.TimeSignature \override #'molecule-callback
    =   #(parenthesize-callback Time_signature::brew_molecule)
  \time 9/8
  s128
  \property Staff.TimeSignature = \turnOff
  \time 3/4
  s128
  \partial 4*3
  s4*3
  \time 9/8
  s8*9
  \repeat unfold 2 {
    \time 3/4
    s4*3
    \time 9/8
    s8*9
  }
}

skipsig = \notes {
  s128*3 \partial 4*3
}

music = \notes\relative c'' {
  \skipsig
  \repeat unfold 3 { c4 d e | c d e d c8 | }
}

\score {
  <
    \property Score.BreakAlignment \override #'space-alist =
      #break-align-space-alist
    \context Staff <
      \fakesig
      \music
    >
  >
}


-- 
Jan Nieuwenhuizen <address@hidden> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org




reply via email to

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