On 4/3/19, Gianmaria Lari <gianmarial...@gmail.com> wrote:
> I don't have lilypond programming experience and I would like to know:
> - if there are hidden mistakes

No, that’s quite clean actually!

> - if it is better to write the function in a different way

I think in this case, simpler is better.

> - how I could avoid to write \voiceOne in \test {\voiceOne a b c'}

Just invert the order of the arguments to \partCombine: first the
uppermost (transposed) music, then the original music.

> - how I can encapsulate scale, inside the "test" function

You can use a "local" (which means temporary, just for the scope of a
single function) variable, defined with "let":

%%%%
\version "2.21.0"
test  =
#(define-music-function (music) (ly:music?)
   (let ((scale #{ c d e f g a b #}))
     #{
       \partCombine
         \modalTranspose c e $scale $music
         $music
     #}))

\test { a b c'}

%%%%

See "Local Bindings" in
https://www.gnu.org/software/guile/manual/html_node/Local-Bindings.html#Local-Bindings

Cheers,
V.

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to