summaryrefslogtreecommitdiff
path: root/src/unheard/theory.clj
diff options
context:
space:
mode:
authorJake Zerrer <him@jakezerrer.com>2025-11-06 11:17:12 -0500
committerJake Zerrer <him@jakezerrer.com>2025-11-06 12:32:15 -0500
commit576bfd688fc8a65de176d4f1fbf9bf71505953a9 (patch)
tree437c1528646774253f12f640fb4203ff4dbd9548 /src/unheard/theory.clj
parentbefc0162943944b88108cce208ef443822def7d2 (diff)
Create first clock-based composition
Diffstat (limited to 'src/unheard/theory.clj')
-rw-r--r--src/unheard/theory.clj9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/unheard/theory.clj b/src/unheard/theory.clj
index 5d5805b..0fbc6d5 100644
--- a/src/unheard/theory.clj
+++ b/src/unheard/theory.clj
@@ -4,12 +4,13 @@
(defn note [clock start duration value]
(m/cp
- (if (m/?< (m/latest #(<= start % (dec (+ start duration))) clock))
- #{value}
- #{})))
+ (let [v (m/?< clock)]
+ (if (<= start v (dec (+ start duration)))
+ #{value}
+ #{}))))
(defn poly [& notes]
- (m/ap
+ (m/cp
(apply union (m/?< (apply m/latest vector notes)))))
;; TODO: Group could actually wrap note, rather than using explicitly