Skip to content

Instantly share code, notes, and snippets.

Created April 24, 2017 00:30
What would you like to do?
randomly generated bongos
(defn random-bongos
[ticks vol-min vol-max]
[(octave 4)
(set-duration 0.25) ; 16th notes
(let [notes (-> #{[:c] [:c :sharp] [:d] [:d :sharp] [:e]}
(->> (map #(note (apply pitch %))))
(conj (pause)))
rand-note #(rand-nth notes)
rand-vol #(vol (+ vol-min (rand-int (- vol-max vol-min))))
tick #(vector (rand-vol) (rand-note))]
(take ticks (repeatedly tick)))])
percussion: (random-bongos 64 25 75)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment