;;;
;;; c:\\program files\\acl62\\music10.cl
;;;
(load "c:\\program files\\acl62\\music9.cl")
(defun get-the-number-of-notes (l)
(do ((lst l (cddr lst))
(w))
((null lst) (length w))
(setf w (append w (second lst)))))
(defun get-a-melody-at-random (pair)
(let* ((l1 (get-a-phrase-at-random-aux pair))
(n1 (length l1))
(l2 (get-rythm-of-4beat n1)))
(list l1 (list '4beat l2))))
(defun get-a-melody-at-random-2 (pair)
(let* ((l1 (get-a-phrase-at-random-2-aux pair))
(n1 (length l1))
(l2 (get-rythm-of-4beat n1)))
(list l1 (list '4beat l2))))
(defun get-a-melody-for-ballad (pair)
(let* ((l1 (get-a-phrase-for-ballad-aux pair))
(n1 (length l1))
(r4 (get-rythm-of-4beat n1))
(r3 (get-rythm-of-3beat n1)))
(list l1 (list '4beat r4) (list '3beat r3))))
(defun get-a-melody-for-waltz (pair)
(let* ((l1 (get-a-phrase-for-waltz-aux pair))
(n1 (length l1))
(r4 (get-rythm-of-4beat n1))
(r3 (get-rythm-of-3beat n1)))
(list l1 (list '3beat r3) (list '4beat r4))))
;;;
;;;
;;;
(defun auto-comp-aux (pair)
(let ((l1 (get-a-melody-at-random pair))
(l2 (get-a-melody-at-random-2 pair))
(l3 (get-a-melody-for-ballad pair))
(l4 (get-a-melody-for-waltz pair)))
(format t "~% Melody-1 ~%~a~%~a" (first l1) (second l1))
(format t "~% Melody-2 ~%~a~%~a" (first l2) (second l2))
(format t "~% Melody-3 ~%~a~%~a~%~a" (first l3) (second l3) (third l3))
(format t "~% Melody-4 ~%~a~%~a~%~a" (first l4) (second l4) (third l4)))
(read-sentence))
(defun auto-comp-aux-2 (pairs)
(do ((lst pairs (cdr lst)))
((null lst))
(print (car lst))
(interpret-a-pair-2 (car lst))
(auto-comp-aux (car lst))))
(defun interpret-a-pair-aux-2 (l)
(format t "~% ***** ~a *****" l)
(format t "~% chord-scale: ~a" (chord-scale l))
(format t "~% chord-tone: ~a" (chord-tone l))
(format t "~% tension-notes: ~a" (tension-note l))
(format t "~% guide-tone: ~a" (guide-tone l))
(format t "~% elements-of-melody: ~a" (get-elements-of-melody l))
(format t "~% UST ~a" (UST l)))
(defun interpret-a-pair-2 (l)
(do ((lst l (cddr lst)))
((null lst))
(interpret-a-pair-aux-2 (list (first lst) (second lst)))))
;;;
;;;
;;;
(defun auto-comp (wn)
(tagbody
(my-randomize)
(format t "~%***** ~a *****" (second (first wn)))
(format t "~%The original key is ~a." (first (first wn)))
(format t "~%Enter a key.")
loop1
(setf l1 (read-sentence))
(if (not (key-p (car l1)))
(go loop1))
(if (equal (car l1) (first (first wn)))
(setf l2 (cdr wn))
(setf l2 (modulate-key1-to-key2 (cdr wn) (first (first wn)) (car l1))))
(format t "~%***** The key is ~a. *****" (car l1))
(auto-comp-aux-2 l2)))