[CM] Grace: Process in a Process

Uğur Güney ugurguney at gmail.com
Fri May 23 04:22:39 PDT 2008


http://pinhead.music.uiuc.edu/~hkt/grace/doc/cm.html#sprout

# I thought about this, and want to ask whether a new thread is
created for every sprout command. If so maybe it is hard for the
computer to create a new thread every 0.5 seconds with good
synchronization.
# I changed the code such that instead of using a process inside a
process for random selection of what to output at every beat, I put a
loop in the place of inner process. In this way there is only one
process and hence there is not any synchronization problem.

(define-process (ritim2 n tempo)
  (run with
       patdur = (make-cycle '(.1 .05 .1 .05 .05)) and
       pattimes = (make-weighting '((1 10) (2 2) (3 1))) and
       rate = (/ (/ 60 tempo) 4)
       repeat n
       do
       (loop
         with times = (next pattimes)
         with dur = (next patdur)
         for i from 0 below times by 1
         do
         (send "cs:i" 1 (* i (/ rate times)) dur))
       (wait rate)))

(sprout (ritim2 100 120) 0 1)
(stop 1)


On Tue, May 20, 2008 at 5:04 PM, Uğur Güney <ugurguney at gmail.com> wrote:
> # In the (send) case, the timing is correct. Sounds are produced in
> constant time intervals. But in the (sprout (one-note...)) case they
> come in irregular intervals.



More information about the Cmdist mailing list