Created
October 7, 2016 19:49
-
-
Save BurkeB/ebf5f01c0d20ff6b9dc111ac427ddea8 to your computer and use it in GitHub Desktop.
Microphone Clojure test
This file contains 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 characters
(def audioformat (new javax.sound.sampled.AudioFormat 44100 16 2 true true)) | |
(def info (new javax.sound.sampled.DataLine$Info javax.sound.sampled.TargetDataLine audioformat)) | |
(if (not= (javax.sound.sampled.AudioSystem/isLineSupported info))(print "dataline not supported")(print "ok lets start\n")) | |
(def line (javax.sound.sampled.AudioSystem/getTargetDataLine audioformat)) | |
(.open line audioformat) | |
(.start line) | |
(let [size (/ (.getBufferSize line) 5) | |
buf (byte-array size)] | |
(if (> (.read line buf 0 size) 0) | |
(println (map int buf)))) | |
(.close line) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment