Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (ns midi-gen.core
  2.   (:require [overtone.midi :as m]
  3.             [overtone.live :as ot]
  4.             [overtone.at-at :as at-at]))
  5.  
  6. (def bpm 150)
  7. (def midi-pool (at-at/mk-pool))
  8. (def midi-out (first (ot/midi-connected-receivers)))
  9. (def metro (ot/metronome bpm))
  10.  
  11. (defn looper [beat]
  12.   (at-at/at (metro beat) #(m/midi-note midi-out (ot/note :c#2) 100 100 0) midi-pool)
  13.   (at-at/at (metro (+ 0.50 beat)) #(m/midi-note midi-out (ot/note :f#2) 100 100 0) midi-pool)
  14.   (ot/apply-by (metro (inc beat)) #'looper (inc beat) []))
  15.  
  16. (comment
  17.   (looper (metro))
  18.   (ot/stop))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement