comparison clojure/com/aurellem/run/music.clj @ 456:9c192737034d

fixed silence at end, and increased tempo.
author Robert McIntyre <rlm@mit.edu>
date Thu, 03 May 2012 11:24:46 -0500
parents 1c10fa8366a7
children a2ae4213deb7
comparison
equal deleted inserted replaced
455:1c10fa8366a7 456:9c192737034d
444 (concat [(assoc (silence 0) 444 (concat [(assoc (silence 0)
445 :time-stamp 0)] notes) 445 :time-stamp 0)] notes)
446 notes) 446 notes)
447 447
448 notes-with-silence 448 notes-with-silence
449 (filter (comp not zero? :duration) 449 (concat
450 (interleave silences notes))] 450 (filter (comp not zero? :duration)
451 (map 451 (interleave silences notes))
452 (fn [note-event] 452 [(silence 3)])]
453 (note-codes (:frequency note-event) 453
454 (:volume note-event) 454 (map
455 (int (* (:duration note-event) 0x100)))) 455 (fn [note-event]
456 notes-with-silence))) 456 (note-codes (:frequency note-event)
457 (:volume note-event)
458 (int (* (:duration note-event) 0x100))))
459 notes-with-silence)))
460
457 461
458 (defn midi->mini-midi [#^File midi-file] 462 (defn midi->mini-midi [#^File midi-file]
459 {:track-1 (flatten (midi-track->mini-midi midi-file 0)) 463 {:track-1 (flatten (midi-track->mini-midi midi-file 0))
460 :track-2 (flatten (midi-track->mini-midi midi-file 1))}) 464 :track-2 (flatten (midi-track->mini-midi midi-file 1))})
461 465