Omitting specific symbols from key signatures

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Omitting specific symbols from key signatures

Adam Good-3
Hi everyone,
I would greatly appreciate any help assistance.

In the snippet below, I define a key signature that gives accidentals for a locrian mode and then show this mode as if the tonic = fis (F#). I would like three things...

1. to suppress printing of the "fis" in the key signature (yet still have it considered in the scale pitch definitions).

2. to have the score (music) always print fis.

3. have this work across transpositions so, if I want \key cis \KeySig the cis will be suppressed from the key signature, etc.

Thank you ahead!!

Adam Good

%%%%%
\version "2.18.2"
KeySig = #'((0 . 0)(1 . -1/2)(2 . -1/2)(3 . 0)(4 . -1/2)(5 . -1/2)(6 . -1/2))

\relative c' {
  \key fis \KeySig
  fis4 g a b c d e fis
}

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Omitting specific symbols from key signatures

Torsten Hämmerle
Hi Adam,

the KeySig you've defined is nothing but \locrian.

If you don't want the F# to be shown (that's the tonic in F# locrian), you
just need to define a ,FLAT for step 0 (the tonic), because this will lower
the tonic and thus eliminate the F# from your key signature.
That way, the F# will not be printed in the key signature, but it will show
up each time as an accidental in the music:

%%%%%
\version "2.18.2"
KeySig = #`((0 . ,FLAT)(1 . ,FLAT)(2 . ,FLAT)(3 . 0)(4 . ,FLAT)(5 . ,FLAT)(6
. ,FLAT))

\relative c' {
  \key fis \KeySig
  fis4 g a b c d e fis
}
%%%%%


An alternative solution without defining a custom key signature would be
abusing the \lydian mode and setting the tonic a half step lower: ;)

%%%%%
\relative c' {
  \key f \lydian
  fis4 g a b c d e fis
}
%%%%%

(This works because our custom key signature now has flats everywhere except
on step 3 and this is basically a shifted lydian mode which has just a sharp
on step 3).
Yes, that's confusing, but, after all, you can add a comment. That's the
good thing about text-based formats.

HTH,
Torsten




--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Omitting specific symbols from key signatures

Adam Good-3
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. Although irrelevant, the example I'm giving is much much simpler than my actual needs which involves key signatures for Turkish makams and microtonality. So far I'm only running across two makams that have this issue. Anyway, being able to solve my simple locrian example will show me the way.

Basically I want to suppress output of that one lonely accidental.

Thanks again!

Adam

On Tue, Oct 30, 2018 at 12:50 PM Torsten Hämmerle <[hidden email]> wrote:
Hi Adam,

the KeySig you've defined is nothing but \locrian.

If you don't want the F# to be shown (that's the tonic in F# locrian), you
just need to define a ,FLAT for step 0 (the tonic), because this will lower
the tonic and thus eliminate the F# from your key signature.
That way, the F# will not be printed in the key signature, but it will show
up each time as an accidental in the music:

%%%%%
\version "2.18.2"
KeySig = #`((0 . ,FLAT)(1 . ,FLAT)(2 . ,FLAT)(3 . 0)(4 . ,FLAT)(5 . ,FLAT)(6
. ,FLAT))

\relative c' {
  \key fis \KeySig
  fis4 g a b c d e fis
}
%%%%%


An alternative solution without defining a custom key signature would be
abusing the \lydian mode and setting the tonic a half step lower: ;)

%%%%%
\relative c' {
  \key f \lydian
  fis4 g a b c d e fis
}
%%%%%

(This works because our custom key signature now has flats everywhere except
on step 3 and this is basically a shifted lydian mode which has just a sharp
on step 3).
Yes, that's confusing, but, after all, you can add a comment. That's the
good thing about text-based formats.

HTH,
Torsten




--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Omitting specific symbols from key signatures

Torsten Hämmerle
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
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Omitting specific symbols from key signatures

Adam Good-3
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 <[hidden email]> 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
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Omitting specific symbols from key signatures

Torsten Hämmerle
Adam Good-3 wrote
> 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.


Yes, I'm on the dev list.
And I'll appreciate a co-operation regarding makam issues.
After all, you and Hans can provide valuable practical examples, and one
important point after finally having added my new accidental glyphs, all the
non-standard accidental combinations in key signatures music currently
suffer from several spacing problems, because currently, for obvious
reasons, the focus had been solely on standard western accidentals.

All the best,
Torsten




--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Omitting specific symbols from key signatures

Adam Good-3
On Wed, Oct 31, 2018 at 10:48 AM Torsten Hämmerle <[hidden email]> wrote: 
Yes, I'm on the dev list.
And I'll appreciate a co-operation regarding makam issues.
After all, you and Hans can provide valuable practical examples, and one
important point after finally having added my new accidental glyphs, all the
non-standard accidental combinations in key signatures music currently
suffer from several spacing problems, because currently, for obvious
reasons, the focus had been solely on standard western accidentals.

Excellent let's bring it over there! I'll come up with a couple basic examples. And my apologies for not immediately recognizing your name from the thread RE: glyphs.

Thank you for all of this!

Adam

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Omitting specific symbols from key signatures

Torsten Hämmerle
Just for the files:

Forget all about music functions and a-posteriori manipulations of scales,
there is an disturbingly simple solution:

(link to my corresponding dev-list posting:)
How to set up a key signature definition
<http://lilypond.1069038.n5.nabble.com/Turkish-makam-using-regular-ly-td216753i20.html#a217107>  

All the best,
Torsten



--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user