lilypond-user
[Top][All Lists]
Advanced

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

Re: "smart" transposition of key signatures


From: David Kastrup
Subject: Re: "smart" transposition of key signatures
Date: Mon, 07 Oct 2013 19:22:10 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Kieren MacMillan <address@hidden> writes:

> One small improvement could [possibly?] be made: allowing for the extraction 
> of the keys into a variable separate from the notes.
> As you can see in the attached snippet, that doesn't work as expected.

> global = {
>   \key c \minor s1
>   \key cis \major s1
>   \key es \minor s1
> }
>
> smartglobal = {
>   \smartkey c \minor s1
>   \smartkey cis \major s1
>   \smartkey es \minor s1
> }
>
> notes = \relative c' {
>   c4 es g <c, es g>
>   cis eis gis <cis, eis gis>
>   es ges bes <es, ges bes>
> }
>
> music = << \global \notes >>
> smartmusic = << \smartglobal \notes >>

Uh, there is a _reason_ that \smartkey takes a music argument.  It can't
enharmonize some music that is not even under its control but is merely
played in parallel.

> *THAT* solution will definitely be worth both a snippet and some
> euros.

Have to pass.  What you can do if you want to is to write (cdr elts)
instead of elts everywhere in the body of the cond.  If you do that, the
key is not actually included in the resulting music.  You can then write

smartglobal = {
  \smartkey c \minor { \key c \minor s1 }
  \smartkey cis \major { \key cis \major s1 }
  \smartkey es \minor { \key es \minor s1 }
}

smartnotes = \relative c' {
  \smartkey c \minor { c4 es g <c, es g> }
  \smartkey cis \major { cis eis gis <cis, eis gis> }
  \smartkey es \minor { es ges bes <es, ges bes> }
}

But frankly, this seems like a rather awkward interface prone to user
error.  So I am afraid I have to decline.

While one can imagine other criteria than the key signature for
enharmonization, separating the criterion from the actually affected
music is not feasible.  The dependence on the key signature rather than
some part of the music content has the advantage that it is reasonably
simple to deal with multi-voice situations without having to write

\new Staff \smartkey ... << \new Voice ...
                            \new Voice ...
                         >>

in order to get the same enharmonization for all voices in a Staff
(anything else would be quite awkward).

But you don't get around telling every music how to enharmonize, and
that won't happen if it is merely in parallel with some enharmonization
construct.

-- 
David Kastrup



reply via email to

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