   (note :db5)    ;=> 73
   (note 60)      ;=> 60
   (note nil)     ;=> nil"
-
   [n]
   (cond
-   (nil? n) nil
-   (integer? n) (if (>= n 0)
-                    n
-                    (throw (IllegalArgumentException.
-                            (str "Unable to resolve note: "
-                                 n
-                                 ". Value is out of range. Lowest value is 0"))))
-   (keyword? n) (note (name n))
-   (string? n) (let [match (re-find ONLY-MIDI-NOTE-RE n)
-                     _ (when (nil? match)
-                         (throw (IllegalArgumentException.
-                                 (str "Unable to resolve note: "
-                                      n
-                                      ". Does not appear to be in MIDI format i.e. C#4"))))
-                     note-match (parse-note-match match)
-                     _ (when (< (:octave note-match) -1)
-                         (throw (IllegalArgumentException.
-                                 (str "Unable to resolve note: "
-                                      n
-                                      ". Octave is out of range. Lowest octave value is -1"))))]
-                 (:midi-note note-match))
-   :else (throw (IllegalArgumentException. (str "Unable to resolve note: " n ". Wasn't a recognised format (either an integer, keyword, string or nil)")))))
+    (nil? n) nil
+    (integer? n) (if (>= n 0)
+                   n
+                   (throw (IllegalArgumentException.
+                           (str "Unable to resolve note: "
+                                n
+                                ". Value is out of range. Lowest value is 0"))))
+    (keyword? n) (note (name n))
+    (string? n) (:midi-note (note-map n))
+    :else (throw (IllegalArgumentException. (str "Unable to resolve note: " n ". Wasn't a recognised format (either an integer, keyword, string or nil)")))))
 
 (defn match-note
   "Returns the first midi-note formatted substring in s. If passed optional prev

(def MIDI-NOTE-RE (re-pattern MIDI-NOTE-RE-STR))
(def ONLY-MIDI-NOTE-RE (re-pattern (str "\\A" MIDI-NOTE-RE-STR "\\Z")))

(defn- parse-note-match
  "Takes a match array returned by a regexp match and returns a map of note info"
  [match]
  (let [[match pitch-class octave] match
        pitch-class                (canonical-pitch-class-name pitch-class)
        octave                     (Integer. octave)
        interval                   (NOTES (keyword pitch-class))]

     :interval    interval
     :midi-note   (octave-note octave interval)}))


(defn mk-midi-string
  "Takes a string or keyword representing a pitch and a number
  representing an integer and returns a new keyword which is a
  concatanation of the two. Throws an error if the resulting midi
  string is invalid.

  (midi-string :F 7)  ;=> :F7
  (midi-string :Eb 3) ;=> :Eb3"
  [pitch-key octave]
  (let [res (str (name pitch-key) octave)]
    (validate-midi-string! res)
    res))

(defn note
  "Resolves note to MIDI number format. Resolves upper and lower-case keywords
  and strings in MIDI note format. If given an integer or nil, returns them
