[CM] Does cm and portmidi support polyphony?

Rick Taube taube@uiuc.edu
Tue, 21 Mar 2006 06:26:28 -0600

thanassis -- both portmidi and midishare support playing many events 
simultaneously , or more technically, um ta ta   um ta ta  with lots of 
other notes at the same time. it does not matter if you use one "track" 
or many. so the problems you are experiencing must be of a different 

> left and right hand and make two seq_track,one for the left hand and 
> one for the right hand, but in the same time we call 
> (portmidi-record)...
> for example
> (if keynum < 64) which is the middle C make a left hand seq and name 
> it <seq_track0> and for keynum > 64 make a right hand seq, 
> <seq_track1> while (portmidi-record) recieve midi messages from the 
> midi keyboard.

yes this is ceratinly possible, do something like

(defparameter righthand (new seq))

(defparameter lefthand (new seq))

(defun record-hands (mm ms)
    (let ((ev (midi-message->midi-event mm :time ms)))
      (if (< (sv ev :keynum) 64)
          (append-object ev lefthand)
          (append-object ev righthand))))

(defparameter mp (portmidi-open :input ?))

(set-receiver! #'record-hands mp)

;; play um-ta-ta um-ta-ta with melody

(remove-receiver! mp)