Harvey,
You mentioned errata for Cybernetic Music by Jaxitron. One of the last routines
I coded (before I was distracted by something else) was the DVLP2 melody
routine. I had placed one mistake in the code for DVLP2. But there seems to be
a discrepancy in the hand code on page 119 and the usage of the DVLP2 function
to reproduce it on page 121. The comments explain. Here is the updated version
which I tested against the first 2 examples on page 122
DVLP2 =: 4 : 0
M=: P=. (1+2*$,y)$x
P =. (1 TMP y) (1+2*i. $,y)} P
M =: P,P
M =: M, _1 TMP 1+i. $,y
M =: M,M BGN _1 TMP 1
P =. (P BGN _1 TMP 1) + (($P)$0 1) expansion -1+i. $, y
M =: M,P
NB. Error in my original translation of APL code
NB. DVLP2 function on page 120. I used 'take' ('{.')
NB. instead of 'drop' ('}.') the following line is the corrected
NB. direct translation:
M =: M,(_2}.P),((0{P)+ 3 1 _3 _2),(0{P)
NB. The above is correct when tested on the first 2 examples on page 122
NB. however in hand code on page 119 there is no (_2}.P)
NB. so I believe there's an error in the output displayed there
NB. and in the hand code. If you use the following line you will get
NB. the expected output for 0 DVLP2 1 but it then breaks the other
NB. examples
NB. M =: M,((0{P)+ 3 1 _3 _2),(0{P)
P =. (0{P) CDNC212 $,y
M =: M,P,P,P
M =: M,(1 + _1{.P),_1 + ($,y){.P
)
In the above DVLP2 code I left out the line to convert it to character based
note representation (calling the n2p function). I assumed the intermediate form
would be more useful.
Finally my n2p function to take the output from DVLP2 and translate it to
character notes does not handle the relative octave changes properly. I didn’t
understand it at the time and basically created a mishmash of absolute octave
numbering which doesn’t work with Cybernetic Music method. In the method in
Cybernetic Music if you change an octave you prepend a _1 to the note if you go
down one octave (+1 if you go up an octave) from that point until another
relative change is specified all notes that follow will be in the lower (or
upper) octave. In the examples in cybernetic music there are a lot of _1Bb +1D
due to the octave changing only for 1 note and going back up to the original
octave. That is also why a 0 (zero) starts his note output that is the center
octave for the piece and relative changes take place from there.
Tom McGuire
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm