On 2020-04-01 3:04 pm, Павел Буданов wrote:
Hello, I'm newbie in scheme. I want to write simple function to octavize
melody, but something doesn't works...


\version "2.20.0"
octavize = #(define-music-function
    (parser location music) (ly:music?)
    #{ << #music \transpose c c' #music >> #})

music = { c' d' e' f' }

\markup "Need:"
\new Voice { << \music \transpose c c' \music >> }
\markup "Got:"
\new Voice { \octavize \music }

This is a case where the $ is needed over #. The \transpose ... #music is changing the value which affects both usage of #music. Using $music in place of either (or both) #music should fix the issue.

Also, parser and location are no longer required to be specified as arguments, so you can shorten up the function definition a bit.


-- Aaron Hill

Reply via email to