Mercurial > vba-clojure
view clojure/com/aurellem/exp/music.clj @ 442:58fe9c35d7c9
discovered meanig of first 8 bytes of music.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Thu, 26 Apr 2012 05:45:16 -0500 |
parents | e682c9ed3056 |
children | afdc51232e4f |
line wrap: on
line source
1 (ns com.aurellem.exp.music2 "scratchpad namespace"3 (:use (com.aurellem.gb gb-driver util constants4 assembly saves5 items pokemon status types6 characters species moves7 pokedex money rival-name8 text-speed badges9 pokemon-presets10 ))12 (:import java.io.File)13 (:import [com.aurellem.gb.gb_driver SaveState]))18 (defn analyze-music []19 (clojure.pprint/pprint20 (map (fn [[addr nums]]21 [(hex addr) nums])22 (apply harmonic-compare23 (map read-state24 ["song-1" "no-song-1"25 "song-2" "no-song-2"26 "song-3" "no-song-3"27 "song-4"])))))28 ;; there are only two addresses that alternate between only29 ;; two unique values:31 0xC0DE ;; lol code :)32 0xC0DF34 ;; perhaps they are the address of the current playing sound?36 ;; after watching them for a while in different environments,37 ;; I can tell that they're definately music related, but they38 ;; _don't_ seem to be the address to the current track.39 ;; they generally change whenever a substantually different40 ;; sequence is played. maybe they control some high level41 ;; setting in the synthesizer? They are only affected by the42 ;; background music and not by pokemon cries, etc.44 0xC001 ;; seems to change along with the music, but is much45 ;; more stable than 0xC0DE and 0xC0DF. It _is_46 ;; affected by sound effects. When a sound effect happens,47 ;; is sometimes does not return to its previous value when the sound48 ;; effect is done.50 0xC000 ;; does not seem to be affected by music52 ;; maybe 0xC001 - something is loaded with the actual sounds?55 ;; replacing just the first 0xFF bytes starting at 0xC001 with those56 ;; found in celadon changes the music to celadon city.58 ;; this can't be the actual music because it doesn't have enough59 ;; information.61 ;; let's try to narrow down the bytes from the first 0xFF of celadon62 ;; starting at 0xC00164 (def celadon-song65 [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 066 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 067 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 068 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 069 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 070 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 171 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 372 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 073 0 0 0 0 0 0 0 0 0 0])75 (def jiggly-song76 [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 077 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 078 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 079 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 080 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 081 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 182 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 083 103 167 32 0 180 196 32 0 0 0 0 144 1 0 66 28 0 31 31 224 255 0 0 084 0 0 0 0 0 0 0 0 0 0])86 (def fight-gym-leader-song87 [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 088 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 089 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 090 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 091 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 092 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 193 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 494 3 0 179 195 32 0 180 196 32 0 3 0 0 104 1 0 65 176 0 8 8 224 255 0 095 0 0 0 0 0 0 0 0 0 0 0])98 (def fight-gym-leader-song-simp99 [101 (Integer/parseInt "00000001" 2) ;; channel-on/off102 ;; are active104 0 ;; no-effect106 ;; channel 0107 0 ;; note-counter low108 92 ;; note-counter high110 ;; channel 1111 43 ;; note-counter low112 94 ;; note-counter high114 ;; channel 2115 112 ;; note-counter low116 95 ;; note-counter high119 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0120 0 0 0 0 0 0 0 0 234 234 234 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0121 0 192 192 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 0122 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 0123 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 0124 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 1125 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 4126 3 0 179 195 32 0 180 196 32 0 3 0 0 104 1 0 65 176 0 8 8 224 255128 ])130 (defn change-music131 ([#^SaveState state start length song]133 (set-memory-range state (+ 0xC004 start)134 (take length (drop start song))))135 ([start length song]136 (continue! (change-music (read-state "rlm-viridian-forest")137 start length song))))141 ;;0 0x90) blend between both, with end theme as well143 ;; 0x05 0xEA is the limit to completely change song to celadon from144 ;; viridian forest146 ;; 0x05 0xEA is also sufficient to change music to celadon from147 ;; a battle in viridian forest149 (def minimal-celadon-song150 (subvec celadon-song 0x05 0xEA))152 ;; 0xC006 -- appears to be the song note counter.153 ;; 0cC007 --