# HG changeset patch # User Robert McIntyre # Date 1336129979 18000 # Node ID 85d9fa354f0b103c04d4327e7925d604b5f9888f # Parent ac0ed5c1a1c44e90931ace562960886abf2b9e97 got drums to work. diff -r ac0ed5c1a1c4 -r 85d9fa354f0b clojure/com/aurellem/run/music.clj --- a/clojure/com/aurellem/run/music.clj Fri May 04 05:17:18 2012 -0500 +++ b/clojure/com/aurellem/run/music.clj Fri May 04 06:12:59 2012 -0500 @@ -17,6 +17,9 @@ (def sync-test (File. "/home/r/proj/vba-clojure/music/sync-test.mid")) +(def drum-test + (File. "/home/r/proj/vba-clojure/music/drum-test.mid")) + (defn raw-midi-text [#^File midi-file] (:out @@ -520,10 +523,18 @@ (int (* (:duration note-event) 0x100)))) abstract-mini-midi))) +(def midi-code->gb-noise-code + {nil 0xFF + 35 87 + 38 20 + 39 0 + }) + + (defn noise-codes [code volume duration] (assert (<= 0 volume 0xF)) (if (<= duration 0xFF) - [(if (nil? code) 0xFF code) + [(midi-code->gb-noise-code code code) (bit-shift-left volume 4) duration] (vec @@ -583,7 +594,6 @@ (music-kernel wave-duty-1 wave-duty-2)) (PC! program-target)))) - (defn test-noise [] (let [noise-pattern (concat (interleave (range 0x100) (repeat 0xF0) (repeat 255)) @@ -595,7 +605,8 @@ (PC! 0xC000)))) (defn test-play-noise [noise-code] - (println "playing-noise" noise-code) + (Thread/sleep 300) + (println "playing noise:" noise-code) (run-moves (let [noise-pattern (interleave (repeat 10 noise-code) (repeat 0xF0) (repeat 255))] @@ -603,13 +614,11 @@ (set-memory-range 0xA900 (flatten noise-pattern)) (set-memory-range 0xC000 (music-kernel 0 0)) (PC! 0xC000))) - (repeat 128 []))) + (repeat 20 []))) (defn test-all-noises [] (dorun (map test-play-noise (range 0x100)))) - - (def C4 (partial note-codes 261.63)) (def D4 (partial note-codes 293.66)) (def E4 (partial note-codes 329.63)) diff -r ac0ed5c1a1c4 -r 85d9fa354f0b music/Friendship is Magic (MLP Theme Song).rg Binary file music/Friendship is Magic (MLP Theme Song).rg has changed diff -r ac0ed5c1a1c4 -r 85d9fa354f0b music/pony-title.mid Binary file music/pony-title.mid has changed