[CM] Basic midi-CM

Rick Taube taube@uiuc.edu
Wed, 15 Jan 2003 08:49:23 -0600


it should be possible to send every midi message in the protocol, including sysex stuff. rather than define a trillion different classes, CM simply defines a class called 'midimsg' that lets you package up bytes to send howver you want.
the midimsg class has 3 slots

	time  duh
	msg   the main byte message
	data  other bytes

here is the trick: the value of the 'msg' slot is a specially formatted fixnum that encodes a 3 byte (max) MIDI message. Each of these integer message types has a low-level constructor:

	? (make-note-on 0 60 90)
	155226

	? (make-note-off 0 60 90)
	138842

	? (make-program-change 0 1)
	196736	

	? (make-control-change 0 1 2))
	180354

and so on. you can use the utility function 'midi-print-message' to inspect these things:

	? (midi-print-message 138842)
	#<Note-Off 0 60 90>
	138842

	? (midi-print-message 180354)
	#<Control-Change 0 1 2>
	180354

so to send a program change 3 on channel 0 at time zero:

        (process ...
                 output (new midimsg :time 0 
                             :msg (make-program-change 0 3)))

unfortunatly, the lowlevel functions are undocumented (well what did you expect...) but look at src/midi1.scm  for all the definions. the file src/midix.scm has tons of sysex stuff. actually, i think i _did_ document these low level functions at some point and those docs should still be valid. so maybe i shuold dust it off and add it to the doc/ tree in the next tarfile.





At 5:56 AM -0800 1/15/03, Ken wrote:
>-How does one send control info in CM?  For instance, lets say I just want
>to set the volume for a process to 85.  Will the process output volume
>messages for each iteration, or is there a way to output a single message?
>
>-How does one output a control sweep of some sort?  If I had a held note and
>I wanted to have a ramp of modulation messages come on during the sustain,
>how do I code that?
>
>Hope this makes sense,
>
>Thanks,
>Ken Locarnini
>
>
>
>
>_______________________________________________
>Cmdist mailing list
>Cmdist@ccrma.stanford.edu
>http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist