lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple scheme function


From: Aaron Hill
Subject: Re: Simple scheme function
Date: Wed, 01 Apr 2020 15:11:15 -0700
User-agent: Roundcube Webmail/1.4.2

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

[Prev in Thread] Current Thread [Next in Thread]