[CM] OT music

James Hearon j_hearon at hotmail.com
Mon Jun 26 10:30:19 PDT 2023


Hi Michael,
re: code ex.

There was no overarching algorithm or AI.  (I wish there were...things could be easier).  Just using Bill's great variety of insts and gens to create sounds derived from the manual, and then mixing them.  Also using Michael Scholz's inf-snd.el and emacs as editor. Here's an example.

Best Regards,
Jim

;instrument to create sounds
(define (pulsed-envtest beg dur amp)
  (let ((start (seconds->samples beg))
      (stop (seconds->samples (+ beg dur)))
        (rnd1 (abs(mus-random 5)))
        (e (make-pulsed-env '(0 1 1 1 2 0) .01 1))
        (frq (make-env '(0 1 1 0) :duration dur :scaler (hz->radians 70)))
      (ampf (make-env '(0 0 .1 1 20 1 20.1 0) :duration dur :scaler amp))
      (gen1 (make-polywave 300 '(1 0.8 2 .07 3 .13)))
      (rnd2 (make-rand-interp 150 (hz->radians 20)))
        )
  (do ((i start (+ i 1)))
      ((= i stop))
      (outa i (* (env ampf)
                 (pulsed-env e (*(env frq)rnd1 ) )
             (polywave gen1 (rand-interp rnd2)))))))

 (with-sound (:play #t) (pulsed-envtest 0 6 .95))

; then mixes...

;;/////////////////////////////
;;/////////////////////////////
;;STEREO vers.
;show files from a folder. load a file from the list.
;add a number of mixes at random times.
;render, getting ready to save file.
;;/////////////////////////////
;;/////////////////////////////
;the list of files
(sound-files-in-directory "/opt/snd-23/test/")

;prints the list
(let* ((mylist (sound-files-in-directory "/opt/snd-23/test/")))mylist)

;get the length of the list
(let* (( mylist (sound-files-in-directory "/opt/snd-23/test/")) ;declare a list
)
(length mylist)
)
;-----------
;sets all mixes to blue
(set! (mix-color) (make-color 0 0 1))
;-----------
;; OPEN A STEREO SOUND for inspection, if needed.
(begin
(open-sound "/opt/snd-23/test/mywave.wav")
)

(play)

(close-sound #t)
;--------------------------
;displays the path, first filename, and opens the first file in the list
;then ADDS MIXES
(let* (( mypath "/opt/snd-23/test/")
       ( mylist (sound-files-in-directory "/opt/snd-23/test/")) ;declare a list
       ( myframples 0)
       ( ranframples 0)
       ( startnum 1)  ;*starting mix number*
       ( nummixes 5)  ;*number of mixes (nummixes - startnum)
       )
(format #t " ~A\n" mypath)
(format #t " ~A\n" (list-ref mylist 0))
(string-append mypath (list-ref mylist 0))
(open-sound (string-append mypath (list-ref mylist 9 ))) ;first opened snd
(set! myframples (framples *snd-opened-sound*))
(format #t "~A\n" myframples )
      (do ((i startnum (+ i 1)))
           ((>= i (+ startnum nummixes)))
(set! ranframples (random myframples))
(normalized-mix (string-append mypath(list-ref mylist i)) ranframples  #t 0 0)  ;note #t for stereo
))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cm-mail.stanford.edu/pipermail/cmdist/attachments/20230626/416dec0d/attachment.html>


More information about the Cmdist mailing list