comparison 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
comparison
equal deleted inserted replaced
440:292ece432ac4 441:e682c9ed3056
61 ;; let's try to narrow down the bytes from the first 0xFF of celadon 61 ;; let's try to narrow down the bytes from the first 0xFF of celadon
62 ;; starting at 0xC001 62 ;; starting at 0xC001
63 63
64 (def celadon-song 64 (def celadon-song
65 [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 65 [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
66 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 66 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
67 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 67 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
68 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 68 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
69 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 69 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
70 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 70 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
71 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 71 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
72 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 72 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
73 0 0 0 0 0 0 0 0 0 0]) 73 0 0 0 0 0 0 0 0 0 0])
74 74
75 (defn change-music-to-celadon 75 (def jiggly-song
76 ([#^SaveState state start length] 76 [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
77 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
78 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
79 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
80 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
81 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
82 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
83 103 167 32 0 180 196 32 0 0 0 0 144 1 0 66 28 0 31 31 224 255 0 0 0
84 0 0 0 0 0 0 0 0 0 0])
85
86 (def fight-gym-leader-song
87 [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
88 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
89 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
90 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
91 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
92 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
93 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
94 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
95 0 0 0 0 0 0 0 0 0 0 0])
96
97
98 (def fight-gym-leader-song-simp
99 [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
100 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
101 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
102 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
103 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
104 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
105 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
106 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
107 0 0 0 0 0 0 0 0 0 0 0])
108
109 (defn change-music
110 ([#^SaveState state start length song]
77 111
78 (set-memory-range state (+ 0xC001 start) 112 (set-memory-range state (+ 0xC001 start)
79 (take length (drop start celadon-song)))) 113 (take length (drop start song))))
80 ([start length] 114 ([start length song]
81 (continue! (change-music-to-celadon (read-state "rlm-viridian-forest-battle") 115 (continue! (change-music (read-state "rlm-viridian-forest")
82 start length)))) 116 start length song))))
83 117
84 118
85 119
86 ;;0 0x90) blend between both, with end theme as well 120 ;;0 0x90) blend between both, with end theme as well
87 121
88 ;; 0x05 0xEA is the limit to completely change song to celadon from 122 ;; 0x05 0xEA is the limit to completely change song to celadon from
89 ;; viridian forest 123 ;; viridian forest
90 124
91 ;; 0x05 0xEA is also sufficient to change music to celadon from 125 ;; 0x05 0xEA is also sufficient to change music to celadon from
92 ;; a battle in viridian forest 126 ;; a battle in viridian forest
127
128 (def minimal-celadon-song
129 (subvec celadon-song 0x05 0xEA))
130
131 ;; 0xC006 -- appears to be the song note counter.
132 ;; 0cC007 --