[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Adding parallel thirds to the notes of a melody
From: |
Valentin Villenave |
Subject: |
Re: Adding parallel thirds to the notes of a melody |
Date: |
Wed, 3 Apr 2019 09:19:40 +0200 |
On 4/3/19, Gianmaria Lari <address@hidden> 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.