[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: \transpose not work working inside define-music-function
From: |
Wols Lists |
Subject: |
Re: \transpose not work working inside define-music-function |
Date: |
Sun, 27 Dec 2015 16:41:03 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 27/12/15 16:32, J Smith wrote:
> I'm trying to define a music function that transposes a chord and a
> melody multiple times. But for some reason, the transposition is done
> only once.
>
> Here's my attempt:
>
> repeatpattern =
> #(define-music-function (parser location chord pattern) (ly:music?
> ly:music?)
> #{
> % <<
> \new ChordNames {
> \transpose c d { #chord }
> \transpose c e { #chord }
> }
> \new Staff {
> \transpose c d { #pattern }
> \transpose c e { #pattern }
> }
> % >>
> #})
>
> \score {
> \repeatpattern { c1 } { c'4 d' e' r }
> }
>
> (delete the %'s preceding << and >>; had to add them to pass Gmane's
> filter).
>
> Any ideas for why this is not working and how to fix it? (i.e., it
> should transpose "c d e" into "d e f#" and "e f# g#", not into "f# g#
> a#").
>
Just a guess, but \transpose is funny - I think of it as taking note
NAMES. As soon as you've fed the names through anything (such as
define-music-function) they've been converted to note PITCHES, and
\transpose no longer works.
Short answer - \transpose is very temperamental and sensitive as to
where it is used.
(And note, my understanding is almost certainly technically wrong, I
just find it helpful as a superficial guide to what's going on.)
Cheers,
Wol