Hi Lucas,

I would not alter much beyond what you have if the current code works perfectly 
for your purpose (I think what you have is quite cool, though from the 
notational standpoint, instead of "[number]°v.:”, I would simply use 
“([number])” for simplicity’s sake, but that’s just my personal choice). 
However, based on my recent coding when I came up with the metric modulation, 
here’s something for you to consider:

In your ‘ritornello' where you do a binding of ‘volta-marks’ using let*, I see 
that you go back and forth between Scheme and LilyPond codes. The function 
works fine as is now, and I’ve seen many examples of switching back to LilyPond 
code (at least temporarily) after the code reaches to the main function body. 
But in interacting with \markup commands, I’ve faced situations where embedding 
Scheme codes within it didn’t work as expected. 

So this is just to say that if you run into such a problem yourself, you can 
rewrite the \markup command bit in Scheme (which appears to be what you’d need 
to do if you come up with a new markup function, 
https://lilypond.org/doc/v2.23/Documentation/extending/markup-functions). 

So your ‘volta-marks’ binding:

(volta-marks
(map
(lambda (n)
#{ \volta #(list n) {
<>^\markup {\italic \concat { #(number->string (+ n 1)) "º" "v.:" } }
} #})
volta-list))

…can be rewritten entirely on Scheme like this:

(volta-marks
(map
(lambda (n)
(make-music
'VoltaSpeccedMusic
'volta-numbers
(list n)
'element
(make-music
'SequentialMusic
'elements
(list (make-music
'EventChord
'elements
(list (make-music
'TextScriptEvent
'direction
1
'text
(markup #:line (#:italic (#:concat ((number->string (+ n 1)) "º" 
"v.:")))))))))))
volta-list))

You can use \displayScheme function to see how a markup function is represented 
in Scheme 
(https://lilypond.org/doc/v2.23/Documentation/extending/markup-construction-in-scheme).
  Again, you don’t have to alter the code you came up with if it works fine for 
now, but knowing how to stay put in Scheme may help some headache if you go on 
to write more complex codes.

Hope this is helpful—
Yoshi

Reply via email to