@kairotic/controls 0.1.0 → 0.2.0

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 CHANGED
@@ -7,7 +7,7 @@ npm under the scope `@kairotic` and served inside claude.ai by jsDelivr.
7
7
 
8
8
  | Package | Classes |
9
9
  |---|---|
10
- | [`@kairotic/synth`](../synth/) | `adsr~ [a d s r]` an envelope that follows a gate · `synth~` a polyphonic synthesizer |
10
+ | [`@kairotic/synth`](../synth/) | `adsr~ [a d s r]` an envelope that follows a gate · `synth~` a polyphonic synthesizer · `gendy~ [freq x-step y-min y-max y-step breakpoints]` a dynamic stochastic oscillator, after Xenakis |
11
11
  | [`@kairotic/spatial`](../spatial/) | `pan~ [position]` stereo panning · `space~ [x y]` binaural placement around the listener |
12
12
  | [`@kairotic/controls`](../controls/) | `knob [min max initial] [log] [name]` a rotary control with its own view in the patch · `keyboard [low keys] [hold]` a virtual MIDI keyboard with velocity and chords, for synth~ and faust~ |
13
13
 
@@ -22,7 +22,7 @@ complete and sounds the same even if the package changes later. You can also bri
22
22
  ```clojure
23
23
  (packages) ; the official packages and their classes
24
24
  (add-package! "@kairotic/synth")
25
- (import! "npm:@kairotic/synth@0.1.1/dist/index.mjs")
25
+ (import! "npm:@kairotic/synth@0.2.0/dist/index.mjs")
26
26
  ```
27
27
 
28
28
  ## Writing for a package
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  // Generated by packages/build.mjs
2
2
  export default {
3
3
  "package": "@kairotic/controls",
4
- "version": "0.1.0",
4
+ "version": "0.2.0",
5
5
  "api": 1,
6
6
  "author": "bonuoq",
7
7
  "license": "MPL-2.0",
@@ -17,6 +17,12 @@ export default {
17
17
  "license": "MPL-2.0",
18
18
  "doc": "Rotary knob: drag it up or down (⇧ for fine control). Sends its value between min and max; with log the travel is logarithmic (frequencies), and with a name it sends [:name value] (e.g. a faust~ parameter). A number sets it and sends it on; a bang sends it again.",
19
19
  "source": ";; knob · a rotary control with its own view in the patch\n;; Part of @kairotic/controls. Written against the Kairotic API (api/…).\n{;; ── about ──────────────────────────────────────────────\n :class \"knob\"\n :license \"MPL-2.0\"\n :doc \"Rotary knob: drag it up or down (⇧ for fine control). Sends its value between min and max; with log the travel is logarithmic (frequencies), and with a name it sends [:name value] (e.g. a faust~ parameter). A number sets it and sends it on; a bang sends it again.\"\n :usage \"knob [min max initial] [log] [name]\"\n :io [1 1]\n :size [72 78]\n\n ;; ── arguments ──────────────────────────────────────────\n ;; numbers fill min, max and initial in order; \"log\" is a flag; any other word is the name\n :args [[:min 0] [:max 1] [:initial :min] [:log false] [:name nil]]\n\n ;; ── logic ──────────────────────────────────────────────\n :receive (fn [{:keys [state args value]}]\n (let [current (if (number? state) state (:initial args))\n outgoing (fn [v] (if (:name args) [(:name args) v] v))]\n (cond\n (number? value) (let [v (api/clamp value (:min args) (:max args))]\n {:state v :out [[0 (outgoing v)]] :show v})\n (= value :bang) {:state current :out [[0 (outgoing current)]] :show current}\n :else {:state current})))\n\n ;; on release the value stays in the box text as its initial value (Kairotic Study 13 and later)\n :persist (fn [v] {:initial (api/nice v)})\n\n :gesture (fn [{:keys [start args dy fine]}]\n (let [{lo :min hi :max log? :log} args\n u (api/to-unit (if (number? start) start (:initial args)) lo hi log?)]\n (api/from-unit (- u (/ dy (if fine 800 160))) lo hi log?)))\n\n ;; values for the holes of the view\n :derive (fn [{:keys [shown args]}]\n (let [{lo :min hi :max log? :log} args\n v (if (number? shown) shown (:initial args))]\n {:angle (+ -135 (* 270 (api/to-unit v lo hi log?)))\n :label (str (when (:name args) (str (name (:name args)) \" \")) (api/nice v))}))\n\n ;; ── view ───────────────────────────────────────────────\n :view [[:arc {:cx 36 :cy 33 :r 23 :from -135 :to 135 :stroke :grid :weight 5}]\n [:arc {:cx 36 :cy 33 :r 23 :from -135 :to :$angle :stroke :accent :weight 5}]\n [:circle {:cx 36 :cy 33 :r 16 :stroke :soft :fill :bg}]\n [:needle {:cx 36 :cy 33 :r0 5 :r 17 :angle :$angle :stroke :ink :weight 2.5}]\n [:text {:x 36 :y 72 :anchor :middle :size 11} :$label]]}\n"
20
+ },
21
+ {
22
+ "class": "scale",
23
+ "license": "MPL-2.0",
24
+ "doc": "A number from one range (in-lo…in-hi, 0…1 by default) to another (out-lo…out-hi): straight, or with log in equal ratios (for frequencies, a cutoff, a speed: equal moves are equal intervals); clipped to the range, and reversed when out-hi is under out-lo. With ms, it glides there in that time (a jumpy sensor made smooth). It takes a number, a list whose last element is the number ([:lx 0.3] from gamepad), or a map with :value. learn: the next values it gets make the input range (move the controller from end to end), learn off stops. Between a controller (control, knob, motion…) and whatever it moves.",
25
+ "source": ";; scale · a number from one range to another, straight or logarithmic, smoothed if asked\n;; Part of @kairotic/controls. Written against the Kairotic API (api/…). Discussion #135.\n(let [lin (fn [v a b] (if (== a b) 0 (/ (- v a) (- b a))))\n out-of (fn [u {:keys [out-lo out-hi log]}]\n (let [u (api/clamp u 0 1)]\n (if (and log (pos? out-lo) (pos? out-hi))\n (* out-lo (js/Math.pow (/ out-hi out-lo) u))\n (+ out-lo (* u (- out-hi out-lo))))))\n ;; the number in a message: a number, the last number of a list ([:lx 0.3] from gamepad), or :value of a map\n number-in (fn [v] (cond (number? v) v\n (map? v) (let [x (:value v)] (when (number? x) x))\n (sequential? v) (let [x (last v)] (when (number? x) x))\n :else nil))\n tick 0.02]\n {;; ── about ──\n :class \"scale\"\n :license \"MPL-2.0\"\n :doc \"A number from one range (in-lo…in-hi, 0…1 by default) to another (out-lo…out-hi): straight, or with log in equal ratios (for frequencies, a cutoff, a speed: equal moves are equal intervals); clipped to the range, and reversed when out-hi is under out-lo. With ms, it glides there in that time (a jumpy sensor made smooth). It takes a number, a list whose last element is the number ([:lx 0.3] from gamepad), or a map with :value. learn: the next values it gets make the input range (move the controller from end to end), learn off stops. Between a controller (control, knob, motion…) and whatever it moves.\"\n :usage \"scale [in-lo in-hi out-lo out-hi] [log] [ms]\"\n :io [1 1]\n :size [130 24]\n :args [[:in-lo 0] [:in-hi 1] [:out-lo 0] [:out-hi 1] [:log false] [:ms 0]]\n :help {:inlets [\"a number (or [name value], or {:value v}); learn; learn off\"]\n :outlets [\"the number in the new range\"]\n :messages [[\"learn\" \"the next values make the input range\"] [\"learn off\" \"keeps the range learnt\"]]\n :example \"(box :b1 \\\"knob\\\" 40 30)\\n(box :b2 \\\"scale 0 1 220 880 log 200\\\" 40 120)\\n(box :b3 \\\"number\\\" 40 160)\\n(connect :b1 0 :b2 0)\\n(connect :b2 0 :b3 0)\"\n :try \"Turn the knob: 220 to 880 Hz in equal steps of pitch, gliding 200 ms.\"\n :see [\"control\" \"knob\" \"mtof\"]}\n\n ;; ── logic ──\n :receive (fn [{:keys [inlet value state args at]}]\n (let [st (or state {})\n lo (or (:lo st) (:in-lo args)) hi (or (:hi st) (:in-hi args))\n ms (max 0 (:ms args))]\n (cond\n (#{:learn \"learn\"} value) {:state (assoc st :learning true :lo nil :hi nil :seen nil) :show {:learn true}}\n (and (sequential? value) (#{:learn \"learn\"} (first value)) (#{:off \"off\" 0} (second value)))\n {:state (dissoc st :learning) :show {:learn false}}\n ;; a glide: one step of it, scheduled to itself\n (and (= inlet 0) (vector? value) (= :scale-step (first value)))\n (let [[_ gen] value]\n (if (and (= gen (:gen st)) (:target st))\n (let [k (min 1 (/ tick (max 0.001 (/ ms 1000))))\n cur (+ (:cur st) (* k (- (:target st) (:cur st))))\n done (< (js/Math.abs (- (:target st) cur)) (* 1e-4 (max 1 (js/Math.abs (:target st)))))\n cur (if done (:target st) cur)]\n (cond-> {:state (assoc st :cur cur) :out [[0 (api/nice cur)]] :show {:v cur}}\n (not done) (assoc :later [[(+ at tick) 0 [:scale-step gen]]])))\n {:state st}))\n :else\n (if-let [v (number-in value)]\n (let [st (if (:learning st)\n (let [s (vec (take-last 512 (conj (or (:seen st) []) v)))]\n (assoc st :seen s :lo (apply min s) :hi (apply max s)))\n st)\n lo (or (:lo st) (:in-lo args)) hi (or (:hi st) (:in-hi args))\n target (out-of (lin v lo hi) args)]\n (if (and (pos? ms) (number? (:cur st)))\n (let [gen (inc (or (:gen st) 0))]\n {:state (assoc st :target target :gen gen) :later [[(+ at tick) 0 [:scale-step gen]]] :show {:v (:cur st)}})\n {:state (assoc st :cur target :target target) :out [[0 (api/nice target)]] :show {:v target}}))\n {:state st}))))\n\n ;; ── view ──\n :derive (fn [{:keys [shown args]}]\n {:label (str (if (:learn shown) \"learning… \" \"\")\n (api/nice (:in-lo args)) \"…\" (api/nice (:in-hi args)) \" → \" (api/nice (:out-lo args)) \"…\" (api/nice (:out-hi args))\n (when (:log args) \" log\"))\n :w (* 126 (api/clamp (if (number? (:v shown)) (lin (:v shown) (:out-lo args) (:out-hi args)) 0) 0 1))})\n :view [[:rect {:x 1 :y 1 :w 128 :h 22 :r 3 :stroke :accent :fill :bg}]\n [:rect {:x 2 :y 19 :w :$w :h 3 :r 1 :stroke nil :fill :accent}]\n [:text {:x 6 :y 15 :size 10.5} :$label]]})\n"
20
26
  }
21
27
  ]
22
28
  };
package/dist/keyboard.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  // Generated by packages/build.mjs from src/keyboard.cljs
2
2
  export default {
3
3
  "class": "keyboard",
4
- "version": "0.1.0",
4
+ "version": "0.2.0",
5
5
  "author": "bonuoq",
6
6
  "license": "MPL-2.0",
7
7
  "doc": "Virtual MIDI keyboard. Press a key to play it and let go to release it; dragging glides from key to key. ⇧-click toggles a note in a chord that stays after mouse up (⇧-drag adds every key it passes); a plain click starts over; the strip above the keys releases everything. With the word hold every note stays (a latch) until the strip is clicked. Where the key is touched sets the velocity: soft at the top, full at the bottom. Outlets: Hz (0, most recent note first), voice ids = the MIDI numbers (1), gate (2), [:gain velocity] (3). For synth~ connect 0→0 and 1→1; for faust~ connect 0 and 3 to its left inlet.",
package/dist/knob.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  // Generated by packages/build.mjs from src/knob.cljs
2
2
  export default {
3
3
  "class": "knob",
4
- "version": "0.1.0",
4
+ "version": "0.2.0",
5
5
  "author": "bonuoq",
6
6
  "license": "MPL-2.0",
7
7
  "doc": "Rotary knob: drag it up or down (⇧ for fine control). Sends its value between min and max; with log the travel is logarithmic (frequencies), and with a name it sends [:name value] (e.g. a faust~ parameter). A number sets it and sends it on; a bang sends it again.",
package/dist/scale.mjs ADDED
@@ -0,0 +1,9 @@
1
+ // Generated by packages/build.mjs from src/scale.cljs
2
+ export default {
3
+ "class": "scale",
4
+ "version": "0.2.0",
5
+ "author": "bonuoq",
6
+ "license": "MPL-2.0",
7
+ "doc": "A number from one range (in-lo…in-hi, 0…1 by default) to another (out-lo…out-hi): straight, or with log in equal ratios (for frequencies, a cutoff, a speed: equal moves are equal intervals); clipped to the range, and reversed when out-hi is under out-lo. With ms, it glides there in that time (a jumpy sensor made smooth). It takes a number, a list whose last element is the number ([:lx 0.3] from gamepad), or a map with :value. learn: the next values it gets make the input range (move the controller from end to end), learn off stops. Between a controller (control, knob, motion…) and whatever it moves.",
8
+ "source": ";; scale · a number from one range to another, straight or logarithmic, smoothed if asked\n;; Part of @kairotic/controls. Written against the Kairotic API (api/…). Discussion #135.\n(let [lin (fn [v a b] (if (== a b) 0 (/ (- v a) (- b a))))\n out-of (fn [u {:keys [out-lo out-hi log]}]\n (let [u (api/clamp u 0 1)]\n (if (and log (pos? out-lo) (pos? out-hi))\n (* out-lo (js/Math.pow (/ out-hi out-lo) u))\n (+ out-lo (* u (- out-hi out-lo))))))\n ;; the number in a message: a number, the last number of a list ([:lx 0.3] from gamepad), or :value of a map\n number-in (fn [v] (cond (number? v) v\n (map? v) (let [x (:value v)] (when (number? x) x))\n (sequential? v) (let [x (last v)] (when (number? x) x))\n :else nil))\n tick 0.02]\n {;; ── about ──\n :class \"scale\"\n :license \"MPL-2.0\"\n :doc \"A number from one range (in-lo…in-hi, 0…1 by default) to another (out-lo…out-hi): straight, or with log in equal ratios (for frequencies, a cutoff, a speed: equal moves are equal intervals); clipped to the range, and reversed when out-hi is under out-lo. With ms, it glides there in that time (a jumpy sensor made smooth). It takes a number, a list whose last element is the number ([:lx 0.3] from gamepad), or a map with :value. learn: the next values it gets make the input range (move the controller from end to end), learn off stops. Between a controller (control, knob, motion…) and whatever it moves.\"\n :usage \"scale [in-lo in-hi out-lo out-hi] [log] [ms]\"\n :io [1 1]\n :size [130 24]\n :args [[:in-lo 0] [:in-hi 1] [:out-lo 0] [:out-hi 1] [:log false] [:ms 0]]\n :help {:inlets [\"a number (or [name value], or {:value v}); learn; learn off\"]\n :outlets [\"the number in the new range\"]\n :messages [[\"learn\" \"the next values make the input range\"] [\"learn off\" \"keeps the range learnt\"]]\n :example \"(box :b1 \\\"knob\\\" 40 30)\\n(box :b2 \\\"scale 0 1 220 880 log 200\\\" 40 120)\\n(box :b3 \\\"number\\\" 40 160)\\n(connect :b1 0 :b2 0)\\n(connect :b2 0 :b3 0)\"\n :try \"Turn the knob: 220 to 880 Hz in equal steps of pitch, gliding 200 ms.\"\n :see [\"control\" \"knob\" \"mtof\"]}\n\n ;; ── logic ──\n :receive (fn [{:keys [inlet value state args at]}]\n (let [st (or state {})\n lo (or (:lo st) (:in-lo args)) hi (or (:hi st) (:in-hi args))\n ms (max 0 (:ms args))]\n (cond\n (#{:learn \"learn\"} value) {:state (assoc st :learning true :lo nil :hi nil :seen nil) :show {:learn true}}\n (and (sequential? value) (#{:learn \"learn\"} (first value)) (#{:off \"off\" 0} (second value)))\n {:state (dissoc st :learning) :show {:learn false}}\n ;; a glide: one step of it, scheduled to itself\n (and (= inlet 0) (vector? value) (= :scale-step (first value)))\n (let [[_ gen] value]\n (if (and (= gen (:gen st)) (:target st))\n (let [k (min 1 (/ tick (max 0.001 (/ ms 1000))))\n cur (+ (:cur st) (* k (- (:target st) (:cur st))))\n done (< (js/Math.abs (- (:target st) cur)) (* 1e-4 (max 1 (js/Math.abs (:target st)))))\n cur (if done (:target st) cur)]\n (cond-> {:state (assoc st :cur cur) :out [[0 (api/nice cur)]] :show {:v cur}}\n (not done) (assoc :later [[(+ at tick) 0 [:scale-step gen]]])))\n {:state st}))\n :else\n (if-let [v (number-in value)]\n (let [st (if (:learning st)\n (let [s (vec (take-last 512 (conj (or (:seen st) []) v)))]\n (assoc st :seen s :lo (apply min s) :hi (apply max s)))\n st)\n lo (or (:lo st) (:in-lo args)) hi (or (:hi st) (:in-hi args))\n target (out-of (lin v lo hi) args)]\n (if (and (pos? ms) (number? (:cur st)))\n (let [gen (inc (or (:gen st) 0))]\n {:state (assoc st :target target :gen gen) :later [[(+ at tick) 0 [:scale-step gen]]] :show {:v (:cur st)}})\n {:state (assoc st :cur target :target target) :out [[0 (api/nice target)]] :show {:v target}}))\n {:state st}))))\n\n ;; ── view ──\n :derive (fn [{:keys [shown args]}]\n {:label (str (if (:learn shown) \"learning… \" \"\")\n (api/nice (:in-lo args)) \"…\" (api/nice (:in-hi args)) \" → \" (api/nice (:out-lo args)) \"…\" (api/nice (:out-hi args))\n (when (:log args) \" log\"))\n :w (* 126 (api/clamp (if (number? (:v shown)) (lin (:v shown) (:out-lo args) (:out-hi args)) 0) 0 1))})\n :view [[:rect {:x 1 :y 1 :w 128 :h 22 :r 3 :stroke :accent :fill :bg}]\n [:rect {:x 2 :y 19 :w :$w :h 3 :r 1 :stroke nil :fill :accent}]\n [:text {:x 6 :y 15 :size 10.5} :$label]]})\n"
9
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kairotic/controls",
3
- "version": "0.1.0",
4
- "description": "Kairotic control components: knob (a rotary control) and keyboard (a virtual MIDI keyboard), with their own views in the patch",
3
+ "version": "0.2.0",
4
+ "description": "Kairotic control components: knob (a rotary control), keyboard (a virtual MIDI keyboard) and scale (a number from one range to another), with their own views in the patch",
5
5
  "author": "bonuoq",
6
6
  "license": "MPL-2.0",
7
7
  "repository": {
package/src/scale.cljs ADDED
@@ -0,0 +1,72 @@
1
+ ;; scale · a number from one range to another, straight or logarithmic, smoothed if asked
2
+ ;; Part of @kairotic/controls. Written against the Kairotic API (api/…). Discussion #135.
3
+ (let [lin (fn [v a b] (if (== a b) 0 (/ (- v a) (- b a))))
4
+ out-of (fn [u {:keys [out-lo out-hi log]}]
5
+ (let [u (api/clamp u 0 1)]
6
+ (if (and log (pos? out-lo) (pos? out-hi))
7
+ (* out-lo (js/Math.pow (/ out-hi out-lo) u))
8
+ (+ out-lo (* u (- out-hi out-lo))))))
9
+ ;; the number in a message: a number, the last number of a list ([:lx 0.3] from gamepad), or :value of a map
10
+ number-in (fn [v] (cond (number? v) v
11
+ (map? v) (let [x (:value v)] (when (number? x) x))
12
+ (sequential? v) (let [x (last v)] (when (number? x) x))
13
+ :else nil))
14
+ tick 0.02]
15
+ {;; ── about ──
16
+ :class "scale"
17
+ :license "MPL-2.0"
18
+ :doc "A number from one range (in-lo…in-hi, 0…1 by default) to another (out-lo…out-hi): straight, or with log in equal ratios (for frequencies, a cutoff, a speed: equal moves are equal intervals); clipped to the range, and reversed when out-hi is under out-lo. With ms, it glides there in that time (a jumpy sensor made smooth). It takes a number, a list whose last element is the number ([:lx 0.3] from gamepad), or a map with :value. learn: the next values it gets make the input range (move the controller from end to end), learn off stops. Between a controller (control, knob, motion…) and whatever it moves."
19
+ :usage "scale [in-lo in-hi out-lo out-hi] [log] [ms]"
20
+ :io [1 1]
21
+ :size [130 24]
22
+ :args [[:in-lo 0] [:in-hi 1] [:out-lo 0] [:out-hi 1] [:log false] [:ms 0]]
23
+ :help {:inlets ["a number (or [name value], or {:value v}); learn; learn off"]
24
+ :outlets ["the number in the new range"]
25
+ :messages [["learn" "the next values make the input range"] ["learn off" "keeps the range learnt"]]
26
+ :example "(box :b1 \"knob\" 40 30)\n(box :b2 \"scale 0 1 220 880 log 200\" 40 120)\n(box :b3 \"number\" 40 160)\n(connect :b1 0 :b2 0)\n(connect :b2 0 :b3 0)"
27
+ :try "Turn the knob: 220 to 880 Hz in equal steps of pitch, gliding 200 ms."
28
+ :see ["control" "knob" "mtof"]}
29
+
30
+ ;; ── logic ──
31
+ :receive (fn [{:keys [inlet value state args at]}]
32
+ (let [st (or state {})
33
+ lo (or (:lo st) (:in-lo args)) hi (or (:hi st) (:in-hi args))
34
+ ms (max 0 (:ms args))]
35
+ (cond
36
+ (#{:learn "learn"} value) {:state (assoc st :learning true :lo nil :hi nil :seen nil) :show {:learn true}}
37
+ (and (sequential? value) (#{:learn "learn"} (first value)) (#{:off "off" 0} (second value)))
38
+ {:state (dissoc st :learning) :show {:learn false}}
39
+ ;; a glide: one step of it, scheduled to itself
40
+ (and (= inlet 0) (vector? value) (= :scale-step (first value)))
41
+ (let [[_ gen] value]
42
+ (if (and (= gen (:gen st)) (:target st))
43
+ (let [k (min 1 (/ tick (max 0.001 (/ ms 1000))))
44
+ cur (+ (:cur st) (* k (- (:target st) (:cur st))))
45
+ done (< (js/Math.abs (- (:target st) cur)) (* 1e-4 (max 1 (js/Math.abs (:target st)))))
46
+ cur (if done (:target st) cur)]
47
+ (cond-> {:state (assoc st :cur cur) :out [[0 (api/nice cur)]] :show {:v cur}}
48
+ (not done) (assoc :later [[(+ at tick) 0 [:scale-step gen]]])))
49
+ {:state st}))
50
+ :else
51
+ (if-let [v (number-in value)]
52
+ (let [st (if (:learning st)
53
+ (let [s (vec (take-last 512 (conj (or (:seen st) []) v)))]
54
+ (assoc st :seen s :lo (apply min s) :hi (apply max s)))
55
+ st)
56
+ lo (or (:lo st) (:in-lo args)) hi (or (:hi st) (:in-hi args))
57
+ target (out-of (lin v lo hi) args)]
58
+ (if (and (pos? ms) (number? (:cur st)))
59
+ (let [gen (inc (or (:gen st) 0))]
60
+ {:state (assoc st :target target :gen gen) :later [[(+ at tick) 0 [:scale-step gen]]] :show {:v (:cur st)}})
61
+ {:state (assoc st :cur target :target target) :out [[0 (api/nice target)]] :show {:v target}}))
62
+ {:state st}))))
63
+
64
+ ;; ── view ──
65
+ :derive (fn [{:keys [shown args]}]
66
+ {:label (str (if (:learn shown) "learning… " "")
67
+ (api/nice (:in-lo args)) "…" (api/nice (:in-hi args)) " → " (api/nice (:out-lo args)) "…" (api/nice (:out-hi args))
68
+ (when (:log args) " log"))
69
+ :w (* 126 (api/clamp (if (number? (:v shown)) (lin (:v shown) (:out-lo args) (:out-hi args)) 0) 0 1))})
70
+ :view [[:rect {:x 1 :y 1 :w 128 :h 22 :r 3 :stroke :accent :fill :bg}]
71
+ [:rect {:x 2 :y 19 :w :$w :h 3 :r 1 :stroke nil :fill :accent}]
72
+ [:text {:x 6 :y 15 :size 10.5} :$label]]})