[CM] help with repeated notes not running through a list...

Rob Howiler rhowiler at presby.edu
Tue Feb 23 13:05:04 PST 2016


Hi - When I execute this last bit, I don't get a random distribution of
octaves the way I *think* I am supposed to.  It doesn't seem to cycle
through the row, it just puts out a repeated pitch.

Also, when I try to use :time (now) in the mp:midi section, I get no
sound.  If I use :time 0, things work fine.

Any help would really be appreciated.
Rob
-----------------------------------------

(define (chance? prob)
  (< (random 1.0) prob))

(define (keynum->pc k)
  (mod k 12))

(define (retrograde-row row)
  (reverse row))

(define (transpose-row row to)
(loop for pc in row
      collect (keynum->pc (+ pc))))

(define (invert-row row)
  (loop for pc in row
        collect (keynum->pc (- 12 pc))))

(define row1 '(0 1 6 7 10 11 5 4 3 9 2 8))
(define row2 (invert-row row1))
(define row3 (retrograde-row row1))
(define row4 (retrograde-row row2))

(define (ttone reps row key beat amp)
  (process with len = (length row)
           repeat reps
           for i from 0
           for p = (mod i len)
           for pc = (list-ref row p) ; i mod 12
           for k = (+ key pc)
           do
           (mp:midi :key k :time 0 :dur beat)
           (wait beat)))
;;execute
(sprout (ttone 13 row1 60 2 .2))

;;;;;;;;;This returns repeated note on execution
(define (ttone2 len row key beat amp)
  (process repeat len
           for i from 0
           for p = (mod i len)
           for pc = (list-ref row p)
           for n = (if (chance? .5)
                     (+ key 12)
                     (- key 12))
           for k = (+ n pc)
           do (mp:midi :time 0 :key key :dur 1 :amp amp)
           (wait beat)))
;;;;;;;;;just a repeated note.  doesn't run through row
(sprout (ttone2 12 row1 55 2 .2))

(define (ttone3 len row key beat amp)
  (process repeat len
           for i from 0
           for pc = (list-ref row (mod i 12))
           for w = (* beat (random 4))
           for n = (if (= w 0)
                     (if (chance? .5)
                       (+ key 12)
                       (- key 12))
                     key)
                     for k = (+ n pc)
          do
          (mp:midi :time 0 :dur beat :key key :amp amp)
          (wait w)))

(sprout (ttone3 12 row1 55 2 .2))

-- 

------------------------------
<http://www.presby.edu>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cm-mail.stanford.edu/mailman/private/cmdist/attachments/20160223/64a35645/attachment.html>


More information about the Cmdist mailing list