[CM] Grace: Process in a Process

Uğur Güney ugurguney at gmail.com
Tue May 20 07:04:12 PDT 2008


# OK. I thought one sprout for running the outer process was enough
but I was wrong. Every process must be sprouted to start.
# I surrounded the "one-note" processes with sprout command as you
suggested. This way it produced sound! But this time the output is
different then using (send) instead of the (one-note) wrapper process.
# 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.
# I suspect that I made a mistake in the design. There is a wait
command in the outer process ritim. The tempo is defined by the user
while sprouting ritim. So, after every "rate" seconds the (one-note)
process must be sprouted. There isn't any wait commands in the
(one-note). Where is the problem do you think?
# What confuses me is that just running (sprout (one-note 0.1)) or
(sprout (two-notes 0.1 0.5)), not calling them through another process
"ritim", produces the correct behavior.
# Thanks in advance!
-ugur-

On Tue, May 20, 2008 at 4:16 PM, Heinrich Taube <taube at uiuc.edu> wrote:
> hi, calling (one-note ...) just creates a process, it doesnt start running
> it. when you want to start a process running you have to actually sprout it.
> so your main process would look like this (untested):
>
> (define-process (ritim n tempo)
>  (run with
>      pat = (make-cycle '(.2 .1 .2 .1 .1)) and
>      rate = (/ (/ 60 tempo) 4)
>      repeat n
>      do
>      (send "cs:i" 1 0 (next pat))
>      (sprout (one-note (next pat)) )
>      (wait rate)))
>
>
> see:
>        http://pinhead.music.uiuc.edu/~hkt/grace/doc/cm.html#sprout
>
> On May 20, 2008, at 1:59 AM, Uğur Güney wrote:
>
>> # Hi,
>> # I'm trying to make a real-time drummer for using on performances
>> with my band, but stuck somewhere.
>> # I want to call a process in a process. The outer process will select
>> one of the inner processes. ie. "if a random variable is higher than
>> something than call this one, else call other one."
>> # There is a working example for this: "gestures.sal" but I can not
>> translate it to scheme language. The code below is what I have tried.
>> Using (one-note (next pat)) instead of (send "cs:i"...) did not
>> worked. What should I do?
>> # Have a nice day!
>> -ugur-
>>
>> merdivenler.lisp:
>> (define-process (ritim n tempo)
>>  (run with
>>      pat = (make-cycle '(.2 .1 .2 .1 .1)) and
>>      rate = (/ (/ 60 tempo) 4)
>>      repeat n
>>      do
>>      (send "cs:i" 1 0 (next pat))
>>      ;(one-note (next pat))
>>      (wait rate)))
>>
>> (sprout (ritim 10 120))
>>
>> (define-process (one-note dur)
>>  (run repeat 1
>>      do
>>      (send "cs:i" 1 0 dur)))
>>
>> (define-process (two-notes dur rate)
>>  (run repeat 2
>>      do
>>      (send "cs:i" 1 0 dur)
>>      (wait (/ rate 2))))
>>
>>
>> ritm.orc
>> sr=44100
>> ksmps=1
>> nchnls=1
>> 0dbfs = 1.0
>>
>>        instr 1 ;untitled
>> idur init p3
>> aenv linseg 0, idur*.1, 1, idur*.9, 0
>>
>> anoise noise 1, 0
>>
>> out anoise*(aenv)^4
>>        endin
>>
>> _______________________________________________
>> Cmdist mailing list
>> Cmdist at ccrma.stanford.edu
>> http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist
>
>



More information about the Cmdist mailing list