<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<br>
<div style="color: rgb(0, 0, 0);"><font size="2"><span style="font-size:10pt;">
<div class="PlainText">Hi,<br>
<div><br>
I had written about a scheme method to do something similar to CLM's with-mix<br>
for larger compositional structures using multiple instruments and Bill had replied...<br>
<br>
&quot;If you want to concatenate several with-sounds into one,<br>
just concatenate the instrument calls, with some variable<br>
holding the section's start time.&quot;<br>
<br>
I'm not sure I'm off in the right direction, but I tried to implement what Bill was suggesting and got stuck getting the instruments to read in the body of with-sound.&nbsp; I tried a cons, let, string, and a vector on the instrument calls and couldn't get those
 to play in with-sound so I just put them in a pattern.&nbsp; The instrument calls seem to be getting thru when I print, but for some reason with-sound is not recognizing them.<br>
<br>
Maybe I'm off on the wrong design here.<br>
<br>
Any help, comments appreciated.<br>
<br>
Regards,<br>
Jim<br>
<br>
<br>
(load &quot;/opt/snd-16/CM_patterns.scm&quot;)<br>
<br>
(define (round-off z n)<br>
&nbsp; (let ((power (expt 10 n)))<br>
&nbsp;&nbsp;&nbsp; (/ (round (* power z)) power)))<br>
<br>
(definstrument (examp1 start-time duration frequency amplitude)<br>
(let* ((beg (seconds-&gt;samples start-time))<br>
(end (&#43; beg (seconds-&gt;samples duration)))<br>
(sine-wave (make-oscil :frequency frequency)))<br>
(do ((i beg (&#43; i 1)))<br>
((= i end))<br>
(let ((x (* amplitude (oscil sine-wave))))<br>
(outa i x)<br>
(outb i x)))))<br>
<br>
(definstrument (examp2 start-time duration frequency amplitude)<br>
(let* ((beg (seconds-&gt;samples start-time))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (end (&#43; beg (seconds-&gt;samples duration)))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (gen (make-polywave 440.0 :partials '(1 1.69 3 5))))<br>
(do ((i beg (&#43; i 1)))<br>
&nbsp;&nbsp;&nbsp; ((= i end))<br>
(let ((x (* amplitude (polywave gen))))<br>
(outa i x)<br>
(outb i x) ))))<br>
<br>
;sanity check<br>
(with-sound (:output &quot;/home/myTest.wav&quot; :srate 48000 :channels 2<br>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :header-type mus-riff :statistics #t :play #t)<br>
&nbsp; (examp1 0 .5&nbsp; 480 .75)<br>
&nbsp; (examp2 1 .5&nbsp; 580 .07)<br>
&nbsp; (examp1 2 .5&nbsp; 380 .75)<br>
)<br>
<br>
(let ((aaa (make-heap '(360 800.345 1200 600))) ;freq<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (bbb (make-cycle '(1 1 .75 .25 .20 .15 .10 .10 .10 .10))) ;dur<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (ccc (make-heap '((examp1 i v (next aaa) .2) (examp2 i v (next aaa) .2) )))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br>
(with-sound (:reverb nrev :output &quot;/home/myTest.wav&quot; :srate 48000 :channels 2&nbsp; &nbsp;<br>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :header-type mus-riff :statistics #t :play #t)<br>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; (let ((i 0))<br>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (do ((k 0 (&#43; k 1))) &nbsp;<br>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ((&gt;= k 25))<br>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (let ((v (next bbb)))<br>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;(examp1 i v (next aaa) .2) ;works fine<br>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;;(format #t &quot;~%next ccc:&nbsp; &quot;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;(display (next ccc)) <br>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (next ccc) ; xxx not working<br>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;(set! i (&#43; (round-off i 2) v))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )))))&nbsp;</div>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>