- [Class]
midi-key-signature
A MIDI key signature event.
midi-key-signature
supports the following
slot initializations:
:time
number- The start time of the object.
:key
integer- An integer -7-7, where -7 means seven flats, 0 means no sharps or flats, and 7 means seven sharps. The default value is 0.
:mode
integer- An integer 0-1, where 0 means major and 1 means minor. The default value is 0.
Examples:
Example 1. The midi-key-signature
event.
;;; Ab major (new midi-key-signature :time 0 :key -4) ;;; A# minor (new midi-key-signature :time 0 :key 7 :mode 1)
Example 2. Generating time and key signatures.
(define major (new mode :degrees '(c d e f g a b c))) (define (gen-measures mea tempo ) ;; generate measures, each with own time and key signatures (let ((tonics (new heap :of '((c 0) (cs 7) (d 2) (ef -3) (e 4) (f -1) (fs 6) (g 1))))) (process with rhy = (rhythm 'e tempo) repeat mea for bpm = (pick 2 3 4 5) ; beats in measure for ton = (next tonics) ; keysig info do (transpose major (first ton)) ; shift mode output (new midi-key-signature :time (now) :key (second ton)) output (new midi-time-signature :time (now) :numerator bpm :denominator 4) each k = (between 28 42) ; modal keynums 48-72 as i below (1- (* bpm 2)) output (new midi :time (+ (now) (* rhy i)) :keynum (keynum k :in major) :duration rhy) wait (* rhy bpm)))) (events (gen-measures 8 120) "test.mid") ⇒ "test.mid" (midi-file-print "test.mid")
See also:
- MIDI event classes [Topic]