From 1941fed92200e60c0912115e4eb87d114c206383 Mon Sep 17 00:00:00 2001 From: Jake Zerrer Date: Thu, 6 Nov 2025 14:15:51 -0500 Subject: Abstract out triad --- dev/scratch.clj | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'dev') diff --git a/dev/scratch.clj b/dev/scratch.clj index cb9a249..9bfac2c 100644 --- a/dev/scratch.clj +++ b/dev/scratch.clj @@ -9,19 +9,23 @@ (def midi-keyboard "CoreMIDI4J - Minilab3 MIDI") +(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 [>c >tonic] (poly - (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))) + (triad >c >tonic) + (triad >c (m/latest #(+ % 12) >tonic)) ;; The rest of the "song" is a drum pattern. - (note >c 1 1 (m/ap kick)) + (note >c 1 1 (m/ap kick)) (note >c 9 1 (m/ap kick)) (note >c 17 1 (m/ap kick)) (note >c 25 1 (m/ap kick)) -- cgit v1.2.3