|
From: | Freeman Gilmore |
Subject: | Re: keyAlterationOrder |
Date: | Tue, 29 Dec 2020 14:05:30 -0500 |
Hi,
I know that the alist cannot be read with assoc, at least in its simpleform.
It is at best a stretch to call this property an association list to begin with. An alist is a list of key-value pairs; but this property is a list of step-alteration pairs with no associative semantics. To use this list, you need only filter it to the items you are interested in, and the resulting list will have the items in the desired order. Consider this contrived example:assoc would read the first key of a given value none of the others keys ofWhy not?the same value would be read in the chain.%%%% \version "2.20.0" \new Voice { \applyContext #(lambda (context) (let ((keyAlterationOrder (ly:context-property context 'keyAlterationOrder)) (pitches #{ \fixed c' { cis dis ees fis gis aes bes } #})) (set! pitches (map (lambda (pitch) (cons (ly:pitch-steps pitch) (ly:pitch-alteration pitch))) (music-pitches pitches))) (format #t "\n Unordered: ~s" pitches) (format #t "\n Ordered: ~s" (filter (lambda (elem) (member elem pitches)) keyAlterationOrder))))
} %%%% ==== Parsing... Interpreting music...Unordered: ((0 . 1/2) (1 . 1/2) (2 . -1/2) (3 . 1/2) (4 . 1/2) (5 . -1/2) (6 . -1/2)) Ordered: ((6 . -1/2) (2 . -1/2) (5 . -1/2) (3 . 1/2) (0 . 1/2) (4 . 1/2) (1 . 1/2))====Converted from (step . alteration) back to pitch, the final order is: Bb Eb Ab F# C# G# D#. This should make sense given the standard convention of how flats and sharps are arranged
You are right indeed, it cannot really be called an alist
and assoc is of little use. Thanks for the example.
I think you misunderstood Carl. The order of the alist is the
critical piece of information. This property controls the order
in which alterations are printed in the key. For example:
I originally thought it did; but i can not see the logic by studying the two examples above
Aaron's reply should answer that.
One question though, Does the key signature affect the midi output?Yes, Key_performer generates a key signature meta event (FF 59).
Absolutely. Note that in MIDI, key signatures are limited to
a number of flats or sharps and a boolean representing major
or minor scale [1]. So the MIDI output is unaffected by
keyAlterationOrder.
[Prev in Thread] | Current Thread | [Next in Thread] |