CM note subclass that sprouts algos?

Larry Troxler lt@westnet.com
Mon, 21 Jul 1997 22:01:47 -0400 (EDT)


Well, hopefully the following code and comments will make it clear what I
would like to do.  Basically, I have a function that sprouts an algorithm,
and rather than need to call this function from a "mute", I would like to
actually make a subclass of note, with slots corresponding to the function
args, that when scheduled, calls the functionto kick of
the algo for each 
note instance. Is this desirable, possible, etc.. ?

- - - - -

 ;; I did this because (random 0) crashes on Linux ACL! Why??
(defun zrand (x) (if (zerop x) 0 (random x)))

;;; Splat, although implemented as an algorithm, is something that I would
;;; like to treat conceptually as an instrument that I can insert in 
;;; threads, etc, using stella, using the function args as slots. How?
(defun splat (s-time spec density amp-spread start-spread f1 f1-spread f2
f2-spread f-shape r-spread)  
  (let ((a 0.3))
    (sprout  
     (algorithm
      nil
      badd  ;; a modified version of "badd" in the CLM dist., actually
      (start s-time
       length density  ; Xemacs indents this wrong, thinking "start" is a
func
       fuzz 100
       pvibamp 0
       rvibamp r-spread
       partials spec
       freq-env-base f-shape)
      (setf rhythm (zrand start-spread))
      (setf dur 6)
      (setf ampfun (list 0 0  2 1  3 1 5 0))
      (setf frequency f1)
      (setf amplitude a)
      (setf a (* a amp-spread))
      (let ((f-final (+ (- ( / f2 f1) 1) (clm-random f2-spread))))
	(setf freqfun (list 0 (clm-random f1-spread) 
			    2 f-final 5 f-final)))
      ))))

   
;;; This a testbed algo that tries out a variety of parameters for
;;; my "splat" instrument. Now, if I can make "splat" a true note class,
;;; that when run/mixed,  calls (splat) to sprout an algorithm, then I
;;; could do things like make this a generator to save output, ormanipulate
;;; splat parameters in threads via stella, etc.
(mute 
 m1 (length 20 rhythm 9)
 (let ((pset (item (items (b3 c4) (items (b3 c4) (b4 c5) (b2 c3) (f4 e4)
(c4 c5) in heap) in sequence))))
 (splat 
  time					;start
  (item (items (1 1) (items (1 1 2 0.2 3 0.4) (1 1) (1 1 1.5 1 2.5 1) ( 1
1) (1 1) in heap) in sequence)) ;spec
  (item (items 1 (items 3 6 10 20  in heap) in sequence)) ;density
  (item (items 0.5 (items 0.7 0.3 0.1 in heap) in sequence)) ; amp-spread
  (item (items 0 (items 0 0 0 0.2 1 in heap) in sequence)) ; start-spread
  (pitch (first pset))				; f1
  (item (items 0 (items 0 0 0.03 0.1 1.0 in heap) in sequence)) ; spread
  (pitch (second pset))				;f2
  (item (items 0 (items 0 0 0 0.03 0.1 1.0 in heap) in sequence)) ; spread
  (item (items 1 1 0.4 0.7 1.6 in heap)) ; freq env shape
  (item (items 0 (items 0 0 0 0.01 0.1 in heap) in sequence)) ;r-spread
  )
 ))
 
--  Larry Troxler  --  lt@westnet.com  --  Patterson, NY USA  --