Skip to content

Commit

Permalink
Now also with loading midi files from a URL.
Browse files Browse the repository at this point in the history
  • Loading branch information
rosejn committed Jul 5, 2012
1 parent 72778e2 commit 358aee3
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/overtone/midi/file.clj
Expand Up @@ -30,7 +30,9 @@
(defn- midi-track
[track]
(let [size (.size track)]
(for [i (range size)] (midi-event (.get track i)))))
{:type :midi-track
:size size
:events (for [i (range size)] (midi-event (.get track i)))}))

(defn midi-sequence
[src]
Expand Down Expand Up @@ -58,14 +60,19 @@
:usecs usecs
:properties props}))

(defn- midi-src
[src]
(merge
(midi-info src)
(midi-sequence src)))

(defn midi-file
[path]
(let [f (File. path)]
(merge
(midi-info f)
(midi-sequence f))))
(midi-src f)))

(defn midi-url
[url]
(midi-info (URL. url)))
(let [src (URL. url)]
(midi-src src)))

0 comments on commit 358aee3

Please sign in to comment.