Skip to content

Instantly share code, notes, and snippets.

@soulflyer
Created December 21, 2011 04:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soulflyer/1504575 to your computer and use it in GitHub Desktop.
Save soulflyer/1504575 to your computer and use it in GitHub Desktop.
Possible additions to overtone.music.pitch
(defn find-name
"Returnd the name of the first matching thing found in things
or nil if not found"
([thing things]
(if (= (val (first things)) thing)
(key (first things))
(if (< 1 (count things))
(find-name thing (rest things))))))
(defn find-scale-name
"Return the name of the first matching scale found in SCALE
or nil if not found
ie: (find-scale-name [2 1 2 2 2 2 1]
:melodic-minor-asc"
[scale]
(find-name scale SCALE))
(defn find-chord-name
"Return the name of the first matching chord in CHORD
or nil if not found
ie: (find-chord-name #{0 3 7}
:minor"
[chord]
(find-name chord CHORD))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment