diff options
Diffstat (limited to 'src/notation.clj')
| -rw-r--r-- | src/notation.clj | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/src/notation.clj b/src/notation.clj index 6ec09f8..a4b9488 100644 --- a/src/notation.clj +++ b/src/notation.clj @@ -77,17 +77,17 @@ (def pulse (m/signal (m/watch ctr))) (defn note [value duration] - #_ - (m/eduction (take-while #(not= ::done %))) - (m/ap - (m/amb #{value} - (let [c (atom 0) - dxfn (case (m/?< pulse) :inc inc :dec dec)] - (println "AT" (swap! c dxfn)) - (if (< 0 @c duration) - (m/amb #{value}) - (m/amb #{}) - ))))) + (m/eduction (take-while #(not= ::done %)) + (m/ap + (m/amb #{value} + (let [c (atom 0)] + (m/?< pulse) + (swap! c inc) + (if (> @c duration) + (m/amb + #{} + ::done) + (m/amb))))))) (defmacro chord [& notes] @@ -101,12 +101,6 @@ (m/amb= ~@reset-forms) ~union-form))))) -;; We have something pretty cool going. I think chord is actually correct. -;; Line isn't working quite corectly, though. -;; The idea of note storing its internal state is clever, but isn't behaving -;; quite corectly when you try to sequence two chords back to back. Think through -;; how this will work with pulses. You are close! -;; (defmacro line [& notes] `(m/ap (m/amb ~@(map (fn [note] `(m/?< ~note)) notes)))) @@ -125,5 +119,4 @@ (cancel) -(reset! ctr :dec) -(reset! ctr :inc) +(reset! ctr nil) |
