-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfaunsStaircase.clj
More file actions
25 lines (19 loc) · 883 Bytes
/
faunsStaircase.clj
File metadata and controls
25 lines (19 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
(ns mad-sounds.faunsStaircase
(:require [overtone.live :refer :all]
[overtone.inst.sampled-piano :refer :all]))
(defn piano-strike [time fingers]
(let [root (+50 (mod time 24))
amp (+ 0.3 (/ 0.7 t))]
(doseq [f (take fingers (chord root :dim7))]
(sampled-piano f))))
;; let introduces local binding (aka variable) here it is "root" and "amp"
;;doseq introduces local binding; here it is "f" and loops f through sampled piano
;;a chord has 3 to 4 notes and sounds "good"
(defn looper [nome] ;;nome is incoming metronome/timestamp
(let [beat (nome)
random-offset (rand 1) ;; for time randomization
fingers (inc (rand-int 3)) ;; random number between 0 and 4 for fingers
(at (+ (nome beat) random-offset) (piano-strike beat fingers))
(apply-by (nome (inc beat)) looper nome []))))
(looper (metronome 220))
(stop)