Thinking about this more, the issue with simultaneous transposition and key
changes is worse than I realized, since it's pretty common to write
something like:

global = {
  s1
  \key e \major
  s1
}

music = {
  g'1
  \transposition a
  g'1
}

\new Staff \with {
  \autoTranspose
} <<
  \global \music
>>

The output is incorrect (but differently wrong) regardless of whether you
write << \global \music >> or << \music \global >>.

This is partially a bug in the original snippet, not just my version with
inserted key signatures. Solving it would seem to require the ability to
"listen ahead" or "listen behind" to all the events happening at the same
moment. Is that even possible?

On Thu, Jan 19, 2023 at 5:48 PM Saul Tobin <saul.james.to...@gmail.com>
wrote:

> Hi all,
>
> I managed to add functionality to the auto-transpose engraver snippet from
> OLL so that it prints key signatures at transposition changes. It also
> doesn't do so if the transposition change is only octave transposition.
>
> The one thing I'd like to fix is the behavior when an actual key change
> occurs at the same moment as a transposition change. Currently this
> triggers a warning and the output is only correct depending on whether the
> key change or transposition is written first. Not sure how to approach
> solving that.
>
> Saul
>
>

Reply via email to