Skip to content

Instantly share code, notes, and snippets.

@daveyarwood
Created April 24, 2017 00:30
Show Gist options
  • Save daveyarwood/b067f743b44d5e89be59016a4f33901a to your computer and use it in GitHub Desktop.
Save daveyarwood/b067f743b44d5e89be59016a4f33901a to your computer and use it in GitHub Desktop.
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