From ca7d1956dfc466faa5abf84e63de77a73bec5713 Mon Sep 17 00:00:00 2001 From: Julian Squires Date: Mon, 27 Dec 2004 13:39:39 +0100 Subject: [PATCH] A few updates to support latest YMamoto. --- README | 13 ++++++--- examples/demo-y.mbl | 10 +++---- src/mumble.lisp | 6 +++-- src/music-parser.lisp | 7 ++--- src/package.lisp | 3 ++- src/replay-ymamoto.lisp | 70 +++++++++++++++++++++++++++++++------------------ tools/dot-s-to-sc68.sh | 17 +++++++++--- 7 files changed, 83 insertions(+), 43 deletions(-) diff --git a/README b/README index 454670f..602b4cf 100644 --- a/README +++ b/README @@ -4,7 +4,7 @@ Julian Squires / 2004 Mumble is a package for converting text representations of music into data for specific playroutines. The format, described in this -document, is a variant on the (popular?) Music Macro Language (or MML) +document is a variant on the (popular?) Music Macro Language (or MML) format. I started writing this package so I could convert some of my older @@ -37,6 +37,13 @@ UNSUPPORTED REPLAYS I'D LIKE TO SUPPORT * something on the atari 800XL +USING MUMBLE FROM THE LISP REPL + +You should be able to just: +> (asdf:oos 'asdf:load-op 'mumble) +> (mumble:compile-mumble "my-file.mbl" "my-file.out-ext") +and everything should work. + INPUT FORMAT BASICS @@ -63,8 +70,8 @@ parsing myself). @a => arpeggio. Followed by digits indicating arpeggio number, or 0 for arpeggio off. @b => pitch macro (mnemonic: bend). -@d => volume macro? For scripting time signatures/repeated rhythmic - accents, etc. +@d => volume macro? (mnemonic: dynamics). For scripting time + signatures/repeated rhythmic accents, etc. @i => instrument. An instrument is, broadly, a snapshot of partial channel state; what that means depends on the replay. @t => tempo macro? For scripting rallentendos and accelerandos. diff --git a/examples/demo-y.mbl b/examples/demo-y.mbl index d688ec3..bfe20db 100644 --- a/examples/demo-y.mbl +++ b/examples/demo-y.mbl @@ -26,7 +26,7 @@ copyright "Julian Squires / 2004" ;;;; D minor. -ABC t128 +ABC t140 B q4 A o2 d1 | f | @@ -37,14 +37,13 @@ A b- | a2 g2 | B [f8f16f]3 f8f | @a1 e8e16ee8e @a2 ee16ee8e | C r | r | -#COMMENT Drums should kick in here. #MUSIC - ABC !loop +C q8 A q6 d4 d d d8>d< | f4 f f f8e | B @a1 [d8d16d]3 d8d | @a2 [c8c16c]3 c8c | C r | r | -;D k8 h h h s h h h | k8 h h h s h h h | +;D k8 h h h s h h h | k8 h h h s h h h | A b-4 b- b- b-8>f< | a4 a8>a< g4 g8>c+< | B [f8f16f]3 f8f | @a1 e8e16ee8e @a2 ee16ee8e | @@ -72,7 +71,7 @@ C c2 e4 a | b-2 a4 >c+ | ;;;; A minor. B @a0 q4 -C q2 +C q4 A o1 a4 a a a8>a | c4 c c c8cec a4 g | >c4 f4 f f f8>c< | e4 e8>e< d4 d8g+ | B >[c8c16c]3 c8c< | b8b16bb8b bb16bb8b | C f2 a8>cea | b2 g4 g+ | - A a | c4 c c c8c4c8 e4 0 (1+ note->)) + (note (aref notes note->) (aref notes note->)) + (channel-pos 0 (1+ channel-pos))) + ((>= note-> (length notes))) + (case (music-command-type note) + (:note (ymamoto-output-note note channel stream)) + (:arpeggio + (format stream "~&~8TDC.W $~X" + (logior (ash #b11000000 8) (music-command-value note))) + (incf *total-bytes* 2)) + (:tempo + (setf (channel-tempo channel) (music-command-value note))) + (:staccato + (setf (channel-staccato channel) (music-command-value note)))) + (when (and (channel-loop-point channel) + (= (channel-loop-point channel) + channel-pos)) + (setf *loop-point* *total-bytes*))) + (format t "~&frames: ~A, bytes: ~A" *total-frames* *total-bytes*)) (defun output-ymamoto-header (stream) @@ -106,14 +118,15 @@ multiple loops." ORG 0 song_header: - DC.L arpeggio_table ; pointer to arpeggio table - DC.L venv_table ; pointer to volume envelope table - DC.B 1 ; number of tracks")) + DC.W arpeggio_table>>2 ; pointer to arpeggio table + DC.W venv_table>>2 ; pointer to volume envelope table + DC.B 1,0 ; number of tracks, pad")) (defun ymamoto-output-length-loop-list-table (stream name table) ;; note that the zeroth element of the table is skipped. - (format stream "~&~A:~%~8TDC.B ~D" name (max 0 (1- (length table)))) + (format stream "~&~8TALIGN 4~&~A:~%~8TDC.B ~D" name + (max 0 (1- (length table)))) (do ((i 1 (1+ i))) ((>= i (length table))) (multiple-value-bind (list loop) (find-and-remove-loop (aref table i)) @@ -130,7 +143,7 @@ song_header: (output-ymamoto-header stream) ;; for n tracks (let ((track-num 1)) - (format stream "~&~8TDC.L track_~D" track-num)) + (format stream "~&~8TDC.W track_~D>>2" track-num)) (ymamoto-output-length-loop-list-table stream "arpeggio_table" (tune-get-table tune :arpeggio)) (ymamoto-output-length-loop-list-table @@ -139,18 +152,25 @@ song_header: (let ((track-num 1)) ;; I bet the following could all be reduced to one big format ;; statement. Yuck. - (format stream "~&track_~D:" track-num) + (format stream "~&~8TALIGN 4~&track_~D:" track-num) (do ((c (tune-channels tune) (cdr c)) (ctr (char-code #\a) (1+ ctr))) ((null c)) - (format stream "~&~8TDC.L channel_~A" (code-char ctr))) + (format stream "~&~8TDC.W channel_~A~A>>2" + track-num (code-char ctr))) + + ;; output channels themselves. (do ((c (tune-channels tune) (cdr c)) (ctr (char-code #\a) (1+ ctr))) ((null c)) - (format stream "~&channel_~A:" (code-char ctr)) - (ymamoto-output-note-stream (channel-data-stream (car c)) stream) + (format t "~¬e ~A" (channel-loop-point (car c))) + (format stream "~&~8TALIGN 4~&channel_~A~A:" + track-num (code-char ctr)) + (ymamoto-output-note-stream (channel-data-stream (car c)) + (car c) + stream) (if (channel-loop-point (car c)) - (format stream "~&~8TDC.W $8001") + (format stream "~&~8TDC.W $8001, $~X" *loop-point*) (format stream "~&~8TDC.W $8000")))))) (register-replay "YMamoto" diff --git a/tools/dot-s-to-sc68.sh b/tools/dot-s-to-sc68.sh index 966aa86..5f6eeb3 100644 --- a/tools/dot-s-to-sc68.sh +++ b/tools/dot-s-to-sc68.sh @@ -1,17 +1,28 @@ #!/bin/sh +# +# Wishlist: +# - extract title, composer, etc, put into sc68 file properly. +# +# Julian Squires / 2004 # $1 should end in .s if [ X`echo $1 | sed -e s/\.s$//` = X$1 ]; then echo "The argument to this script ($1) should end in \".s\"." exit 1 fi +binfile=`echo $1 | sed -e s/\.s$/.bin/` +sc68file=`echo $1 | sed -e s/\.s$/.sc68/` as68 $1 || exit 1 debug68 <