[CM] typo in ex13 ch20

Uğur Güney ugurguney at gmail.com
Tue Feb 19 00:51:09 PST 2008


# In the book NftM there is an example, ex13, in Chapter 20, which is

(define (play-pat reps rate dur amp )
  (let ((pat (new heap
               :notes '(c4 d ef f g af bf c5)
               :for (new random :of '(8 12 16))
               :repeat reps))
        (x 0)
        (r #t ))
    (process for k = (next pat)
             until (eod? k)
             for p = (pattern-period-length pat)
             if r set x = 0
             output
             (new midi :time (now)
                  :keynum k
                  :amplitude (interp x 0 .4 (- p 1) amp)
                  :duration dur)
             wait rate
             set r = (eop? pat)
             set x = (+ x 1))))

http://www.music.mcgill.ca/~ferguson/Notes%20from%20the%20Metalevel/nm/20/patterns.cm

# It gives an error while running with: (events (play-pat 10 .1 .3 .8) "
pat-10.midi")
# I looked at the CM Dictionary:
http://commonmusic.sourceforge.net/doc/dict/patterns-topic.html and saw that
there is not a type of pattern called "random" but "weighting". I changed it
and the example produced the intended result.

# I'm reading textbooks for many years and this is the first time I found an
error :-) I want to share this experience with you.
# I think the former name of  "weighting" was "random".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cm-mail.stanford.edu/pipermail/cmdist/attachments/20080219/269957ca/attachment.html>


More information about the Cmdist mailing list