diff options
| author | Jake Zerrer <him@jakezerrer.com> | 2025-11-26 09:02:27 -0500 |
|---|---|---|
| committer | Jake Zerrer <him@jakezerrer.com> | 2025-11-26 13:10:08 -0500 |
| commit | 2fdbdc593383b0798100ba1ab437719f959f6c25 (patch) | |
| tree | 662c9d38f4312bdd7dc018704f4e4c40656a9760 | |
| parent | f7410a781fa7c7c2584c43ffe9fefb81815dd82c (diff) | |
Update test song to use new interval tree impl
| -rw-r--r-- | dev/scratch.clj | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/dev/scratch.clj b/dev/scratch.clj index 7cc86cc..f93cc3a 100644 --- a/dev/scratch.clj +++ b/dev/scratch.clj @@ -14,9 +14,9 @@ ;; This is a major cord, ;; held 32 32nd notes. ;; The tonic can vary. - (note >c 0 32 >tonic) - (note >c 0 32 (m/latest #(+ % 4) >tonic)) - (note >c 0 32 (m/latest #(+ % 7) >tonic)))) + (note >c 0 32 >tonic) + (note >c 0 32 (m/latest #(+ % 4) >tonic)) + (note >c 0 32 (m/latest #(+ % 7) >tonic)))) (defn drums [>clock] @@ -37,12 +37,18 @@ (note >clock 21 1 (m/ap snare)) (note >clock 29 1 (m/ap snare)))) -(defn song +(defn song' [>clock >tonic] (phrase ((triad >clock >tonic) 0) ((triad >clock (m/latest #(+ % 12) >tonic)) 0) ((drums >clock) 0))) +(defn song + [>clock >tonic] + (apply phrase + (apply concat + (for [i (range 0 50000)] [((song' >clock >tonic) (* 32 i))])))) + ;; TODO: Move into /dev ;; Add logging (defn debug-flow [f] ((m/reduce prn nil (m/ap (m/?< f))) prn prn)) @@ -50,19 +56,17 @@ (def run (midi/<bus minilab3/device-name (fn [v] - (m/ap - (let [controls (midi/controller v minilab3/config) - >clock (get-in controls [:knob 1]) - >tonic (get-in controls [:knob 2]) - s (song >clock >tonic) - t (timeline s)] - (m/?< - ;; BUG: - ;; Remove dedupe as part of #2d7f861 - (m/eduction (dedupe) - (m/latest vector - >clock - (read >clock t))))))))) + (m/ap (let [controls (midi/controller v minilab3/config) + >clock (get-in controls [:knob 1]) + >tonic (get-in controls [:knob 2]) + s (song >clock >tonic) + t (timeline s)] + (m/?< + ;; BUG: + ;; Remove dedupe as part of #2d7f861 + (m/eduction + (dedupe) + (m/latest vector >clock (read >clock t))))))))) #_(def cancel (run {} {})) @@ -77,9 +81,9 @@ (def s (song >c >t)) (def cancel ((m/reduce prn #{} (read >c (timeline s))) prn prn)) (cancel) - (reset! c -1) (reset! c 1) - (reset! c 4) - (reset! t 4) + (reset! c 10000) + (reset! t 1) + (swap! c inc) (swap! t inc)) |
