# [CM] algorithm issues

Michael Theodore kerenaka@yahoo.com
Sat, 21 Dec 2002 13:31:07 -0800 (PST)

```(Sorry for the formatting of this message - it's
properly formatted at:

Hello there,
I'm trying to implement an alogorithm for someone, and
I can tell that I'm
going about it the hard way (the *real* hard way!).
It's working as it is,
but it's longer than I've actually shown, and my way
isn't going to scale
terribly well. I'm actually using
CM 1.3! (had lots of things that worked in 1.3 that
didn't in 1.4, and have
been stuck there ever since - I'll join the rest of
the world as soon as
I time to fix everything...). Any help would be deeply
deeply appreciated!
(I have two tickets waiting to the fountain of eternal
youth for the helful respondant.....)
best regards,
Michael

ALGORITHM:
1) Begin with strand 1 (1), repeat 9x
2) Insert strand 2 (2) in between each element of
strand 1, until
9x of strand 2
3) considering all prior strands as an ongoing single
strand, insert strand 3 (3), until 9x
4) considering all prior strands as an ongoing single
strand (creating the composite 3 1 3 2), insert the
first element of
strand 4 (4a), until 9x
5) considering all prior strands as an ongoing single
strand, insert the second element of
strand 4 (4b), alternating with the first element of
strand 4, until 9x 4b
6) considering all prior strands as an ongoing single
strand, insert the third element of
strand 4 (4c), maintaing the 4a 4b 4c cycle of strand
4, until 9x 4c

SAMPLE OUTPUT:
Stella [Top-Level]: mix bob
Start time offset:(<cr>=None)
1 1 1 1 1 1 1 1 1
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2
1 3 2 3 1 3 2 3 1 3 2 3 1 3 2 3 1 3
2 4A 3 4A 1 4A 3 4A 2 4A 3 4A 1 4A 3 4A 2 4A ;;; 1 3 2
3 strand picks up where it was in the cycle
3 4B 1 4A 3 4B 2 4A 3 4B 1 4A 3 4B 2 4A 3 4B 1 4A 3 4B
2 4A 3 4B 1 4A 3 4B 2 4A 3 4B
1 4C 3 4A 2 4B 3 4C 1 4A 3 4B 2 4C 3 4A 1 4B 3 4C 2 4A
3 4B 1 4C 3 4A 2 4B 3 4C 1 4A 3 4B 2 4C 3 4A 1 4B 3 4C
2 4A 3 4B 1 4C 3 4A 2 4B 3 4C
1 5A 4A 5A 3 5A 4B 5A 2 5A 4C 5A 3 5A 4A 5A 1 5A
3 5B 4B 5A 2 5B 4C 5A 3 5B 4A 5A 1 5B 4B 5A 3 5B 4C 5A
2 5B 4A 5A 3 5B 4B 5A 1 5B 4C 5A 3 5B

CODE FOLLOWS:
(let ((mess 0)(times 0))
(algorithm bob midi-note (start 0 length 213 amplitude
0.9 channel 0)
(setf note 60)
(setf mess (item
(items

(items "beginning")  ;;for printing
purposes

(items 1 for 9)  ;;;; 1

(items "start")      ;;for printing
purposes

(items
(items
(items 1)    ;;; 1
(items 2)) for 9) ;;2

(items "start")

(items
(items
(items 1 2  for 1) ;;;1 2
(items 3 for 1)) for 9) ;;3

(items "start")

(items
(items
(items
(items
(items 2 1  for 1)  ;;1 2
(items 3 for 1)) ; 3
for 1 counting values)
(items 4a)) for 9)

(items "start")

(items
(items
(items
(items
(items 3 1 3 2  for 1)) ;
previous strands collapsed into a single strand
for 1 counting values)
(items 4b 4a for 1)) for 34
counting values)

(items "start")

(items
(items
(items 1 3 2 3  for 1) ;;1 2
(items 4c 4a 4b  for 1)) for 56
counting values)

(items "start")

(items
(items
(items
(items
(items  1 3 2 3  for 1) ;;1 2
(items 4a 4b 4c  for 1))
for 1 counting values)
(items 5a) for 18 counting
values))

(items "start")

(items
(items
(items
(items
(items 3 2 3 1 for 1) ;;1 2
(items  4b 4c 4a for 1))
for 1 counting values)
(items 5b 5a for 1) for 34
counting values)))))

;;;etc

(if (or (equal mess "start")(equal mess "beginning"))
;; if beginning of pattern, newline
(progn
(format t "~&")
(setf times 1))
(setf times (+ times 1)))
(if (= (mod times 60) 0)  ;;; if pattern is longer
than 60
(format t "~&       ")) ;;; wrap the lines
(if (not (or (equal mess "start")(equal mess
"beginning")))
(format t "~S " mess))
(setf rhythm 1.0)
(setf duration rhythm)))

__________________________________________________
Do you Yahoo!?