Skip to content

Instantly share code, notes, and snippets.

@erik
Created May 8, 2010 02:38
Show Gist options
  • Save erik/394265 to your computer and use it in GitHub Desktop.
Save erik/394265 to your computer and use it in GitHub Desktop.
(ns ClojMidi
(:import (javax.sound.midi MidiSystem)))
(def channels (.getChannels (doto (MidiSystem/getSynthesizer) (.open))))
(defn play-note [pitch velocity time]
(.noteOn (first channels) pitch velocity)
(Thread/sleep time)
(.noteOff (first channels) pitch velocity))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment