From a1e2543142761bde35d9d3a2cfb46da952a8d064 Mon Sep 17 00:00:00 2001 From: Jake Zerrer Date: Thu, 6 Nov 2025 13:26:52 -0500 Subject: Create second instrument (keyboard) with separate input --- src/unheard/theory.clj | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/unheard/theory.clj b/src/unheard/theory.clj index 0fbc6d5..d63532f 100644 --- a/src/unheard/theory.clj +++ b/src/unheard/theory.clj @@ -2,16 +2,17 @@ (:require [missionary.core :as m] [clojure.set :refer [union]])) -(defn note [clock start duration value] +(defn note [>clock start duration >value] (m/cp - (let [v (m/?< clock)] - (if (<= start v (dec (+ start duration))) - #{value} + (let [[c v] (m/?< (m/latest vector >clock >value))] + (if (<= start c (dec (+ start duration))) + #{v} #{})))) (defn poly [& notes] - (m/cp - (apply union (m/?< (apply m/latest vector notes))))) + (m/signal + (m/cp + (apply union (m/?< (apply m/latest vector notes)))))) ;; TODO: Group could actually wrap note, rather than using explicitly ;; WIll introduce a lot of GC churn, though -- cgit v1.2.3