On 2020-03-07 9:41 pm, Pablo Cordal wrote:
Hi everyone!
I need to write several musical elements one after the other in the
same
staff separated by a double bar.Each element can last less or more than
one
bar (could be for instance 1 bar and a half),and I need an instruction
so
the beat count starts after each double bar.
Anybody can give a hand please?
Seems like all you need to do is reset the Timing.measurePosition back
to zero and increment the Score.currentBarNumber:
%%%%
\version "2.19.84"
forceBar = #(define-music-function (bar) (string?)
(define (advanceToNextMeasure context)
(let ((timing (ly:context-find context 'Timing))
(score (ly:context-find context 'Score)))
(ly:context-set-property! timing 'measurePosition
(ly:make-moment 0))
(ly:context-set-property! score 'currentBarNumber
(1+ (ly:context-property score 'currentBarNumber)))))
#{ \applyContext #advanceToNextMeasure \bar #bar #})
{
\override Score.BarNumber.break-visibility = #all-visible
b'4 4 4 4 4 \forceBar "|."
b'4 4 4 4 4 4 4 \forceBar "|."
b'4 4 4 \forceBar "|."
b'4 4 4 4 4 4 \forceBar "|."
}
%%%%
I have wrapped that up in a \forceBar command which acts like a \bar
that always starts a new measure.
This could have unintended side-effects, so additional testing would be
needed.
-- Aaron Hill