<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi,<div>Yes. This is helpful, insightful. I'm still trying to get used to scheme in snd.</div><div>Thanks,</div><div>Jim<br><br><div><br><br>> <br>> Message: 1<br>> Date: Sat, 11 Jul 2015 12:12:00 +0200<br>> From: anders.vinjar@bek.no<br>> To: cmdist@ccrma.Stanford.EDU<br>> Subject: Re: [CM] scheme, snd, cm_patterns.scm<br>> Message-ID: <87io9rf1fz.fsf@bek.no><br>> Content-Type: text/plain<br>> <br>> Hi James.<br>> <br>> The beauty of the pattern-streams is they are 'streams', embodying a<br>> pattern (eg. a 'heap' in the above example) together with a promise to<br>> deliver the next item whenever you need it.<br>> <br>> Typically you set up a generator and store a pointer to that, just like<br>> you've done:<br>> <br>> (define aaa (make-heap '(160 600.345 1000 400)))<br>> <br>> After that,<br>> <br>> (next aaa)<br>> <br>> will return the next item from aaa anytime you want one.<br>> <br>> Using a slightly modified version of your example, you could do<br>> something like:<br>> <br>> (let ((aaa (make-heap '(160 600.345 1000 400)))) ;set up a stream<br>> (with-sound (:output "MyTest.wav" :srate 48000 :channels 2<br>>                  :header-type mus-riff :statistics #t)<br>>          (do ((st 0 (+ st 0.25)))<br>>                  ((>= st 2))<br>>                 (examp1 st 0.25<br>>                         (next aaa)        next item from aaa<br>>                         0.5 48000))))<br>> <br>> You'll find a general doc about Ricks patterns here:<br>> <br>> http://commonmusic.sourceforge.net/cm/res/doc/cm.html#patterns<br>> <br>> Many files included with CMs docs, esp. "doc/patterns1.scm" and<br>> "doc/patterns2.scm" - provide examples of setting up patterns and<br>> using these.<br>> <br>> -anders<br>> <br>> <br>> <br>> ------------------------------<br>> <br>> _______________________________________________<br>> Cmdist mailing list<br>> Cmdist@ccrma.stanford.edu<br>> https://cm-mail.stanford.edu/mailman/listinfo/cmdist<br>> <br>> <br>> End of Cmdist Digest, Vol 87, Issue 7<br>> *************************************<br>> <br></div></div>                                            </div></body>
</html>