Skip to content

Commit 0b83247

Browse files
committed
feat: replace static piano rolls with interactive noon widgets
- Switch from noon.viz.piano-roll (static SVGs) to noon.viz.clay/editor (interactive CodeMirror editors with eval, piano roll, and Web Audio) - Update noon git SHA to 3dff70e (includes standalone widget build) - Add :local-noon alias for local development - Remove noon.eval and piano-roll requires — widget handles everything
1 parent efba240 commit 0b83247

2 files changed

Lines changed: 35 additions & 39 deletions

File tree

deps.edn

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
com.hyperphor/multitool {:mvn/version "0.2.3"}
7676
datascript/datascript {:mvn/version "1.7.8"}
7777
io.github.pbaille/noon {:git/url "https://github.com/pbaille/noon.git"
78-
:git/sha "e63bb7c82671293c5610da6a02e3148a48ad71dd"}}
78+
:git/sha "3dff70e5a7953dc079e81306c67fe0eaecec77f3"}}
7979

8080
:mvn/repos {"osgeo" {:url "https://repo.osgeo.org/repository/release/"}}
8181

@@ -90,5 +90,6 @@
9090
org.scicloj/kindly {:local/root "../kindly"}
9191
org.scicloj/kindly-advice {:local/root "../kindly-advice"}
9292
org.scicloj/kindly-render {:local/root "../kindly-render"}}}
93+
:local-noon {:override-deps {io.github.pbaille/noon {:local/root "/Users/pierrebaille/Code/WIP/noon"}}}
9394
:neil {:project {:name io.github.timothypratley/clojurecivitas}}
9495
:dev {:jvm-opts ["--add-opens=java.base/java.nio=ALL-UNNAMED"]}}}

src/music/noon_introduction.clj

Lines changed: 33 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
:tags [:music :harmony :functional-programming :midi]}}}
1010

1111
(ns music.noon-introduction
12-
(:require [noon.viz.piano-roll :as pr]
13-
[noon.eval :refer [score]]))
12+
(:require [noon.viz.clay :as nclay]))
1413

1514
;; ## What is Noon?
1615
;;
@@ -168,18 +167,19 @@
168167

169168
;; *The four step types — chromatic, diatonic, structural, and tonic — each walking up from C4.
170169
;; Note how the same ascending pattern selects different notes depending on the layer.
171-
;; Colors indicate each note's role: tonic (dark blue), structural (medium blue), diatonic (light blue), chromatic (grey).*
172-
173-
^:kindly/hide-code
174-
(pr/piano-roll-group
175-
[{:label "chromatic — (tup c0 c1 c2 c3 c4 c5 c6)"
176-
:score (score (tup c0 c1 c2 c3 c4 c5 c6))}
177-
{:label "diatonic — (tup d0 d1 d2 d3 d4 d5 d6)"
178-
:score (score (tup d0 d1 d2 d3 d4 d5 d6))}
179-
{:label "structural — (tup s0 s1 s2 s3)"
180-
:score (score (tup s0 s1 s2 s3))}
181-
{:label "tonic — (tup t0 t1 t2)"
182-
:score (score (tup t0 t1 t2))}])
170+
;; Try editing the code and pressing Eval & Play!*
171+
172+
;; chromatic — semitone by semitone:
173+
(nclay/editor "(score (tup c0 c1 c2 c3 c4 c5 c6))")
174+
175+
;; diatonic — scale degree by degree:
176+
(nclay/editor "(score (tup d0 d1 d2 d3 d4 d5 d6))")
177+
178+
;; structural — chord tone by chord tone:
179+
(nclay/editor "(score (tup s0 s1 s2 s3))")
180+
181+
;; tonic — octave by octave:
182+
(nclay/editor "(score (tup t0 t1 t2))")
183183

184184
;; The chromatic run gives you all 7 semitones.
185185
;; The diatonic run gives you the major scale.
@@ -204,15 +204,14 @@
204204
;; *Same diatonic steps, three different scales. The code is identical — only the scale context changes.
205205
;; Notice how the intervals between notes shift while the structure remains.*
206206

207-
^:kindly/hide-code
208-
(pr/piano-roll-group
209-
[{:label "major (default)"
210-
:score (score dur:4 (lin d0 d1 d2 d3 d4 d5 d6 d7))}
211-
{:label "dorian"
212-
:score (score dur:4 (scale :dorian) (lin d0 d1 d2 d3 d4 d5 d6 d7))}
213-
{:label "hungarian"
214-
:score (score dur:4 (scale :hungarian) (lin d0 d1 d2 d3 d4 d5 d6 d7))}]
215-
{:shared-pitch-range true})
207+
;; major (default):
208+
(nclay/editor "(score dur:4 (lin d0 d1 d2 d3 d4 d5 d6 d7))")
209+
210+
;; dorian:
211+
(nclay/editor "(score dur:4 (scale :dorian) (lin d0 d1 d2 d3 d4 d5 d6 d7))")
212+
213+
;; hungarian:
214+
(nclay/editor "(score dur:4 (scale :hungarian) (lin d0 d1 d2 d3 d4 d5 d6 d7))")
216215

217216
;; The same goes for structural steps:
218217
;;
@@ -227,13 +226,11 @@
227226
;; *Triad vs tetrad: the same structural steps produce C-E-G-C with a triad structure,
228227
;; but C-E-G-B when the structure is set to tetrad — the seventh appears automatically.*
229228

230-
^:kindly/hide-code
231-
(pr/piano-roll-group
232-
[{:label "triad (default) — (tup s0 s1 s2 s3)"
233-
:score (score (tup s0 s1 s2 s3))}
234-
{:label "tetrad — (structure :tetrad) (tup s0 s1 s2 s3)"
235-
:score (score (structure :tetrad) (tup s0 s1 s2 s3))}]
236-
{:shared-pitch-range true})
229+
;; triad (default):
230+
(nclay/editor "(score (tup s0 s1 s2 s3))")
231+
232+
;; tetrad:
233+
(nclay/editor "(score (structure :tetrad) (tup s0 s1 s2 s3))")
237234

238235
;; ## Changing the Context
239236
;;
@@ -264,10 +261,10 @@
264261
;;```
265262

266263
;; *A I-IV-V-I chord progression, each chord arpeggiated.
267-
;; Dashed lines mark where the harmonic context changes — the same arpeggio pattern adapts to each degree.*
264+
;; The same arpeggio pattern adapts to each degree.
265+
;; Try changing `(tup s0 s1 s2)` to `(tup s0 s1 s2 s3)` after switching to `(structure :tetrad)`!*
268266

269-
^:kindly/hide-code
270-
(pr/piano-roll (score (lin I IV V I) (each (tup s0 s1 s2))))
267+
(nclay/editor "(score (lin I IV V I) (each (tup s0 s1 s2)))")
271268

272269
;; Here `I`, `IV`, `V` are degree changes — they shift the harmonic context
273270
;; so that structural steps target the chord tones of each degree.
@@ -285,11 +282,10 @@
285282
;; (each (tup d1 d1- d0)))
286283
;;```
287284

288-
;; *Mixing layers: structural chord tones (medium blue) decorated with diatonic neighbor notes (light blue).
285+
;; *Mixing layers: structural chord tones decorated with diatonic neighbor notes.
289286
;; The structural steps define the skeleton; the diatonic steps fill in the passing tones.*
290287

291-
^:kindly/hide-code
292-
(pr/piano-roll (score dur:2 (tup s0 s1 s2 s3) (each (tup d1 d1- d0))))
288+
(nclay/editor "(score dur:2 (tup s0 s1 s2 s3) (each (tup d1 d1- d0)))")
293289

294290
;; This creates a chord arpeggio (`s0 s1 s2 s3`) then decorates each chord tone
295291
;; with upper and lower neighbor scale notes (`d1 d1- d0`).
@@ -308,8 +304,7 @@
308304
;; *Harmonic minor progression: I-IV-VII-I with arpeggiated chords.
309305
;; Notice the characteristic G♯ (raised 7th degree) appearing in the VII chord.*
310306

311-
^:kindly/hide-code
312-
(pr/piano-roll (score (scale :harmonic-minor) (lin I IV VII I) (each (tup s0 s1 s2))))
307+
(nclay/editor "(score (scale :harmonic-minor) (lin I IV VII I) (each (tup s0 s1 s2)))")
313308

314309
;; ## Why This Matters
315310
;;

0 commit comments

Comments
 (0)