@kairotic/app 0.0.0-stage → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -2
- package/index.html +1101 -0
- package/kairotic/api.cljs +362 -0
- package/kairotic/assistant.cljs +505 -0
- package/kairotic/backends/gun-backend.js +371 -0
- package/kairotic/canvas.cljs +751 -0
- package/kairotic/code.cljs +108 -0
- package/kairotic/components.cljs +838 -0
- package/kairotic/core.cljs +96 -0
- package/kairotic/corefns.cljs +473 -0
- package/kairotic/docs.mjs +2 -0
- package/kairotic/engine.cljs +482 -0
- package/kairotic/examples.mjs +96 -0
- package/kairotic/faust.cljs +225 -0
- package/kairotic/help.cljs +1036 -0
- package/kairotic/hiccup.cljs +566 -0
- package/kairotic/input.cljs +271 -0
- package/kairotic/kfile.mjs +138 -0
- package/kairotic/library.cljs +214 -0
- package/kairotic/links.cljs +41 -0
- package/kairotic/mt.cljs +1604 -0
- package/kairotic/mtboxes.cljs +276 -0
- package/kairotic/packages/analysis.mjs +64 -0
- package/kairotic/packages/controls.mjs +28 -0
- package/kairotic/packages/data.mjs +22 -0
- package/kairotic/packages/faust-units/cmaes.mjs +82 -0
- package/kairotic/packages/faust-units/graph.mjs +212 -0
- package/kairotic/packages/faust-units/listen.mjs +125 -0
- package/kairotic/packages/faust-units/notation.mjs +139 -0
- package/kairotic/packages/faust-units/parse.mjs +439 -0
- package/kairotic/packages/faust-units/recipe.mjs +195 -0
- package/kairotic/packages/faust-units/render.mjs +69 -0
- package/kairotic/packages/faust-units/units.mjs +130 -0
- package/kairotic/packages/faust-units/view.mjs +353 -0
- package/kairotic/packages/faust-units.mjs +9 -0
- package/kairotic/packages/io.mjs +58 -0
- package/kairotic/packages/net.mjs +28 -0
- package/kairotic/packages/patterns.mjs +34 -0
- package/kairotic/packages/spatial.mjs +22 -0
- package/kairotic/packages/spectral/shift.mjs +169 -0
- package/kairotic/packages/spectral.mjs +16 -0
- package/kairotic/packages/synth.mjs +28 -0
- package/kairotic/packages/theory/counterpoint.mjs +798 -0
- package/kairotic/packages/theory/mirror.mjs +221 -0
- package/kairotic/packages/theory.mjs +46 -0
- package/kairotic/patterns.cljs +538 -0
- package/kairotic/presets.cljs +227 -0
- package/kairotic/quantize.cljs +782 -0
- package/kairotic/record.cljs +169 -0
- package/kairotic/release.cljs +90 -0
- package/kairotic/ring.cljs +129 -0
- package/kairotic/ringaudio.cljs +232 -0
- package/kairotic/ringcore.mjs +270 -0
- package/kairotic/score.cljs +176 -0
- package/kairotic/shapes.cljs +283 -0
- package/kairotic/signal.cljs +327 -0
- package/kairotic/sounds.cljs +565 -0
- package/kairotic/sounds.mjs +108 -0
- package/kairotic/span.cljs +129 -0
- package/kairotic/spell.cljs +281 -0
- package/kairotic/structure.cljs +145 -0
- package/kairotic/talk.cljs +115 -0
- package/kairotic/tempo.cljs +226 -0
- package/kairotic/treecanvas.cljs +299 -0
- package/kairotic/tutorials.mjs +1283 -0
- package/kairotic/vendor/codemirror.mjs +23 -0
- package/package.json +23 -4
- package/page/00-work.cljs +862 -0
- package/page/01-commands.cljs +1219 -0
- package/page/02-patch-view.cljs +1051 -0
- package/page/03-history-view.cljs +481 -0
- package/page/04-panels.cljs +448 -0
- package/page/05-gestures.cljs +1247 -0
- package/page/06-connection.cljs +219 -0
- package/page/07-claude.cljs +430 -0
- package/page/08-sessions.cljs +423 -0
- package/page/09-learn.cljs +602 -0
- package/page/10-embed.cljs +469 -0
- package/page/11-startup.cljs +61 -0
- package/page/12-feedback.cljs +172 -0
- package/page/13-perform.cljs +325 -0
- package/page/14-editor.cljs +656 -0
- package/page/15-presets.cljs +230 -0
- package/page/16-release.cljs +242 -0
- package/page/17-sounds.cljs +147 -0
- package/page/18-lines.cljs +594 -0
- package/page/19-files.cljs +247 -0
- package/page/19-html.cljs +152 -0
- package/page/20-talk.cljs +527 -0
- package/page/21-net.cljs +110 -0
- package/page/22-learn.cljs +303 -0
- package/page/23-ids.cljs +233 -0
- package/page/24-clipboard.cljs +136 -0
- package/page/25-tidy.cljs +74 -0
- package/page/26-probes.cljs +111 -0
- package/sources.mjs +2 -0
|
@@ -0,0 +1,1036 @@
|
|
|
1
|
+
;; SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
;; Kairotic · help
|
|
3
|
+
;; What each box class is for, port by port, with a small patch that shows it working (like the help
|
|
4
|
+
;; patches of Pd and Max). A component can carry its own help in its definition (:help, same shape);
|
|
5
|
+
;; this file is the help of the core classes, and of the official packages until they ship their own.
|
|
6
|
+
;;
|
|
7
|
+
;; {:inlets ["what the left inlet takes" …] one line per inlet, left to right
|
|
8
|
+
;; :outlets ["what the left outlet gives" …]
|
|
9
|
+
;; :messages [["bang" "what it does"] …] words and values it understands (optional)
|
|
10
|
+
;; :example "(box :b1 …)\n(connect …)" a help patch, as patch code (optional)
|
|
11
|
+
;; :try "something to do with the example" (optional)
|
|
12
|
+
;; :steps [{:title "…" :note "…" :try "…" :example "…"} …]
|
|
13
|
+
;; more uses, after the :example: the help patch opens as a lesson, one step each, every
|
|
14
|
+
;; step adding its lines to the patch of the step before (◀ ▶ travel between them) (optional)
|
|
15
|
+
;; :see ["other" "classes"] (optional)
|
|
16
|
+
;; :ref [["label" "https://…"] …] outer documentation, opened in a new tab (optional;
|
|
17
|
+
;; the boxes of clojure.core carry theirs: clojuredocs.org)
|
|
18
|
+
;; :package "@kairotic/synth" when the class comes from a package
|
|
19
|
+
;; :doc :usage only for classes the page may not have loaded yet}
|
|
20
|
+
|
|
21
|
+
(ns kairotic.help
|
|
22
|
+
(:require [clojure.string :as str]
|
|
23
|
+
[kairotic.components :as comp]))
|
|
24
|
+
|
|
25
|
+
(def lines (fn [& ls] (str/join "\n" ls)))
|
|
26
|
+
|
|
27
|
+
(def core
|
|
28
|
+
{"loadbang"
|
|
29
|
+
{:outlets ["a bang when the engine starts (▶)"]
|
|
30
|
+
:example (lines "(box :b1 \"loadbang\" 40 30)" "(box :b2 \"print\" 40 90)" "(connect :b1 0 :b2 0)")
|
|
31
|
+
:try "Press ▶: the bang arrives at print, which writes it in the REPL."
|
|
32
|
+
:see ["bang" "metro"]}
|
|
33
|
+
|
|
34
|
+
"bang"
|
|
35
|
+
{:inlets ["anything: it flashes and sends a bang"]
|
|
36
|
+
:outlets ["bang"]
|
|
37
|
+
:messages [["click" "sends a bang"]]
|
|
38
|
+
:example (lines "(box :b1 \"bang\" 40 30)" "(box :b2 \"counter 1\" 40 90)" "(box :b3 \"print\" 40 150)"
|
|
39
|
+
"(connect :b1 0 :b2 0)" "(connect :b2 0 :b3 0)")
|
|
40
|
+
:try "Start the engine and click the bang: each click counts one more."
|
|
41
|
+
:see ["msg" "loadbang" "metro"]}
|
|
42
|
+
|
|
43
|
+
"msg"
|
|
44
|
+
{:inlets ["anything (or a click): sends its content"]
|
|
45
|
+
:outlets ["its content, read as in Clojure: a number, a keyword with its colon (:stop), a name (inc, e4, https://…), true false nil, a string between quotes (\"two words\"), an EDN form ([0 4 7], {:freq 440}), or a list of them; empty, a bang"]
|
|
46
|
+
:example (lines "(box :b1 \"msg 60\" 40 30)" "(box :b2 \"msg 67\" 110 30)" "(box :b3 \"mtof\" 40 90)"
|
|
47
|
+
"(box :b4 \"osc~ 261.63\" 40 140)" "(box :b5 \"gain~ 0.3\" 40 190)" "(box :b6 \"dac~\" 40 240)"
|
|
48
|
+
"(connect :b1 0 :b3 0)" "(connect :b2 0 :b3 0)" "(connect :b3 0 :b4 0)" "(connect :b4 0 :b5 0)"
|
|
49
|
+
"(connect :b5 0 :b6 0)" "(connect :b5 0 :b6 1)")
|
|
50
|
+
:try "Start the engine and click the two messages: two MIDI pitches become two frequencies."
|
|
51
|
+
:messages [["msg :stop" "a keyword: what boxes understand as an order (:stop, :rec 4, :clear)"]
|
|
52
|
+
["msg inc" "a name: a function where a box takes one (map inc), or free text (e4, 6/5, a URL)"]
|
|
53
|
+
["msg [0 4 7] {:freq 440}" "EDN forms, read whole"]]
|
|
54
|
+
:ref [["EDN" "https://github.com/edn-format/edn"] ["Keywords and symbols" "https://clojure.org/reference/data_structures#Keywords"]]
|
|
55
|
+
:see ["number" "bang"]}
|
|
56
|
+
|
|
57
|
+
"number"
|
|
58
|
+
{:inlets ["a number sets it and sends it on; a bang sends it again"]
|
|
59
|
+
:outlets ["the number"]
|
|
60
|
+
:messages [["drag" "up and down changes it (and sends it); let go, the number stays in its text, as a knob's does"]
|
|
61
|
+
["double-click" "type a number (Enter sends it, Esc closes); so too knobs and the sliders of faust~"]]
|
|
62
|
+
:example (lines "(box :b1 \"number 440\" 40 30)" "(box :b2 \"osc~ 440\" 40 90)" "(box :b3 \"gain~ 0.3\" 40 140)"
|
|
63
|
+
"(box :b4 \"dac~\" 40 190)" "(connect :b1 0 :b2 0)" "(connect :b2 0 :b3 0)"
|
|
64
|
+
"(connect :b3 0 :b4 0)" "(connect :b3 0 :b4 1)")
|
|
65
|
+
:try "Start the engine and drag the number: the oscillator follows. Let it go: its text keeps the new number (back in the history, it goes back)."
|
|
66
|
+
:see ["msg" "knob"]}
|
|
67
|
+
|
|
68
|
+
"print"
|
|
69
|
+
{:inlets ["anything: it is written in the REPL, after the label (print out0 → out0: 60)"]
|
|
70
|
+
:example (lines "(box :b1 \"msg 440.1234\" 40 30)" "(box :b2 \"print freq\" 40 90)"
|
|
71
|
+
"(box :b3 \"format \\\"%.1f Hz\\\"\" 180 90)" "(box :b4 \"print\" 180 150)"
|
|
72
|
+
"(connect :b1 0 :b2 0)" "(connect :b1 0 :b3 0)" "(connect :b3 0 :b4 0)")
|
|
73
|
+
:try "Click the msg: the REPL writes freq: 440.1234 and print: 440.1 Hz."
|
|
74
|
+
:see ["msg" "format" "str"]}
|
|
75
|
+
|
|
76
|
+
"draw"
|
|
77
|
+
{:inlets ["a shape ([:circle {:cx 40 :cy 40 :r 10 :fill :accent}]) is added; a list of shapes replaces them all; [:set k shape] adds or replaces the one called k; [:unset k] removes it; clear"]
|
|
78
|
+
:outlets ["the :hit of a shape pressed (a shape with :hit k sends k)"]
|
|
79
|
+
:messages [["[:circle {:cx :cy :r}]" "a circle (also :rect :line :arc :needle :path :curve :text and :group)"]
|
|
80
|
+
["[[:line …] [:text …]]" "a list: replaces everything"]
|
|
81
|
+
["[:set :cursor [:line …]]" "the shape called :cursor, added or moved"]
|
|
82
|
+
["[:unset :cursor]" "removes it"] [":clear" "empties the view"]]
|
|
83
|
+
:example (lines "(box :b1 \"msg :circle 60 55 22 :accent :hit :sun\" 40 30)"
|
|
84
|
+
"(box :b2 \"msg :circle 160 55 14 :kairos :hit :moon\" 360 30)"
|
|
85
|
+
"(box :b3 \"msg :set :label :text 20 100 \\\"press one of them\\\"\" 40 70)"
|
|
86
|
+
"(box :b4 \"draw 240 120\" 40 120)" "(box :b5 \"print\" 40 270)"
|
|
87
|
+
"(connect :b1 0 :b4 0)" "(connect :b2 0 :b4 0)" "(connect :b3 0 :b4 0)" "(connect :b4 0 :b5 0)")
|
|
88
|
+
:try "Click the three messages, then press the circles: print writes :sun or :moon. From code, any shape of kairotic.shapes: (send! :b4 [:curve {:points [[10 90] [80 20] [150 80] [230 30]] :stroke :accent}]). Shapes take the theme's colours (:ink :soft :accent :kairos :bg :grid) and :opacity."
|
|
89
|
+
:see ["monitor" "pcclock" "msg"]}
|
|
90
|
+
|
|
91
|
+
"mtof"
|
|
92
|
+
{:inlets ["a MIDI pitch (60 = middle C) or a list of them"]
|
|
93
|
+
:outlets ["the frequency in Hz (or the list)"]
|
|
94
|
+
:example (lines "(box :b1 \"number 69\" 40 30)" "(box :b2 \"mtof\" 40 90)" "(box :b3 \"print\" 40 150)"
|
|
95
|
+
"(connect :b1 0 :b2 0)" "(connect :b2 0 :b3 0)")
|
|
96
|
+
:try "Drag the number: 69 is A4, 440 Hz; every 12 steps the frequency doubles."
|
|
97
|
+
:see ["ftom" "osc~"]}
|
|
98
|
+
|
|
99
|
+
"ftom"
|
|
100
|
+
{:inlets ["a frequency in Hz or a list of them"]
|
|
101
|
+
:outlets ["the MIDI pitch, with decimals for what falls between keys"]
|
|
102
|
+
:see ["mtof"]}
|
|
103
|
+
|
|
104
|
+
"+" {:inlets ["a number or a list: it adds the right one and sends the result" "the number to add (stored, nothing is sent)"]
|
|
105
|
+
:outlets ["the sum"]
|
|
106
|
+
:example (lines "(box :b1 \"number 60\" 40 30)" "(box :b2 \"number 7\" 130 30)" "(box :b3 \"+ 7\" 40 90)" "(box :b4 \"print\" 40 150)"
|
|
107
|
+
"(connect :b1 0 :b3 0)" "(connect :b2 0 :b3 1)" "(connect :b3 0 :b4 0)")
|
|
108
|
+
:try "The right inlet only stores: change it, then drag the left number to hear (read) the result. A fifth above is + 7."
|
|
109
|
+
:see ["-" "*" "/"]}
|
|
110
|
+
"-" {:inlets ["a number or a list: minus the right one" "the number to subtract (stored)"] :outlets ["the difference"] :see ["+"]}
|
|
111
|
+
"*" {:inlets ["a number or a list: times the right one" "the factor (stored)"] :outlets ["the product"] :see ["+" "/"]}
|
|
112
|
+
"/" {:inlets ["a number or a list: divided by the right one (0 if it is 0)" "the divisor (stored)"] :outlets ["the quotient"] :see ["*" "!/"]}
|
|
113
|
+
"!/" {:inlets ["a number or a list: what divides the right one (0 if it is 0)" "the dividend (stored)"] :outlets ["the quotient: !/ 1 gives 1 / the number"] :see ["/" "sample"]}
|
|
114
|
+
"!-" {:inlets ["a number or a list: subtracted from the right one" "the minuend (stored)"] :outlets ["the difference"] :see ["-"]}
|
|
115
|
+
|
|
116
|
+
"metro"
|
|
117
|
+
{:inlets ["bang, 1 or :start: starts · 0 or :stop: stops" "the interval in ms"]
|
|
118
|
+
:outlets ["a bang every interval"]
|
|
119
|
+
:example (lines "(box :b1 \"msg 1\" 40 30)" "(box :b2 \"msg 0\" 100 30)" "(box :b3 \"metro 250\" 40 90)"
|
|
120
|
+
"(box :b4 \"counter 1 8\" 40 150)" "(box :b5 \"print\" 40 210)"
|
|
121
|
+
"(connect :b1 0 :b3 0)" "(connect :b2 0 :b3 0)" "(connect :b3 0 :b4 0)" "(connect :b4 0 :b5 0)")
|
|
122
|
+
:try "Start the engine, then 1 and 0: a pulse that counts from 0 to 7."
|
|
123
|
+
:see ["counter" "ramp" "loadbang"]}
|
|
124
|
+
|
|
125
|
+
"counter"
|
|
126
|
+
{:inlets ["bang (or a number): sends the value and advances one step · :reset: back to the minimum" "a number sets the next value"]
|
|
127
|
+
:outlets ["the value"]
|
|
128
|
+
:see ["metro"]}
|
|
129
|
+
|
|
130
|
+
"dispatch"
|
|
131
|
+
{:inlets ["a message: goes out by the outlet the selector chooses (or by none)"
|
|
132
|
+
"the selector: k (outlet k, from 0) · nil or false (closed) · true (outlet 0) · a function, keyword or map that chooses for each message · a set (its members by outlet 0)"]
|
|
133
|
+
:outlets ["outlet 0" "outlet 1 … (dispatch n has n)"]
|
|
134
|
+
:messages [["msg 1" "every message by outlet 1"] ["msg nil" "nothing goes out"]
|
|
135
|
+
["msg {60 0 64 1}" "60 by outlet 0, 64 by outlet 1, anything else by none"]
|
|
136
|
+
["msg :to" "each message by the outlet its :to says ({:freq 440 :to 1})"]]
|
|
137
|
+
:example (lines "(box :b1 \"msg 60\" 40 30)" "(box :b2 \"msg 64\" 100 30)" "(box :b3 \"msg 67\" 160 30)"
|
|
138
|
+
"(box :b4 \"msg 0\" 260 30)" "(box :b5 \"msg 1\" 320 30)" "(box :b6 \"msg nil\" 380 30)" "(box :b7 \"msg {60 0 64 1}\" 470 30)"
|
|
139
|
+
"(box :b8 \"dispatch 2\" 40 100)" "(box :b9 \"print out0\" 40 170)" "(box :b10 \"print out1\" 200 170)"
|
|
140
|
+
"(connect :b1 0 :b8 0)" "(connect :b2 0 :b8 0)" "(connect :b3 0 :b8 0)"
|
|
141
|
+
"(connect :b4 0 :b8 1)" "(connect :b5 0 :b8 1)" "(connect :b6 0 :b8 1)" "(connect :b7 0 :b8 1)"
|
|
142
|
+
"(connect :b8 0 :b9 0)" "(connect :b8 1 :b10 0)")
|
|
143
|
+
:try "Click a selector on the right (0, 1, nil or the map) and then the notes on the left: each note goes out by the way chosen — the REPL says which, out0 or out1 — or by none. With the map, 60 and 64 choose their own way and 67 is held back."
|
|
144
|
+
:see ["msg" "get"]}
|
|
145
|
+
|
|
146
|
+
"ramp"
|
|
147
|
+
{:inlets ["bang: goes from a to b in s seconds · [a b s]: that motion · a number: jumps there · :stop" "1 / 0: loop on or off"]
|
|
148
|
+
:outlets ["the moving value"]
|
|
149
|
+
:example (lines "(box :b1 \"loadbang\" 40 30)" "(box :b2 \"ramp 220 880 4 loop\" 40 90)" "(box :b3 \"osc~ 220\" 40 150)"
|
|
150
|
+
"(box :b4 \"gain~ 0.3\" 40 200)" "(box :b5 \"dac~\" 40 250)"
|
|
151
|
+
"(connect :b1 0 :b2 0)" "(connect :b2 0 :b3 0)" "(connect :b3 0 :b4 0)" "(connect :b4 0 :b5 0)" "(connect :b4 0 :b5 1)")
|
|
152
|
+
:try "Press ▶: a glissando of two octaves in four seconds, again and again."
|
|
153
|
+
:see ["metro" "reader" "phasor~"]}
|
|
154
|
+
|
|
155
|
+
"presets"
|
|
156
|
+
{:inlets ["a keyframe to recall: its number (1 = the first) or its label · bang: a new preset · [:generate seed] · [:morph a b t] · keep"
|
|
157
|
+
"a position between keyframes: 1.5 morphs halfway from the first to the second"]
|
|
158
|
+
:outlets ["the values of the controls it set: {:b3 0.5 :b5 880}"]
|
|
159
|
+
:messages [["2 · intro" "recalls that keyframe: every box takes its text of then, as one event of the history"]
|
|
160
|
+
["1.5 (right)" "moves the controls (knobs, envelopes…) between two keyframes, as messages, as a drag does"]
|
|
161
|
+
[":keep" "writes the last morph into the texts of the controls, as one event"]
|
|
162
|
+
["bang · [:generate 42]" "a new preset: what is the same in every keyframe stays, what changes takes a value within its range"]
|
|
163
|
+
["(keyframes) · (recall 2) · (morph 1 2 0.5) · (morph :keep) · (generate 42)" "the same from the REPL, with every keyframe of the work"]
|
|
164
|
+
["(store-presets! :bN) · (presets! :bN […])" "keeps its keyframes in the box (only what changes): then it uses them, and they travel with the patch in its code, links and embeds"]]
|
|
165
|
+
:example (lines "(box :b1 \"msg 1\" 40 30)" "(box :b2 \"msg 2\" 100 30)" "(box :b3 \"bang\" 160 30)"
|
|
166
|
+
"(box :b4 \"knob 1 2 1\" 230 20)" "(box :b5 \"presets\" 40 120)"
|
|
167
|
+
"(box :b6 \"knob 100 1000 220 log\" 40 180)" "(box :b7 \"osc~ 220\" 40 280)"
|
|
168
|
+
"(box :b8 \"gain~ 0.2\" 40 330)" "(box :b9 \"dac~\" 40 380)"
|
|
169
|
+
"(connect :b1 0 :b5 0)" "(connect :b2 0 :b5 0)" "(connect :b3 0 :b5 0)" "(connect :b4 0 :b5 1)"
|
|
170
|
+
"(connect :b6 0 :b7 0)" "(connect :b7 0 :b8 0)" "(connect :b8 0 :b9 0)" "(connect :b8 0 :b9 1)")
|
|
171
|
+
:try "Press ◆ Snapshot, turn the lower knob and press ◆ again: two keyframes. Start the engine: 1 and 2 recall them, the knob on the right morphs between them, and the bang makes a new preset in between."
|
|
172
|
+
:see ["knob" "patch"]}
|
|
173
|
+
|
|
174
|
+
"canvas"
|
|
175
|
+
{:inlets ["a position (or a click): it comes out on the left · an edit ([:stroke [[x y] …]], [:erase :t1], [:clear], [:axis :y 0 1]… or [:batch [edits]]): it changes the buffer, as one event · a question ([:read x], [:strokes], [:get :t1], [:count], [:end], [:range], [:data]): the answer comes out on the left · a musical tree: shown over it"]
|
|
176
|
+
:outlets ["the position, or the answer to a question" "the buffer, for a reader or reader~ (on their right inlet)"]
|
|
177
|
+
:messages [["(axis :bN :x -1 1)" "range of an axis, :log for logarithmic"] ["(stroke :bN [[x y] …])" "draws"]
|
|
178
|
+
["the corner · (resize :bN 640 300)" "drag its bottom-right corner to resize it; a double-click there brings back its size"]
|
|
179
|
+
["[:stroke [[0 0] [1 1]]] · [:stroke :t3 pts]" "a stroke by message (a new id, or that one)"]
|
|
180
|
+
["[:move :t1 dx dy] · [:stretch :t1 k] · [:erase :t1] · [:clear]" "edit strokes by message"]
|
|
181
|
+
["[:axis :x lo hi] · [:axis :y lo hi :log] · [:grid-y step]" "axes and grid by message"]
|
|
182
|
+
["[:batch [[:clear] [:stroke pts] …]]" "several edits, one event of the history"]
|
|
183
|
+
["[:read 0.5] · [:read :y 0.2] · [:strokes] · [:get :t1] · [:count] · [:range] · [:data]" "questions: the answer comes out on the left"]
|
|
184
|
+
["{ } in the header (or a double-click on its right) · (source :bN)" "the buffer as EDN text, in the code window: edit it and apply (Ctrl+Enter); what changed is one event"]]
|
|
185
|
+
:example (lines "(box :b1 \"canvas\" 40 60)" "(box :b2 \"loadbang\" 40 15)" "(box :b3 \"ramp 0 1 4 loop\" 120 15)"
|
|
186
|
+
"(box :b4 \"reader\" 40 290)" "(box :b5 \"print\" 40 340)"
|
|
187
|
+
"(connect :b2 0 :b3 0)" "(connect :b3 0 :b4 0)" "(connect :b1 1 :b4 1)" "(connect :b4 0 :b5 0)"
|
|
188
|
+
"(axis :b1 :x 0 1)" "(axis :b1 :y 0 1)" "(stroke :b1 [[0 0.2] [0.5 0.9] [1 0.4]])")
|
|
189
|
+
:try "Press ▶: the reader goes along X and prints the height of the stroke. Draw another stroke and listen to the list grow."
|
|
190
|
+
:steps [{:title "An automation"
|
|
191
|
+
:note "A reader~ goes along the canvas at audio rate: its value is a signal that can move a parameter, here the factor of a gain~ (a tremolo drawn by hand)."
|
|
192
|
+
:example (lines "(box :b6 \"phasor~ 0.5\" 300 15)" "(box :b7 \"reader~ norm\" 300 290)" "(box :b8 \"osc~ 330\" 420 290)"
|
|
193
|
+
"(box :b9 \"gain~ 0\" 420 340)" "(box :b10 \"dac~\" 420 390)"
|
|
194
|
+
"(connect :b6 0 :b7 0)" "(connect :b1 1 :b7 1)" "(connect :b8 0 :b9 0)" "(connect :b7 0 :b9 1)"
|
|
195
|
+
"(connect :b9 0 :b10 0)" "(connect :b9 0 :b10 1)")
|
|
196
|
+
:try "Press ▶: the stroke becomes the volume of the oscillator every two seconds. Draw a zigzag and listen to it."}
|
|
197
|
+
{:title "A path in two dimensions"
|
|
198
|
+
:note "With reader path, the position (0…1) goes along a stroke, and both its X and Y come out: a trajectory, for space~ or for two parameters at once."
|
|
199
|
+
:example (lines "(clear :b1)" "(axis :b1 :x -1 1)" "(axis :b1 :y -1 1)"
|
|
200
|
+
"(stroke :b1 [[0 0.8] [0.7 0.4] [0.5 -0.6] [-0.6 -0.5] [-0.7 0.5] [0 0.8]])"
|
|
201
|
+
"(text! :b4 \"reader path\")")
|
|
202
|
+
:try "Press ▶: print writes [x y] as the reader goes around the shape. Connect its outlet to a space~ (see its help) to move a sound along it."}]
|
|
203
|
+
:see ["reader" "reader~" "freqt"]}
|
|
204
|
+
|
|
205
|
+
"freqt"
|
|
206
|
+
{:inlets ["a time (or a click): it comes out on the left · an edit ([:note t \"c4\" dur], [:stroke [[t hz] …]], [:erase :t1], [:clear], [:tuning \"19-tet\"], [:grid-x 0.25 [4]]… or [:batch [edits]]): it changes the buffer, as one event · a question ([:read t], [:strokes], [:get :t1], [:count], [:end], [:data]): the answer comes out on the left · a musical tree: shown over it"]
|
|
207
|
+
:outlets ["the time, or the answer to a question" "the buffer, for a reader or reader~"
|
|
208
|
+
"shown as a score: the edits made on the notes of the tree it shows ([:edit …]), for the tree box"]
|
|
209
|
+
:messages [["(note :bN t \"c4\" dur)" "a note"] ["(tuning :bN \"31-tet\" 261.63)" "a tuning"] ["(grid-x :bN 0.25 \"3+3+2\")" "a bar grid"]
|
|
210
|
+
["the corner · (resize :bN 640 300)" "drag its bottom-right corner to resize it (as a score, its width reflows the notation); a double-click there brings back its size"]
|
|
211
|
+
["[:note 0 \"c4\" 1] · [:note 1 64 0.5]" "a note by message (pitch as a name or MIDI)"]
|
|
212
|
+
["[:move :t1 dt cents] · [:stretch :t1 k] · [:erase :t1] · [:clear]" "edit notes by message"]
|
|
213
|
+
["[:tuning \"19-tet\" 261.63] · [:grid-x 0.25 [4]]" "tuning and grid by message"]
|
|
214
|
+
["[:batch [[:clear] [:note 0 \"c4\" 1] …]]" "several edits, one event of the history"]
|
|
215
|
+
["[:read 2] · [:strokes] · [:get :t1] · [:count] · [:end] · [:data]" "questions: the answer comes out on the left"]
|
|
216
|
+
["⇄ score in the header · (view :bN :score)" "the same buffer, quantized and drawn as a score: measures in the meter of its bar grid, tuplets, ties (⇄ canvas brings it back)"]
|
|
217
|
+
["(quantize :bN {:meter \"6/8\"})" "the tree that score shows, to keep or edit (options: :meter :divs :merge :nest :voices :grace :legato)"]
|
|
218
|
+
["shown as a score, alt-click a note · (division! :bN t)" "its beat divided the next way (another division, in halves, with the next beat), kept in the buffer"]
|
|
219
|
+
["(to-tree! :bN)" "a tree box beside it, with its strokes as notes: the drawing, now a tree"]
|
|
220
|
+
["(quant :bN {:meter \"6/8\" :key \"eb\"}) · [:quantize {…}]" "how its score is quantized and in which key, kept in its buffer (one event); (quant :bN nil): the defaults. {:meters [\"3/4\" \"5/8[2+3]\"]}: a meter for each bar, the last going on"]
|
|
221
|
+
["(track! :bN) · (quant :bN {:time :track})" "what was played freely (transcribe, at any tempo, with rubato) written on its beats: the tempo and the beats are found, and track! keeps them (the time map) so that the score stays as it is; if the bar starts in the wrong place, (track! :bN {:downbeat t}) with the time of a note that starts a bar; (track! :bN nil) forgets them"]
|
|
222
|
+
["shown as a score, shift-alt-click a note · (enharmonic! :bN t midi)" "another name for that note (c#4 → db4), kept in the buffer"]
|
|
223
|
+
["shown as a score, click a note of a tree" "↑ ↓ pitch (⇧ octave) · a…g the nearest note of that name · + − duration · ← → next · Delete → rest"]
|
|
224
|
+
["click a rest" "Enter → a note (the pitch of the one before) · ↑ ↓ a step above or below it · a…g that note"]
|
|
225
|
+
["(keep! :bN)" "writes the tree it shows into its buffer, with its recipe beside it (the tree and the boxes that made it)"]
|
|
226
|
+
["(recipe :bN) · (remake! :bN)" "the recipe of a kept buffer · the tree written back, without the changes made since"]
|
|
227
|
+
["{ } in the header (or a double-click on its right) · (source :bN)" "the buffer as EDN text, in the code window: edit it and apply (Ctrl+Enter); what changed is one event"]]
|
|
228
|
+
:example (lines "(box :b1 \"freqt\" 40 60)" "(box :b2 \"phasor~ 0.25\" 40 15)" "(box :b3 \"reader~ norm 1 gate\" 40 290)"
|
|
229
|
+
"(box :b4 \"osc~\" 40 340)" "(box :b5 \"gain~\" 40 390)" "(box :b6 \"dac~\" 40 440)"
|
|
230
|
+
"(connect :b2 0 :b3 0)" "(connect :b1 1 :b3 1)" "(connect :b3 0 :b4 0)" "(connect :b3 1 :b5 1)"
|
|
231
|
+
"(connect :b4 0 :b5 0)" "(connect :b5 0 :b6 0)" "(connect :b5 0 :b6 1)"
|
|
232
|
+
"(melody :b1 \"c4/1 e4/.5 d4/.5 g4/2\" 0)")
|
|
233
|
+
:try "Press ▶: the reader~ plays the four beats again and again. Draw a stroke of your own, straight or curved: it sounds at the frequency it passes through."
|
|
234
|
+
:steps [{:title "A tuning and a grid"
|
|
235
|
+
:note "A freqt can have a tuning (the lines of its Y axis: any equal division, just intonation, a Scala .scl) and a grid of time with its bars. Drawing snaps to both."
|
|
236
|
+
:example (lines "(tuning :b1 \"19-tet\")" "(grid-x :b1 0.5 [4])")
|
|
237
|
+
:try "Draw a few notes: they fall on the 19 degrees of the octave and on the half beats. Try (tuning :b1 \"just-5\") or (tuning :b1 nil) to draw freely again."}
|
|
238
|
+
{:title "As a score"
|
|
239
|
+
:note "The same buffer can be shown as a score, quantized into measures (in the meter of its bar grid, with tuplets and ties): ⇄ score in its header, or (view :b1 :score). Nothing changes in the data; ⇄ canvas brings the drawing back, and (quantize :b1) gives the tree the score shows."
|
|
240
|
+
:example (lines "(tuning :b1 nil)" "(view :b1 :score)")
|
|
241
|
+
:try "Press ▶: the score sounds the same as the drawing did. To edit notes one by one in a score, show a tree: see the help of tree."}
|
|
242
|
+
{:title "The viewer of a tree"
|
|
243
|
+
:note "A freqt shown as a score is the viewer of a tree that comes transformed (tree → mt transpose 7 → freqt). Its third outlet sends the edits made on the notes back to the tree box. (A box written \"score\", from older works, is a freqt shown as a score.)"
|
|
244
|
+
:example (lines "(box :b7 \"bang\" 500 15)" "(box :b8 \"tree\" 500 60)" "(code :b8 \"\\\"c5/1 b4/.5 a4 g4/2\\\"\")"
|
|
245
|
+
"(box :b9 \"freqt\" 500 160)" "(view :b9 :score)"
|
|
246
|
+
"(connect :b7 0 :b8 0)" "(connect :b8 0 :b9 0)" "(connect :b9 2 :b8 0)")
|
|
247
|
+
:try "Click a note of the new score and press ↑ or ↓, + or −, Delete (a rest) and then Enter (a note again): the change goes back to the tree by the dashed line."}]
|
|
248
|
+
:see ["canvas" "reader" "tree" "quantize" "transcribe"]}
|
|
249
|
+
|
|
250
|
+
"reader"
|
|
251
|
+
{:inlets ["a position in the units of the buffer (along X, or Y with reader y; 0…1 with reader norm, or with reader path) · on a ring: in seconds (0…1 with norm), or :d, :speed, :stop"
|
|
252
|
+
"the buffer of a canvas, freqt or ring (a ring's right outlet)"]
|
|
253
|
+
:outlets ["the values where the position crosses something (a list) · from a ring, each value as it was written" "their ids (sent first), for voices"]
|
|
254
|
+
:messages [["reader d 1 · msg :d 1" "on a ring: it follows the ring's head 1 s behind, on its own — a canon, a delay; it starts when the ring's time does"]
|
|
255
|
+
["reader d 1 speed 0.5 · msg :speed 0.5" "first the distance, then the speed: at 0.5 it falls behind (an augmentation), at −1 it goes back over what was written"]
|
|
256
|
+
["a number (a ramp, a counter)" "on a ring: moves it there; it sends what it crosses, either way, and a move larger than its jump (0.5 s; jump 1, msg :jump 1) is a seek"]
|
|
257
|
+
[":stop" "it stops following"]]
|
|
258
|
+
:example (lines "(box :b1 \"msg 60\" 40 30)" "(box :b2 \"msg 64\" 100 30)" "(box :b3 \"msg 67\" 160 30)"
|
|
259
|
+
"(box :b4 \"ring 8\" 40 90)" "(box :b5 \"reader d 1\" 40 150)" "(box :b6 \"reader d 2 speed 0.5\" 180 150)"
|
|
260
|
+
"(box :b7 \"print canon\" 40 210)" "(box :b8 \"print slower\" 180 210)"
|
|
261
|
+
"(connect :b1 0 :b4 0)" "(connect :b2 0 :b4 0)" "(connect :b3 0 :b4 0)"
|
|
262
|
+
"(connect :b4 1 :b5 1)" "(connect :b4 1 :b6 1)" "(connect :b5 0 :b7 0)" "(connect :b6 0 :b8 0)")
|
|
263
|
+
:try "Press ▶ and click the three messages: each comes back a second later, and from the second reader two seconds later, twice as slow. A ramp into a reader on the ring moves it by hand."
|
|
264
|
+
:see ["ring" "writer" "canvas" "reader~"]}
|
|
265
|
+
|
|
266
|
+
"osc~"
|
|
267
|
+
{:inlets ["a number: the frequency in Hz · a signal: the frequency itself" "—"]
|
|
268
|
+
:outlets ["a sine signal (quiet: 0.15)"]
|
|
269
|
+
:example (lines "(box :b1 \"number 440\" 40 30)" "(box :b2 \"osc~ 440\" 40 90)" "(box :b3 \"gain~ 0.3\" 40 140)"
|
|
270
|
+
"(box :b4 \"dac~\" 40 190)" "(connect :b1 0 :b2 0)" "(connect :b2 0 :b3 0)"
|
|
271
|
+
"(connect :b3 0 :b4 0)" "(connect :b3 0 :b4 1)")
|
|
272
|
+
:try "Start the engine and drag the number. Then put a phasor~ through a * into the left inlet: a signal instead of numbers."
|
|
273
|
+
:see ["gain~" "dac~" "phasor~" "mtof"]}
|
|
274
|
+
|
|
275
|
+
"gain~"
|
|
276
|
+
{:inlets ["the signal" "the factor: a number, or a signal (an envelope) that then is the factor"]
|
|
277
|
+
:outlets ["the signal times the factor"]
|
|
278
|
+
:see ["osc~" "adsr~" "dac~"]}
|
|
279
|
+
|
|
280
|
+
"dac~"
|
|
281
|
+
{:inlets ["one inlet per output channel: those written after it (1 2 by default)"]
|
|
282
|
+
:example (lines "(box :b1 \"osc~ 330\" 40 30)" "(box :b2 \"gain~ 0.2\" 40 80)" "(box :b3 \"dac~ 1 2\" 40 130)"
|
|
283
|
+
"(connect :b1 0 :b2 0)" "(connect :b2 0 :b3 0)")
|
|
284
|
+
:try "Only the left channel sounds: connect the gain~ to the right inlet too."
|
|
285
|
+
:see ["gain~" "pan~" "space~" "adc~"]}
|
|
286
|
+
|
|
287
|
+
"adc~"
|
|
288
|
+
{:outlets ["one signal per input channel: those written after it (1 by default)"]
|
|
289
|
+
:example (lines "(box :b1 \"adc~ 1\" 40 30)" "(box :b2 \"scope~ 20\" 40 80)" "(box :b3 \"snapshot~ 50 db\" 240 80)"
|
|
290
|
+
"(box :b4 \"print\" 240 140)"
|
|
291
|
+
"(connect :b1 0 :b2 0)" "(connect :b1 0 :b3 0)" "(connect :b3 0 :b4 0)")
|
|
292
|
+
:try "Press ▶ and allow the microphone: sing or clap and watch the scope and the level. It does not go to dac~, so it cannot feed back; send it through a gain~ to hear it (with headphones)."
|
|
293
|
+
:see ["dac~" "snapshot~" "scope~"]}
|
|
294
|
+
|
|
295
|
+
"snapshot~"
|
|
296
|
+
{:inlets ["the signal; a number changes ms, a bang sends the last value again"]
|
|
297
|
+
:outlets ["its value (or its level with rms, peak or db) every ms, only when it changed"]
|
|
298
|
+
:messages [["rms · peak · db" "written in the box: its level over each ms instead of its value"]]
|
|
299
|
+
:example (lines "(box :b1 \"phasor~ 0.5\" 40 30)" "(box :b2 \"snapshot~ 100\" 40 80)" "(box :b3 \"print\" 40 130)"
|
|
300
|
+
"(connect :b1 0 :b2 0)" "(connect :b2 0 :b3 0)")
|
|
301
|
+
:try "Press ▶: the ramp of the phasor~ arrives as numbers ten times a second. Write snapshot~ 100 peak and connect an adc~ instead."
|
|
302
|
+
:see ["adc~" "scope~" "phasor~"]}
|
|
303
|
+
|
|
304
|
+
"scope~"
|
|
305
|
+
{:inlets ["the signal; a number changes the time shown (ms)"]
|
|
306
|
+
:messages [["drag up/down" "zoom (⇧ finer)"] ["drag sideways" "the time shown"]]
|
|
307
|
+
:example (lines "(box :b1 \"osc~ 220\" 40 30)" "(box :b2 \"scope~ 20\" 40 80)" "(connect :b1 0 :b2 0)")
|
|
308
|
+
:try "Press ▶: a sine wave stands still. Drag over it to zoom; connect an adc~ instead of the osc~."
|
|
309
|
+
:see ["adc~" "snapshot~"]}
|
|
310
|
+
|
|
311
|
+
"record"
|
|
312
|
+
{:inlets ["numbers (a knob, snapshot~, features~…); :rec starts a take from 0, :stop ends it" "a bang: the stroke being drawn ends, the next number begins another"]
|
|
313
|
+
:outlets ["edits for a canvas or freqt (its inlet): [:batch …], at most every 2 seconds"]
|
|
314
|
+
:messages [[":rec" "starts from 0; its first write clears the buffer"] [":rec t (msg :rec 4)" "from t seconds: what is before t stays, what is after is replaced"] [":ovr t (msg :ovr 4)" "from t seconds, over only what the take covers: what comes after it stays"] [":stop" "writes what is left and stops"]]
|
|
315
|
+
:example (lines "(box :b1 \"knob 0 1 0.5\" 40 30)" "(box :b2 \"msg :rec\" 140 30)" "(box :b3 \"msg :stop\" 200 30)"
|
|
316
|
+
"(box :b4 \"record 0 1\" 40 120)" "(box :b5 \"canvas\" 40 170)"
|
|
317
|
+
"(connect :b1 0 :b4 0)" "(connect :b2 0 :b4 0)" "(connect :b3 0 :b4 0)" "(connect :b4 0 :b5 0)")
|
|
318
|
+
:try "Press ▶, click rec, move the knob for a few seconds, click stop: the canvas holds the gesture. A phasor~ into a reader~ with the canvas on its right plays it back as an automation."
|
|
319
|
+
:see ["canvas" "snapshot~" "reader~" "transcribe"]}
|
|
320
|
+
|
|
321
|
+
"ring"
|
|
322
|
+
{:inlets ["any value: written where the ring's time is (from its first message) · a writer's edits · :clear"]
|
|
323
|
+
:outlets ["what it is asked ([:data])" "the buffer, for a reader or a writer (on their right or middle inlet); :start when its time starts"]
|
|
324
|
+
:messages [["ring 8" "keeps the last 8 seconds: its write head goes round as a tape head, so what is older than one turn is gone"]
|
|
325
|
+
[":clear" "empties it; its time starts again at the next message"]
|
|
326
|
+
["[:data]" "what it keeps, as {:dur :events [[position value] …]}"]]
|
|
327
|
+
:example (lines "(box :b1 \"msg 60\" 40 30)" "(box :b2 \"msg 67\" 100 30)" "(box :b3 \"ring 4\" 40 90)"
|
|
328
|
+
"(box :b4 \"reader d 0.5\" 40 150)" "(box :b5 \"reader d 1.5\" 160 150)" "(box :b6 \"print\" 40 210)"
|
|
329
|
+
"(connect :b1 0 :b3 0)" "(connect :b2 0 :b3 0)" "(connect :b3 1 :b4 1)" "(connect :b3 1 :b5 1)"
|
|
330
|
+
"(connect :b4 0 :b6 0)" "(connect :b5 0 :b6 0)")
|
|
331
|
+
:try "Press ▶ and click the messages: a canon in three voices, 0.5 s and 1.5 s behind. After 4 seconds what you played is gone."
|
|
332
|
+
:see ["reader" "writer" "record"]}
|
|
333
|
+
|
|
334
|
+
"writer"
|
|
335
|
+
{:inlets ["what is written where the writer is · :rec t / :ovr t · :stop" "the buffer (a ring's right outlet)" "a position in seconds of the span (0…1 with norm), from any source"]
|
|
336
|
+
:outlets ["edits for the ring (its left inlet)"]
|
|
337
|
+
:messages [["writer · writer mix" "ovr (the default) replaces what it passes, silence too, as a tape head; mix leaves it (an overdub)"]
|
|
338
|
+
["a position on the right" "it goes there: moving, with ovr it erases what it passes; a move larger than its jump (0.5 s; writer jump 1) is a seek"]
|
|
339
|
+
[":ovr t (msg :ovr 2)" "to t, then on at speed 1, replacing what it passes"]
|
|
340
|
+
[":rec t (msg :rec 2)" "the same, and on a ring everything else is erased first"]
|
|
341
|
+
[":stop" "it stays where it is"]]
|
|
342
|
+
:example (lines "(box :b1 \"msg 60\" 40 30)" "(box :b2 \"msg 67\" 100 30)" "(box :b3 \"msg :ovr 0\" 160 30)"
|
|
343
|
+
"(box :b4 \"writer\" 40 90)" "(box :b5 \"ring 4\" 40 150)" "(box :b6 \"reader d 1\" 40 210)" "(box :b7 \"print\" 40 270)"
|
|
344
|
+
"(connect :b1 0 :b4 0)" "(connect :b2 0 :b4 0)" "(connect :b3 0 :b4 0)" "(connect :b4 0 :b5 0)"
|
|
345
|
+
"(connect :b5 1 :b4 1)" "(connect :b5 1 :b6 1)" "(connect :b6 0 :b7 0)")
|
|
346
|
+
:try "Press ▶ and click the notes: without a position the writer writes where the ring's head is, and the reader plays them a second later. Click :ovr 0: now the writer goes round from the ring's position 0 at speed 1, wherever the ring's head is, replacing what it passes, and the reader meets the notes when it gets there. A ramp on its right inlet moves it by hand."
|
|
347
|
+
:see ["ring" "reader" "record"]}
|
|
348
|
+
|
|
349
|
+
"phasor~"
|
|
350
|
+
{:inlets ["a number: the frequency in Hz (0.25 = once every 4 seconds)"]
|
|
351
|
+
:outlets ["a ramp signal from 0 to 1"]
|
|
352
|
+
:see ["reader~" "sig~"]}
|
|
353
|
+
|
|
354
|
+
"sig~"
|
|
355
|
+
{:inlets ["a number: the new constant value"] :outlets ["a constant signal"] :see ["phasor~" "osc~"]}
|
|
356
|
+
|
|
357
|
+
"reader~"
|
|
358
|
+
{:inlets ["the position signal, in the buffer's units (the X axis of a canvas, the time of a freqt, the seconds of a sample) or 0…1 with reader~ norm (a phasor~ straight in); along a stroke (path) always 0…1 · on a ring~: a position in seconds (0…1 with norm), or nothing (then it follows the ring's head); :d, :speed, :jump, :gain"
|
|
359
|
+
"the buffer of a canvas or freqt, the sound of a sample (then it plays it, 0 its start and 1 its end), or a ring~ (its right outlet)"]
|
|
360
|
+
:outlets ["one signal per voice (the values it crosses) · from a ring~, the sound it reads" "with gate: one more per voice, 1 where it sounds and 0 where not"]
|
|
361
|
+
:messages [["reader~ d 1 · msg :d 1" "on a ring~, without a position: 1 s behind the ring's head — a canon, a delay; a new d glides (the pitch bends) or, larger than its jump (0.25 s), seeks with a crossfade"]
|
|
362
|
+
["reader~ d 1 speed 0.5 · msg :speed -1" "first the distance, then the speed: at 0.5 an octave down and falling behind, at −1 backwards"]
|
|
363
|
+
["a position signal on a ring~" "it reads there (seconds; norm: 0…1, a phasor~), at any speed, either way"]]
|
|
364
|
+
:example (lines "(box :b1 \"freqt\" 40 60)" "(box :b2 \"phasor~ 0.25\" 40 15)" "(box :b3 \"reader~ norm 1 gate\" 40 290)"
|
|
365
|
+
"(box :b4 \"osc~\" 40 340)" "(box :b5 \"gain~\" 40 390)" "(box :b6 \"dac~\" 40 440)"
|
|
366
|
+
"(connect :b2 0 :b3 0)" "(connect :b1 1 :b3 1)" "(connect :b3 0 :b4 0)" "(connect :b3 1 :b5 1)"
|
|
367
|
+
"(connect :b4 0 :b5 0)" "(connect :b5 0 :b6 0)" "(connect :b5 0 :b6 1)"
|
|
368
|
+
"(stroke :b1 [[0 220] [1 330] [1.5 293.66]])" "(stroke :b1 [[2.5 440] [4 220]])")
|
|
369
|
+
:try "Press ▶: the drawing plays every four seconds, and is silent where nothing is drawn (the gate)."
|
|
370
|
+
:see ["phasor~" "adsr~" "freqt" "reader" "sample"]}
|
|
371
|
+
|
|
372
|
+
"ring~"
|
|
373
|
+
{:inlets ["the sound, written where the ring's time is (its write head goes round as a tape head) · :clear silences it"]
|
|
374
|
+
:outlets ["—" "the buffer, for reader~ and writer~ (on their right / middle inlet)"]
|
|
375
|
+
:messages [["ring~ 8" "keeps the last 8 seconds (up to 60)"] [":clear" "silence, the heads where they are"]
|
|
376
|
+
["up to 8 heads" "the reader~ and writer~ on it share one node: a feedback inside the ring is exact, through other boxes it costs a block (128 samples)"]
|
|
377
|
+
["reader~ → faust~ → writer~" "a faust~ in a loop of the ring runs inside the ring's node, one sample at a time: exact at any d (a string whose d is its period, a comb, a tape echo that darkens); its parameters follow it there (not a polyphonic one)"]]
|
|
378
|
+
:example (lines "(box :b1 \"adc~\" 40 30)" "(box :b2 \"ring~ 8\" 40 90)" "(box :b3 \"reader~ d 1\" 40 150)"
|
|
379
|
+
"(box :b4 \"reader~ d 1 speed 0.5\" 200 150)" "(box :b5 \"gain~ 0.4\" 40 210)" "(box :b6 \"dac~\" 40 270)"
|
|
380
|
+
"(connect :b1 0 :b2 0)" "(connect :b2 1 :b3 1)" "(connect :b2 1 :b4 1)" "(connect :b3 0 :b5 0)" "(connect :b4 0 :b5 0)"
|
|
381
|
+
"(connect :b5 0 :b6 0)" "(connect :b5 0 :b6 1)")
|
|
382
|
+
:try "With headphones, press ▶ and sing: you come back a second later, and from the second reader~ an octave down, ever later. msg :d 0.25 into a reader~ glides it nearer."
|
|
383
|
+
:see ["reader~" "writer~" "ring" "sample"]}
|
|
384
|
+
|
|
385
|
+
"writer~"
|
|
386
|
+
{:inlets ["the sound it writes · :rec t / :ovr t · :stop · :keep x" "the ring~'s buffer (its right outlet)" "a position signal (seconds, or 0…1 with norm: a phasor~); without one, where the ring's head is"]
|
|
387
|
+
:messages [["writer~ · writer~ mix · writer~ mix 0.8" "ovr (the default) replaces what is there, silence too, as a tape head; mix adds to it, keeping what was there times 0.8"]
|
|
388
|
+
["a position signal" "it writes there as it goes, at any speed, either way; a jump larger than its jump (0.25 s) is a seek"]
|
|
389
|
+
[":ovr t (msg :ovr 2) · :rec t" "to t, then on at speed 1, replacing; rec erases the ring first"] [":stop" "it stays where it is"]]
|
|
390
|
+
:example (lines "(box :b1 \"adc~\" 40 30)" "(box :b2 \"phasor~ -0.25\" 200 30)" "(box :b3 \"writer~ norm\" 40 90)"
|
|
391
|
+
"(box :b4 \"ring~ 4\" 200 90)" "(box :b5 \"reader~ d 0.5\" 200 150)" "(box :b6 \"gain~ 0.4\" 200 210)" "(box :b7 \"dac~\" 200 270)"
|
|
392
|
+
"(connect :b1 0 :b3 0)" "(connect :b2 0 :b3 2)" "(connect :b4 1 :b3 1)" "(connect :b4 1 :b5 1)"
|
|
393
|
+
"(connect :b5 0 :b6 0)" "(connect :b6 0 :b7 0)" "(connect :b6 0 :b7 1)")
|
|
394
|
+
:try "With headphones, press ▶ and sing: the writer~ goes round the ring backwards (a phasor~ at −0.25 Hz), so the reader~, which goes forwards, plays you reversed, in chunks."
|
|
395
|
+
:see ["ring~" "reader~" "phasor~"]}
|
|
396
|
+
|
|
397
|
+
"sample"
|
|
398
|
+
{:inlets ["the signal to record; :rec starts, :stop ends (or its length in seconds), :clear empties it, a bang asks its length"]
|
|
399
|
+
:outlets ["its length in seconds (after each recording, and on a bang)" "the sound, for a reader~ (on its right inlet)"]
|
|
400
|
+
:messages [[":rec" "records what reaches it, from the beginning"] [":rec t (msg :rec 2.5)" "keeps its first t seconds and records from there"] [":ovr t (msg :ovr 2.5)" "replaces only what the take covers, keeping what comes after (:ovr: from 0)"] [":stop" "keeps what was heard"]
|
|
401
|
+
[":clear" "empties it"] ["a URL (msg https://… · msg :url github:… · a string)" "loads the sound there; every browser that opens the work fetches it"]
|
|
402
|
+
["(load-sound! :bN)" "brings in a sound file"] ["(load-sound! :bN \"https://…\")" "loads it from a URL"]
|
|
403
|
+
["(sample! :bN {:url \"…\"})" "a sample that is only a URL, as a link or a shared session writes it"]
|
|
404
|
+
["github:owner/repo@ref/path.wav" "a file of a public GitHub repository (through jsDelivr: no CORS problem)"]
|
|
405
|
+
["freesound:12345" "a sound of Freesound, with your API key: (freesound-key! \"…\"); (sounds \"kick\") searches; (credits) lists who made them"]
|
|
406
|
+
["(save-sound :bN)" "saves it as WAV"]]
|
|
407
|
+
:example (lines "(box :b1 \"adc~ 1\" 40 30)" "(box :b2 \"msg :rec\" 140 30)" "(box :b3 \"msg :stop\" 200 30)"
|
|
408
|
+
"(box :b4 \"sample 10\" 40 90)" "(box :b5 \"!/ 1\" 40 190)" "(box :b6 \"phasor~\" 40 240)"
|
|
409
|
+
"(box :b7 \"reader~ norm\" 40 290)" "(box :b8 \"gain~ 0.5\" 40 340)" "(box :b9 \"dac~\" 40 390)"
|
|
410
|
+
"(connect :b1 0 :b4 0)" "(connect :b2 0 :b4 0)" "(connect :b3 0 :b4 0)" "(connect :b4 0 :b5 0)"
|
|
411
|
+
"(connect :b5 0 :b6 0)" "(connect :b6 0 :b7 0)" "(connect :b4 1 :b7 1)" "(connect :b7 0 :b8 0)"
|
|
412
|
+
"(connect :b8 0 :b9 0)" "(connect :b8 0 :b9 1)")
|
|
413
|
+
:try "Press ▶, click rec, sing a phrase, click stop: its length becomes the speed of the phasor~ (!/ 1: one over the seconds), and the reader~ plays it in a loop. Use headphones. Change the phasor~ to play it faster, slower or backwards."
|
|
414
|
+
:see ["reader~" "adc~" "phasor~"]}
|
|
415
|
+
|
|
416
|
+
"faust~"
|
|
417
|
+
{:inlets ["audio inputs of process (if any); the left one also takes parameters: [:freq 440]"]
|
|
418
|
+
:outlets ["audio outputs of process"]
|
|
419
|
+
:messages [["(code :bN \"process = …;\")" "writes its source"] ["double-click" "edit the code, beside its patch of Faust's own elements (Patch in the bar hides it); Ctrl+Enter applies"]
|
|
420
|
+
["Recipe (in the window's bar)" "the values of its sliders that sound closest to a sample box or a sound file, written in the code; Ctrl+Enter applies them"]
|
|
421
|
+
["declare options \"[nvoices:8]\"" "polyphonic: Hz on the left, voice ids on the right (a second inlet), as synth~; each id a voice"]
|
|
422
|
+
["[:gain 0.6] · :stop" "polyphonic: the velocity of the next notes · releases every voice"]
|
|
423
|
+
["effect = …;" "polyphonic: applied once to the sum of the voices"]]
|
|
424
|
+
:example (lines "(box :b1 \"faust~\" 40 30)" "(box :b2 \"dac~\" 40 200)" "(connect :b1 0 :b2 0)" "(connect :b1 0 :b2 1)"
|
|
425
|
+
"(code :b1 \"import(\\\"stdfaust.lib\\\");\\nf = hslider(\\\"freq\\\", 220, 50, 2000, 1);\\nprocess = os.sawtooth(f) * 0.1 : fi.lowpass(2, 1200);\")")
|
|
426
|
+
:try "Press ▶. Then change 1200 in the code and apply with Ctrl+Enter: the filter opens."
|
|
427
|
+
:steps [{:title "Polyphonic: a keyboard"
|
|
428
|
+
:note "With declare options \"[nvoices:8]\" the source is a voice: its freq, gain and gate are set note by note by Faust's own allocator, for up to 8 notes at once (the oldest is taken when they run out). Hz on the left and voice ids on the right, as synth~; [:gain v] is the velocity of the next notes."
|
|
429
|
+
:example (lines "(box :b3 \"faust~\" 300 30)" "(code :b3 \"import(\\\"stdfaust.lib\\\");\\ndeclare options \\\"[nvoices:8]\\\";\\nfreq = hslider(\\\"freq\\\", 440, 40, 4000, 0.01);\\ngain = hslider(\\\"gain\\\", 0.8, 0, 1, 0.01);\\ngate = button(\\\"gate\\\");\\ncutoff = hslider(\\\"cutoff\\\", 2400, 200, 8000, 1);\\nprocess = os.sawtooth(freq) * gain * en.adsr(0.01, 0.2, 0.6, 0.6, gate) * 0.12 : fi.lowpass(2, cutoff);\")" "(box :b4 \"keyboard\" 300 210)" "(connect :b4 0 :b3 0)" "(connect :b4 1 :b3 1)" "(connect :b4 3 :b3 0)" "(connect :b3 0 :b2 0)" "(connect :b3 0 :b2 1)")
|
|
430
|
+
:try "Press ▶ and play a chord (⇧-click several keys): every key a voice. Touch lower on the keys to play louder. Its other controls (cutoff) are for every voice."}
|
|
431
|
+
{:title "A score in several voices"
|
|
432
|
+
:note "mt play sends the Hz of the notes sounding and their voice ids: each note of a chord, a voice of the faust~."
|
|
433
|
+
:example (lines "(box :b5 \"tree\" 560 30)" "(code :b5 \"\\\"c4+e4+g4/2 d4+f4+a4/2 b3+d4+g4/2 c4+e4+g4+c5/2\\\"\")" "(box :b6 \"msg :bang\" 560 150)" "(box :b7 \"msg :stop\" 640 150)" "(box :b8 \"mt play loop\" 560 190)" "(connect :b5 0 :b8 0)" "(connect :b6 0 :b8 0)" "(connect :b7 0 :b8 0)" "(connect :b8 0 :b3 0)" "(connect :b8 1 :b3 1)")
|
|
434
|
+
:try "Press ▶ and click msg :bang: the four chords in a loop; msg :stop ends it."}
|
|
435
|
+
{:title "Any tuning"
|
|
436
|
+
:note "The notes reach the voices as MIDI pitches with decimals, so any frequency sounds as written: here a just major triad (4:5:6), then the equal-tempered one."
|
|
437
|
+
:example (lines "(box :b9 \"msg 220 275 330\" 560 260)" "(box :b10 \"msg 220 277.18 329.63\" 700 260)" "(box :b11 \"msg :stop\" 870 260)" "(connect :b9 0 :b3 0)" "(connect :b10 0 :b3 0)" "(connect :b11 0 :b3 0)")
|
|
438
|
+
:try "Press ▶ and click the first two messages in turn: the just third is 14 cents lower, and it does not beat."}
|
|
439
|
+
{:title "An effect for all the voices"
|
|
440
|
+
:note "effect = …; in the same source is applied once, to the sum of the voices (here an echo); its controls are parameters of the box too."
|
|
441
|
+
:example (lines "(code :b3 \"import(\\\"stdfaust.lib\\\");\\ndeclare options \\\"[nvoices:8]\\\";\\nfreq = hslider(\\\"freq\\\", 440, 40, 4000, 0.01);\\ngain = hslider(\\\"gain\\\", 0.8, 0, 1, 0.01);\\ngate = button(\\\"gate\\\");\\ncutoff = hslider(\\\"cutoff\\\", 2400, 200, 8000, 1);\\nprocess = os.sawtooth(freq) * gain * en.adsr(0.01, 0.2, 0.6, 0.6, gate) * 0.12 : fi.lowpass(2, cutoff);\\neffect = ef.echo(1, 0.33, 0.45);\")")
|
|
442
|
+
:try "Press ▶ and play the keyboard again: every note echoes. Change ef.echo(1, 0.33, 0.45) and apply it (Ctrl+Enter)."}]
|
|
443
|
+
:see ["knob" "component" "script"]}
|
|
444
|
+
|
|
445
|
+
"script"
|
|
446
|
+
{:inlets ["what its function receives, by inlet (as many as the first number)"]
|
|
447
|
+
:outlets ["what its function returns in :out (as many as the second number)"]
|
|
448
|
+
:messages [["source" "(fn [m] {:out [[0 (* 2 (:value m))]]})"]]
|
|
449
|
+
:see ["component"]}
|
|
450
|
+
|
|
451
|
+
"component"
|
|
452
|
+
{:doc "Defines a box class inside the work. It has no inlets nor outlets, so it is not drawn in the patch: the Components tab lists the work's definitions and opens them."
|
|
453
|
+
:messages [["source" "a map {:class \"x\" :doc … :io [1 1] :receive (fn [m] …)}: defines the class x in the work"]
|
|
454
|
+
["New component (Components tab) · (new-component!)" "a new definition, from a template, open in the code window"]
|
|
455
|
+
["Edit · × (Components tab)" "its code in the code window · removes it (one event of the history)"]
|
|
456
|
+
["a click on its row" "chooses it: the Claude tab can then change it"]]
|
|
457
|
+
:see ["script" "faust~"]}
|
|
458
|
+
|
|
459
|
+
"patch"
|
|
460
|
+
{:inlets ["one per inlet / inlet~ box inside, left to right"] :outlets ["one per outlet / outlet~ box inside"]
|
|
461
|
+
:messages [["double-click" "opens it (patch @name: opens its line, in its tab)"]
|
|
462
|
+
["patch @name" "uses the line called name (spaces as -): its newest point, so it changes as the line advances; inside it, adc~ and dac~ are quiet (they play when the line plays alone): sound goes in and out through inlet~ / outlet~"]
|
|
463
|
+
["(pin-ref :bN)" "pins a patch @name to the point of its line it reads now · (follow-ref :bN) follows the line again"]
|
|
464
|
+
["(abstract :bN \"name\")" "turns it into a class (an abstraction)"]]
|
|
465
|
+
:see ["inlet" "outlet"]}
|
|
466
|
+
|
|
467
|
+
"inlet" {:outlets ["what arrives at this inlet of the sub-patch"] :see ["patch" "outlet" "inlet~"]}
|
|
468
|
+
"outlet" {:inlets ["what leaves the sub-patch by this outlet"] :see ["patch" "inlet" "outlet~"]}
|
|
469
|
+
"inlet~" {:outlets ["the signal that arrives at this inlet of the sub-patch"] :see ["patch" "outlet~"]}
|
|
470
|
+
"outlet~" {:inlets ["the signal that leaves the sub-patch by this outlet"] :see ["patch" "inlet~"]}
|
|
471
|
+
|
|
472
|
+
"tree"
|
|
473
|
+
{:inlets ["a bang: sends the tree again · [:edit …] (from the edits outlet of a freqt shown as a score): changes it · a tree: replaces it"]
|
|
474
|
+
:outlets ["the tree, expanded (melody strings become notes, [:use …] the fragments it names), whenever it changes"
|
|
475
|
+
"its notes as a buffer (strokes of frequency over time), for the right inlet of a reader~"]
|
|
476
|
+
:messages [["{ } in the header (or a double-click on its right) · (source :bN)" "its text, in the code window (Ctrl+Enter applies): only the nodes that changed go into the history"]
|
|
477
|
+
["(tree! :bN [:voice …])" "writes a tree into it, as edits of the nodes that change"]
|
|
478
|
+
["(tree-edit! :bN [:attrs [0 1 2] {…}])" "edits nodes by their path: [:set p x] [:attrs p {…}] [:insert p x] [:remove p]"]
|
|
479
|
+
["(node-at :bN [0 1])" "the node at a path"]
|
|
480
|
+
["score: how it is shown at first · (view :bN :score)" "the tree drawn as a score, in this box (⇄ roll shows its roll)"]
|
|
481
|
+
["in a score: click a note" "↑ ↓ pitch (⇧ octave) · a…g the nearest note of that name · # another name (c#4 → db4) · + − duration · ← → next · Delete → rest"]
|
|
482
|
+
["{:key \"eb\"} on the tree, a voice or a measure" "the score's key: its signature, accidentals that last the bar; :none writes every accidental"]
|
|
483
|
+
["in a score: click a rest" "Enter → a note (the pitch of the one before) · ↑ ↓ a step above or below it · a…g that note"]
|
|
484
|
+
["(as-tree :bN)" "reads it back as data"]
|
|
485
|
+
["⇄ roll · (view :bN :roll)" "a piano roll: its notes as strokes of frequency over time: drawing, dragging, stretching or erasing there edits the tree (free time; with measures, the bars it touches are quantized again; ⌥ to a free voice)"]
|
|
486
|
+
["(quantize! :bN) · (unquantize! :bN)" "its free time written in measures, and back (one event each)"]
|
|
487
|
+
["(track! :bN)" "its free time played (in seconds, at any tempo): the beats are found and kept in its :quant, so that its score and quantize! write it on them"]]
|
|
488
|
+
:example (lines "(box :b1 \"bang\" 40 20)" "(box :b2 \"tree\" 40 60)"
|
|
489
|
+
"(code :b2 \"[:voice\\n [:measure {:meter [3 4]} \\\"e5/1\\\" [:tuplet {:ratio [3 2]} \\\"d5/.5 c5 b4\\\"] [:note {:pitch \\\"a4\\\" :dur 1 :dyn \\\"p\\\"}]]\\n [:measure \\\"g4/3\\\"]]\")"
|
|
490
|
+
"(box :b3 \"mt transpose 7\" 40 190)" "(box :b4 \"tree\" 40 230)"
|
|
491
|
+
"(connect :b1 0 :b2 0)" "(connect :b2 0 :b3 0)" "(connect :b3 0 :b4 0)")
|
|
492
|
+
:try "The tree box is its own score: click a note and press ↑ (or a…g, + −, Delete), or press { } in its header, change a note in its text and apply it (Ctrl+Enter). It sends its tree whenever it changes: through mt transpose 7 it reaches the second tree box, a fifth higher, which follows. Press ⇄ roll on the tree box to draw notes into it. (A tree that comes into a tree box is written into it, as one event of the history.)"
|
|
493
|
+
:see ["mt" "quantize" "freqt"]}
|
|
494
|
+
|
|
495
|
+
"mt"
|
|
496
|
+
{:inlets ["a tree: it comes out transformed (for play: a tree to play, then bang, :stop)"
|
|
497
|
+
"for transpose, invert, augment, rotate, canon, thin: the amount · for seq, par: the tree to join"]
|
|
498
|
+
:outlets ["the result (for play: the Hz of the notes sounding, a list)"]
|
|
499
|
+
:messages [["mt transpose 7" "seven semitones up"] ["mt invert c4" "mirrored around c4"] ["mt retrograde" "backwards"]
|
|
500
|
+
["mt augment 2" "twice as long"] ["mt rotate 1" "the first element goes to the end"] ["mt canon 2 7" "against itself, 2 beats later, a fifth up"]
|
|
501
|
+
["mt canon d 2 k P5 speed 0.5" "the same with the words of a reader on a ring: d beats later, k away (semitones or an interval), the comes at a speed — 0.5 twice as slow (an augmentation canon), −1 backwards (a crab) —, and inversion upside down"]
|
|
502
|
+
["mt thin 0.5" "keeps half the notes of each measure, the ones on its strongest positions (metric weight)"]
|
|
503
|
+
["mt seq · mt par" "the left tree followed by (or with) the right one"] ["mt events · mt pitches · mt duration" "the tree as data"]
|
|
504
|
+
["mt play [loop]" "plays it: Hz (0) and voice ids (1) for synth~, parameters (2), dynamics and texts (3)"]
|
|
505
|
+
["mt play speed 0.5 · msg :speed -1" "at a speed: twice as slow, or the tree backwards — the reader of a tree on its own clock (a reader moved by positions reads the tree box instead: what sounds where it is)"]]
|
|
506
|
+
:example (lines "(box :b1 \"bang\" 40 20)" "(box :b2 \"tree\" 40 60)" "(code :b2 \"\\\"c4/1 d4/.5 e4 g4/1 e4 f4/.5 e4 d4/2\\\"\")"
|
|
507
|
+
"(box :b4 \"number 7\" 220 170)" "(box :b3 \"mt transpose 7\" 40 170)" "(box :b5 \"tree\" 40 220)"
|
|
508
|
+
"(connect :b1 0 :b2 0)" "(connect :b2 0 :b3 0)" "(connect :b4 0 :b3 1)" "(connect :b3 0 :b5 0)")
|
|
509
|
+
:try "Change the box text to mt retrograde, mt invert c4 or mt augment 2: the score follows. (The number on the right inlet takes effect with the next tree: click the bang.)"
|
|
510
|
+
:steps [{:title "Two voices: a canon"
|
|
511
|
+
:note "mt canon d i puts the tree against itself, d beats later and i semitones away: two voices that the score shows as two staves."
|
|
512
|
+
:example (lines "(text! :b3 \"mt canon 2 7\")" "(delete :b4)")
|
|
513
|
+
:try "Click the bang. Change it to mt canon 1 -12 (an octave below, one beat later) or mt canon 4 0."}
|
|
514
|
+
{:title "Playing it"
|
|
515
|
+
:note "mt play reads a tree in time: the Hz of the notes that sound (left) and their voice ids (second) go to a synth~, which gives each voice its own note."
|
|
516
|
+
:example (lines "(box :b6 \"msg :bang\" 500 170)" "(box :b7 \"msg :stop\" 570 170)" "(box :b8 \"mt play loop\" 500 220)"
|
|
517
|
+
"(box :b9 \"synth~\" 500 270)" "(box :b10 \"gain~ 0.3\" 500 320)" "(box :b11 \"dac~\" 500 370)"
|
|
518
|
+
"(connect :b3 0 :b8 0)" "(connect :b6 0 :b8 0)" "(connect :b7 0 :b8 0)" "(connect :b8 0 :b9 0)" "(connect :b8 1 :b9 1)"
|
|
519
|
+
"(connect :b9 0 :b10 0)" "(connect :b10 0 :b11 0)" "(connect :b10 0 :b11 1)")
|
|
520
|
+
:try "Press ▶, click the first bang (the tree goes to mt play) and then msg :bang: the canon sounds in a loop; :stop ends it."}]
|
|
521
|
+
:see ["tree" "freqt" "synth~"]}
|
|
522
|
+
|
|
523
|
+
;; ───── official packages (until they carry their own :help) ─────
|
|
524
|
+
"features~"
|
|
525
|
+
{:package "@kairotic/analysis" :usage "features~ [ms] [descriptor …]"
|
|
526
|
+
:doc "Descriptors of a signal every ms, one outlet per word: rms, energy, zcr, loudness, centroid, spread, flatness, rolloff, kurtosis, skewness, slope, crest, sharpness, perceptualSpread, mfcc, chroma (Meyda)."
|
|
527
|
+
:inlets ["the signal"]
|
|
528
|
+
:outlets ["one outlet per descriptor written, in order (rms centroid flatness without words); centroid, spread and rolloff in Hz"]
|
|
529
|
+
:example (lines "(box :b1 \"adc~ 1\" 40 30)" "(box :b2 \"features~ 50 rms centroid\" 40 90)"
|
|
530
|
+
"(box :b3 \"number\" 40 150)" "(box :b4 \"number\" 200 150)"
|
|
531
|
+
"(connect :b1 0 :b2 0)" "(connect :b2 0 :b3 0)" "(connect :b2 1 :b4 0)")
|
|
532
|
+
:try "Press ▶ and allow the microphone: whisper and then hum — the centroid (brightness) falls."
|
|
533
|
+
:see ["pitch~" "chroma~" "snapshot~"]}
|
|
534
|
+
|
|
535
|
+
"pitch~"
|
|
536
|
+
{:package "@kairotic/analysis" :usage "pitch~ [lo hi] [threshold]"
|
|
537
|
+
:doc "The pitch of a signal by YIN: Hz on the left (0 once when it stops hearing one), how clearly periodic on the right."
|
|
538
|
+
:inlets ["the signal"]
|
|
539
|
+
:outlets ["the frequency in Hz, only when it changes; 0 once when it no longer finds one" "the clarity, 0…1"]
|
|
540
|
+
:example (lines "(box :b1 \"adc~ 1\" 40 30)" "(box :b2 \"pitch~ 80 1000\" 40 90)" "(box :b3 \"ftom\" 40 150)"
|
|
541
|
+
"(box :b4 \"number\" 40 200)" "(connect :b1 0 :b2 0)" "(connect :b2 0 :b3 0)" "(connect :b3 0 :b4 0)")
|
|
542
|
+
:try "Press ▶ and sing: the box shows the note and its cents, the number the MIDI pitch."
|
|
543
|
+
:see ["onset~" "ftom" "freqt"]}
|
|
544
|
+
|
|
545
|
+
"onset~"
|
|
546
|
+
{:package "@kairotic/analysis" :usage "onset~ [threshold] [ms]"
|
|
547
|
+
:doc "A bang at the beginning of each sound (a note, a stroke, a syllable), and its strength."
|
|
548
|
+
:inlets ["the signal; [:threshold x] and [:ms y] change them while it listens; a [:segment …] from form~ forgets the usual change of the section before"]
|
|
549
|
+
:outlets ["a bang for each onset" "its strength (the growth of the spectrum, 0…1)" "the growth of every frame (the onset strength envelope)"]
|
|
550
|
+
:example (lines "(box :b1 \"adc~ 1\" 40 30)" "(box :b2 \"onset~\" 40 90)" "(box :b3 \"counter 1\" 40 150)"
|
|
551
|
+
"(box :b4 \"number\" 40 200)" "(connect :b1 0 :b2 0)" "(connect :b2 0 :b3 0)" "(connect :b3 0 :b4 0)")
|
|
552
|
+
:try "Press ▶ and clap: the counter counts the claps. Raise the threshold if it counts too much."
|
|
553
|
+
:see ["pitch~" "sample" "counter" "form~"]}
|
|
554
|
+
|
|
555
|
+
"chroma~"
|
|
556
|
+
{:package "@kairotic/analysis" :usage "chroma~ [ms]"
|
|
557
|
+
:doc "How much of each pitch class a signal has: 12 values from C to B, and the strongest class as a word."
|
|
558
|
+
:inlets ["the signal"]
|
|
559
|
+
:outlets ["12 values, C to B, 0…1 (the strongest 1)" "the strongest pitch class (:c … :b), when it changes"]
|
|
560
|
+
:example (lines "(box :b1 \"adc~ 1\" 40 30)" "(box :b2 \"chroma~\" 40 90)" "(box :b3 \"print\" 40 170)"
|
|
561
|
+
"(connect :b1 0 :b2 0)" "(connect :b2 1 :b3 0)")
|
|
562
|
+
:try "Press ▶ and play a chord or a drone: the bars show its pitch classes; print writes the strongest."
|
|
563
|
+
:see ["pitch~" "mt" "features~"]}
|
|
564
|
+
|
|
565
|
+
"quantize"
|
|
566
|
+
{:about "**Free time written in measures, when you ask.** What `transcribe` or a drawing left in a `freqt` — notes placed anywhere in time — becomes a measured tree: measures, tuplets, ties, grace notes, voices, ready for a `tree` box, `mt` and the rest.
|
|
567
|
+
|
|
568
|
+
**Only a bang sends.** The options can be tried first, one message at a time, and nothing goes out until you bang it: a tree written into a tree box is an event of the work's history.
|
|
569
|
+
|
|
570
|
+
**Two ways in.** A `freqt` on the right inlet (its second outlet: the buffer), or a tree on the left — in free time, or measured (it is made free first, to be written again another way). Two `quantize` boxes can write the same take two ways."
|
|
571
|
+
:inlets ["a bang: quantize and send · a tree (free or measured): the material, until the next one · [:meter \"6/8\"] and the other options, or a map of them · [:meter nil] forgets one · :reset forgets all · :clear forgets the tree"
|
|
572
|
+
"a freqt (from its second outlet): the material, read at the bang"]
|
|
573
|
+
:outlets ["the measured tree, for a tree box" "what it found: {:bars :meter :tempo :notes :voices}"]
|
|
574
|
+
:messages [[":bang" "quantize the material and send the tree"]
|
|
575
|
+
["[:meter \"3/4\"]" "the meter (\"6/8\", \"7/8[2+2+3]\" for its groups); without one, the freqt's bar grid, or 4/4"]
|
|
576
|
+
["[:meters [\"3/4\" \"5/8\"]]" "a meter for each bar, the last one going on"]
|
|
577
|
+
["[:divs [1 2 3 4]]" "the divisions a beat may take (1 to 8 by default: 3, 5, 7 are tuplets)"]
|
|
578
|
+
["[:merge []]" "no two beats joined into one tuplet ([3 5 6] by default)"]
|
|
579
|
+
["[:legato 0.25]" "the largest gap before the next note that is not a rest, in beats (0: every gap is a rest)"]
|
|
580
|
+
["[:chord 0.04]" "starts this close (beats) are one chord"]
|
|
581
|
+
["[:voices 1]" "how many voices overlapping notes may take (2 by default)"]
|
|
582
|
+
["[:grace false]" "no grace notes: a note too short for any point is dropped"]
|
|
583
|
+
["[:key \"eb\"]" "the key it is written in: its signature and its spelling"]
|
|
584
|
+
["[:tempo 72]" "the tempo written in the tree"]
|
|
585
|
+
["[:time :track]" "what was played freely (with rubato, at any tempo): its beats are found first (also: quantize track)"]
|
|
586
|
+
["{:meter \"6/8\" :divs [1 2 3]}" "several options at once"]
|
|
587
|
+
[":reset" "the options forgotten (the defaults again)"]]
|
|
588
|
+
:example (lines "(box :b1 \"freqt\" 40 60)" "(resize :b1 420 200)"
|
|
589
|
+
"(melody :b1 \"c4/1.06 e4/.47 d4/.55 g4/.94 e4/1.03 f4/.32 e4/.36 d4/.3 c4/2.1\" 0)"
|
|
590
|
+
"(box :b2 \"msg :bang\" 520 30)" "(box :b6 \"msg :meter \\\"3/4\\\"\" 600 30)" "(box :b7 \"msg :meter nil\" 740 30)"
|
|
591
|
+
"(box :b3 \"quantize\" 520 90)" "(box :b4 \"tree\" 520 160)" "(resize :b4 460 160)" "(box :b5 \"print\" 760 90)"
|
|
592
|
+
"(connect :b1 1 :b3 1)" "(connect :b2 0 :b3 0)" "(connect :b6 0 :b3 0)" "(connect :b7 0 :b3 0)"
|
|
593
|
+
"(connect :b3 0 :b4 0)" "(connect :b3 1 :b5 0)")
|
|
594
|
+
:try "The freqt holds a phrase played freely — the durations are not quite 1, ½ or ⅓. Click :bang: quantize writes it in measures of 4/4 and the tree box shows the score. Click :meter \"3/4\" and :bang again: the same notes, in 3/4. Change a stroke in the freqt (drag it) and bang: the score follows only when you ask."
|
|
595
|
+
:steps [{:title "From your voice"
|
|
596
|
+
:note "transcribe writes what pitch~ hears into the freqt, as strokes in free time; quantize writes them in measures. With :time :track (or quantize track) it first finds the beats of what you sang freely."
|
|
597
|
+
:example (lines "(box :b8 \"adc~ 1\" 40 330)" "(box :b9 \"pitch~ 80 1000\" 40 390)" "(box :b10 \"onset~\" 200 390)"
|
|
598
|
+
"(box :b11 \"msg :rec\" 300 330)" "(box :b12 \"msg :stop\" 380 330)" "(box :b13 \"transcribe 60\" 40 450)"
|
|
599
|
+
"(box :b14 \"msg :time :track\" 880 30)"
|
|
600
|
+
"(connect :b8 0 :b9 0)" "(connect :b8 0 :b10 0)" "(connect :b9 0 :b13 0)" "(connect :b10 0 :b13 1)"
|
|
601
|
+
"(connect :b11 0 :b13 0)" "(connect :b12 0 :b13 0)" "(connect :b13 0 :b1 0)" "(connect :b14 0 :b3 0)")
|
|
602
|
+
:try "Press ▶, click :rec, sing a phrase, click :stop: the freqt holds it. Click :time :track, then :bang: your phrase, in measures."}]
|
|
603
|
+
:see ["transcribe" "freqt" "tree" "mt"]}
|
|
604
|
+
|
|
605
|
+
"transcribe"
|
|
606
|
+
{:package "@kairotic/analysis" :usage "transcribe [bpm] [notes|glide] [ms]"
|
|
607
|
+
:doc "Writes what pitch~ hears into a freqt, as strokes: notes where the contour settles on another pitch (slides, vibrato and ornaments do not start notes), or contours (glide)."
|
|
608
|
+
:inlets ["Hz from pitch~ (0: silence); :rec starts from 0, :stop ends" "a bang (from onset~): a new note, even on the same pitch"]
|
|
609
|
+
:outlets ["edits for a freqt: [:batch [[:stroke …] …]], at most every 2 seconds (one event of the history each)"]
|
|
610
|
+
:messages [[":rec" "starts a take from 0 (its first write clears the freqt)"] [":rec t (msg :rec 8)" "from beat t: what is before t stays, what is after is replaced"] [":ovr t (msg :ovr 8)" "from beat t, over only what the take covers: what comes after it stays"] [":stop" "writes what is left and stops"]]
|
|
611
|
+
:example (lines "(box :b1 \"adc~ 1\" 40 30)" "(box :b2 \"pitch~ 80 1000\" 40 90)" "(box :b3 \"onset~\" 200 90)"
|
|
612
|
+
"(box :b4 \"msg :rec\" 330 90)" "(box :b5 \"msg :stop\" 400 90)" "(box :b6 \"transcribe 60\" 40 160)"
|
|
613
|
+
"(box :b7 \"freqt\" 40 220)"
|
|
614
|
+
"(connect :b1 0 :b2 0)" "(connect :b1 0 :b3 0)" "(connect :b2 0 :b6 0)" "(connect :b3 0 :b6 1)"
|
|
615
|
+
"(connect :b4 0 :b6 0)" "(connect :b5 0 :b6 0)" "(connect :b6 0 :b7 0)")
|
|
616
|
+
:try "Press ▶, click :rec, sing a phrase, click :stop: the freqt holds it (⇄ previews it as a score). To write it in measures, as a tree, connect the freqt's second outlet to a quantize box and bang it. Write transcribe 60 glide to keep the slides."
|
|
617
|
+
:see ["pitch~" "onset~" "freqt" "quantize"]}
|
|
618
|
+
|
|
619
|
+
"spectrum~"
|
|
620
|
+
{:package "@kairotic/analysis" :usage "spectrum~ [lo hi]"
|
|
621
|
+
:doc "The spectrum of a signal drawn in the patch, on a log scale of frequency (dB from -90 to 0)."
|
|
622
|
+
:inlets ["the signal"]
|
|
623
|
+
:example (lines "(box :b1 \"osc~ 220\" 40 30)" "(box :b2 \"spectrum~\" 40 90)" "(connect :b1 0 :b2 0)")
|
|
624
|
+
:try "Press ▶: one peak at 220 Hz. Connect an adc~ instead and sing a vowel: its partials and formants."
|
|
625
|
+
:see ["scope~" "features~"]}
|
|
626
|
+
|
|
627
|
+
"monitor"
|
|
628
|
+
{:package "@kairotic/analysis" :usage "monitor [seconds] [name …]"
|
|
629
|
+
:doc "Draws the messages that arrive over the last seconds, one lane per inlet: a number as a line, a list as a strip of cells, a bang or a word as a mark."
|
|
630
|
+
:inlets ["anything, drawn in the first lane; with names (monitor 6 rms centroid chroma) one inlet per name, left to right"]
|
|
631
|
+
:example (lines "(box :b1 \"adc~ 1\" 40 30)" "(box :b2 \"features~ 20 rms centroid\" 40 90)" "(box :b3 \"chroma~\" 260 90)"
|
|
632
|
+
"(box :b4 \"onset~\" 460 90)" "(box :b5 \"monitor 6 rms centroid chroma onset\" 40 180)"
|
|
633
|
+
"(connect :b1 0 :b2 0)" "(connect :b1 0 :b3 0)" "(connect :b1 0 :b4 0)"
|
|
634
|
+
"(connect :b2 0 :b5 0)" "(connect :b2 1 :b5 1)" "(connect :b3 0 :b5 2)" "(connect :b4 0 :b5 3)")
|
|
635
|
+
:try "Press ▶ and allow the microphone: speak, then sing a long note — the centroid falls, the chroma strip settles on one row, each syllable leaves a mark."
|
|
636
|
+
:see ["features~" "chroma~" "onset~" "print"]}
|
|
637
|
+
|
|
638
|
+
"realize~"
|
|
639
|
+
{:package "@kairotic/analysis" :usage "realize~ [settings] [midi]"
|
|
640
|
+
:doc "Plays a faust~ from descriptors written as a score — loudness, brightness, noisiness, pitch — or from what features~ and pitch~ hear in another sound: its pitch (or freq) and gain sliders follow them, and its other sliders take the settings of that faust~ that sound nearest (Study 37)."
|
|
641
|
+
:inlets ["loudness: dB, or a level 0…1 (features~ rms)" "brightness: Hz (features~ centroid)" "noisiness: 0…1 (features~ flatness)" "pitch: Hz (pitch~; 0 for none), MIDI with realize~ midi" "loudness heard in what it plays (features~ of the faust~: rms)" "brightness heard (centroid)" "noisiness heard (flatness): with these three it corrects itself"]
|
|
642
|
+
:outlets ["[:slider value] for the faust~ it plays: connect it to the faust~'s left inlet" "how far the nearest setting is from what is written (above 1: the faust~ cannot sound like that)"]
|
|
643
|
+
:messages [[":learn" "plays steady settings of the faust~ offline and listens to them (300, or the number written): after changing its code"]]
|
|
644
|
+
:example (lines "(box :b1 \"adc~ 1\" 40 30)" "(box :b2 \"features~ 20\" 40 90)" "(box :b3 \"pitch~\" 260 90)"
|
|
645
|
+
"(box :b4 \"realize~\" 40 160)" "(box :b5 \"faust~\" 40 240)" "(box :b6 \"dac~\" 40 430)" "(box :b7 \"msg :learn\" 300 160)"
|
|
646
|
+
"(connect :b1 0 :b2 0)" "(connect :b1 0 :b3 0)" "(connect :b2 0 :b4 0)" "(connect :b2 1 :b4 1)" "(connect :b2 2 :b4 2)"
|
|
647
|
+
"(connect :b3 0 :b4 3)" "(connect :b7 0 :b4 0)" "(connect :b4 0 :b5 0)" "(connect :b5 0 :b6 0)" "(connect :b5 0 :b6 1)"
|
|
648
|
+
"(code :b5 \"import(\\\"stdfaust.lib\\\");\\npitch = hslider(\\\"pitch\\\", 60, 36, 84, 0.01) : si.smoo;\\ngain = hslider(\\\"gain [unit:dB]\\\", -12, -80, 6, 0.1) : ba.db2linear : si.smoo;\\nwave = hslider(\\\"wave\\\", 0.5, 0, 1, 0.001) : si.smoo;\\nnoise = hslider(\\\"noise\\\", 0.1, 0, 1, 0.001) : si.smoo;\\ncutoff = hslider(\\\"cutoff [scale:log]\\\", 1000, 60, 14000, 1) : si.smoo;\\nresonance = hslider(\\\"resonance [scale:log]\\\", 1, 0.5, 8, 0.01) : si.smoo;\\nf0 = ba.midikey2hz(pitch);\\nosc = os.sawtooth(f0) * (1 - wave) + os.square(f0) * wave;\\nprocess = osc * (1 - noise) + no.noise * noise : fi.svf.lp(min(cutoff, 0.45 * ma.SR), resonance) * gain;\")")
|
|
649
|
+
:try "Press ▶ and allow the microphone (headphones): sing, whisper, hum — the synth follows your loudness, brightness, noisiness and pitch with its own sound. Then let it listen: a features~ 20 on the faust~, its three outlets into the last three inlets of realize~ — it corrects what it asks where it falls short. Draw instead: four canvases read by reader~ and snapshot~ are a score for it."
|
|
650
|
+
:see ["features~" "pitch~" "faust~" "monitor"]}
|
|
651
|
+
|
|
652
|
+
"form~"
|
|
653
|
+
{:package "@kairotic/analysis" :usage "form~ [seconds] [step] [kernel]"
|
|
654
|
+
:doc "How alike the moments of what arrives are over the last seconds (20): a self-similarity matrix of one frame every step seconds (0.25), drawn; where a segment begins, and the period that repeats."
|
|
655
|
+
:inlets ["lists of numbers (a chroma~, an mfcc), or numbers (onset~'s envelope, an rms); [:seconds x] [:step x] [:kernel x] change them; :clear forgets"]
|
|
656
|
+
:outlets ["the novelty of each frame, 0…1 (how much the music changes there; kernel seconds (2) late)" "a bang where a segment begins" "the period that repeats most, in seconds, when it changes" "[:segment {:t :at :length :period}] for the segment that ends"]
|
|
657
|
+
:example (lines "(box :b1 \"adc~ 1\" 40 30)" "(box :b2 \"chroma~\" 40 90)" "(box :b3 \"onset~\" 240 90)"
|
|
658
|
+
"(box :b4 \"form~\" 40 170)" "(box :b5 \"print\" 280 300)"
|
|
659
|
+
"(connect :b1 0 :b2 0)" "(connect :b1 0 :b3 0)" "(connect :b2 0 :b4 0)" "(connect :b4 3 :b3 0)" "(connect :b4 3 :b5 0)")
|
|
660
|
+
:try "Press ▶ and play a section, then another (other chords, another register): the squares along the diagonal are the sections, a line marks where the second begins, print writes the segment, and onset~ starts the new section afresh."
|
|
661
|
+
:see ["chroma~" "onset~" "monitor"]}
|
|
662
|
+
|
|
663
|
+
"fetch"
|
|
664
|
+
{:package "@kairotic/data" :usage "fetch [json|text|edn] [live]"
|
|
665
|
+
:doc "Brings in what is at a URL (JSON read as EDN, text or EDN) as a task: it goes out on the left and is kept as the data of the box, in the history, the same for everyone; with live, only in this tab."
|
|
666
|
+
:inlets ["a URL (msg https://… · github:owner/repo@ref/path · [:fetch url]); refresh; bang; [:get key …]; clear"]
|
|
667
|
+
:outlets ["what it found (or the part a [:get …] asks for)" ":loading, :ready or [:error \"…\"]"]
|
|
668
|
+
:messages [["a URL" "brings it in; a URL it already keeps is sent again, not fetched"]
|
|
669
|
+
[":refresh" "fetches its URL again"] ["bang" "sends what it holds"]
|
|
670
|
+
[":get :items 0 :name · [:get [:items 0 :name]]" "sends one part of it"] [":clear" "forgets it"]
|
|
671
|
+
["(keep! :bN {:url \"…\" :value …})" "what it keeps, as the code of the work writes it"]]
|
|
672
|
+
:example (lines "(box :b1 \"msg github:bonuoq/kairotic@main/packages/data/package.json\" 40 30)" "(box :b2 \"fetch\" 40 80)"
|
|
673
|
+
"(box :b3 \"edn 340 260\" 40 150)" "(box :b4 \"print\" 400 150)"
|
|
674
|
+
"(connect :b1 0 :b2 0)" "(connect :b2 0 :b3 0)" "(connect :b3 0 :b4 0)")
|
|
675
|
+
:try "Click the message: the answer arrives in the edn box, and stays in the work (go back and forward in the history: it is not fetched again). Pick a line: its value goes to print."
|
|
676
|
+
:see ["edn" "sample" "print"]}
|
|
677
|
+
|
|
678
|
+
"edn"
|
|
679
|
+
{:package "@kairotic/data" :usage "edn [width height]"
|
|
680
|
+
:doc "Any value as a tree, like Portal: collections open and close, values coloured by kind; picking a line sends that part (left) and its path (right)."
|
|
681
|
+
:inlets ["any value; :depth n opens it n levels down; bang sends the part picked again; :clear"]
|
|
682
|
+
:outlets ["the part picked" "its path, for [:get …] of a fetch box"]
|
|
683
|
+
:messages [[":depth 2" "opens it two levels down"] ["bang" "the part picked again (the whole value if none)"] [":clear" "empties it"]
|
|
684
|
+
["▸ ▾ · a line · a drag" "opens or closes · picks it · scrolls (also the bar on the right)"]]
|
|
685
|
+
:example (lines "(box :b1 \"tree\" 40 30)" "(tree! :b1 [:voice [:measure {:meter [4 4]} \"c4/1 e4 g4 c5\"]])"
|
|
686
|
+
"(box :b2 \"edn 320 220\" 40 130)" "(box :b3 \"print\" 400 130)" "(connect :b1 0 :b2 0)" "(connect :b2 0 :b3 0)" "(connect :b2 1 :b3 0)")
|
|
687
|
+
:try "The tree arrives: open the measure and pick a note: the note and its path go to print."
|
|
688
|
+
:see ["fetch" "print" "tree"]}
|
|
689
|
+
|
|
690
|
+
"pbind"
|
|
691
|
+
{:package "@kairotic/patterns" :usage "pbind [seed] [repeat] [loop]"
|
|
692
|
+
:doc "A pattern as EDN data: a map of constants, sequences and #pat/… generators, with its randomness seeded. It sends its pattern whenever it changes, for a player."
|
|
693
|
+
:inlets ["bang: sends its pattern again · a map: replaces it (one event of the history) · [:set :dur [1 0.5]]: one key · [:unset :amp]"]
|
|
694
|
+
:outlets ["its pattern (a factory of streams), for a player"]
|
|
695
|
+
:messages [["{:degree [0 2 4] :dur 0.5}" "a key with a vector is a sequence; the shorter ones start again until the longest ends"]
|
|
696
|
+
["#pat/choose [0.25 0.5] · #pat/white [0 7] · #pat/walk [0 2 -7 7]" "endless random values (the same for everyone: the seed)"]
|
|
697
|
+
["#pat/shuffle [0 2 4] · #pat/series [0 2 8]" "every pass in a new order · an arithmetic series"]
|
|
698
|
+
["#pat/hold [4 [:c :g :d]]" "one value every 4 beats (following time, not events)"]
|
|
699
|
+
["#pat/chord [0 4 7]" "a vector as one value: a chord"]
|
|
700
|
+
["{:degree [0 2 :rest 4]} · [0 nil 4]" "a silence: :rest (:_ :- :r) or nil as the degree, note or freq"]
|
|
701
|
+
[":amp #pat/white [0.2 0.6]" "the loudness of each note (0…1), for synth~ and a polyphonic faust~"]
|
|
702
|
+
["pbind 7 · pbind 7 4 · pbind 7 loop" "the seed · four passes · for ever"]]
|
|
703
|
+
:example (lines "(box :b1 \"pbind 7 loop\" 40 30)"
|
|
704
|
+
"(code :b1 \"{:degree #pat/shuffle [0 2 4 7]\\n :dur [0.5 0.5 1]\\n :amp #pat/white [0.1 0.3]}\")"
|
|
705
|
+
"(box :b2 \"msg :start\" 40 130)" "(box :b3 \"msg :stop\" 110 130)" "(box :b4 \"player 110\" 40 180)"
|
|
706
|
+
"(box :b5 \"synth~\" 40 240)" "(box :b6 \"dac~\" 40 290)"
|
|
707
|
+
"(connect :b2 0 :b4 0)" "(connect :b3 0 :b4 0)" "(connect :b1 0 :b4 1)"
|
|
708
|
+
"(connect :b4 0 :b5 0)" "(connect :b4 1 :b5 1)" "(connect :b5 0 :b6 0)" "(connect :b5 0 :b6 1)")
|
|
709
|
+
:try "Press ▶ and start: four notes in a new order every pass. Change :dur in the pbind (double-click it) and apply: the player goes on with it from the same beat. Change the seed (pbind 8 loop): other orders, but the same for everyone in a room."
|
|
710
|
+
:steps [{:title "One value per bar"
|
|
711
|
+
:note "#pat/hold follows time: the root changes every 4 beats whatever the rhythm, as Overtone's ^{:dur 4} does."
|
|
712
|
+
:example (lines "(code :b1 \"{:degree #pat/shuffle [0 2 4 7]\\n :dur [0.5 0.5 1]\\n :root #pat/hold [4 [:c :f :g :c]]}\")")
|
|
713
|
+
:try "Press start: the same figure, moving through four harmonies."}
|
|
714
|
+
{:title "Random, but the same"
|
|
715
|
+
:note "Every key has a seed of its own (the box's seed and its name): changing one key leaves the randomness of the others as it was."
|
|
716
|
+
:example (lines "(code :b1 \"{:degree #pat/walk [0 1 -4 9]\\n :dur #pat/choose [0.25 0.25 0.5]\\n :scale :dorian}\")")
|
|
717
|
+
:try "Start, stop and start again: the same walk. Change :scale to :lydian: the same rhythm and contour, other notes."}]
|
|
718
|
+
:see ["pattern" "player" "tree"]}
|
|
719
|
+
|
|
720
|
+
"pattern"
|
|
721
|
+
{:package "@kairotic/patterns" :usage "pattern [seed] [repeat] [loop]"
|
|
722
|
+
:doc "A pattern as Clojure code: an expression that returns event maps (or one map, read as a pbind), with seeded randomness and pbind, pseq, pwhite, pchoose, pshuffle, pseries, pwalk at hand. In a shared room it runs only after (trust-scripts true)."
|
|
723
|
+
:inlets ["bang: sends its pattern again"]
|
|
724
|
+
:outlets ["its pattern (a factory of streams), for a player"]
|
|
725
|
+
:messages [["(pbind {:degree (pwhite 0 7) :dur 0.25} :inf)" "a pbind whose values are lazy sequences"]
|
|
726
|
+
["(concat (pbind m1) (pbind m2))" "phrases one after another"]
|
|
727
|
+
["(for [d (range 8)] {:degree d :dur (if (even? d) 0.5 0.25)})" "any Clojure that gives event maps"]
|
|
728
|
+
["rand · rand-int · rand-nth · shuffle" "seeded by the box: the same for everyone"]]
|
|
729
|
+
:example (lines "(box :b1 \"pattern 3\" 40 30)"
|
|
730
|
+
"(code :b1 \"(pbind {:degree (pwhite 0 7)\\n :dur (pchoose [0.25 0.25 0.5])\\n :octave [5 5 6]}\\n :inf)\")"
|
|
731
|
+
"(box :b2 \"msg :start\" 40 130)" "(box :b3 \"msg :stop\" 110 130)" "(box :b4 \"player 120\" 40 180)"
|
|
732
|
+
"(box :b5 \"synth~\" 40 240)" "(box :b6 \"dac~\" 40 290)"
|
|
733
|
+
"(connect :b2 0 :b4 0)" "(connect :b3 0 :b4 0)" "(connect :b1 0 :b4 1)"
|
|
734
|
+
"(connect :b4 0 :b5 0)" "(connect :b4 1 :b5 1)" "(connect :b5 0 :b6 0)" "(connect :b5 0 :b6 1)")
|
|
735
|
+
:try "Press ▶ and start. Edit the code (double-click the box) and apply: the player follows the new pattern from the beat it is on."
|
|
736
|
+
:see ["pbind" "player" "script"]}
|
|
737
|
+
|
|
738
|
+
"player"
|
|
739
|
+
{:package "@kairotic/patterns" :usage "player [bpm] [quant] [jump] [limit] [edges] [spread]"
|
|
740
|
+
:doc "Plays a pattern by its own clock (start/stop), one step at a time (bang) or at a position in beats (a number): the Hz and voice ids of the notes sounding, the whole event and the beat."
|
|
741
|
+
:inlets [":start · :stop: its own clock · bang: one step, now · a number: a position in beats · :seek p · :reset · [:bpm 90]"
|
|
742
|
+
"a pattern (from a pbind or a pattern box): a new one goes on from the same beat"]
|
|
743
|
+
:outlets ["the Hz of the notes sounding (a list), after [:gain amp] when the event has :amp" "their voice ids, sent first (for synth~ or a polyphonic faust~)"
|
|
744
|
+
"the whole event, with :beat, :hz and :ids (and :dir :back when entered from its end)" "the beat"]
|
|
745
|
+
:messages [[":start · :stop" "its own clock: every event lasts its :dur in beats at its bpm"]
|
|
746
|
+
["player 120 4" "start on a multiple of 4 beats: players with the same tempo meet"]
|
|
747
|
+
["[:bpm 90]" "another tempo, without a jump"]
|
|
748
|
+
["bang" "the next event now (and the ones of :dur 0 right after it)"]
|
|
749
|
+
["a number" "a position in beats: every event is a span, from its onset to its end, that sounds while the position is inside it — entered at its onset going forwards, at its end going backwards (:dir :back); what a step passes over sounds within it"]
|
|
750
|
+
[":seek 8 · [:seek 8]" "there at once, nothing in between: what still sounds there goes on, what starts to contain that position starts"]
|
|
751
|
+
["player 120 0 8 8" "a step more than 8 (jump) times the one before it, or longer than 8 (limit) beats, is a seek: the wrap of a ramp"]
|
|
752
|
+
["player 120 0 8 8 edges" "a seek sounds only what starts exactly there"]
|
|
753
|
+
["player 120 0 8 8 spread" "what a step passes keeps its rhythm, one step later (with ▶)"]
|
|
754
|
+
[":reset" "back to the beginning, silently"]]
|
|
755
|
+
:example (lines "(box :b1 \"pbind 1 loop\" 40 30)"
|
|
756
|
+
"(code :b1 \"{:note [:c4 :e4 :g4 :b4 :a4 :f4]\\n :dur [0.5 0.5 1]}\")"
|
|
757
|
+
"(box :b2 \"msg :start\" 40 130)" "(box :b3 \"msg :stop\" 110 130)" "(box :b4 \"player 100\" 40 180)"
|
|
758
|
+
"(box :b5 \"synth~\" 40 240)" "(box :b6 \"dac~\" 40 290)" "(box :b7 \"get % :beat\" 260 240)" "(box :b8 \"print\" 260 290)"
|
|
759
|
+
"(connect :b2 0 :b4 0)" "(connect :b3 0 :b4 0)" "(connect :b1 0 :b4 1)"
|
|
760
|
+
"(connect :b4 0 :b5 0)" "(connect :b4 1 :b5 1)" "(connect :b5 0 :b6 0)" "(connect :b5 0 :b6 1)"
|
|
761
|
+
"(connect :b4 2 :b7 0)" "(connect :b7 0 :b8 0)")
|
|
762
|
+
:try "Press ▶ and start: the six notes, three durations cycling. The third outlet is the whole event: print writes the beat of each."
|
|
763
|
+
:steps [{:title "Step by step"
|
|
764
|
+
:note "A bang plays the next event now: the pattern follows whatever moves it — a metro, an onset~ of what someone plays, a key."
|
|
765
|
+
:example (lines "(box :b9 \"metro 300\" 180 130)" "(box :b10 \"msg 1\" 180 100)" "(box :b11 \"msg 0\" 230 100)"
|
|
766
|
+
"(connect :b10 0 :b9 0)" "(connect :b11 0 :b9 0)" "(connect :b9 0 :b4 0)")
|
|
767
|
+
:try "Stop the clock and click 1: one note every 300 ms, whatever its :dur. Connect an onset~ from an adc~ instead: one note each time you play."}
|
|
768
|
+
{:title "At a position"
|
|
769
|
+
:note "A number is a position in beats, as a reader reads a buffer: every event is a span that sounds while the position is inside it. Forwards it starts at its onset; backwards at its end. The wrap of a ramp (a step far larger than the ones before) is a seek: there at once."
|
|
770
|
+
:example (lines "(box :b12 \"ramp 0 6 3 loop\" 330 130)" "(box :b13 \"msg :bang\" 330 100)"
|
|
771
|
+
"(connect :b13 0 :b12 0)" "(connect :b12 0 :b4 0)")
|
|
772
|
+
:try "Stop the clock and click bang: six beats in three seconds, again and again. Change the ramp to ramp 6 0 3 loop: the phrase backwards, each note from its end. Drag a number box into it instead: you are the clock, either way."}]
|
|
773
|
+
:see ["pbind" "pattern" "metro" "ramp" "reader" "synth~"]}
|
|
774
|
+
|
|
775
|
+
"pcclock"
|
|
776
|
+
{:package "@kairotic/theory" :usage "pcclock [notes]"
|
|
777
|
+
:doc "A pitch-class set on the clock face: its polygon, the sets before it, its axes of symmetry; its prime form and interval vector go out."
|
|
778
|
+
:inlets ["a list of pitches (Hz, as a keyboard or midiin sends them; MIDI or 0…11 with midi), a list of 12 weights (a chroma), or a number: a note, the last n notes (4) being the set; :clear"]
|
|
779
|
+
:outlets ["the prime form, when the set changes" "the interval vector" "the pitch class pressed"]
|
|
780
|
+
:example (lines "(box :b1 \"msg 60 64 67\" 40 30)" "(box :b2 \"msg 60 63 66 69\" 140 30)" "(box :b3 \"pcclock midi\" 40 80)"
|
|
781
|
+
"(box :b4 \"print\" 40 330)" "(connect :b1 0 :b3 0)" "(connect :b2 0 :b3 0)" "(connect :b3 0 :b4 0)")
|
|
782
|
+
:try "Click the major triad, then the diminished seventh: (0 3 7) has no axis, (0 3 6 9) has four. (The messages are MIDI notes, hence midi; a keyboard sends Hz, as pitches go between boxes, so a pcclock written without midi takes it directly.) Press a pitch class on the clock: it comes out on the right."
|
|
783
|
+
:see ["fourier" "tonnetz" "chroma~"]}
|
|
784
|
+
|
|
785
|
+
"fourier"
|
|
786
|
+
{:package "@kairotic/theory" :usage "fourier [notes]"
|
|
787
|
+
:doc "The six Fourier coefficients of a pitch-class distribution (chromatic, dyadic, triadic, octatonic, diatonic, whole-tone), each a point in its circle with its trail."
|
|
788
|
+
:inlets ["a list of pitches (Hz, as a keyboard or midiin sends them; MIDI or 0…11 with midi), a list of 12 weights (a chroma, from chroma~), or a number: a note (the last n count: 4); :clear"]
|
|
789
|
+
:outlets ["the six magnitudes, 0…1" "the six phases, in degrees"]
|
|
790
|
+
:example (lines "(box :b1 \"msg 60 62 64 65 67 69 71\" 40 30)" "(box :b2 \"msg 60 64 68\" 240 30)" "(box :b3 \"fourier midi\" 40 80)"
|
|
791
|
+
"(connect :b1 0 :b3 0)" "(connect :b2 0 :b3 0)")
|
|
792
|
+
:try "The diatonic scale fills f5; the augmented triad, f3 and f6 at 1. With adc~ → chroma~ → fourier, sing or play and watch the trails."
|
|
793
|
+
:see ["pcclock" "tonnetz" "chroma~"]}
|
|
794
|
+
|
|
795
|
+
"tonnetz"
|
|
796
|
+
{:package "@kairotic/theory" :usage "tonnetz [notes]"
|
|
797
|
+
:doc "Triads on the Tonnetz (fifths across, thirds up) and the path of the harmony: each triad found joined to the ones before."
|
|
798
|
+
:inlets ["a list of pitches (Hz, as a keyboard or midiin sends them; MIDI or 0…11 with midi), a list of 12 weights (a chroma, above 0.5), or a number: a note (the last n count: 3); :clear forgets the path"]
|
|
799
|
+
:outlets ["the triad, when it changes (:C, :am, :Ebm…)" "the pitch class pressed"]
|
|
800
|
+
:example (lines "(box :b1 \"msg 60 64 67\" 40 30)" "(box :b2 \"msg 60 63 67\" 130 30)" "(box :b3 \"msg 60 63 68\" 220 30)"
|
|
801
|
+
"(box :b4 \"msg 59 63 68\" 310 30)" "(box :b5 \"tonnetz midi\" 40 80)" "(box :b6 \"print\" 40 340)"
|
|
802
|
+
"(connect :b1 0 :b5 0)" "(connect :b2 0 :b5 0)" "(connect :b3 0 :b5 0)" "(connect :b4 0 :b5 0)" "(connect :b5 0 :b6 0)")
|
|
803
|
+
:try "Click the four messages in order: C, c, A♭, g♯ — P, L, P: each step crosses one edge of the lattice. Press a node to hear which class it is (its number comes out on the right)."
|
|
804
|
+
:see ["pcclock" "fourier" "mt"]}
|
|
805
|
+
|
|
806
|
+
"euclid"
|
|
807
|
+
{:package "@kairotic/theory" :usage "euclid [k 3] [n 8] [rotation 0] [bars 1] [midi]"
|
|
808
|
+
:about "**A Euclidean rhythm: k onsets spread as evenly as they can be over n pulses**, by Bjorklund's algorithm — Euclid's, for the greatest common divisor, on ones and zeros. Toussaint showed that it writes rhythms of the whole world: `euclid 3 8` is the tresillo (3-3-2), `euclid 5 8` the cinquillo, `euclid 5 16` a rotation of the bossa nova, `euclid 7 12` the bembé.
|
|
809
|
+
|
|
810
|
+
**Drawn as a necklace**: the n pulses around a circle, time running clockwise from the top, the onsets joined into a polygon — the same geometry as a pitch-class set on `pcclock`. A necklace has no start; pressing a pulse makes the rhythm start there (a rotation), which may sound quite different.
|
|
811
|
+
|
|
812
|
+
**Rhythm apart from pitch.** It goes out as a musical tree for a `tree` box: a bar of n pulses with an `:rtm` whose shares are the intervals between onsets (a negative share a silence). Its right inlet takes the pitches the notes take in turn, starting again when they run out — *talea* and *color*, as in an isorhythmic motet: a keyboard's chord, a melody string, a map `{:pitches …}`, the pattern of `comes`. Its middle outlet is the `:rtm` map alone, to merge with other pitches elsewhere."
|
|
813
|
+
:args [[:k "how many onsets"]
|
|
814
|
+
[:n "how many pulses in the bar"]
|
|
815
|
+
[:rotation "the pulse it starts on (a rotation of the necklace)"]
|
|
816
|
+
[:bars "how many bars: the rhythm again, the pitches going on"]
|
|
817
|
+
[:midi "numbers on the right inlet are MIDI notes (62), not Hz"]]
|
|
818
|
+
:doc "A Euclidean rhythm (Bjorklund, after Toussaint): k onsets as evenly as they can be over n pulses, drawn as a necklace; pressing a pulse makes it start there. Out: a musical tree with an :rtm (the intervals as shares), the :rtm map alone, and the pulses as ones and zeros. The right inlet gives the pitches its notes take in turn."
|
|
819
|
+
:inlets ["a bang: send it · a number: k · [:k 5], [:n 16], [:rotation 2], [:bars 4], [:meter \"3/4\"] (or a map of them): change it, and send it when it is new"
|
|
820
|
+
"the pitches (cold, for the next time it sends): a list of Hz (a keyboard's keys held; MIDI with midi), a melody string (\"c4 e4 g4\"), a map with :pitches or :pitch, a pattern {:note [...]} of comes or cancrizans, notes or chords of a tree · :clear forgets them (every note c4)"]
|
|
821
|
+
:outlets ["the rhythm as a musical tree, for a tree box: [:voice [:measure {:meter [4 4]} [:rtm {:shares [3 3 2] :pitches …}]] …]"
|
|
822
|
+
"the :rtm map alone ({:shares [3 3 2]}, with the pitches if it has them): merge it with other pitches, and write it as a node with vector :rtm %"
|
|
823
|
+
"the pulses, ones and zeros ([1 0 0 1 0 0 1 0])"]
|
|
824
|
+
:messages [[":bang" "sends it"]
|
|
825
|
+
["[:k 5]" "five onsets (a number alone is k too)"]
|
|
826
|
+
["[:n 16]" "sixteen pulses"]
|
|
827
|
+
["[:rotation 2]" "starts on the third pulse"]
|
|
828
|
+
["[:bars 4]" "four bars, the pitches going on from bar to bar"]
|
|
829
|
+
["[:meter \"3/4\"]" "a bar of another meter (by default 4/4 for 8 or 16 pulses, 12/8 for 12, n/8 up to 12, else n/16; nil goes back to it)"]
|
|
830
|
+
[":clear" "on the right: forgets the pitches"]]
|
|
831
|
+
:example (lines "(box :b1 \"msg :bang\" 40 20)" "(box :b2 \"msg [:k 5]\" 120 20)" "(box :b3 \"msg [:n 16]\" 210 20)" "(box :b4 \"msg [:rotation 3]\" 310 20)"
|
|
832
|
+
"(box :b5 \"euclid 3 8\" 40 70)" "(box :b6 \"tree\" 260 70)" "(resize :b6 420 160)" "(box :b7 \"print pulses\" 40 300)"
|
|
833
|
+
"(connect :b1 0 :b5 0)" "(connect :b2 0 :b5 0)" "(connect :b3 0 :b5 0)" "(connect :b4 0 :b5 0)" "(connect :b5 0 :b6 0)" "(connect :b5 2 :b7 0)")
|
|
834
|
+
:try "Click bang: the tresillo, 3-3-2, in the tree box as eighths in 4/4. Click [:k 5]: the cinquillo; then [:n 16]: five in sixteen, a rotation of the bossa nova; [:rotation 3] starts it on the fourth pulse — a silence first. Press a pulse on the necklace: the rhythm starts there."
|
|
835
|
+
:steps [{:title "Pitches: talea and color"
|
|
836
|
+
:note "The right inlet gives the notes their pitches, in turn, starting again when they run out: three pitches over five onsets take three bars to meet the rhythm again, as the color and the talea of an isorhythmic motet. It is cold: what arrives there sounds the next time the box sends. A keyboard sends the keys held, in Hz; a melody string or a map {:pitches …} is kept as it is."
|
|
837
|
+
:example (lines "(box :b8 \"keyboard 60 24\" 720 20)" "(box :b9 \"msg {:pitches \\\"c4 e4 g4\\\"}\" 720 110)" "(box :b10 \"msg [:bars 3]\" 450 20)"
|
|
838
|
+
"(box :b11 \"mt play loop\" 260 260)" "(box :b12 \"msg :bang\" 380 230)" "(box :b13 \"synth~\" 260 310)" "(box :b14 \"dac~\" 260 360)"
|
|
839
|
+
"(connect :b8 0 :b5 1)" "(connect :b9 0 :b5 1)" "(connect :b10 0 :b5 0)" "(connect :b6 0 :b11 0)" "(connect :b12 0 :b11 0)"
|
|
840
|
+
"(connect :b11 0 :b13 0)" "(connect :b11 1 :b13 1)" "(connect :b13 0 :b14 0)" "(connect :b13 0 :b14 1)")
|
|
841
|
+
:try "With five onsets ([:k 5] above), click {:pitches \"c4 e4 g4\"}, then [:bars 3] (it sends): C E G over the onsets, the color going on from bar to bar. Press ▶ and click the bang of mt play to hear it. Hold a chord on the keyboard and click bang above: the chord's notes, one onset each."}]
|
|
842
|
+
:see ["tree" "mt" "pcclock" "pbind"]}
|
|
843
|
+
|
|
844
|
+
"cancrizans"
|
|
845
|
+
{:package "@kairotic/theory" :usage "cancrizans [system] [mode] [k -7] [beats 2] [bars 6] [temp 0] [seed 1] [table] [live] [midi]"
|
|
846
|
+
:about "**A crab canon: the second voice is your line backwards**, both sounding at once, so the work reads the same from either end. With `table` it is also upside down: one score read by two players from opposite sides of a table — a musical ambigram.
|
|
847
|
+
|
|
848
|
+
**It is written from both ends to the middle**, because the comes's first note is the dux's last: each step writes a note at the start and then one at the end. A note that breaks a rule, or from which the crab could not be closed, is corrected to the nearest one that can. On the right, the **futuribles**: the notes that can come next, each with the ways it leaves to close the work. When it closes, both voices go out as patterns (for `pbind` and `player`) and as a score (outlet 4, for a `tree` box).
|
|
849
|
+
|
|
850
|
+
**live** (Study 46) plays it beat by beat. In the first half you play and the box answers each note, at the same beat, with the end of your own line; at the middle the rest of your line comes out as a score to read, and while you read it the box plays your first half backwards. Both voices sound from it, with their voice ids, on one `synth~`.
|
|
851
|
+
|
|
852
|
+
**System and mode** as in `comes`, in any order, and with the flags: `cancrizans hypodorian`, `cancrizans pentatonic penta-A table live`. The mode sets the range, the notes to begin on, the final it ends on and the axis of a table canon; its tenor plays no part here."
|
|
853
|
+
:args [[:system "the scale, its tuning and its rules: diatonic (by default), meantone, septimal31 or pentatonic"]
|
|
854
|
+
[:mode "one of the system's modes (dorian by default): its range, the notes to begin on, the final, the axis of table"]
|
|
855
|
+
[:k "how far away the comes is, in steps of the scale: −7 an octave below"]
|
|
856
|
+
[:beats "beats in a bar: 2 or 3"]
|
|
857
|
+
[:bars "its length in bars: longer, more ways to write it (and longer to count)"]
|
|
858
|
+
[:temp "live: chance in the box's answers (0: always the one :end says)"]
|
|
859
|
+
[:seed "the seed of its chance: the same seed, the same game"]
|
|
860
|
+
[:table "a table canon: backwards and upside down"]
|
|
861
|
+
[:live "played beat by beat (Study 46) instead of written by turns from both ends"]
|
|
862
|
+
[:midi "numbers in are MIDI notes (62), not Hz"]]
|
|
863
|
+
:doc "A crab canon written from both ends to the middle (Study 43): the comes is the dux backwards; with table, backwards and upside down — the score read by a second player from across the table, a musical ambigram. Each step writes a note at the start, then one at the end; the futuribles are the ways to close the work in the middle. When it closes, both voices go out as patterns."
|
|
864
|
+
:inlets ["the next note (at the start, then at the end): Hz, a list of keys held, [:midi 62], an event (:freq, or a player's :hz), or MIDI with midi · :engine · :back · :reset · [:k -4], [:mode :hypodorian], [:system :pentatonic], [:bars 5], [:table true], [:axis 62]: a new work"
|
|
865
|
+
"live: the pulse (a bang from a metro or a pulse): a beat, with your note or the box's for you"]
|
|
866
|
+
:outlets ["the dux, when the work closes, as a pattern {:note [...] :dur [...]} (for a pbind) · live: the Hz of both voices, yours and the box's, as a player sends them (for a synth~)" "the comes, as a pattern · live: their voice ids, sent first (for a synth~'s right inlet)" "the futuribles: the notes that can come next ({:midi :name :futures}; live, with :end, what the box will answer at the end)" "where the work is: {:step :steps :writing :beat :futures :dux :comes :closed :asked :played :corrected}" "the score, as a musical tree (for a tree box, its score): when the work closes, both voices; live, at the middle what is left of your line to read, and at the end the whole crab"]
|
|
867
|
+
:messages [["[:midi 62]" "a MIDI note as the next note (Hz, a keyboard's list or an event also)"]
|
|
868
|
+
[":engine" "the next note, written by the box (live: a beat, with the box playing your note)"]
|
|
869
|
+
[":back" "the last note taken back"]
|
|
870
|
+
[":reset" "a new work"]
|
|
871
|
+
["[:system :septimal31]" "another system (or an EDN map) — these start a new work"]
|
|
872
|
+
["[:mode :hypodorian]" "another mode of the system"]
|
|
873
|
+
["[:k -4]" "the comes a 5th below"]
|
|
874
|
+
["[:bars 5]" "another length"]
|
|
875
|
+
["[:table true]" "a table canon: backwards and upside down"]
|
|
876
|
+
["[:axis 62]" "the axis of a table canon, a MIDI note (the final by default)"]
|
|
877
|
+
["[:temp 2]" "live: the box draws among its answers"]
|
|
878
|
+
["[:seed 7]" "live: its chance (:reset plays the same game again)"]]
|
|
879
|
+
:example (lines "(box :b1 \"msg :engine\" 40 30)" "(box :b2 \"cancrizans\" 40 80)" "(box :b3 \"pbind\" 40 150)" "(box :b4 \"pbind\" 40 260)"
|
|
880
|
+
"(box :b9 \"msg :start\" 40 370)" "(box :b5 \"player 90\" 40 420)" "(box :b6 \"player 90\" 240 420)" "(box :b7 \"synth~\" 40 490)"
|
|
881
|
+
"(box :b17 \"synth~\" 240 490)" "(box :b8 \"dac~\" 40 550)" "(box :b10 \"print\" 260 80)"
|
|
882
|
+
"(box :b19 \"tree\" 40 620)" "(resize :b19 460 200)" "(connect :b2 4 :b19 0)"
|
|
883
|
+
"(connect :b1 0 :b2 0)" "(connect :b2 0 :b3 0)" "(connect :b2 1 :b4 0)" "(connect :b3 0 :b5 1)" "(connect :b4 0 :b6 1)"
|
|
884
|
+
"(connect :b9 0 :b5 0)" "(connect :b9 0 :b6 0)" "(connect :b5 0 :b7 0)" "(connect :b6 0 :b17 0)"
|
|
885
|
+
"(connect :b7 0 :b8 0)" "(connect :b7 0 :b8 1)" "(connect :b17 0 :b8 0)" "(connect :b17 0 :b8 1)" "(connect :b2 3 :b10 0)")
|
|
886
|
+
:try "Click :engine until the work closes: the box writes it from both ends, and the dux and the comes reach the pbinds. Press ▶ and click :start: the crab sounds, each voice on its own synth~ (one synth~ plays one line: a note from the other player would take the place of the last). The tree box below shows the crab as a score: read the comes from the end and it is the dux. Play notes on a keyboard into it instead (the note at the start, then the one at the end)."
|
|
887
|
+
:steps [{:title "Played live"
|
|
888
|
+
:note "With live (Study 46) the crab is played beat by beat: your note, and at the same beat the box's answer — the end of your own line, written ahead. Two beats before the middle a cue; at the middle the rest of your line comes out as the score to read (outlet 4, a musical tree for a score), and the box plays your first half backwards while you read it. Both voices sound from its left outlet, after their voice ids (outlet 1): one synth~ plays both. The first note to read is the last end of your line the box wrote (with an odd number of beats the middle note is shared: the box plays it with you, an octave below); from there each voice plays what the other played, backwards."
|
|
889
|
+
:example (lines "(box :b11 \"keyboard 60 24\" 520 30)" "(box :b12 \"cancrizans live\" 520 150)" "(box :b13 \"synth~\" 520 230)" "(box :b15 \"loadbang\" 720 110)"
|
|
890
|
+
"(box :b16 \"html\" 860 30)" "(resize :b16 300 230)"
|
|
891
|
+
"(code :b16 \"[:div.col [:h4 \\\"beat \\\" :$t \\\" of \\\" :$n \\\" · \\\" :$phase] [:p.soft :$ways \\\" ways to close it\\\"] :$in]\")"
|
|
892
|
+
"(box :b14 \"tree\" 860 290)" "(resize :b14 460 180)"
|
|
893
|
+
"(connect :b15 0 :b12 0)" "(connect :b12 2 :b16 0)" "(connect :b12 3 :b16 0)" "(connect :b12 4 :b14 0)"
|
|
894
|
+
"(connect :b11 0 :b12 0)" "(connect :b12 0 :b13 0)" "(connect :b12 1 :b13 1)" "(connect :b13 0 :b8 0)" "(connect :b13 0 :b8 1)")
|
|
895
|
+
:try "Press ▶: the loadbang counts the futures. The html box shows where the crab is and its futuribles as a table — each note you can play, the ways it leaves to close the crab, and :end, what the box will answer at the end of your line. Play D on the keyboard: the box answers with D an octave below — both voices on one synth~, yours as the box takes it (corrected if it must be), with their voice ids (1→1). Play on: at the middle the tree box shows, as a score, what is left of your line to read — the box's answers so far, backwards —; at the end it shows the whole crab."}]
|
|
896
|
+
:see ["comes" "pbind" "player"]}
|
|
897
|
+
|
|
898
|
+
"comes"
|
|
899
|
+
{:package "@kairotic/theory" :usage "comes [system] [mode] [k -7] [d 3] [beats 2] [imitation 1] [bars 8] [upbeat 0] [temp 0] [seed 1] [fourth] [inversion] [augmentation] [live] [nocues] [midi]"
|
|
900
|
+
:about "**You play a line, the dux, and comes answers with a second voice, the comes, that imitates it** — a canon, a few beats later, by the rules of 16th-century counterpoint. A note that breaks a rule, or from which the canon could not be finished, is corrected to the nearest one that can be played, and the box says why.
|
|
901
|
+
|
|
902
|
+
**Two ways to play.** By turns (the default): each note you send is a beat; the same note again, or `:hold`, holds it over the beat. With **live**, a pulse on the right inlet (a `metro`) gives the beats and a note lasts until you play the next one; held three beats in 2/2 the canon turns to 3/2, longer than a bar the section ends and the next note begins a new canon.
|
|
903
|
+
|
|
904
|
+
**Where it plays: a system and one of its modes.** The **system** is the scale, its tuning and its rules: `diatonic` (the default), `meantone`, `septimal31`, `pentatonic`, or your own as EDN. The **mode** is one of its modes — `dorian` (the default), `hypodorian`, `ionian`, `aeolian`…; in the pentatonic `penta-C`, `penta-A`, `penta-D` — and sets the final, the range and the notes to begin on. Write them in the box in any order: `comes hypodorian`, `comes pentatonic penta-A`.
|
|
905
|
+
|
|
906
|
+
**How the comes imitates.** `k` steps away (−7: an octave below) and `d` beats later. `imitation` 1 is a strict canon; lower, the comes moves more freely. `inversion` turns it upside down, `augmentation` makes it twice as slow, and `fourth` makes your line a cantus firmus (a note a bar) with the comes syncopated against it.
|
|
907
|
+
|
|
908
|
+
**What comes out.** Both voices as Hz with their voice ids — one `synth~`, connected 0→0 and 1→1, plays both —; on the right the **futuribles**, the notes you can play next, the most plausible first, each with the ways it leaves to finish the canon (counted exactly), and where the canon is."
|
|
909
|
+
:args [[:system "the scale, its tuning and its rules: diatonic (by default), meantone, septimal31 or pentatonic"]
|
|
910
|
+
[:mode "one of the system's modes: dorian (by default), hypodorian, ionian, mixolydian, aeolian and their plagals; penta-C, penta-A, penta-D in the pentatonic"]
|
|
911
|
+
[:k "how far away the comes imitates, in steps of the scale: −7 an octave below, −4 a 5th below, 0 at the unison"]
|
|
912
|
+
[:d "how many beats after the dux the comes comes in"]
|
|
913
|
+
[:beats "beats in a bar: 2 (2/2) or 3 (3/2)"]
|
|
914
|
+
[:imitation "1 a strict canon · 0.5–0.9 the comes near the dux's notes · 0.2–0.4 only following its motion · below, free"]
|
|
915
|
+
[:bars "how long the canon is, in bars"]
|
|
916
|
+
[:upbeat "beats of rest before the first note (an anacrusis)"]
|
|
917
|
+
[:temp "chance: at 0 always the most plausible; higher, the comes (and the dux with :engine) drawn among the candidates"]
|
|
918
|
+
[:seed "the seed of its chance: the same seed, the same game"]
|
|
919
|
+
[:fourth "fourth species: your line a cantus firmus, a note a bar, and the comes syncopated"]
|
|
920
|
+
[:inversion "the comes upside down, about the final (or [:axis 62])"]
|
|
921
|
+
[:augmentation "the comes twice as slow (a strict canon, six bars at most)"]
|
|
922
|
+
[:live "played on a pulse (the right inlet) instead of by turns"]
|
|
923
|
+
[:nocues "live: it does not turn to 3/2 or end the section by itself; other boxes decide, with [:beats 3] and :end"]
|
|
924
|
+
[:midi "numbers in are MIDI notes (62), not Hz"]]
|
|
925
|
+
:doc "Counterpoint live: you play the dux and the comes answers, as a canon in a mode (Study 41). A note that breaks a rule of the style, or from which the canon could not be finished, is corrected to the nearest one that can be played, and the box says why. Notes may be held over the beat (ties), and a dissonance may fall on a strong beat as a suspension. By turns (the default) one note in is one beat; live, a pulse on the right is a beat, and a note lasts until the next one is struck. The system (Study 42) — the scale, its tuning and its rules — is diatonic by default, or meantone, septimal31, pentatonic, or an EDN map: its modes come with it, and the notes out are tuned."
|
|
926
|
+
:inlets ["the dux's next note: Hz (a number, or the list of notes held, as a keyboard or midiin sends them), [:midi 62], or an event (:freq from midiin, or a player's :hz) · :hold (by turns) · [:k -4], [:d 2], [:imitation 0.5], [:mode :hypodorian], [:system :pentatonic], [:beats 3], [:species 4]: the canon changed (by turns at once, live at the next section) · :end (the section ends: the next note begins a new canon) · :engine · :back · :reset"
|
|
927
|
+
"live: the pulse (a bang from a metro or a pulse): a beat"]
|
|
928
|
+
:outlets ["the Hz of both voices sounding, the dux (as played, or corrected) and the comes, as a keyboard or a player sends them" "their voice ids, sent first (for a synth~'s right inlet): a note held keeps its id and goes on sounding" "the futuribles: the notes that can come next, the most plausible first ({:midi :name :futures :bits :score :comes})" "where the canon is: {:t :n :bar :beat :held :asked :played :corrected :reason :comes :futures :bits :obligations :section :meter …}, or a cue {:cue :ternary|:end :section :meter}"]
|
|
929
|
+
:messages [["[:midi 62]" "a MIDI note as the dux's next note (Hz, a keyboard's list or an event also)"]
|
|
930
|
+
[":engine" "the box plays the next pair itself, the most plausible"]
|
|
931
|
+
[":hold" "by turns: the note held over the next beat (a tie)"]
|
|
932
|
+
[":back" "the last pair taken back"]
|
|
933
|
+
[":reset" "a new canon"]
|
|
934
|
+
[":end" "the section ends: the next note begins a new canon"]
|
|
935
|
+
["[:system :pentatonic]" "another system (or an EDN map {:tuning … :modes …}) — these change the canon: by turns at once, live at the next section"]
|
|
936
|
+
["[:mode :hypodorian]" "another mode of the system"]
|
|
937
|
+
["[:k -4]" "the comes a 5th below"]
|
|
938
|
+
["[:d 2]" "the comes two beats after the dux"]
|
|
939
|
+
["[:imitation 0.5]" "less imitation: the comes near the dux's notes"]
|
|
940
|
+
["[:beats 3]" "3/2"]
|
|
941
|
+
["[:species 4]" "fourth species (with [:beats 2])"]
|
|
942
|
+
["[:transform :inversion]" "the comes upside down; :augmentation twice as slow; :canon back to a canon"]
|
|
943
|
+
["[:axis 62]" "the axis of the inversion, a MIDI note"]
|
|
944
|
+
["[:temp 1.5]" "chance in the comes, and in the dux of :engine (0: the futuribles' choice)"]
|
|
945
|
+
["[:seed 7]" "its chance: the same seed, the same game (:reset plays it again)"]]
|
|
946
|
+
:example (lines "(box :b1 \"keyboard 60 24\" 40 30)" "(box :b2 \"comes\" 40 130)" "(box :b3 \"synth~\" 40 200)"
|
|
947
|
+
"(box :b5 \"dac~\" 40 260)" "(box :b6 \"print\" 280 200)" "(box :b7 \"msg :engine\" 220 100)"
|
|
948
|
+
"(connect :b1 0 :b2 0)" "(connect :b7 0 :b2 0)" "(connect :b2 0 :b3 0)" "(connect :b2 1 :b3 1)"
|
|
949
|
+
"(connect :b3 0 :b5 0)" "(connect :b3 0 :b5 1)" "(connect :b2 3 :b6 0)")
|
|
950
|
+
:try "Press ▶ and play D, E, F on the keyboard: the dux. From the fourth note on the comes answers an octave below, three beats later. Play a black key, or a note against the rules: the box takes the nearest one that can be played and prints why. Click :engine to let it go on alone."
|
|
951
|
+
:steps [{:title "Live, on a pulse"
|
|
952
|
+
:note "With live, a metro gives the beats: hold a key and the note is held over them (a tie); hold it three beats in 2/2 and the canon turns to 3/2; longer than a bar, and the section ends: the next note begins a new canon. That is all comes reads of time: with nocues it leaves the meter and the sections to other boxes, which send [:beats 3] and end."
|
|
953
|
+
:example (lines "(box :b8 \"metro 600\" 380 100)" "(box :b9 \"msg 1\" 380 70)" "(box :b10 \"comes live\" 380 160)"
|
|
954
|
+
"(connect :b9 0 :b8 0)" "(connect :b8 0 :b10 1)" "(connect :b1 0 :b10 0)" "(connect :b10 0 :b3 0)" "(connect :b10 1 :b3 1)" "(connect :b10 3 :b6 0)")
|
|
955
|
+
:try "Press ▶, click 1 to start the pulse and play slowly: the comes answers on the beats. Hold a note three beats: the cue :ternary is printed."}]
|
|
956
|
+
:see ["keyboard" "midiin" "metro" "pulse" "tonnetz"]}
|
|
957
|
+
|
|
958
|
+
"adsr~"
|
|
959
|
+
{:package "@kairotic/synth" :usage "adsr~ [a d s r]"
|
|
960
|
+
:doc "An envelope that follows a gate, for the factor of a gain~. Drag over it to change its shape."
|
|
961
|
+
:inlets ["a gate (signal or numbers: above 0 attacks, 0 releases), a bang, or [a d s r]"]
|
|
962
|
+
:outlets ["the envelope signal, 0…peak"]
|
|
963
|
+
:example (lines "(box :b1 \"bang\" 40 30)" "(box :b2 \"adsr~ 10 300 0 400\" 40 80)" "(box :b3 \"osc~ 440\" 220 80)"
|
|
964
|
+
"(box :b4 \"gain~ 0\" 220 220)" "(box :b5 \"dac~\" 220 270)"
|
|
965
|
+
"(connect :b1 0 :b2 0)" "(connect :b2 0 :b4 1)" "(connect :b3 0 :b4 0)"
|
|
966
|
+
"(connect :b4 0 :b5 0)" "(connect :b4 0 :b5 1)")
|
|
967
|
+
:try "Start the engine and click the bang: a plucked note. Drag over the envelope to make it longer."
|
|
968
|
+
:see ["gain~" "reader~" "synth~"]}
|
|
969
|
+
|
|
970
|
+
"gendy~"
|
|
971
|
+
{:package "@kairotic/synth" :usage "gendy~ [freq x-step y-min y-max y-step breakpoints]"
|
|
972
|
+
:doc "A dynamic stochastic oscillator, after Xenakis's GENDY: a wave of breakpoints whose amplitudes and durations each take a random walk between mirror barriers, cycle after cycle — a pitch that drifts, a timbre that changes."
|
|
973
|
+
:inlets ["a number: the frequency in Hz · [:x-step 30], [:y-step 0.2]…: one parameter · a list of six: all of them · a signal: added to the frequency, in Hz (FM)"]
|
|
974
|
+
:outlets ["the sound (about ±0.15 by default: y-min and y-max are its barriers)"]
|
|
975
|
+
:messages [["220" "the frequency"] ["[:x-step 40]" "how far the durations wander (0–100 %): the pitch drifts"]
|
|
976
|
+
["[:y-step 0.2]" "how far the amplitudes move each cycle: the timbre changes faster"]
|
|
977
|
+
["[:breakpoints 6]" "fewer breakpoints, a simpler wave (more of them, a richer one); changing it keeps the wave"]
|
|
978
|
+
["[220 10 -0.15 0.15 0.05 16]" "freq x-step y-min y-max y-step breakpoints"]]
|
|
979
|
+
:example "(box :b1 \"gendy~ 110\" 40 30)\n(box :b2 \"dac~\" 40 90)\n(box :b3 \"scope~ 30\" 160 90)\n(connect :b1 0 :b2 0)\n(connect :b1 0 :b2 1)\n(connect :b1 0 :b3 0)"
|
|
980
|
+
:try "Press ▶: a buzz whose pitch and colour never settle. Write gendy~ 110 0 in the box: with no wander of the durations, the pitch holds and only the timbre moves."
|
|
981
|
+
:steps [{:title "The two walks"
|
|
982
|
+
:note "x-step lets the durations wander (the pitch), y-step the amplitudes (the timbre). Two knobs send them by name."
|
|
983
|
+
:example "(box :b4 \"knob 0 100 10 x-step\" 360 20)\n(box :b5 \"knob 0 0.3 0.05 y-step\" 450 20)\n(connect :b4 0 :b1 0)\n(connect :b5 0 :b1 0)"
|
|
984
|
+
:try "Press ▶ and turn x-step up: the pitch scatters into noise. Turn it down and y-step up: one pitch, a restless colour."}
|
|
985
|
+
{:title "Breakpoints"
|
|
986
|
+
:note "Few breakpoints make a simple wave, close to a triangle or a square; many, a richer and noisier one. Changing their number keeps the wave, with no click."
|
|
987
|
+
:example "(box :b6 \"msg :breakpoints 4\" 360 120)\n(box :b7 \"msg :breakpoints 48\" 500 120)\n(connect :b6 0 :b1 0)\n(connect :b7 0 :b1 0)"
|
|
988
|
+
:try "Press ▶ and click both messages in turn, watching the scope."}
|
|
989
|
+
{:title "A signal on the inlet: FM"
|
|
990
|
+
:note "A signal connected to the inlet is added to the frequency, in Hz: a slow one makes a vibrato, a fast one frequency modulation."
|
|
991
|
+
:example "(box :b8 \"osc~ 5\" 360 200)\n(box :b9 \"gain~ 300\" 360 250)\n(connect :b8 0 :b9 0)\n(connect :b9 0 :b1 0)"
|
|
992
|
+
:try "Press ▶: 5 Hz around 110 Hz. Change osc~ 5 to osc~ 80 for a rougher sound."}]
|
|
993
|
+
:see ["osc~" "synth~" "faust~"]}
|
|
994
|
+
|
|
995
|
+
"synth~"
|
|
996
|
+
{:package "@kairotic/synth" :usage "synth~"
|
|
997
|
+
:doc "Polyphonic triangle-wave synthesizer, one voice per id."
|
|
998
|
+
:inlets ["frequencies (a number or a list) · :stop" "voice ids (from a reader)"]
|
|
999
|
+
:outlets ["the sound"]
|
|
1000
|
+
:see ["reader" "adsr~"]}
|
|
1001
|
+
|
|
1002
|
+
"pan~"
|
|
1003
|
+
{:package "@kairotic/spatial" :usage "pan~ [position]"
|
|
1004
|
+
:doc "Stereo panning with equal power."
|
|
1005
|
+
:inlets ["the signal" "the position: −1 left … 1 right"]
|
|
1006
|
+
:outlets ["left" "right"]
|
|
1007
|
+
:see ["space~" "dac~"]}
|
|
1008
|
+
|
|
1009
|
+
"space~"
|
|
1010
|
+
{:package "@kairotic/spatial" :usage "space~ [x y]"
|
|
1011
|
+
:doc "A sound placed around the listener (binaural): drag the dot, or send [x y]. For headphones."
|
|
1012
|
+
:inlets ["the signal; [x y] moves it (−1…1, y = 1 in front)"]
|
|
1013
|
+
:outlets ["left" "right"]
|
|
1014
|
+
:see ["pan~" "reader"]}})
|
|
1015
|
+
|
|
1016
|
+
(defn of
|
|
1017
|
+
"The help of a class: its own :help, or the core one."
|
|
1018
|
+
[cls]
|
|
1019
|
+
(let [d (comp/lookup cls)]
|
|
1020
|
+
(merge (get core cls) (:help d))))
|
|
1021
|
+
|
|
1022
|
+
(defn patch-steps
|
|
1023
|
+
"The steps of the help patch of a class: its :example (with :try) first, then its :steps.
|
|
1024
|
+
[{:title :note :try :code [\"(box …)\" …]} …], empty when it has no help patch."
|
|
1025
|
+
[cls]
|
|
1026
|
+
(let [h (of cls)
|
|
1027
|
+
code (fn [e] (->> (str/split-lines (str e)) (map str/trim) (remove str/blank?) vec))]
|
|
1028
|
+
(vec (concat (when (:example h)
|
|
1029
|
+
[{:title cls :note (or (:doc (comp/lookup cls)) (:doc h) "") :try (or (:try h) "") :code (code (:example h))}])
|
|
1030
|
+
(for [st (:steps h)]
|
|
1031
|
+
{:title (or (:title st) cls) :note (or (:note st) "") :try (or (:try st) "") :code (code (:example st))})))))
|
|
1032
|
+
|
|
1033
|
+
(defn known
|
|
1034
|
+
"Every class with a help page (registered or listed here)."
|
|
1035
|
+
[]
|
|
1036
|
+
(sort (distinct (concat (keys core) (map first (comp/listing))))))
|