[CM] subobject-->:time
web musicae
webmusicae at hotmail.com
Fri Apr 29 03:01:44 PDT 2005
Helllo Rick, I'm surprised, was really easy with sv function. Tanks!. But,
why 'sv' is not in Common Music Dictionary?. Maybe is a old feautre of cm <
2.6?. Do you advice me any complet documentation?.
>From: Rick Taube <taube at uiuc.edu>
>To: "web musicae" <webmusicae at hotmail.com>
>CC: cmdist at ccrma.Stanford.EDU
>Subject: Re: [CM] subobject-->:time
>Date: Thu, 28 Apr 2005 17:56:17 -0500
>
>>Hello. How can I access to :time value of subobjects in a sequence.
>>I need obtain a list llike
>>((time note duration) ...) ;from a midi-file
>
>(loop for x in (subobjects #&myseq)
> collect (list (sv x time) (sv x keynum) (sv x duration)))
>
>>And second question. I'd want to realize a converter from midi time
>>to score time, then need implement silence events (?) -then I need
>>resolve de first question. Example from (after import-events):
>>(midi :time 0 :keynum 60 :duration 1 ...)
>>(midi :time 3 :keynum 67 :duration 1...)
>>...
>>to
>>(c4 q)
>>(rest h)
>>(g4 q)
>>...
>
>(defun seq-to-notes (seq)
> (let ((endtime 0))
> (loop for x in (subobjects seq)
> for begtime = (sv x time)
> for duration = (sv x duration)
> if (> begtime endtime) collect (list 'rest (- begtime
>endtime))
> collect (list (note (sv x keynum)) duration)
> do (setq endtime (+ begtime duration)))))
>
>
>;; test
>(new seq :name 'foo
> :subobjects
> (loop repeat 20
> for beg = 0 then (+ beg (pick 1 2 3 4))
> collect (new midi :time beg :duration 1
> :keynum (random 100))))
>
>(seq-to-notes #&foo)
>
>((F6 1) (REST 3) (EF0 1) (REST 2) (FS0 1) (REST 3) (BF4 1) (REST 2)
>(A2 1)
> (REST 3) (FS1 1) (G5 1) (REST 1) (F-1 1) (B4 1) (REST 3) (D4 1)
>(D3 1) (BF3 1)
> (EF3 1) (REST 3) (EF4 1) (REST 2) (A4 1) (REST 3) (C0 1) (BF3 1)
>(REST 2)
> (D0 1) (REST 1) (D-1 1) (REST 3) (F2 1))
>?
>
>
>
>--rick
>
>_______________________________________________
>Cmdist mailing list
>Cmdist at ccrma.stanford.edu
>http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist
More information about the Cmdist
mailing list