[CM] midi-import
Rick Taube
taube at uiuc.edu
Wed Feb 28 06:59:38 PST 2007
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
objects.
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:
http://commonmusic.sourceforge.net/doc/dict/fold-objects-fn.html
there is also a tutorial on editing data with these functions:
http://commonmusic.sourceforge.net/etc/tutorials/editing.lisp
More information about the Cmdist
mailing list