[CM] midi-import

Rick Taube taube@uiuc.edu
Wed, 28 Feb 2007 08:59:38 -0600

On Feb 28, 2007, at 7:44 AM, Orm Finnendahl wrote:

> Hi,
> I'm trying to import midi-events from a midi-file, collecting them
> into a list of numbers[...] How is it possible to filter out the  
> midi-messages?

if i understandd you correctly you want to collect the keynums of all  
<midi> objects in a seq of objects that might (also) contain non-midi  

do this:

	(define myseq (import-events ...))
	(fold-objects #'cons foo '() :slot 'keynum :class <midi>)

this would only collect the even keynumbers:

	(fold-objects #'cons foo '() :slot 'keynum :class <midi> :test #'even?)

fold objects is a very cool function, it lets you do all sorts of  
processing on sequences of data.

look at the examples in fold-object and map-objects for more info:


there is also a tutorial on editing data with these functions: