diff options
author | Keith OHara <k-ohara5a5a@oco.net> | 2011-02-27 10:22:28 -0800 |
---|---|---|
committer | Keith OHara <k-ohara5a5a@oco.net> | 2011-03-01 23:14:30 -0800 |
commit | 9513397ad5f95ce92d490ba09afb4c32ec8bb791 (patch) | |
tree | b8cf84133c3ae874c8e5a8d76ec342eb606c0128 | |
parent | dbafc9ace7e261b158dacaea1076bb5db8b987a2 (diff) |
Key signatures for modes. Fix 748.
Compute midi key signatures for modes with fractional alterations,
using code from Graham Breed.
Provide a keyAlterationOrder for the modes in arabic.ly.
-rw-r--r-- | input/regression/midi-key-signature.ly | 15 | ||||
-rw-r--r-- | lily/key-engraver.cc | 2 | ||||
-rw-r--r-- | ly/arabic.ly | 50 | ||||
-rw-r--r-- | scm/midi.scm | 3 |
4 files changed, 52 insertions, 18 deletions
diff --git a/input/regression/midi-key-signature.ly b/input/regression/midi-key-signature.ly new file mode 100644 index 0000000000..8eafbad703 --- /dev/null +++ b/input/regression/midi-key-signature.ly @@ -0,0 +1,15 @@ +\version "2.13.53" +\header { + texidoc = "MIDI key signatures are output, using an approximate +key signature if MIDI format cannot represent the true key signature" +} + +\include "arabic.ly" +\score { + \relative do' { + \key fa \bayati + fa4 solsb lab sib + } + \midi { } + \layout { } +} diff --git a/lily/key-engraver.cc b/lily/key-engraver.cc index 66b6e00a2b..db223e6606 100644 --- a/lily/key-engraver.cc +++ b/lily/key-engraver.cc @@ -194,7 +194,7 @@ Key_engraver::read_event (Stream_event const *r) } if (warn) - r->origin ()->warning ("No ordering for key signature alterations"); + r->origin ()->warning ("Incomplete keyAlterationOrder for key signature"); } context ()->set_property ("keySignature", scm_reverse (accs)); diff --git a/ly/arabic.ly b/ly/arabic.ly index 48414b473d..61790e5542 100644 --- a/ly/arabic.ly +++ b/ly/arabic.ly @@ -33,52 +33,72 @@ dwn = { % bayati = #`( - (0 . 0) + (0 . ,NATURAL) (1 . ,SEMI-FLAT) (2 . ,FLAT) - (3 . 0) - (4 . 0) + (3 . ,NATURAL) + (4 . ,NATURAL) (5 . ,FLAT) (6 . ,FLAT) ) kurd = #`( - (0 . 0) + (0 . ,NATURAL) (1 . ,FLAT) (2 . ,FLAT) - (3 . 0) - (4 . 0) + (3 . ,NATURAL) + (4 . ,NATURAL) (5 . ,FLAT) (6 . ,FLAT) ) rast = #`( - (0 . 0) - (1 . 0) + (0 . ,NATURAL) + (1 . ,NATURAL) (2 . ,SEMI-FLAT) - (3 . 0) - (4 . 0) - (5 . 0) + (3 . ,NATURAL) + (4 . ,NATURAL) + (5 . ,NATURAL) (6 . ,SEMI-FLAT) ) sikah = #`( - (0 . 0) + (0 . ,NATURAL) (1 . ,SEMI-FLAT) (2 . ,SEMI-FLAT) (3 . ,SEMI-SHARP) - (4 . 0) + (4 . ,NATURAL) (5 . ,SEMI-FLAT) (6 . ,SEMI-FLAT) ) iraq = #`( - (0 . 0) + (0 . ,NATURAL) (1 . ,SEMI-FLAT) (2 . ,SEMI-FLAT) - (3 . 0) + (3 . ,NATURAL) (4 . ,SEMI-FLAT) (5 . ,SEMI-FLAT) (6 . ,SEMI-FLAT) ) +\layout { + \context { + \Score + keyAlterationOrder = + #`( + (6 . ,FLAT) (2 . ,FLAT) (5 . ,FLAT ) (1 . ,FLAT) + (4 . ,FLAT) (0 . ,FLAT) (3 . ,FLAT) + (6 . ,SEMI-FLAT) (2 . ,SEMI-FLAT) (5 . ,SEMI-FLAT ) (1 . ,SEMI-FLAT) + (4 . ,SEMI-FLAT) (0 . ,SEMI-FLAT) (3 . ,SEMI-FLAT) + (3 . ,SHARP) (0 . ,SHARP) (4 . ,SHARP) (1 . ,SHARP) + (5 . ,SHARP) (2 . ,SHARP) (6 . ,SHARP) + (3 . ,SEMI-SHARP) (0 . ,SEMI-SHARP) (4 . ,SEMI-SHARP) (1 . ,SEMI-SHARP) + (5 . ,SEMI-SHARP) (2 . ,SEMI-SHARP) (6 . ,SEMI-SHARP) + (6 . ,DOUBLE-FLAT) (2 . ,DOUBLE-FLAT) (5 . ,DOUBLE-FLAT ) (1 . ,DOUBLE-FLAT) + (4 . ,DOUBLE-FLAT) (0 . ,DOUBLE-FLAT) (3 . ,DOUBLE-FLAT) + (3 . ,DOUBLE-SHARP) (0 . ,DOUBLE-SHARP) (4 . ,DOUBLE-SHARP) (1 . ,DOUBLE-SHARP) + (5 . ,DOUBLE-SHARP) (2 . ,DOUBLE-SHARP) (6 . ,DOUBLE-SHARP) + ) + } +} diff --git a/scm/midi.scm b/scm/midi.scm index 7f26bea0dc..a3540e60ca 100644 --- a/scm/midi.scm +++ b/scm/midi.scm @@ -284,8 +284,7 @@ (define-public (alterations-in-key pitch-list) "Count number of sharps minus number of flats." - (* (apply + (map cdr pitch-list)) 2)) - + (apply + (map (lambda (p) (round (* (cdr p) 2))) pitch-list)) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |