<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>
"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."<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. 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. 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 "/opt/snd-16/CM_patterns.scm")<br>
<br>
(define (round-off z n)<br>
(let ((power (expt 10 n)))<br>
(/ (round (* power z)) power)))<br>
<br>
(definstrument (examp1 start-time duration frequency amplitude)<br>
(let* ((beg (seconds->samples start-time))<br>
(end (+ beg (seconds->samples duration)))<br>
(sine-wave (make-oscil :frequency frequency)))<br>
(do ((i beg (+ 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->samples start-time))<br>
(end (+ beg (seconds->samples duration)))<br>
(gen (make-polywave 440.0 :partials '(1 1.69 3 5))))<br>
(do ((i beg (+ i 1)))<br>
((= i end))<br>
(let ((x (* amplitude (polywave gen))))<br>
(outa i x)<br>
(outb i x) ))))<br>
<br>
;sanity check<br>
(with-sound (:output "/home/myTest.wav" :srate 48000 :channels 2<br>
:header-type mus-riff :statistics #t :play #t)<br>
(examp1 0 .5 480 .75)<br>
(examp2 1 .5 580 .07)<br>
(examp1 2 .5 380 .75)<br>
)<br>
<br>
(let ((aaa (make-heap '(360 800.345 1200 600))) ;freq<br>
(bbb (make-cycle '(1 1 .75 .25 .20 .15 .10 .10 .10 .10))) ;dur<br>
(ccc (make-heap '((examp1 i v (next aaa) .2) (examp2 i v (next aaa) .2) )))<br>
)<br>
(with-sound (:reverb nrev :output "/home/myTest.wav" :srate 48000 :channels 2 <br>
:header-type mus-riff :statistics #t :play #t)<br>
(let ((i 0))<br>
(do ((k 0 (+ k 1))) <br>
((>= k 25))<br>
(let ((v (next bbb)))<br>
;(examp1 i v (next aaa) .2) ;works fine<br>
;(format #t "~%next ccc: ")<br>
;(display (next ccc)) <br>
(next ccc) ; xxx not working<br>
(set! i (+ (round-off i 2) v))<br>
))))) </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>