lilypond-user
[Top][All Lists]
Advanced

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

Re: Chord from a variable


From: Christopher R. Maden
Subject: Re: Chord from a variable
Date: Sun, 07 Aug 2011 16:59:27 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.18) Gecko/20110617 Thunderbird/3.1.11

On 08/07/2011 02:14 PM, Volker Paul wrote:
> The task is not to put a chord INTO a variable, but to get it FROM a
> variable. \chordmode's argument should be a variable (as in my
> example), and \chordmode should generate its output, a chord, from
> this variable.

I think this, and the earlier question about repeats, stem from the same
problem.

LilyPond is not a macro language.  Languages like TeX and the C
preprocessor are, and that sets some people’s expectations:

#define FOO bar

x = FOO( y ) // becomes x = bar( y )

FOO = f( y ) // becomes bar = f( y )

In LilyPond, the values are computed.

v = { c }

creates a music object with a sequence of one quarter(?) note of pitch
c, and stores it in the variable v.  It does *not* store the notation
string “{ c }” in the variable.  Similarly, the earlier question about
unfolding a relative repeat: the music object is a series of notes of
specific pitches, and unfolding the repeat repeats those notes, not the
notation (with its relative pitch notation).

> Then I must ask the other way:
> Why is the c in the chord one octave higher?
> I.e., why is the c in \chordmode { c } interpreted as c'?

That has bugged me too, and I have in some pieces used commas all over
the place to bring the pitches down.  Oh, well.

> Is there such a thing as forcing a mode change when READING the
> variable?

Yes.  This is the only time the mode is asserted; for what you want, you
need:

v = \chordmode{ c }
\v

> Or is there another function that builds a chord on a note stored in
> a variable?

I suspect you’ll need to get into Scheme to perform that kind of alchemy.

~Chris
-- 
Chris Maden, text nerd  <URL: http://crism.maden.org/ >
Those who learn from history are doomed to become cynics.



reply via email to

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