lilypond-user
[Top][All Lists]
Advanced

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

Re: select a note in a chord


From: Valentin Villenave
Subject: Re: select a note in a chord
Date: Thu, 17 Jan 2019 23:03:29 +0100

On 1/17/19, Davide Bonetti <address@hidden> wrote:
> I worked on your example, and here is the result.

Nice!

> I'm sure there is a better way to write the inversion function, but I
> haven't find a way to program the repetition of a function in scheme.

This is certainly not the most elegant way, but it seems to work:

inversion =
#(define-music-function (num music) (integer? ly:music?)
   (let ((str "")
         (up? (> num 0)))
     (map (lambda (x)
            (set! str
                  (string-append str
                    (if up? "\\rise 1 " "\\drop 1 ")))
            str)
       (iota (abs num)))
     #{ $(ly:parser-include-string str) $music #}))

Can you verify that it works as you intended? (If you’re running 2.18,
you’ll need to add "parser" after ly:parser-include-string.)

Cheers,
V.



reply via email to

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