[CM] scheme, larger structures

2016-08-22 Thread James Hearon


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


Re: [CM] scheme, larger structures

2016-08-16 Thread andersvi
Hi James.

> "J" == James Hearon writes:

J> I gave up and tried concatenating with-sound blocks instead, and
J> it works after a fashion but the creation of separate audio files
J> means those still have to be stitched together at some point.  At
J> least this is getting closer to what I was after.

What do you mean stitch together?  Do you want something like:

  (with-sound (options)
(calls-for-first-section)
(calls-for-second-section))

?

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

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



[CM] scheme, larger structures

2016-08-11 Thread James Hearon
Hi,


I had written about a scheme method to do something similar to CLM's with-mix
for larger compositional structures using multiple instruments and Bill had 
replied...

"If you want to concatenate several with-sounds into one,
just concatenate the instrument calls, with some variable
holding the section's start time."

I tried several ways to concatenate definstrument calls and place those with the
body of with-sound, but nothing seems to work.  It seems like ws.scm just wants
a direct call to a definstrument in the body part.

I gave up and tried concatenating with-sound blocks instead, and it works after 
a fashion but the
creation of separate audio files means those still have to be stitched together 
at some point.
At least this is getting closer to what I was after.


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 ((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
  )
 (set! var (cons
(with-sound (:reverb nrev :output "Test1.wav" :srate 48000 :channels 2
 :header-type mus-riff :statistics #t :play #t)
(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))
  ;;end of with-sound
(with-sound (:output "Test2.wav" :srate 48000 :channels 2
 :header-type mus-riff :statistics #t :play #t)
(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))
  ;;end of with-sound
) ;end var
) ;end set!
  var
  ) ;end let

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


[CM] Scheme, larger structures

2016-07-22 Thread James Hearon

Hi,

I had written about a scheme method to do something similar to CLM's with-mix
for larger compositional structures using multiple instruments and Bill had 
replied...

"If you want to concatenate several with-sounds into one,
just concatenate the instrument calls, with some variable
holding the section's start time."

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.

Maybe I'm off on the wrong design here.

Any help, comments appreciated.

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 440.0 :partials '(1 1.69 3 5
(do ((i beg (+ i 1)))
((= i end))
(let ((x (* amplitude (polywave gen
(outa i x)
(outb i x) 

;sanity check
(with-sound (:output "/home/myTest.wav" :srate 48000 :channels 2
 :header-type mus-riff :statistics #t :play #t)
  (examp1 0 .5  480 .75)
  (examp2 1 .5  580 .07)
  (examp1 2 .5  380 .75)
)

(let ((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 '((examp1 i v (next aaa) .2) (examp2 i v (next aaa) .2) 
)))
  )
(with-sound (:reverb nrev :output "/home/myTest.wav" :srate 48000 :channels 2
 :header-type mus-riff :statistics #t :play #t)
(let ((i 0))
 (do ((k 0 (+ k 1)))
   ((>= k 25))
  (let ((v (next bbb)))
  ;(examp1 i v (next aaa) .2) ;works fine
;(format #t "~%next ccc:  ")
;(display (next ccc))
(next ccc) ; xxx not working
(set! i (+ (round-off i 2) v))
)






















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