2018-04-01 22:25 GMT+02:00 brob2684 <bennrobert...@hotmail.com>:
> Thomas Morley-2 wrote
>> 2018-03-31 22:55 GMT+02:00 brob2684 <
>
>> bennrobertson@
>
>> >:
>>>
>>> Is it possible to extract the name of the first key signature in a piece
>>> (single staff) after adjusting for any transposition to use in text
>>> markup?
>>> (e.g. looking to get the phrase "C major" if there is no key signature
>>> before the first note (i.e. default key)).
>>>
>>> I have come across http://lsr.di.unimi.it/LSR/Item?id=856, but have no
>>> idea
>>> where to even begin modifying it (some of the changes are obvious - I can
>>> tell I don't need the rescaling bits, but I don't know enough
>>> scheme/lilypond internals to work out how to change it to give me just
>>> text).
>>>
>>
>> Hi,
>>
>> obviously I don't understand what you want.
>> Could you explain why the lsr-snippet doesn't fit your needs?
>> May be some (not working) pseude-code with the syntax you want to use
>> may be helpful as well.
>
> The snippet works insofar as it gives me the name of each key signature,
> which is very close to what I want. However, I'm only interested in storing
> the name of the first key in the piece in a variable to use in text later,
> rather than displaying the name of each key when the key signature changes.
>
> I can deduce that the last three lines of the snippet (below) are
> responsible for printing the name of the key signature above the stave at
> each key change.
>
>             (ly:grob-set-property! grob 'stencil
>               (ly:stencil-combine-at-edge key-sig-stencil 1 1
>                 key-name-scaled padd))
>
> What I would like to do is change this somehow to set a variable to the "key
> signature name".
>
> I suspect what I need to do is remove the three lines above and replace them
> with some sort of command that first tests whether the "key signature name"
> variable been set; if yes then do nothing (to prevent overriding the
> variable), else set the "key signature name" variable to the name of the key
> signature.
>
> At some later point in markup, I'd like to be able to reference the "key
> signature variable", e.g.
>
> melody = \relative c'' {
>   \time 4/4
>   c1 \key d \major d \key e \major e \key f \major f
> }
>
> \score {
>     \new Staff { \melody }
> }
>
> \markup { Some text later that states that the first key in the piece is in
> *\key_signature_name* }
>
> and have the text say "Some text later that states that the first key in the
> piece is in *C major*".



Hi,

thanks for clarification.

I thought a bit about it and I think it might be possible to store the
initial key-signature-name and let TextScript get this name under
certain conditions.
Though, what to do if _no_ KeySignature is present?
Could be c-major or a-minor or e-phrygian or maybe nothing of it but
rather dodecaphonism or ...
How to decide?

Best would be to output something like "no KeySignature present", imho.

What do you think?


Cheers,
  Harm

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to