[CM] Re: reading midi data into cm

Rick Taube taube@uiuc.edu
Thu, 22 Sep 2005 05:53:48 -0500


hello denis, there are several ways to do this -- perhaps the easiest 
is to just provide ":class 'midi" to MAP-OBJECTS so only midi objects  
will be mapped:

(map-objects (lambda (x) (+ x 12)) x :slot! 'keynum :class 'midi)

you could also skip importing the control changes by specifying 
":channel-exclude 11" to import-events (i think 11 is the 
control-change opcode):

(defparameter hk1 (import-events "hk.mid" :meta-exclude t 
:channel-exclude 11))


--rick

On Sep 22, 2005, at 2:02 AM, Denis Fitzpatrick wrote:

> I did the following:
>  
> (defparameter hk1 (import-events "hk.mid" :meta-exclude true))
>  
> then tried:
>  
> (map-objects (lambda (k) (+ k 12)) s2 :slot! 'keynum)
>  
> but got:
>  
> *** - SLOT-VALUE: The class #<PARAMETERIZED-CLASS MIDI-CONTROL-CHANGE> 
> has no
>       slot named KEYNUM
> The following restarts are available:
> ABORT          :R1      ABORT
>  
> I do this:
> (list-objects hk1 :end 5)
> and get:
> 0. #i(midi-control-change time 0.0 channel 0 controller 7 value 127)
> 1. #i(midi-control-change time 0.0 channel 0 controller 10 value 64)
> 2. #i(midi-control-change time 0.0 channel 1 controller 7 value 127)
> 3. #i(midi-control-change time 0.0 channel 1 controller 10 value 64)
> 4. #i(midi-control-change time 0.0 channel 2 controller 7 value 127)
>  
> so I guess I need to somehow filter out those events(?) that do not 
> contain keynum (as later events do) if I want to do some transposing 
> as per one of the tutorial examples.  Can you point me to something? 
>  
> Thanks.
>  
> And I have just ordered and am eagerly awaiting “Notes from the 
> Metalevel…”  which I was turned on to by a recent review in the 
> Computer Music Journal.
>  
> Denis Fitzpatrick
>