[CM] Does cm and portmidi support polyphony?

Rick Taube taube@uiuc.edu
Mon, 27 Mar 2006 11:02:05 -0600

THis works perfectly fine for me (OSX).  Note that im using the  
latest cvs sources and  RTS is now a module so you should download  
from the files page. (ill have more to say about this in a day or so)

(in-package cm)

(use-system :portmidi)    ; load portmidi
(use-system :rts)         ; load rts

(defparameter mp (portmidi-open :input 0 :output 1))   ; my in/out ports
(defparameter mytune (new seq))  ; seq for recording

(portmidi-record! mytune mp)  ; start recording
;; play your tune...then
(portmidi-record! nil mp) ; stop recording

;; now separate into left and right hands seqs

(defparameter split 60)         ; split point for hands
(defparameter left-hand
   (new seq :subobjects
        (subobjects mytune :slot 'keynum :test (lambda (k) (< k  
(defparameter right-hand
   (new seq :subobjects
        (subobjects mytune :slot 'keynum :test (lambda (k) (>= k  

;;; check 'em out

(list-objects left-hand)
(list-objects right-hand)

;; put 'em in a midifile

(events (list left-hand right-hand) "test.mid")