[CM] midi in port

Heinrich Taube taube at uiuc.edu
Wed Jan 7 04:43:22 PST 2009


svn trunk has midi input port working in sndlib and chicken, use the  
Audio>Midi In> menu to open input devices, set filters on channels and  
opcodes, and trace incoming messages. menu settings are saved in your  
preferences. ive also made input hooks easier to work with, rather  
than receiving  C++ pointers  they are simply passed 4 ints: (op chan  
data1 data2)   see cm.html for updated info about midi in and hook  
setting.
im going to take a day or so to try to get sndlib on windows, ill  
build binaries this weekend. here is an example of input hook  tested  
in sndlib and chicken

;; plays an fm generated chord centered around the key you play.
;; the harder you play the denser the chord

(define (fm-hook op ch kn vel)
   (if (and (= op mm:on)
            (> vel 0))
     (let* ((ind (rescale vel 60 120 2 4))
            (spec (fm-spectrum (hz kn)
                               (between 1.0 pi)
                               ind)))
       (loop for k in (spectrum-keys spec
                                     #:min (- kn 18)
                                     #:max (+ kn 18))
          do (send "mp:midi" 0 .5 k vel)))))

;; use quarter-tone tuning

(send "mp:tuning" 2)

;; set the hook

(send "mp:inhook" fm-hook)

;; now play your keyboard ...
;; clear the hook when you are done

(send "mp:inhook" #f)



More information about the Cmdist mailing list