[CM] :time (now) wait rate
Rob Howiler
rhowiler at presby.edu
Mon Mar 7 05:12:09 PST 2016
Hi Ben - Thanks for the heads up. Johannes helped me figure out that I needed to call “wait” as a function. It’s kinda tricky using the Metalevel book with all the changes to the language since it was written, but I’m getting there. I appreciate everyone’s help & everyone’s patience.
> On Mar 6, 2016, at 8:02 PM, Ben McAllister <benmca at gmail.com> wrote:
>
> Looks like you're missing some parens around your call to wait - this
> does the trick for me:
>
> (define (riff knum rhy)
> ;;generate an upward strum of notes
> (let ((rate (rhythm->seconds (/ rhy 4) 60)))
> (process repeat 5
> for k from (+ 39 (mod knum 13)) by 13
> do
> (mp:midi :key k :dur rate :amp .3 :chan 0)
> (wait rate))
> ))
>
> On Thu, Mar 3, 2016 at 10:10 AM, Rob Howiler <rhowiler at presby.edu> wrote:
>> Hi
>> Thanks in advance for helping me with my questions. I know I am becoming a bore with these newbie questions….
>>
>> Anytime I try to use :time (now) in a :mp:midi statement (or perhaps it’s the “rate” part), I get all sound at once when it should sound sequentially. I’m defining a couple of helper apps (as per Notes from the Metalevel which I understand is outdated in some ways, language-wise.
>>
>> (define (bpm->seconds bpm)
>> (/ 60.0 bpm))
>>
>> (define (rhythm->seconds rhy tempo)
>> (* rhy 4.0 (bpm->seconds tempo)))
>>
>> (define (riff knum rhy)
>> ;;generate an upward strum of notes
>> (let ((rate (rhythm->seconds (/ rhy 4) 60)))
>> (process repeat 5
>> for k from (+ 39 (mod knum 13)) by 13
>> do
>> (mp:midi :key k :amp .3 :chan 0)
>> wait rate)))
>> (sprout (riff 48 0.5))
>>
>> ….gives all sound as a chord.
>>
>> using (riff 48 0.5) just gives #<lambda ({time}-968)> in the listener window (the number increases sequentially each time I try to evaluate the (riff 48 0.5) expression).
>>
>> Also, if I use
>> (define (riff knum rhy)
>> ;;generate an upward strum of notes
>> (let ((rate (rhythm->seconds (/ rhy 4) 60)))
>> (process repeat 5
>> for k from (+ 39 (mod knum 13)) by 13
>> do
>> (mp:midi :key k :time (now) :amp .3 :chan 0)
>> wait rate)))
>> (riff 48 0.5) - or (sprout (riff 48 0.5))
>> give me no sound with #<unspecified> in the listener window. The :time (now) is the only thing that’s different.
>>
>> Thanks again for your help and patience.
>> Rob
>>
>> ------------------------------------------------------
>> Dr. Rob Howiler
>> Academic Computing Services Coordinator
>> Assistant Professor of Music
>> rhowiler at presby.edu
>> (864) 833-8324
>> ------------------------------------------------------
>>
>>
>> --
>>
>> ------------------------------
>> <http://www.presby.edu>
>>
>> _______________________________________________
>> Cmdist mailing list
>> Cmdist at ccrma.stanford.edu
>> https://cm-mail.stanford.edu/mailman/listinfo/cmdist
>
>
>
> --
> Ben McAllister | listenfaster.com | @listenfaster | tuktuband.com |
> c: 206.849.3183
------------------------------------------------------
Dr. Rob Howiler
Academic Computing Services Coordinator
Assistant Professor of Music
rhowiler at presby.edu
(864) 833-8324
-------------------------------------------------------
--
------------------------------
<http://www.presby.edu>
More information about the Cmdist
mailing list