lilypond-user
[Top][All Lists]
Advanced

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

Re: using "\transpose" with variables


From: Mats Bengtsson
Subject: Re: using "\transpose" with variables
Date: Thu, 06 Sep 2007 08:58:09 +0200
User-agent: Thunderbird 2.0.0.5 (X11/20070716)



Roland Goretzki wrote:
Hello list, hello Tomas,

You wrote:

Hi,
I try to use \transpose with a variable as parameter like

mykey = {d'}

melody = \transpose c' \mykey \relative c' {... }

what??s wrong?

I get the message: syntax error, unexpected STRING, expecting NOTENAME_PITCH or TONICNAME_PITCH melody = \transpose c' mykey

Incorrect syntax.
Have a look at the documentation at 6.1.8 Transpose:

  \transpose c g' \mykey

which means:

  transpose from c to c' the music defined in \mykey

Roland, I think you misunderstood the question. Tomas probably wants to
do the same transposition on a number of different scores and be able to
change the transposition of all of them, by only modifying a single line in the .ly file, namely a definition of a variable that's used as the second argument of \transpose. Unfortunately, the parser of LilyPond is hard-coded to only accept an explicit pitch name. The solution is therefore to define your own music function in Scheme, that is equivalent to \transpose but can handle a variable as the input.
See Chapter 12 "Interfaces for programmers" and in particular 12.3 "Building
complicated functions", for hints on how to do it.

  /Mats




reply via email to

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