<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;">
<p>Hi,</p>
<p><br>
</p>
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 tried several ways to concatenate definstrument calls and place those with the<br>
body of with-sound, but nothing seems to work. It seems like ws.scm just wants<br>
a direct call to a definstrument in the body part. <br>
<br>
I gave up and tried concatenating with-sound blocks instead, and it works after a fashion but the
<br>
creation of separate audio files means those still have to be stitched together at some point.<br>
At least this is getting closer to what I was after.<br>
<br>
<p>regards,</p>
<p>Jim</p>
<p><br>
</p>
<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 :frequency frequency :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>
(let ((var '())<br>
(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 '(241 840.345 1000 960 500))) ;freq<br>
(ddd (make-cycle '(.2 1.25 .75 .25 .20 .15 .10 .10 .50 .10 .50))) ;dur<br>
)<br>
(set! var (cons<br>
(with-sound (:reverb nrev :output "Test1.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) .3)<br>
(set! i (+ (round-off i 2) v))<br>
)))) ;;end of with-sound<br>
(with-sound (:output "Test2.wav" :srate 48000 :channels 2 <br>
:header-type mus-riff :statistics #t :play #t)<br>
(let ((j 1))<br>
(do ((k 0 (+ k 1))) <br>
((>= k 25))<br>
(let ((v (next ddd)))<br>
(examp2 j v (next ccc) .1)<br>
(set! j (+ (round-off j 2) v))<br>
)))) ;;end of with-sound<br>
) ;end var<br>
) ;end set!<br>
var<br>
) ;end let<br>
<br>
</div>
</body>
</html>