I hereby claim:
- I am forsakendaemon on github.
- I am forsakendaemon (https://keybase.io/forsakendaemon) on keybase.
- I have a public key whose fingerprint is 54DA 82F1 C9B6 E61D ABF3 1065 35DA BF6E 5605 65D4
To claim this, I am signing this object:
| # N.B. The following values work. Technically, you can use any s and p with p a primitive root modulo s. | |
| # It works best if you use an s that is one more than a multiple of three. (e.g. 4, 7, 10, 13) | |
| # It will work for any x up to 2^{s - 1} - 1 | |
| # inv calculates is the inverse of p in \mathbb{Z}_{s}. | |
| # s p | |
| # 1 0 | |
| # 2 1 | |
| # 3 2 | |
| # 4 3 |
I hereby claim:
To claim this, I am signing this object:
| (ns overtonehacking.pitch | |
| (:use [overtone.music.pitch] | |
| [clojure.test] | |
| [clojure.pprint] | |
| ) | |
| ) | |
| ; Utility function to invert a map. Thanks to amalloy on stackexchange.com for help with this! | |
| (defn map-invert-preserving-dups [m] (apply merge-with into (for [[k v] m] {v [k]}))) |
| ;requires clj-http (https://github.com/dakrone/clj-http) and clojure.data.json (https://github.com/clojure/data.json) to be available | |
| (require '[clj-http.client :as client] '[clojure.data.json :only (read-json) :as json]) | |
| (defn getfiles [id] (get (json/read-json (get (client/get (str "https://api.github.com/gists/" id)) :body)) :files)) | |
| (defn getcontent [files] (get (get files (first (keys files))) :content)) | |
| (defn loadgist [id] (load-string (getcontent (getfiles id)))) |
| (def notenames '(:C :C# :D :D# :E :F :F# :G :G# :A :A# :B)) | |
| (defn subchord [chord] (map - (rest chord) chord)) | |
| (defn complete [chord] (concat chord (list (apply - (cons 12 chord))))) | |
| (defn rotate [list] (cons (last list) (butlast list))) | |
| (defn match [chordlist] | |
| (try | |
| (if (= (first chordlist) (+ 1 (count (second chordlist)))) (throw (Exception. "Unable to Match"))) | |
| (condp = (second chordlist) | |
| '(4 3 5) (list (first chordlist) "Major") |