# In the book NftM there is an example, ex13, in Chapter 20, which is<br><pre>(define (play-pat reps rate dur amp )<br> (let ((pat (new heap <br> :notes '(c4 d ef f g af bf c5)<br> :for (new random :of '(8 12 16))<br>
:repeat reps))<br> (x 0)<br> (r #t ))<br> (process for k = (next pat)<br> until (eod? k)<br> for p = (pattern-period-length pat)<br> if r set x = 0<br> output<br>
(new midi :time (now)<br> :keynum k <br> :amplitude (interp x 0 .4 (- p 1) amp)<br> :duration dur)<br> wait rate<br> set r = (eop? pat)<br>
set x = (+ x 1))))</pre><a href="http://www.music.mcgill.ca/~ferguson/Notes%20from%20the%20Metalevel/nm/20/patterns.cm">http://www.music.mcgill.ca/~ferguson/Notes%20from%20the%20Metalevel/nm/20/patterns.cm</a><br>
<br>
# It gives an error while running with: (events (play-pat 10 .1 .3 .8) "pat-10.midi")<br># I looked at the CM Dictionary: <a href="http://commonmusic.sourceforge.net/doc/dict/patterns-topic.html">http://commonmusic.sourceforge.net/doc/dict/patterns-topic.html</a> and saw that there is not a type of pattern called "random" but "weighting". I changed it and the example produced the intended result.<br>
<br># 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.<br># I think the former name of "weighting" was "random".<br>