Torsten that's GREAT! Very very nice and works so well. But it's working a
little too well for my purposes :)

Are you on the dev list? If you'd be willing to help me out some more I can
send you a couple of files that are under development and we can address
specifically the two makams that have this issue.

Let me know and thanks ahead!!

Adam

On Wed, Oct 31, 2018 at 9:08 AM Torsten Hämmerle <[email protected]>
wrote:

> Adam Good-3 wrote
> > Thank you Torsten, unfortunately this doesn't satisfy the criteria of #3
> > request, working across transpositions. If I ask for:
> > \key c \KeySig
> >
> > ...it prints a ces in the key signature. […]
>
> Hi Adam,
>
> Yes, unfortunately, my trickery only works for keys with a "sharp" tonic.
> In
> other cases, e.g. starting with a C, the artificially lowered first step in
> the scale will get a flat in the key signature, which is not what you asked
> for…
>
>
> The consequence of all this simply is that we need a *flexible* key
> signature dynamically reacting on the current tonic:
> If the tonic does not take any accidental (as in your C example), do
> nothing.
> If, however, the tonic has an accidental (no matter if it's a sharp, a
> flat,
> a semi-sharp or whatever) just leave it away.
>
> So, we can't get away with just specifying a fixed, well defined key
> signature, but we have to look for the current tonic and, if there's an
> accidental in the key sig, remove it.
>
> Unfortunately, the grob does not know the tonic and we have to read it from
> the context.
> To make it even worse, everything may change if we apply transposition.
>
> So, based on the naturalize-pitch snipped, I've defined a \makamKey
> function
> that reads all the music and eventually kicks out tonic accidentals from
> the
> key signature (i.e. pitch-alist).
> That way, a fis or bes tonic will never be displayed in the key signature
> but will be printed each time as an individual accidental.
> But a c tonic, for instance, will have no influence on the key signature
> (i.e. no superfluous unwanted accidentals).
>
> %%%%%%%%%%%
> \version "2.18.2"
>
> #(define (makam-alist tonic alist)
>    (let ((tonic-step (ly:pitch-notename tonic))
>          (tonic-alt (ly:pitch-alteration tonic)))
>      (if (eqv? tonic-alt 0)
>          alist
>          (filter (lambda (s) (not (eqv? tonic-step (car s))))
>                  alist))))
>
> #(define (makam-key music)
>    (let ((es (ly:music-property music 'elements))
>          (e (ly:music-property music 'element))
>          (tonic (ly:music-property music 'tonic))
>          (pitch-alist (ly:music-property music 'pitch-alist)))
>      (if (pair? es)
>          (ly:music-set-property!
>           music 'elements
>           (map makam-key es)))
>      (if (ly:music? e)
>          (ly:music-set-property!
>           music 'element
>           (makam-key e)))
>      (if (pair? pitch-alist)
>          (ly:music-set-property!
>           music 'pitch-alist (makam-alist tonic pitch-alist)))
>      music))
>
> makamKey =
> #(define-music-function (parser location m)
>    (ly:music?)
>    (makam-key m))
>
> testmusic = \makamKey \relative c' {
>   \key fis \locrian fis4 g a b c d e fis
> }
>
> { \testmusic }
> \transpose fis c \testmusic
> \transpose fis dis \testmusic
> \transpose fis bes, \testmusic
> %%%%%%%%
>
> <http://lilypond.1069038.n5.nabble.com/file/t3887/special-makam-keysig.png>
>
>
> HTH,
> Torsten
>
> a
>
>
>
> --
> Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html
>
> _______________________________________________
> lilypond-user mailing list
> [email protected]
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to