comparison clojure/com/aurellem/run/music.clj @ 464:413c66186baa

removed duplicate notes in drum track.
author Robert McIntyre <rlm@mit.edu>
date Fri, 04 May 2012 03:50:07 -0500
parents 3e74bf517d8f
children 34bf4b64d9d1
comparison
equal deleted inserted replaced
463:3e74bf517d8f 464:413c66186baa
492 492
493 {:voice-1 (get-track (nth targets 0)) 493 {:voice-1 (get-track (nth targets 0))
494 :voice-2 (get-track (nth targets 1)) 494 :voice-2 (get-track (nth targets 1))
495 :noise (get-track (nth targets 2)) 495 :noise (get-track (nth targets 2))
496 :duty (zipmap (map :out duty-info) 496 :duty (zipmap (map :out duty-info)
497 (map :duty duty-info))})) 497 (map #(get % :duty 0) duty-info))}))
498 498
499 (defn play-midi [#^File midi-file] 499 (defn play-midi [#^File midi-file]
500 (let [track-1-target 0xA000 500 (let [track-1-target 0xA000
501 track-2-target 0xB000 501 track-2-target 0xB000
502 program-target 0xC000 502 program-target 0xC000
503 mini-midi (midi->mini-midi midi-file) 503 mini-midi (midi->mini-midi midi-file)
504 long-silence (flatten (note-codes 20 0 9001)) 504 long-silence (flatten (note-codes 20 0 9001))
505 505
506 voice-1 (flatten (:voice-1 mini-midi)) 506 voice-1 (flatten (:voice-1 mini-midi))
507 wave-duty-1 ((:duty mini-midi) 0) 507 wave-duty-1 ((:duty mini-midi) 0 0)
508 508
509 voice-2 (flatten (:voice-2 mini-midi)) 509 voice-2 (flatten (:voice-2 mini-midi))
510 wave-duty-2 ((:duty mini-midi) 1) 510 wave-duty-2 ((:duty mini-midi) 1 0)
511 ] 511 ]
512 512
513 (-> (second (music-base)) 513 (-> (second (music-base))
514 (set-memory-range track-1-target long-silence) 514 (set-memory-range track-1-target long-silence)
515 (set-memory-range track-2-target long-silence) 515 (set-memory-range track-2-target long-silence)