lilypond-devel
[Top][All Lists]
Advanced

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

Re: How to do this correctly?


From: David Kastrup
Subject: Re: How to do this correctly?
Date: Thu, 28 Jan 2010 15:25:23 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.90 (gnu/linux)

Carl Sorensen <address@hidden> writes:

> On 1/28/10 6:25 AM, "David Kastrup" <address@hidden> wrote:
>
>> Neil Puttock <address@hidden> writes:
>> 
>>> 2010/1/27 Carl Sorensen <address@hidden>:
>>> 
>>>> I don't think there is a way to do this better as the code sits now.  The
>>>> accidentals in the ambitus are AmbitusAccidentals, and are create by the
>>>> Ambitus_engraver, so the standard accidental styles (which might do what 
>>>> you
>>>> want) don't apply.
>>> 
>>> Agreed.  I think you'd have to add a property to the Ambitus_engraver
>>> which tells it to ignore the key signature.
>> 
>> Well, I don't like extra interfaces.  I would be quite interested to
>> know why the posted code actually works, engraving the proper key and
>> using correct accidentals for it.  Is it because the Ambitus engraver
>> pulls its signature from the Voice context (where the engraver sits),
>> while the standard accidental engraver and key signature engraver take
>> it (unmodified) from the Staff, where it presumably is set by the \key
>> command?  Then probably per-voice accidentals would cease working.
>
> I haven't looked thoroughly into this, but I suspect you are correct.
>
>> 
>> Maybe it would be possible to just make \override Ambitus #'keySignature
>> = #'() work as expected.
>> 
>
> How do you expect it to work?  'keySignature is a property of a
> context, not a property of a grob.  Ambitus doesn't have a
> 'keySignature; the context containing Ambitus has a 'keySignature.

Oops.  Misremembered from:

    2.2.2 Ambitus_engraver
    ----------------------

    Create an ambitus.

       Properties (read)

        `keySignature' (list)
              The current key signature.  This is an alist containing
              `(STEP . ALTER)' or `((OCTAVE .  STEP) . ALTER)',  where STEP
              is a number in the range 0 to 6 and ALTER a fraction,
              denoting alteration.  For alterations, use symbols, e.g.
              `keySignature = #`((6 . ,FLAT))'.

> How can one override a property that doesn't exist?

Right.

> Two ways I see of getting the output you want:
>
> 1) Add a property ambitusKeySignature.  This would be the keySignature used
> by the Ambitus_engraver, and would allow one to have any keySignature for
> the ambitus, which would be different from the staff/voice.  You would then
>
> \set ambitusKeySignature = #'()
>
> 2) Add a property ambitusIgnoreKeySignature that would cause the
> Ambitus_engraver to ignore the keySignature of the containing context.  You
> would then do

I think it might be better to have the ambitus engraver copy the key
signature at the time where it is consulted.  Then it would be
tweakable.

I currently have no idea just how and when the key signature gets
consulted by the engraver.

Anyway, I think that likely the ambitus engraver would be a good
candidate for reimplementing as a Scheme engraver.  It would appear
reasonably straightforward but not trivially so, and it is one of those
things where augmenting the _code_ and behavior is likely to be better
extensible in Scheme.

For example, I'd like the max-min interval finder prefer notes
compatible with the ambitus key.  I have code here where the ambitus is
in c major and shows an ambitus from f to fes' (because the fes' indeed
occurs before the equivalent e' appears in the voice).

Another extension would be to deal with clef changes and/or octavation:
if those are different for high and low end of the ambitus interval, it
might make sense to engrave lower and upper ambitus limits separately.

And semi-visual composition is less of a pain in Scheme than in C++.

-- 
David Kastrup




reply via email to

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