lilypond-user
[Top][All Lists]
Advanced

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

Re: Simple variable definition


From: David Kastrup
Subject: Re: Simple variable definition
Date: Sun, 21 Aug 2011 09:58:57 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Vaughan McAlley <address@hidden> writes:

> I’ve spent way to long trying to work this out... the simple test file:
>
> %test1.ly
> \version "2.14.2"
>
> myTranspose =    \transpose c' c
> staffOneName = "Soprano"
>
> % Version for men’s choir
> %{
> myTranspose =  \transpose c' g
> staffOneName = "Alto"
> %}
>
> ...produces
>
> test1.ly:4:0: error: syntax error, unexpected STRING
>
> What’s going on here? There are no misplaced curly braces or the like...

That's the problem.  If you wrote

myTranspose =    \transpose c' c { }

then the transposition from c' to c would have referred to the curly
braces (and nothing else: myTranspose is just a single music
expression).  Written like you did it, it refers to staffOneName.

You probably need to write something like

myTranspose = #(define-music-function (parser location music) (ly:music?)
               #{ \transpose c' c $music #})

in order to have myTranspose take an argument.

-- 
David Kastrup




reply via email to

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