[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using a variable with \relative
From: |
David Kastrup |
Subject: |
Re: Using a variable with \relative |
Date: |
Sun, 11 Sep 2011 13:47:31 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Basso Ridiculoso <address@hidden> writes:
> Is there a way to do something similar to this:
>
>
> \include "english.ly"
>
> x = { c }
> y = { g }
>
> \score {
> <<
> \new Staff {
> \clef "bass"
>
> \relative \x { d e f g a }
>
> \relative \y { bf a c d }
>
> }
> }
No (and please don't use unbreakable space in examples, since it makes
copy and paste impossible).
Pitches can't be placed into identifiers.
> Perhaps I need to write a function that sends in a variable?
Music functions return music expressions. The newfangled scheme
functions (did I commit them already?) don't support ly:export (that
would have been real hard to do), and anyway, ly:export only works for
things that can be put into an identifier.
You can't expect \relative \x to work, but you could make \x { ... }
work in itself for making things relative to something. And
\relative is a noop for unrelativable music.
> How does one dereference a variable inside of a function?
>
> For instance if I sent in \x how do I say "use the value of x"? Or is
> that necessary?
I have no idea what you are talking about.
>
> This doesn't seem to work either
> MyTestFunction =
> #(define-music-function
> (parser location firstnote secondnote thirdnote fourthnote
> fifthnote sixthnote )
> ( ly:music? ly:music? ly:music? ly:music? ly:music? ly:music? )
> #{
> \relative $firstnote { $firstnote $secondnote
> $thirdnote }
> \relative $sixthnote { $fourthnote $fifthnote
> $sixthnote }
> #})
\relative takes a _pitch_ argument, not a music argument. What problem
are you actually trying to solve?
I don't see that this makes much sense.
--
David Kastrup