[CM] typo in ex13 ch20
Uğur Güney
ugurguney at gmail.com
Tue, 19 Feb 2008 10:51:09 +0200
------=_Part_17420_26232807.1203411069432
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
# 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".
------=_Part_17420_26232807.1203411069432
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
# 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>
------=_Part_17420_26232807.1203411069432--