diff clojure/com/aurellem/exp/music.clj @ 441:e682c9ed3056

can cange music; trying to understand music format.
author Robert McIntyre <rlm@mit.edu>
date Thu, 26 Apr 2012 05:05:16 -0500
parents 292ece432ac4
children 58fe9c35d7c9
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/exp/music.clj	Thu Apr 26 04:35:49 2012 -0500
     1.2 +++ b/clojure/com/aurellem/exp/music.clj	Thu Apr 26 05:05:16 2012 -0500
     1.3 @@ -63,23 +63,57 @@
     1.4  
     1.5  (def celadon-song
     1.6    [202 0 0 255 0 178 117 40 118 158 118 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
     1.7 -  0 0 0 0 0 0 0 0 0 0 0 202 202 202 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
     1.8 -  0 0 0 0 128 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
     1.9 -  0 0 0 0 0 0 0 0 0 0 0 0 115 88 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    1.10 -  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    1.11 -  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 5 5 1 1 1 1 1
    1.12 -  1 1 1 1 1 1 1 1 12 12 12 1 1 1 1 1 128 128 128 0 0 0 0 0 5 4 4 0 4 3
    1.13 -  4 0 178 194 32 0 180 196 32 0 3 0 0 144 1 0 66 31 0 2 2 32 48 0 0 0
    1.14 +   0 0 0 0 0 0 0 0 0 0 0 202 202 202 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
    1.15 +   0 0 0 0 128 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    1.16 +   0 0 0 0 0 0 0 0 0 0 0 0 115 88 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    1.17 +   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    1.18 +   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 5 5 1 1 1 1 1
    1.19 +   1 1 1 1 1 1 1 1 12 12 12 1 1 1 1 1 128 128 128 0 0 0 0 0 5 4 4 0 4 3
    1.20 +   4 0 178 194 32 0 180 196 32 0 3 0 0 144 1 0 66 31 0 2 2 32 48 0 0 0
    1.21     0 0 0 0 0 0 0 0 0 0])
    1.22  
    1.23 -(defn change-music-to-celadon
    1.24 -  ([#^SaveState state start length]
    1.25 +(def jiggly-song
    1.26 +  [208 0 0 255 0 240 113 7 114 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    1.27 +   0 0 0 0 0 0 0 0 208 208 0 0 0 0 0 0 65 72 0 0 0 0 0 0 0 0 0 0 0 0 0
    1.28 +   0 128 0 0 0 0 0 0 0 105 130 0 0 0 0 0 0 0 0 0 0 0 0 0 0 17 16 0 0 0
    1.29 +   0 0 0 65 81 0 0 0 0 0 0 58 57 0 0 0 0 0 0 8 5 0 0 0 0 0 0 0 0 0 0 0
    1.30 +   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    1.31 +   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 3 1 1 1 1 1 1 1
    1.32 +   1 1 1 1 1 1 1 13 12 1 1 1 1 1 1 128 0 0 0 88 152 0 0 4 4 4 0 4 4 3 0
    1.33 +   103 167 32 0 180 196 32 0 0 0 0 144 1 0 66 28 0 31 31 224 255 0 0 0
    1.34 +   0 0 0 0 0 0 0 0 0 0])
    1.35 +
    1.36 +(def fight-gym-leader-song
    1.37 +  [234 0 0 255 0 0 92 43 94 112 95 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    1.38 +   0 0 0 0 0 0 0 0 234 234 234 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    1.39 +   0 192 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 7 0 0 0 0 0 0 33 17 17 0 0 0
    1.40 +   0 0 68 82 0 0 0 0 0 0 89 90 57 0 0 0 0 0 8 8 0 0 0 0 0 0 0 0 0 0 0 0
    1.41 +   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    1.42 +   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 4 1 1 1 1 1 1 1
    1.43 +   1 1 1 1 1 1 12 12 12 1 1 1 1 1 192 192 192 0 88 152 0 0 7 5 4 0 4 4
    1.44 +   3 0 179 195 32 0 180 196 32 0 3 0 0 104 1 0 65 176 0 8 8 224 255 0 0
    1.45 +   0 0 0 0 0 0 0 0 0 0 0])
    1.46 +
    1.47 +
    1.48 +(def fight-gym-leader-song-simp
    1.49 +  [234 0 0 255 0 0 92 43 94 112 95 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    1.50 +   0 0 0 0 0 0 0 0 234 234 234 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    1.51 +   0 192 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 7 0 0 0 0 0 0 33 17 17 0 0 0
    1.52 +   0 0 68 82 0 0 0 0 0 0 89 90 57 0 0 0 0 0 8 8 0 0 0 0 0 0 0 0 0 0 0 0
    1.53 +   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    1.54 +   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 4 1 1 1 1 1 1 1
    1.55 +   1 1 1 1 1 1 12 12 12 1 1 1 1 1 192 192 192 0 88 152 0 0 7 5 4 0 4 4
    1.56 +   3 0 179 195 32 0 180 196 32 0 3 0 0 104 1 0 65 176 0 8 8 224 255 0 0
    1.57 +   0 0 0 0 0 0 0 0 0 0 0])
    1.58 +
    1.59 +(defn change-music
    1.60 +  ([#^SaveState state start length song]
    1.61  
    1.62       (set-memory-range state (+ 0xC001 start)
    1.63 -                       (take length (drop start celadon-song))))
    1.64 -  ([start length]
    1.65 -     (continue! (change-music-to-celadon (read-state "rlm-viridian-forest-battle")
    1.66 -                                         start length))))
    1.67 +                       (take length (drop start song))))
    1.68 +  ([start length song]
    1.69 +     (continue! (change-music (read-state "rlm-viridian-forest")
    1.70 +                                         start length song))))
    1.71     
    1.72    
    1.73  
    1.74 @@ -89,4 +123,10 @@
    1.75  ;; viridian forest
    1.76  
    1.77  ;; 0x05 0xEA is also sufficient to change music to celadon from
    1.78 -;; a battle in viridian forest
    1.79 \ No newline at end of file
    1.80 +;; a battle in viridian forest
    1.81 +
    1.82 +(def minimal-celadon-song
    1.83 +  (subvec celadon-song 0x05 0xEA))
    1.84 +
    1.85 +;; 0xC006 -- appears to be the song note counter.
    1.86 +;; 0cC007 -- 
    1.87 \ No newline at end of file