[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How to print measure position as each note prints
From: |
Jay Vara |
Subject: |
How to print measure position as each note prints |
Date: |
Tue, 23 Sep 2014 10:16:37 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
>I am not top-posting
I am trying to figure out how measure position and measure length work
so that I can change them to work properly with compound metres with
appropriate bar lines, notes on bars split and tied etc.
Two issues I have are:
1) Where to place the function that prints measure position and measure
length. By looking at a few snippets, I thought I would put an override
on the NoteHead stencil as in the code below.
2) How to retrieve the measure position and length. Again, looking at a
few snippets I came up with the code below.
As it would be obvious to the experts, the code is not working. It
prints nothing. Can someone suggest what I should change?
\version "2.18.2"
myNoteHeadTry =
#(lambda (grob)
(let* (
;; bindings
(measure-pos (ly:context-property grob 'measurePosition))
(measure-len (ly:context-property grob 'measureLength))
)
;; body
(format "Position ~a Length ~a ~%" measure-pos measure-len)
(ly:text-interface::print grob)
)
)
\score {<<
\compoundMeter #'((5 4) (2 4))
\override NoteHead #`stencil = #myNoteHeadTry
\relative c' { c d e f g2 a b c b a4 g f e d c}
>>
}
\layout {
\context
{ \Voice
\remove Note_heads_engraver
\consists Completion_heads_engraver}}
- How to print measure position as each note prints,
Jay Vara <=