anders wrote...

You can take the body of each of your two with-sound calls and place
within one single with-sound:

(let ((var '())
      (aaa (make-heap '(360 800.345 1200 600)))                 ;freq
      (bbb (make-cycle '(1 1 .75 .25 .20 .15 .10 .10 .10 .10))) ;dur
      (ccc (make-heap '(241 840.345 1000 960 500)))             ;freq
      (ddd (make-cycle '(.2 1.25 .75 .25 .20 .15 .10 .10 .50 .10 .50))) ;dur
      )
  (with-sound (:reverb nrev :output "Test1.wav" :srate 48000 :channels 2
                       :header-type mus-riff :statistics #t :play #t)

              ;; BODY OF CALL 1:

              (let ((i 0))
                (do ((k 0 (+ k 1)))
                    ((>= k 25))
                  (let ((v (next bbb)))
                    (examp1 i v (next aaa) .3)
                    (set! i (+ (round-off i 2) v)))))

              ;; BODY OF CALL 2:

              (let ((j 1))
                (do ((k 0 (+ k 1)))
                    ((>= k 25))
                  (let ((v (next ddd)))
                    (examp2 j v (next ccc) .1)
                    (set! j (+ (round-off j 2) v)))))))

I'm 100% sure what you want to do is possible.  If the above doesn't
come close, please try to be more explicit as to what you want to
achieve, perhaps detail in words.

Cheers,

-anders

------------------------------

Hi,
Yes, this is coming along better now.  Bill gave me a couple of pointers too.
I'm finding myself using Snd more for help with composing than audio editing 
these days,
but takes a while to get used to scheme.

Regards,
Jim

(load "/opt/snd-16/CM_patterns.scm")

(define (round-off z n)
  (let ((power (expt 10 n)))
    (/ (round (* power z)) power)))

(definstrument (examp1 start-time duration frequency amplitude)
(let* ((beg (seconds->samples start-time))
(end (+ beg (seconds->samples duration)))
(sine-wave (make-oscil :frequency frequency)))
(do ((i beg (+ i 1)))
((= i end))
(let ((x (* amplitude (oscil sine-wave))))
(outa i x)
(outb i x)))))

(definstrument (examp2 start-time duration frequency amplitude)
(let* ((beg (seconds->samples start-time))
       (end (+ beg (seconds->samples duration)))
       (gen (make-polywave :frequency frequency :partials '(1 1.69 3 5))))
(do ((i beg (+ i 1)))
    ((= i end))
(let ((x (* amplitude (polywave gen))))
(outa i x)
(outb i x) ))))

(let ((aaa (make-heap '(360 800.345 1200 600))) ;freqs
      (bbb (make-cycle '(1 1 .75 .25 .20 .15 .10 .10 .10 .10))) ;durs
      (ccc (make-heap '(500 440 880 1620 591.23))) ;freqs
      (ddd '(600 700 800 900) ) ;just freqs, no pattern
      (eee (make-cycle '(.2 1.25 .75 .25 .20 .15 .10 .10 .50 .10 .50))) ;durs
       (var1 '() )
       (var2 '() )
       )
      (set! var1 (append (next aaa #t) (next ccc #t) ))
      (set! var2 (append var1 ddd) )
   (let ((var3 (make-heap var1))
         (var4 (make-heap var2))
      )
(with-sound (:reverb nrev :output "/home/test.wav" :srate 48000 :channels 2
             :header-type mus-riff :statistics #t :play #t)
        (let ((i 0))
                 (do ((k 0 (+ k 1)))
               ((>= k 4))
          (let ((v (next bbb)))
            (examp1 i v (next var3) .3)
        (set! i (+ (round-off i 2) v))
                )))

        (let ((j 4))
                 (do ((k 0 (+ k 1)))
               ((>= k 15))
          (let ((v (next eee)))
              (examp2 j v (next var4) .05)
        (set! j (+ (round-off j 2) v))
                )))
                )))  ;;end of with-sound



________________________________
_______________________________________________
Cmdist mailing list
Cmdist@ccrma.stanford.edu
https://cm-mail.stanford.edu/mailman/listinfo/cmdist

Reply via email to