[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: arbitrary repeat counter
From: |
Jean Abou Samra |
Subject: |
Re: arbitrary repeat counter |
Date: |
Wed, 1 Jun 2022 17:14:40 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 |
Le 01/06/2022 à 17:04, Simon Bailey a écrit :
A bit more work and I now have the following:
\version "2.23.9"
#(set-object-property! 'phrase-length 'backend-type? integer?)
#(define (counter-stencil grob)
(let* ((counter (string->number (ly:grob-property grob 'text)))
(phrase-length (ly:grob-property grob 'phrase-length)))
(if (and (eq? (modulo counter phrase-length) 1) (>= counter
phrase-length))
(ly:stencil-aligned-to
(grob-interpret-markup grob
(markup (number->string (ceiling (/ counter phrase-length)))))
Y
CENTER))))
\defineBarLine "!|" #'("!|" "" "!|")
repeatCounting =
#(define-music-function (n bar-length phrase-length music) (index?
ly:music? integer? ly:music?)
#{
<<
\repeat unfold #n { #music \bar "!|" }
{
\set countPercentRepeats = ##t
\hide PercentRepeat
\override PercentRepeatCounter.phrase-length = #phrase-length
\override PercentRepeatCounter.stencil = #counter-stencil
\repeat percent #(* phrase-length n) { #bar-length }
}
>>
#})
\new Staff \relative c' {
\repeatCounting 4 s1 2 {c4 d e f | g f e d }
\break c1
\time 7/4
\repeatCounting 4 s4*7 3 {c4 d e f r r r | g f e d r r r| c1 r2 r4 }
}
How can I find out the following two bits of information?
1. What is the duration of a measure dependent on the current time signature?
In an engraver :-)
(ly:context-property context 'measureLength)
You can't get it in the music function, since timing is not
established at that point (just think that the time signature
could come from another element of a << >> construct, for
example).
Remember, though, that the time signature might change
in the middle of the repeat. Thus it will be a bit
more reliable to actually acknowledge the PercentRepeatCount
grobs and increment a counter whenever you see one.
2. How long is a given musical expression (in measures or beats)?
(ly:music-length your-music)
Best,
Jean
- arbitrary repeat counter, Simon Bailey, 2022/06/01
- Re: arbitrary repeat counter, Jean Abou Samra, 2022/06/01
- Re: arbitrary repeat counter, Simon Bailey, 2022/06/01
- Re: arbitrary repeat counter, Simon Bailey, 2022/06/01
- Re: arbitrary repeat counter, Jean Abou Samra, 2022/06/01
- Re: arbitrary repeat counter, Simon Bailey, 2022/06/01
- Re: arbitrary repeat counter, Jean Abou Samra, 2022/06/01
- Re: arbitrary repeat counter, Simon Bailey, 2022/06/01
- Re: arbitrary repeat counter,
Jean Abou Samra <=
- Re: arbitrary repeat counter, Simon Bailey, 2022/06/01
- Re: arbitrary repeat counter, Jean Abou Samra, 2022/06/01
- Re: arbitrary repeat counter, Simon Bailey, 2022/06/01
- Re: arbitrary repeat counter, Jean Abou Samra, 2022/06/01
- Re: arbitrary repeat counter, Simon Bailey, 2022/06/01
- Re: arbitrary repeat counter, Jean Abou Samra, 2022/06/01
- Re: arbitrary repeat counter, Simon Bailey, 2022/06/04
- Re: arbitrary repeat counter, Wols Lists, 2022/06/06
- Re: arbitrary repeat counter, Jean Abou Samra, 2022/06/06
- Re: arbitrary repeat counter, Wols Lists, 2022/06/06