(ns scratch (:require [unheard.midi :as midi] [unheard.midi.percussion :refer [kick snare hat]] [unheard.instrument.minilab3 :as minilab3] [unheard.instrument.omx-27 :as omx-27] [unheard.theory :refer [note poly]] [missionary.core :as m]) (:import [javax.sound.midi ShortMessage])) #_(print-all-midi-devices) (defn triad [>c >tonic] (poly ;; 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)))) (defn song [{: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 9 1 (m/ap kick)) (note clock 17 1 (m/ap kick)) (note clock 25 1 (m/ap kick)) (note clock 1 1 (m/ap hat)) (note clock 5 1 (m/ap hat)) (note clock 9 1 (m/ap hat)) (note clock 13 1 (m/ap hat)) (note clock 17 1 (m/ap hat)) (note clock 21 1 (m/ap hat)) (note clock 25 1 (m/ap hat)) (note clock 29 1 (m/ap hat)) (note clock 5 1 (m/ap snare)) (note clock 13 1 (m/ap snare)) (note clock 21 1 (m/ap snare)) (note clock 29 1 (m/ap snare)))) ;; TODO: Move into /dev ;; Add logging (defn debug-flow [f] ((m/reduce prn nil (m/ap (m/?< f))) prn prn)) (def run (midi/