diff options
Diffstat (limited to 'dev/scratch.clj')
| -rw-r--r-- | dev/scratch.clj | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/dev/scratch.clj b/dev/scratch.clj index 8bfa7af..0115233 100644 --- a/dev/scratch.clj +++ b/dev/scratch.clj @@ -1,14 +1,13 @@ (ns scratch (:require [unheard.midi :as midi] [unheard.midi.percussion :refer [kick snare hat]] - [unheard.instrument.minilab3 :refer [minilab3]] + [unheard.instrument.minilab3 :as minilab3] + [unheard.instrument.omx-27 :as omx-27] [unheard.theory :refer [note poly]] [missionary.core :as m])) #_(print-all-midi-devices) -(def midi-keyboard "CoreMIDI4J - Minilab3 MIDI") - (defn triad [>c >tonic] (poly ;; This is a major cord, @@ -22,10 +21,11 @@ [{:keys [clock tonic]}] (poly (triad clock tonic) + (triad clock (m/latest #(+ % 12) tonic)) ;; The rest of the "song" is a drum pattern. - (note clock 1 1 (m/ap kick)) + (note clock 1 1 (m/ap kick)) (note clock 9 1 (m/ap kick)) (note clock 17 1 (m/ap kick)) (note clock 25 1 (m/ap kick)) @@ -51,21 +51,20 @@ (m/ap (m/?< f))) prn prn)) (def run - (midi/<bus midi-keyboard + (midi/<bus minilab3/device-name (fn [v] - (m/ap - ;; 2 is the number of message types, e.g. :key - (let [controls (midi/controller v minilab3) - song-config {:clock (get-in controls [:knob 1]) - :tonic (get-in controls [:knob 2])} - p (song song-config)] - (m/amb= - [:n (m/?< p)] - [:c (m/?< (get-in controls [:knob 1]))])))))) + (m/signal + (m/ap + ;; 2 is the number of message types, e.g. :key + (let [controls (midi/controller v minilab3/config) + clock (get-in controls [:knob 1]) + tonic (get-in controls [:knob 2]) + song-config {:clock clock + :tonic tonic} + p (song song-config)] + (m/?< (m/latest vector clock p)))))))) -#_ -(def cancel - (run prn prn)) +#_(def cancel + (run prn prn)) -#_ -(cancel) +#_(cancel) |
