[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
nested-repeats, BarNumbers and unfoldRepeats
From: |
Thomas Morley |
Subject: |
nested-repeats, BarNumbers and unfoldRepeats |
Date: |
Wed, 6 Apr 2016 01:44:26 +0200 |
Hi all,
the challenge: start a repeat with alternative endings in the second
volta of a previous repeat _and_ do BarNumbers correctly with
'numbers-with-letters _and_ correct midi while using \unfoldRepeats.
First attempt:
mus-tst = {
\set Score.alternativeNumberingStyle = #'numbers-with-letters
\override Score.BarNumber.break-visibility = #end-of-line-invisible
\repeat volta 2 { cis'1 }
\alternative {
{ d'1 }
{
\set Score.voltaSpannerDuration = #(ly:make-moment 4/4)
\repeat volta 2 {
e'1
#(make-music 'AlternativeEvent 'alternative-dir 1
'alternative-increment 0)
f'1
\unset Score.voltaSpannerDuration
}
\alternative {
{ g'1 a' }
{ b'1 c'' }
}
}
}
d''1
\bar "|."
}
\score {
{ \new Staff \mus-tst }
\layout {}
%\midi {}
}
\score {
\unfoldRepeats
{ \new Staff \mus-tst }
\layout {}
%\midi {}
}
It does all as desired but
#(make-music 'AlternativeEvent 'alternative-dir 1 'alternative-increment 0)
is not really nice. How to do it more elegant?
This came up in the german forum:
http://www.lilypondforum.de/index.php?topic=2229.msg12386#msg12386
My own attempt:
\version "2.18.2"
#(define ((my-make-volta-set l1 l2) mus)
(let* ((music (ly:music-deep-copy mus))
(alts (ly:music-property music 'elements))
(lalts (length alts))
(times (ly:music-property music 'repeat-count)))
(map (lambda (x y xx yy)
(make-music
'SequentialMusic
'elements
;; set properties for proper bar numbering
(append
(list (make-music 'AlternativeEvent
'alternative-dir xx
'alternative-increment yy))
(list x)
(if (= y (1- lalts))
(list (make-music 'AlternativeEvent
'alternative-dir 1
'alternative-increment 0))
'()))))
alts
(iota lalts)
l1
l2)))
mus-tst = {
\set Score.alternativeNumberingStyle = #'numbers-with-letters
\override Score.BarNumber.break-visibility = #end-of-line-invisible
\withMusicProperty #'elements-callback #(my-make-volta-set '(-1 0) '(1 0))
\repeat volta 2 { cis'1 }
\alternative {
{ d'1 }
{
\set Score.voltaSpannerDuration = #(ly:make-moment 4/4)
\repeat volta 2 {
e'1
f'1
\unset Score.voltaSpannerDuration
}
\alternative {
{ g'1 a' }
{ b'1 c'' }
}
}
}
d''1
\bar "|."
}
\score {
{ \new Staff \mus-tst }
\layout {}
%\midi {}
}
\score {
\unfoldRepeats
{ \new Staff \mus-tst }
\layout {}
%\midi {}
}
Is slightly different in printed output, but with recent
devel-versions the unfoldRepeats-version is terrible.
Hence the other question:
I suspect
https://sourceforge.net/p/testlilyissues/issues/4252/
being responsible for the difference compared with 2.18.
Though,
is my coding that bad?
Or is bordercase triggered not covered by 4252?
Thanks,
Harm
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- nested-repeats, BarNumbers and unfoldRepeats,
Thomas Morley <=