Created
July 13, 2012 19:36
-
-
Save alandipert/3106909 to your computer and use it in GitHub Desktop.
Revisions
-
alandipert revised this gist
Jul 13, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -33,7 +33,7 @@ (if (= 1 (count (str form))) (.noteOn channel (get layout form 60) 127) (doseq [note (map (comp symbol str) (str form))] (.noteOn channel (get layout note 60) 127))) (recur))))))) (midi-rpl (:qwerty keymaps)) -
alandipert revised this gist
Jul 13, 2012 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,7 +21,7 @@ k 69 l 70}}) (defn midi-rpl [layout] (with-open [synth (doto (MidiSystem/getSynthesizer) .open)] (let [channel (aget (.getChannels synth) 0)] (prn "Type " :q " to quit.") @@ -36,4 +36,4 @@ (.noteOn channel (get keymap note 60) 127))) (recur))))))) (midi-rpl (:qwerty keymaps)) -
alandipert revised this gist
Jul 13, 2012 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -19,8 +19,7 @@ h 67 j 68 k 69 l 70}}) (defn midi-repl [layout] (with-open [synth (doto (MidiSystem/getSynthesizer) .open)] -
alandipert created this gist
Jul 13, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,40 @@ (import '(javax.sound.midi MidiSystem Synthesizer)) (def keymaps '{:colemak {a 60 r 62 s 64 t 65 d 66 h 67 n 68 e 69 i 70 o 71} :qwerty {a 60 s 62 d 64 f 65 g 66 h 67 j 68 k 69 l 70 #=(symbol ";") 71}}) (defn midi-repl [layout] (with-open [synth (doto (MidiSystem/getSynthesizer) .open)] (let [channel (aget (.getChannels synth) 0)] (prn "Type " :q " to quit.") (loop [] (print "midi: ") (flush) (when-let [form (read)] (when (not= form :q) (if (= 1 (count (str form))) (.noteOn channel (get layout form 60) 127) (doseq [note (map (comp symbol str) (str form))] (.noteOn channel (get keymap note 60) 127))) (recur))))))) (midi-repl (:qwerty keymaps))