Class
midiGenerates MIDI note on and off pairs from a more general representation of key number, duration and amplitude.
midi supports the following slot initializations:
:time number:channel integer:keynum {keynum | note}r (rest) then the event will not
be output to the destination.
:duration number:amplitude number;; The midi event. ;;; a quiet middle C on channel 3 (new midi :time 0 :duration .5 :channel 3 :keynum 60 :amplitude .1) ;;; keynum specified as a note name (new midi :time 4 :keynum 'cs4 :duration 4) ;; Generating untempered MIDI notes. (define (harms fund low high dur) ;; play harmonics low to high starting on fund (let ((f (hertz fund))) (process for i from low to high output (new midi :time (now) ;; convert hertz to floating point keynum :keynum (keynum (* f (/ i low)) :hz true) :duration dur :amplitude .5) wait (+ dur .1)))) ;;; set channel tuning of midi file to 4 steps per ;;; semi-tone, or 25 cents per step. this quantization ;;; size uses the first four channels of the synthesizer. ;;; play partials 4-16 staring on c3 (events (harms 'c3 4 16 .5) "test.mid" :channel-tuning 4) ⇒ "test.mid" ;;; cancel channel-tuning (io "test.mid" :channel-tuning false)