lilypond-user
[Top][All Lists]
Advanced

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

Re: My first define-music-function, I'm trying, need help


From: Sébastien Gross
Subject: Re: My first define-music-function, I'm trying, need help
Date: Fri, 22 Dec 2006 17:20:55 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

On Thu, Dec 21, 2006 at 02:48:24PM -0800, address@hidden wrote:
> 
> The simple substitution example below should be pretty easy, but I'm "in a
> pickle", can someone show me how to replace the note name in the transpose
> statement with the note specified on the function call (parameter called
> "root")?
> 
> But it gets the following error:
> 
> <string>:2:13: error: syntax error, unexpected MUSIC_IDENTIFIER, expecting
> NOTENAME_PITCH or TONICNAME_PITCH
> \transpose c 
>              \lilyvartmpb { \relative { <c e g> } }
> 


Well I am not a lily schemer expert neither.

I found a function to transpose in the lily sources:

(set! root (ly:pitch-transpose root (ly:make-pitch 1 0 0)))

this makes note "root" one octave higher.

What you have to do:
        - get wanted pitch:
                (ly:music-property (first
                        (ly:music-property root 'elements)) 'pitch)
        - apply "ly:pitch-transpose" for each note of the chord:

        (map do-transpose (ly:music-property chords 'elements))

you have to write "do-transpose" an a function that do the job :-)

For example, have a look at the "removeTies" function here:
http://lilypond.chezwam.org/darcs/lilypond/utils/chezwam-functions.ly

This was my first scheme function I hope this will help you.


I will have a look on your's after my  vacations.


Merry Xmas & happy new year.


-- 
Sebastien Gross




reply via email to

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