[Top][All Lists]

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

Re: keyAlterationOrder

From: Aaron Hill
Subject: Re: keyAlterationOrder
Date: Mon, 28 Dec 2020 23:17:58 -0800
User-agent: Roundcube Webmail/1.4.9

I know that the alist cannot be read with assoc, at least in its simple

Why not?

assoc would read the first key of a given value none of the others keys of
the same value would be read in the chain.

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:

\version "2.20.0"

\new Voice {
  #(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"
       (lambda (elem) (member elem pitches))
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.

One question though,   Does the key signature affect the midi output?

Yes, Key_performer generates a key signature meta event (FF 59).

-- Aaron Hill

reply via email to

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