[CM] CM patterns - make-repeater

Heinrich Taube taube at uiuc.edu
Wed May 12 06:38:46 PDT 2010


On May 10, 2010, at 4:57 PM, Adam wrote:

> Ric,
>
> Could you give us a (Scheme) example of the make-repeater
> pattern ?


;;; -*- syntax: Lisp; font-size: 18; theme: "Emacs"; -*-

; the repeater pattern repeats the output of a pattern
; some number of times

(define (playrep len nts rate)
   (process repeat len
            do (mp:midi :key (next nts) :dur .5)
            (wait rate)))

;;  the heap produces 5 notes and the repeater (re)generates
;; what the heap produces either 1,2,3 or 4 times with 1
;; time being the most likely

(let* ((keys (key '(c3 cs d ds e f fs g gs a b c5)))
        (heap (make-heap keys 5))
        (repr (make-repeater heap
                             :repeat (make-weighting '((1 3) 2 3 4)))))
   (sprout (playrep 100 repr .15))
   )





















>
> I've tried such as,
>
> (define rtest (make-repeater '(2 1 3 4 5) :for 3 :limit #f)
> (next rtest :for )
>
> and many variations of the definition, but fear I don't get it.
> Thanks, best,   Adam.
>
>
> _______________________________________________
> Cmdist mailing list
> Cmdist at ccrma.stanford.edu
> http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist



More information about the Cmdist mailing list