@vibes.diy/prompts 14.3.309 → 14.3.310
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/llms/hydra.d.ts +2 -0
- package/llms/hydra.js +41 -0
- package/llms/hydra.js.map +1 -0
- package/llms/hydra.md +983 -0
- package/llms/index.d.ts +2 -1
- package/llms/index.js +3 -0
- package/llms/index.js.map +1 -1
- package/llms/strudel.md +3 -0
- package/package.json +5 -5
package/llms/hydra.d.ts
ADDED
package/llms/hydra.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export const hydraConfig = {
|
|
2
|
+
name: "hydra",
|
|
3
|
+
label: "Hydra live-coded visuals",
|
|
4
|
+
description: "Live-coded video with Hydra, the browser video synth of the algorave scene, where a moving picture is a chain " +
|
|
5
|
+
"of functions written as text (osc, noise, voronoi, shape, kaleid, modulate, feedback through src(o0)): a " +
|
|
6
|
+
"sketch pad with an editor, examples, a callAI box that rewrites the sketch and a shared gallery; a video synth " +
|
|
7
|
+
"whose knobs write the sketch, with the camera as a source; VJ decks and full-screen visuals for a set; visuals " +
|
|
8
|
+
"that move with the room's sound or with a Strudel pattern's beat through a.fft. Covers the AGPL engine fetched " +
|
|
9
|
+
"after first paint by a pinned esm.sh dynamic import (never bundled, credited visibly), one canvas and a frame " +
|
|
10
|
+
"loop the app owns, running typed sketches with errors shown while the last good one plays, the verbatim " +
|
|
11
|
+
"text-to-sketch system prompt, the microphone and camera from a press. hydra, hydra-synth, live coding " +
|
|
12
|
+
"visuals, livecoding visuals, live visuals, video synth, vj, vjing, algorithmic video, generative video, " +
|
|
13
|
+
"audio-reactive visuals, algorave visuals, feedback visuals, kaleidoscope visuals",
|
|
14
|
+
needs: ["surface-stage"],
|
|
15
|
+
teaches: ["hydra-synth"],
|
|
16
|
+
cues: [
|
|
17
|
+
"hydra",
|
|
18
|
+
"hydra-synth",
|
|
19
|
+
"hydra synth",
|
|
20
|
+
"live coding visuals",
|
|
21
|
+
"live-coding visuals",
|
|
22
|
+
"livecoding visuals",
|
|
23
|
+
"live coded visuals",
|
|
24
|
+
"live-coded visuals",
|
|
25
|
+
"live visuals",
|
|
26
|
+
"video synth",
|
|
27
|
+
"video synthesizer",
|
|
28
|
+
"visual synth",
|
|
29
|
+
"vj",
|
|
30
|
+
"vjing",
|
|
31
|
+
"vj visuals",
|
|
32
|
+
"algorithmic video",
|
|
33
|
+
"algorithmic visuals",
|
|
34
|
+
"generative video",
|
|
35
|
+
"audio reactive visuals",
|
|
36
|
+
"audio-reactive visuals",
|
|
37
|
+
"algorave visuals",
|
|
38
|
+
"feedback visuals",
|
|
39
|
+
],
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=hydra.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydra.js","sourceRoot":"","sources":["../../jsr/llms/hydra.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,MAAM,WAAW,GAAc;IACpC,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,0BAA0B;IACjC,WAAW,EACT,gHAAgH;QAChH,2GAA2G;QAC3G,iHAAiH;QACjH,iHAAiH;QACjH,iHAAiH;QACjH,gHAAgH;QAChH,0GAA0G;QAC1G,wGAAwG;QACxG,0GAA0G;QAC1G,kFAAkF;IACpF,KAAK,EAAE,CAAC,eAAe,CAAC;IACxB,OAAO,EAAE,CAAC,aAAa,CAAC;IACxB,IAAI,EAAE;QACJ,OAAO;QACP,aAAa;QACb,aAAa;QACb,qBAAqB;QACrB,qBAAqB;QACrB,oBAAoB;QACpB,oBAAoB;QACpB,oBAAoB;QACpB,cAAc;QACd,aAAa;QACb,mBAAmB;QACnB,cAAc;QACd,IAAI;QACJ,OAAO;QACP,YAAY;QACZ,mBAAmB;QACnB,qBAAqB;QACrB,kBAAkB;QAClB,wBAAwB;QACxB,wBAAwB;QACxB,kBAAkB;QAClB,kBAAkB;KACnB;CACF,CAAC"}
|
package/llms/hydra.md
ADDED
|
@@ -0,0 +1,983 @@
|
|
|
1
|
+
# Hydra — live-coded video from chains of functions
|
|
2
|
+
|
|
3
|
+
When someone asks for live-coded visuals, Hydra, a video synth, VJ visuals for a
|
|
4
|
+
set or a party, algorithmic or generative video, feedback tunnels and
|
|
5
|
+
kaleidoscopes, visuals that move with the music, or a page where a model
|
|
6
|
+
rewrites the picture on request, this is the recipe. Hydra is a video synth
|
|
7
|
+
that runs on the GPU and is played **as text**:
|
|
8
|
+
`osc(8, 0.1, 1.2).kaleid(5).rotate(() => time * 0.1).out()` is a whole moving
|
|
9
|
+
picture, and a sketch can be typed by a person, written by knobs, saved as a
|
|
10
|
+
document, remixed, or produced by `callAI` from a sentence. It is the visual
|
|
11
|
+
side of the live-coding scene that Strudel and Tidal serve for music, and the
|
|
12
|
+
two play together (the third example below).
|
|
13
|
+
|
|
14
|
+
Hydra is the right call when the picture is a chain of video functions
|
|
15
|
+
(sources, geometry, colour, blending, modulation, feedback). A 3D scene with
|
|
16
|
+
meshes and a camera is the `three-js` skill's; a sketch that draws shapes
|
|
17
|
+
frame by frame with a pen is `p5`'s.
|
|
18
|
+
|
|
19
|
+
The worked examples are `jchris/hydra-pad` (an editor, example chips, a
|
|
20
|
+
prompt box that rewrites the sketch, saved sketches in a shared gallery),
|
|
21
|
+
`jchris/video-synth` (knobs that write the sketch, and the camera as a
|
|
22
|
+
source) and `jchris/beat-visuals` (a Strudel pattern whose beat drives a
|
|
23
|
+
Hydra sketch).
|
|
24
|
+
|
|
25
|
+
## The engine arrives after first paint
|
|
26
|
+
|
|
27
|
+
**Import the engine with its full pinned esm.sh URL inside a memoized
|
|
28
|
+
module-level loader**: `await import("https://esm.sh/hydra-synth@1.4.0")`,
|
|
29
|
+
called from the stage's mount effect, so the page paints first and a skeleton
|
|
30
|
+
holds the stage until the first frame (measured 2026-11-11: about 1.2 s for
|
|
31
|
+
the engine in Chromium, then frames at once). Visuals need no press, unlike
|
|
32
|
+
sound; the microphone and the camera each wait for theirs.
|
|
33
|
+
|
|
34
|
+
**Construct it with `makeGlobal: false`, `autoLoop: false` and
|
|
35
|
+
`detectAudio: false`.** The defaults put `osc`, `src`, `o0`, `time` and fifty
|
|
36
|
+
more names on `window` (where a Strudel engine on the same page defines its
|
|
37
|
+
own `sine`, `saw` and friends), run a frame loop nobody can stop, and ask for
|
|
38
|
+
the microphone the moment the page opens. With all three off, the names stay
|
|
39
|
+
on `hydra.synth`, the app runs its own `requestAnimationFrame` loop calling
|
|
40
|
+
`hydra.tick(dt)` (stopped when the stage unmounts), and the microphone waits
|
|
41
|
+
for a "Listen" press.
|
|
42
|
+
|
|
43
|
+
Hydra is AGPL-licensed. The app links to the engine at its own address, the
|
|
44
|
+
way a browser links to any page, so the two programs stay separate:
|
|
45
|
+
**credit Hydra visibly** (a footer line with a link to hydra.ojack.xyz is the
|
|
46
|
+
house shape), and keep its code at its URL rather than copied into the app.
|
|
47
|
+
|
|
48
|
+
**Run a sketch inside `with` blocks over the synth**, never with
|
|
49
|
+
`hydra.eval()`. Hydra's own `eval` runs code at global scope, so with
|
|
50
|
+
`makeGlobal: false` every name in the sketch is undefined.
|
|
51
|
+
`new Function("synth", "extras", "with (synth) { with (extras) {" + code + "} }")`
|
|
52
|
+
lets a sketch name `osc`, `src`, `o0` and `time` bare, sees the app's own
|
|
53
|
+
values (`a.fft`) first, and lets `speed = 2` or `bpm = 120` reach the synth
|
|
54
|
+
(measured: both land on `hydra.synth`). Arrow functions in the sketch keep
|
|
55
|
+
the scope, so `() => time * 0.1` reads the live clock every frame.
|
|
56
|
+
|
|
57
|
+
**A sketch that does not run throws, and the last good one keeps playing.**
|
|
58
|
+
A syntax error throws from `new Function` ("missing ) after argument list"),
|
|
59
|
+
an unknown function throws when the chain runs ("osc(...).wobble is not a
|
|
60
|
+
function"); `run()` returns `{ ok: false, message }` for both and the app
|
|
61
|
+
shows the message beside the editor. A custom GLSL function that fails to
|
|
62
|
+
compile is logged to the console by the engine and the picture holds.
|
|
63
|
+
|
|
64
|
+
## Project shape
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
App.jsx the interface: the stage, an editor or knobs, examples, the credit line
|
|
68
|
+
lib/hydra.js the loader, attach(), run(), hush(), listen(), startCamera(), hit(), EXAMPLES
|
|
69
|
+
lib/sketch-prompt.js the text-to-sketch system prompt for callAI
|
|
70
|
+
access.js who may publish a sketch to the shared gallery
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Relative imports include the extension (`./lib/hydra.js`). Everything that
|
|
74
|
+
touches the engine lives in the module, so `App.jsx` reads as an interface.
|
|
75
|
+
|
|
76
|
+
## Complete starter — a sketch pad
|
|
77
|
+
|
|
78
|
+
The engine module. `attach(el)` puts the one canvas in the stage and starts
|
|
79
|
+
the loop; `run(code)` shows a sketch; `audio.fft` is what sketches read as
|
|
80
|
+
`a.fft[0..3]`, filled by the microphone (`listen()`) or by the app (`hit()`);
|
|
81
|
+
`startCamera()` feeds the camera into `s0`.
|
|
82
|
+
|
|
83
|
+
### `lib/hydra.js`
|
|
84
|
+
```js
|
|
85
|
+
// lib/hydra.js — the video synth: one engine, one canvas, a loop the app owns.
|
|
86
|
+
const ENGINE_URL = "https://esm.sh/hydra-synth@1.4.0";
|
|
87
|
+
const WIDTH = 1280;
|
|
88
|
+
const HEIGHT = 720;
|
|
89
|
+
|
|
90
|
+
let enginePromise;
|
|
91
|
+
let raf = 0;
|
|
92
|
+
let owner = 0; // which attach() holds the canvas now; an older one's cleanup leaves it alone
|
|
93
|
+
let micStop = null;
|
|
94
|
+
let micStarting; // a listen() still waiting for permission, so a second press joins it
|
|
95
|
+
|
|
96
|
+
/** What sketches read as `a.fft[0..3]`: four bands from 0 to about 1, filled by listen() or by the app. */
|
|
97
|
+
export const audio = { fft: [0, 0, 0, 0] };
|
|
98
|
+
|
|
99
|
+
/** One download and one canvas however many times it is asked for. Never throws: null when it failed. */
|
|
100
|
+
export function loadHydra() {
|
|
101
|
+
enginePromise ??= (async () => {
|
|
102
|
+
const { default: Hydra } = await import(ENGINE_URL);
|
|
103
|
+
const canvas = document.createElement("canvas");
|
|
104
|
+
canvas.width = WIDTH;
|
|
105
|
+
canvas.height = HEIGHT;
|
|
106
|
+
canvas.style.cssText = "display:block;width:100%;height:100%;object-fit:cover";
|
|
107
|
+
const hydra = new Hydra({
|
|
108
|
+
canvas,
|
|
109
|
+
width: WIDTH,
|
|
110
|
+
height: HEIGHT,
|
|
111
|
+
makeGlobal: false, // osc, src, o0… stay on hydra.synth, not on window
|
|
112
|
+
autoLoop: false, // the loop below is ours, so it stops when the stage leaves
|
|
113
|
+
detectAudio: false, // no microphone prompt on load; listen() asks on a press
|
|
114
|
+
enableStreamCapture: false,
|
|
115
|
+
});
|
|
116
|
+
return { hydra, canvas };
|
|
117
|
+
})().catch((error) => {
|
|
118
|
+
enginePromise = undefined; // a later attempt may fetch again
|
|
119
|
+
console.warn("hydra failed to load", error);
|
|
120
|
+
return null;
|
|
121
|
+
});
|
|
122
|
+
return enginePromise;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Put the canvas in `el` and start the frame loop; the returned function takes both away.
|
|
127
|
+
* Resolves null when the engine did not load, so the stage can say so instead of going live.
|
|
128
|
+
*/
|
|
129
|
+
export async function attach(el) {
|
|
130
|
+
const engine = await loadHydra();
|
|
131
|
+
if (!engine || !el) return null;
|
|
132
|
+
const { hydra, canvas } = engine;
|
|
133
|
+
const mine = ++owner;
|
|
134
|
+
el.appendChild(canvas);
|
|
135
|
+
cancelAnimationFrame(raf);
|
|
136
|
+
let last = performance.now();
|
|
137
|
+
const frame = (now) => {
|
|
138
|
+
if (!micStop) for (let i = 0; i < 4; i++) audio.fft[i] *= 0.9; // hits fade unless the mic is filling the bands
|
|
139
|
+
hydra.tick(Math.min(now - last, 100));
|
|
140
|
+
last = now;
|
|
141
|
+
raf = requestAnimationFrame(frame);
|
|
142
|
+
};
|
|
143
|
+
raf = requestAnimationFrame(frame);
|
|
144
|
+
return () => {
|
|
145
|
+
if (owner !== mine) return; // a newer attach owns the canvas and the loop
|
|
146
|
+
cancelAnimationFrame(raf);
|
|
147
|
+
canvas.remove();
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Run a sketch. Hydra code is JavaScript that names its functions bare (osc, src, o0, time),
|
|
153
|
+
* so it runs inside `with` blocks over the synth and the app's own values; `speed = 2` and
|
|
154
|
+
* `bpm = 120` reach the synth. Returns { ok: true } or { ok: false, message } — the last good
|
|
155
|
+
* sketch keeps playing either way.
|
|
156
|
+
*/
|
|
157
|
+
export async function run(code, extras = {}) {
|
|
158
|
+
const engine = await loadHydra();
|
|
159
|
+
if (!engine) return { ok: false, message: "the video engine did not load — check the connection and run again" };
|
|
160
|
+
try {
|
|
161
|
+
const sketch = new Function("synth", "extras", `with (synth) { with (extras) {\n${code}\n} }`);
|
|
162
|
+
sketch(engine.hydra.synth, { a: audio, ...extras });
|
|
163
|
+
return { ok: true };
|
|
164
|
+
} catch (error) {
|
|
165
|
+
return { ok: false, message: String(error?.message || error) };
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** Blank every output and forget update(); the canvas stays, black. */
|
|
170
|
+
export async function hush() {
|
|
171
|
+
const engine = await enginePromise;
|
|
172
|
+
engine?.hydra.hush();
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** Kick one band of a.fft (0 bass … 3 treble) to `amount`; it fades on its own over a few frames. */
|
|
176
|
+
export function hit(band, amount = 1) {
|
|
177
|
+
audio.fft[band] = Math.max(audio.fft[band], amount);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Feed the camera into a source slot (s0 by default) from a press. Throws when the person says no,
|
|
182
|
+
* so the app can say so; returns a function that turns the camera off.
|
|
183
|
+
*/
|
|
184
|
+
export async function startCamera(slot = "s0") {
|
|
185
|
+
const engine = await loadHydra();
|
|
186
|
+
if (!engine) throw new Error("the video engine did not load");
|
|
187
|
+
const stream = await navigator.mediaDevices.getUserMedia({ video: { facingMode: "user" }, audio: false });
|
|
188
|
+
const video = document.createElement("video");
|
|
189
|
+
video.muted = true;
|
|
190
|
+
video.playsInline = true; // iOS plays inline only with this set
|
|
191
|
+
video.srcObject = stream;
|
|
192
|
+
await video.play();
|
|
193
|
+
engine.hydra.synth[slot].init({ src: video, dynamic: true });
|
|
194
|
+
return () => {
|
|
195
|
+
stream.getTracks().forEach((t) => t.stop());
|
|
196
|
+
engine.hydra.synth[slot].clear();
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/** Fill audio.fft from the microphone. Call from a press; returns a stop function. */
|
|
201
|
+
export async function listen() {
|
|
202
|
+
if (micStop) return micStop;
|
|
203
|
+
micStarting ??= openMic().finally(() => {
|
|
204
|
+
micStarting = undefined;
|
|
205
|
+
});
|
|
206
|
+
return micStarting;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
async function openMic() {
|
|
210
|
+
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
|
|
211
|
+
const ctx = new AudioContext();
|
|
212
|
+
await ctx.resume();
|
|
213
|
+
const analyser = ctx.createAnalyser();
|
|
214
|
+
analyser.fftSize = 256;
|
|
215
|
+
analyser.smoothingTimeConstant = 0.6;
|
|
216
|
+
ctx.createMediaStreamSource(stream).connect(analyser);
|
|
217
|
+
const bins = new Uint8Array(analyser.frequencyBinCount);
|
|
218
|
+
const bands = [[1, 4], [4, 12], [12, 40], [40, 100]];
|
|
219
|
+
let id = 0;
|
|
220
|
+
const read = () => {
|
|
221
|
+
analyser.getByteFrequencyData(bins);
|
|
222
|
+
bands.forEach(([from, to], i) => {
|
|
223
|
+
let sum = 0;
|
|
224
|
+
for (let k = from; k < to; k++) sum += bins[k];
|
|
225
|
+
audio.fft[i] = sum / (to - from) / 255;
|
|
226
|
+
});
|
|
227
|
+
id = requestAnimationFrame(read);
|
|
228
|
+
};
|
|
229
|
+
read();
|
|
230
|
+
micStop = () => {
|
|
231
|
+
cancelAnimationFrame(id);
|
|
232
|
+
stream.getTracks().forEach((t) => t.stop());
|
|
233
|
+
ctx.close();
|
|
234
|
+
audio.fft.fill(0);
|
|
235
|
+
micStop = null;
|
|
236
|
+
};
|
|
237
|
+
return micStop;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export const EXAMPLES = [
|
|
241
|
+
{ name: "kaleido bloom", code: `osc(8, 0.1, 1.2)\n .kaleid(5)\n .rotate(() => time * 0.1)\n .modulate(noise(2), 0.2)\n .out()` },
|
|
242
|
+
{ name: "feedback tunnel", code: `src(o0)\n .scale(1.01)\n .rotate(0.01)\n .blend(shape(4, 0.4, 0.01).color(1, 0.4, 0.8), 0.1)\n .out()` },
|
|
243
|
+
{ name: "voronoi tide", code: `voronoi(5, 0.3, 0.3)\n .color(0.2, 0.6, 1)\n .modulateScrollX(osc(3), 0.2)\n .out()` },
|
|
244
|
+
{ name: "pixel rain", code: `noise(4, 0.2)\n .thresh(0.5)\n .color(0.2, 1, 0.6)\n .pixelate(40, 30)\n .scrollY(0, -0.1)\n .out()` },
|
|
245
|
+
{ name: "sound bloom", code: `shape(6, () => 0.25 + a.fft[0] * 0.5, 0.01)\n .repeat(3, 3)\n .modulate(osc(6), () => a.fft[1] * 0.3)\n .color(1, () => 0.4 + a.fft[2], 0.9)\n .out()` },
|
|
246
|
+
];
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
The prompt the rewrite box sends. It is the verbatim system prompt for
|
|
250
|
+
turning a sentence into a sketch (its own section below); the module exports
|
|
251
|
+
it so any app can hand it to `callAI`.
|
|
252
|
+
|
|
253
|
+
### `lib/sketch-prompt.js`
|
|
254
|
+
```js
|
|
255
|
+
// lib/sketch-prompt.js — the system prompt for turning a sentence into a Hydra sketch.
|
|
256
|
+
// Hand it to callAI with the person's request and the current sketch; read back { name, code }.
|
|
257
|
+
export const SKETCH_PROMPT = `You write Hydra sketches. Hydra is a live-coding video synth: a sketch is a chain of functions that builds a moving image, ending in .out().
|
|
258
|
+
|
|
259
|
+
SOURCES start a chain: osc(frequency, sync, offset) stripes, noise(scale, offset), voronoi(scale, speed, blending), shape(sides, radius, smoothing), gradient(speed), solid(r, g, b, a), src(o0) reads an output back (feedback).
|
|
260
|
+
GEOMETRY: .rotate(angle, speed), .scale(amount, xMult, yMult), .kaleid(sides), .pixelate(x, y), .repeat(x, y), .scroll(x, y, speedX, speedY), .scrollX(amount, speed), .scrollY(amount, speed).
|
|
261
|
+
COLOR: .color(r, g, b), .colorama(amount), .hue(amount), .saturate(amount), .contrast(amount), .brightness(amount), .invert(), .luma(threshold), .thresh(threshold), .posterize(bins, gamma), .shift(r, g, b).
|
|
262
|
+
BLENDING with a second chain: .add(chain, amount), .blend(chain, amount), .diff(chain), .mult(chain, amount), .mask(chain), .layer(chain).
|
|
263
|
+
MODULATE moves pixels by a second chain: .modulate(chain, amount), .modulateRotate(chain, multiple), .modulateScale(chain, multiple), .modulateKaleid(chain, sides), .modulateScrollX(chain, amount), .modulatePixelate(chain, multiple).
|
|
264
|
+
OUTPUTS: .out() draws to o0, which is what shows. src(o0).scale(1.01).blend(…, 0.1).out() makes trails and tunnels.
|
|
265
|
+
|
|
266
|
+
MOTION. Any number can be a function of time: () => time * 0.1, () => Math.sin(time) * 0.5. An array steps through values: shape([3, 4, 5]).
|
|
267
|
+
SOUND. a.fft[0] (bass) to a.fft[3] (treble) run from 0 to about 1 while sound is on: () => 0.2 + a.fft[0] * 0.5.
|
|
268
|
+
|
|
269
|
+
OUTPUT. Only Hydra code: one chain ending in .out(), or a few lines each ending in .out(oN) with render() or one final .out(). No imports, no comments, no prose. Keep amounts small: rotate speeds under 0.5, modulate amounts under 0.5, scale feedback between 0.95 and 1.05.
|
|
270
|
+
|
|
271
|
+
EXAMPLES
|
|
272
|
+
Request: slow purple kaleidoscope
|
|
273
|
+
Sketch: osc(6, 0.05, 1).color(0.7, 0.2, 1).kaleid(6).rotate(() => time * 0.05).out()
|
|
274
|
+
Request: a glowing tunnel that pulls you in
|
|
275
|
+
Sketch: src(o0).scale(1.02).rotate(0.005).blend(shape(32, 0.3, 0.02).color(0.2, 0.8, 1), 0.08).out()
|
|
276
|
+
Request: glitchy green rain
|
|
277
|
+
Sketch: noise(8, 0.3).thresh(0.6).color(0, 1, 0.4).pixelate(60, 20).scrollY(0, -0.2).out()
|
|
278
|
+
Request: pulse with the bass
|
|
279
|
+
Sketch: shape(4, () => 0.2 + a.fft[0] * 0.6, 0.02).rotate(() => time * 0.2).modulate(noise(3), () => a.fft[1] * 0.2).out()`;
|
|
280
|
+
|
|
281
|
+
/** The full prompt for one request: the spec, the ask, and the sketch that is showing now. */
|
|
282
|
+
export function rewritePrompt(request, currentCode) {
|
|
283
|
+
return `${SKETCH_PROMPT}\n\nRequest: ${request}\nCurrent sketch (change it, or replace it when the request asks for something new):\n${currentCode}\n\nReturn JSON with "name" (two or three words) and "code" (the sketch).`;
|
|
284
|
+
}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
The interface: the stage, an editor, example chips, a prompt box that asks
|
|
288
|
+
`callAI` to rewrite the sketch, a "Listen to the room" button that makes
|
|
289
|
+
`a.fft` follow the microphone, full screen, and the saved sketches from
|
|
290
|
+
Fireproof with every write gated on `can`.
|
|
291
|
+
|
|
292
|
+
### `App.jsx`
|
|
293
|
+
```jsx
|
|
294
|
+
import React, { useEffect, useMemo, useRef, useState } from "react";
|
|
295
|
+
import { useFireproof } from "use-fireproof";
|
|
296
|
+
import { callAI, useVibe, useViewer } from "use-vibes";
|
|
297
|
+
import { Badge, Button, Card, Field, Heading, Input, Row, Skeleton, Spacer, Stack, Text } from "@vibes.diy/ui";
|
|
298
|
+
import { EXAMPLES, attach, listen, run } from "./lib/hydra.js";
|
|
299
|
+
import { rewritePrompt } from "./lib/sketch-prompt.js";
|
|
300
|
+
|
|
301
|
+
export default function App() {
|
|
302
|
+
const { database, useLiveQuery } = useFireproof("sketchPad");
|
|
303
|
+
const { me, can, ready } = useVibe("sketchPad");
|
|
304
|
+
const { requestLogin, ViewerTag } = useViewer();
|
|
305
|
+
const { docs } = useLiveQuery("type", { key: "sketch" });
|
|
306
|
+
const saved = useMemo(() => [...docs].sort((a, b) => (b.createdAt ?? 0) - (a.createdAt ?? 0)), [docs]);
|
|
307
|
+
|
|
308
|
+
const stage = useRef(null);
|
|
309
|
+
const [code, setCode] = useState(EXAMPLES[0].code);
|
|
310
|
+
const [live, setLive] = useState(false);
|
|
311
|
+
const [problem, setProblem] = useState(null);
|
|
312
|
+
const [ask, setAsk] = useState("");
|
|
313
|
+
const [asking, setAsking] = useState(false);
|
|
314
|
+
const [name, setName] = useState("");
|
|
315
|
+
const [hearing, setHearing] = useState(null); // the stop function while the mic is on
|
|
316
|
+
const alive = useRef(true); // false once the pad unmounts, so a late microphone is closed at once
|
|
317
|
+
|
|
318
|
+
// The engine arrives after first paint; the stage shows a skeleton until the first frame.
|
|
319
|
+
useEffect(() => {
|
|
320
|
+
let gone = false;
|
|
321
|
+
let detach = () => {};
|
|
322
|
+
attach(stage.current).then(async (d) => {
|
|
323
|
+
if (gone) return d?.();
|
|
324
|
+
if (!d) return setProblem("the video engine did not load — check the connection and reload the page");
|
|
325
|
+
detach = d;
|
|
326
|
+
const result = await run(code);
|
|
327
|
+
if (!result.ok) setProblem(result.message);
|
|
328
|
+
setLive(true);
|
|
329
|
+
});
|
|
330
|
+
return () => {
|
|
331
|
+
gone = true;
|
|
332
|
+
detach();
|
|
333
|
+
};
|
|
334
|
+
}, []);
|
|
335
|
+
useEffect(() => () => hearing?.(), [hearing]);
|
|
336
|
+
useEffect(() => () => void (alive.current = false), []);
|
|
337
|
+
|
|
338
|
+
async function show(source = code) {
|
|
339
|
+
const result = await run(source);
|
|
340
|
+
setProblem(result.ok ? null : result.message);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
function pick(next) {
|
|
344
|
+
setCode(next);
|
|
345
|
+
show(next);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
async function rewrite() {
|
|
349
|
+
if (!ask.trim() || asking) return;
|
|
350
|
+
setAsking(true);
|
|
351
|
+
try {
|
|
352
|
+
const reply = await callAI(rewritePrompt(ask, code), {
|
|
353
|
+
schema: { properties: { name: { type: "string" }, code: { type: "string" } } },
|
|
354
|
+
});
|
|
355
|
+
const next = JSON.parse(reply);
|
|
356
|
+
setAsk("");
|
|
357
|
+
pick(next.code);
|
|
358
|
+
} catch {
|
|
359
|
+
setProblem("the rewrite did not come back — press Rewrite to ask again");
|
|
360
|
+
} finally {
|
|
361
|
+
setAsking(false);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
async function toggleListening() {
|
|
366
|
+
if (hearing) {
|
|
367
|
+
hearing();
|
|
368
|
+
setHearing(null);
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
try {
|
|
372
|
+
const stop = await listen();
|
|
373
|
+
if (!alive.current) return stop(); // the pad closed while the permission prompt was up
|
|
374
|
+
setHearing(() => stop);
|
|
375
|
+
} catch {
|
|
376
|
+
setProblem("the microphone stayed off, so a.fft reads zero — sketches still play");
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
const draft = { type: "sketch", name: name || "untitled", code, authorHandle: me?.userHandle };
|
|
381
|
+
const verdict = can.create(draft);
|
|
382
|
+
|
|
383
|
+
async function keep() {
|
|
384
|
+
setName("");
|
|
385
|
+
const { ok } = await database.put({ ...draft, createdAt: Date.now() });
|
|
386
|
+
if (!ok) setName((now) => now || name);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
return (
|
|
390
|
+
<main className="min-h-screen bg-background text-foreground p-4 md:p-8">
|
|
391
|
+
<Stack gap={4}>
|
|
392
|
+
<Row gap={2} align="center" wrap>
|
|
393
|
+
<Heading level={1}>Sketch Pad</Heading>
|
|
394
|
+
<Spacer />
|
|
395
|
+
<Badge tone={live ? "up" : "idle"}>{live ? "Live" : "Warming up the synth…"}</Badge>
|
|
396
|
+
</Row>
|
|
397
|
+
|
|
398
|
+
<div ref={stage} className="relative aspect-video w-full overflow-hidden rounded-md bg-neutral">
|
|
399
|
+
{!live && <div aria-busy="true" className="absolute inset-0"><Skeleton variant="card" /></div>}
|
|
400
|
+
</div>
|
|
401
|
+
|
|
402
|
+
<Row gap={2} align="center" wrap>
|
|
403
|
+
<Button onClick={() => show()}>Run</Button>
|
|
404
|
+
<Button variant="quiet" onClick={() => stage.current?.requestFullscreen?.()}>Full screen</Button>
|
|
405
|
+
<Button variant="quiet" onClick={toggleListening}>{hearing ? "Stop listening" : "Listen to the room"}</Button>
|
|
406
|
+
<Text size="sm" muted>Ctrl+Enter runs the editor</Text>
|
|
407
|
+
</Row>
|
|
408
|
+
|
|
409
|
+
<textarea
|
|
410
|
+
value={code}
|
|
411
|
+
onChange={(e) => setCode(e.target.value)}
|
|
412
|
+
onKeyDown={(e) => { if ((e.ctrlKey || e.metaKey) && e.key === "Enter") { e.preventDefault(); show(); } }}
|
|
413
|
+
spellCheck={false}
|
|
414
|
+
rows={7}
|
|
415
|
+
aria-label="Hydra sketch"
|
|
416
|
+
className="w-full rounded-md border border-border bg-card p-3 font-mono text-sm text-foreground outline-none"
|
|
417
|
+
/>
|
|
418
|
+
{problem && <Text size="sm" tone="down">That sketch needs a tweak: {problem}. The last good one keeps playing.</Text>}
|
|
419
|
+
|
|
420
|
+
<Row gap={2} wrap>
|
|
421
|
+
{EXAMPLES.map((ex) => (
|
|
422
|
+
<Button key={ex.name} size="sm" variant="quiet" onClick={() => pick(ex.code)}>{ex.name}</Button>
|
|
423
|
+
))}
|
|
424
|
+
</Row>
|
|
425
|
+
|
|
426
|
+
<Card variant="tight">
|
|
427
|
+
<Row gap={2} align="top" wrap>
|
|
428
|
+
<Field label="Ask for a change">{(id, d) => <Input id={id} describedBy={d} value={ask} onChange={setAsk} placeholder="slower, and more purple" />}</Field>
|
|
429
|
+
<Button size="sm" onClick={rewrite} disabled={asking}>{asking ? "Rewriting…" : "Rewrite"}</Button>
|
|
430
|
+
</Row>
|
|
431
|
+
</Card>
|
|
432
|
+
|
|
433
|
+
<Card variant="tight">
|
|
434
|
+
<Stack gap={3}>
|
|
435
|
+
<Heading level={2}>Keep this sketch</Heading>
|
|
436
|
+
{!ready && <div aria-busy="true"><Skeleton variant="row" /></div>}
|
|
437
|
+
{ready && !me && <Row gap={2} align="center" wrap><Text muted>Sign in and your sketches stay with you.</Text><Button size="sm" variant="quiet" onClick={requestLogin}>Sign in to keep sketches</Button></Row>}
|
|
438
|
+
{ready && me && verdict.ok && (
|
|
439
|
+
<Row gap={2} align="top" wrap>
|
|
440
|
+
<Field label="Name">{(id, d) => <Input id={id} describedBy={d} value={name} onChange={setName} placeholder="midnight bloom" />}</Field>
|
|
441
|
+
<Button size="sm" onClick={keep}>Keep</Button>
|
|
442
|
+
</Row>
|
|
443
|
+
)}
|
|
444
|
+
{saved.map((s) => (
|
|
445
|
+
<Row key={s._id} gap={2} align="center" wrap>
|
|
446
|
+
<Button size="sm" variant="quiet" onClick={() => pick(s.code)}>{s.name}</Button>
|
|
447
|
+
{s.authorHandle && <ViewerTag userHandle={s.authorHandle} />}
|
|
448
|
+
<Spacer />
|
|
449
|
+
{can.delete(s).ok && <Button size="sm" variant="quiet" tone="down" onClick={() => database.del(s._id)}>Remove</Button>}
|
|
450
|
+
</Row>
|
|
451
|
+
))}
|
|
452
|
+
</Stack>
|
|
453
|
+
</Card>
|
|
454
|
+
|
|
455
|
+
<Text size="sm" muted>
|
|
456
|
+
Video by <a className="underline" href="https://hydra.ojack.xyz" target="_blank" rel="noreferrer">Hydra</a> (AGPL), fetched from its own address when the page opens.
|
|
457
|
+
</Text>
|
|
458
|
+
</Stack>
|
|
459
|
+
</main>
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
### `access.js`
|
|
465
|
+
```js
|
|
466
|
+
// sketch: a saved Hydra sketch. Anyone signed in keeps their own; everyone can read the gallery.
|
|
467
|
+
export function sketchPad(doc, oldDoc, user, ctx) {
|
|
468
|
+
if (!user) throw { forbidden: "sign in to keep sketches" };
|
|
469
|
+
if (doc.type === "sketch" || (doc._deleted && oldDoc && oldDoc.type === "sketch")) {
|
|
470
|
+
const author = oldDoc ? oldDoc.authorHandle : doc.authorHandle;
|
|
471
|
+
if (author !== user.userHandle || (!doc._deleted && doc.authorHandle !== user.userHandle)) throw { forbidden: "sign your sketch with your own handle" };
|
|
472
|
+
return { channels: ["sketches"], grant: { public: ["sketches"] } };
|
|
473
|
+
}
|
|
474
|
+
throw { forbidden: "unknown document type" };
|
|
475
|
+
}
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
## The language in one table
|
|
479
|
+
|
|
480
|
+
A sketch is a chain: one **source**, then any number of transforms, ending in
|
|
481
|
+
`.out()`. Every argument can be a number, a function of `time`
|
|
482
|
+
(`() => Math.sin(time) * 0.5`), or an array that steps through values
|
|
483
|
+
(`shape([3, 4, 5])`, with `.fast(2)` to step twice as often).
|
|
484
|
+
|
|
485
|
+
| kind | functions | what they do |
|
|
486
|
+
| ---- | --------- | ------------ |
|
|
487
|
+
| source | `osc(freq, sync, offset)`, `noise(scale, offset)`, `voronoi(scale, speed, blend)`, `shape(sides, radius, smoothing)`, `gradient(speed)`, `solid(r, g, b, a)`, `src(o0)` | start a picture; `src` reads an output or a source slot |
|
|
488
|
+
| geometry | `.rotate(angle, speed)`, `.scale(amount)`, `.kaleid(sides)`, `.pixelate(x, y)`, `.repeat(x, y)`, `.scroll(x, y, speedX, speedY)`, `.scrollX`, `.scrollY` | move and fold the pixels |
|
|
489
|
+
| colour | `.color(r, g, b)`, `.colorama(amount)`, `.hue(amount)`, `.saturate`, `.contrast`, `.brightness`, `.invert()`, `.luma(threshold)`, `.thresh(threshold)`, `.posterize(bins)`, `.shift(r, g, b)` | change the colours |
|
|
490
|
+
| blend | `.add(chain, amount)`, `.blend(chain, amount)`, `.diff(chain)`, `.mult(chain, amount)`, `.mask(chain)`, `.layer(chain)` | combine with a second chain |
|
|
491
|
+
| modulate | `.modulate(chain, amount)`, `.modulateRotate`, `.modulateScale`, `.modulateKaleid`, `.modulateScrollX`, `.modulatePixelate` | move these pixels by a second chain's colours |
|
|
492
|
+
| output | `.out()` (o0), `.out(o1)`, `render()` shows all four, `render(o2)` shows one | where the chain draws |
|
|
493
|
+
|
|
494
|
+
**Feedback is `src(o0)` inside the chain that draws to `o0`**:
|
|
495
|
+
`src(o0).scale(1.01).rotate(0.01).blend(shape(4), 0.1).out()` leaves trails,
|
|
496
|
+
tunnels and smears. Keep the scale near 1 (0.95 to 1.05) and the blend small,
|
|
497
|
+
or the frame floods to one colour in a second.
|
|
498
|
+
|
|
499
|
+
**Four outputs (`o0`–`o3`) and four sources (`s0`–`s3`).** An output is a
|
|
500
|
+
chain's canvas; a source is outside pixels: `s0` holds the camera after
|
|
501
|
+
`startCamera("s0")`, `s1.initImage(url)` an image, `s2.initVideo(url)` a
|
|
502
|
+
looping video (both need a CORS-open URL, or the frame stays black).
|
|
503
|
+
|
|
504
|
+
**`speed = 0.5` slows every clock in the sketch; `bpm = 120` sets the rate an
|
|
505
|
+
array steps at.** Both are plain assignments in the sketch, and both land on
|
|
506
|
+
the synth through the `with` block.
|
|
507
|
+
|
|
508
|
+
## The interface writes the sketch
|
|
509
|
+
|
|
510
|
+
The pad above is the editor shape. The other shape is the one most people
|
|
511
|
+
want: **knobs, buttons and grids that compile to a sketch string** and
|
|
512
|
+
re-run it as they move. A knob is a number dropped into the string; the
|
|
513
|
+
effect that runs the sketch depends on the string, so every move swaps the
|
|
514
|
+
picture without a gap. Show the string the knobs wrote, so the person can
|
|
515
|
+
carry it into any Hydra editor, and learn the language by watching it change.
|
|
516
|
+
|
|
517
|
+
A video synth whose knobs write the sketch, with the camera as a source:
|
|
518
|
+
|
|
519
|
+
### `App.jsx`
|
|
520
|
+
```jsx app=video-synth
|
|
521
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
522
|
+
import { Badge, Button, Card, Heading, Row, Skeleton, Spacer, Stack, Text } from "@vibes.diy/ui";
|
|
523
|
+
import { Slider } from "@vibes.diy/ui/interactive";
|
|
524
|
+
import { attach, run, startCamera } from "./lib/hydra.js";
|
|
525
|
+
|
|
526
|
+
// Each knob is a number dropped into one sketch string; every move re-runs it.
|
|
527
|
+
const KNOBS = [
|
|
528
|
+
{ key: "sides", label: "Mirror", min: 1, max: 12, step: 1 },
|
|
529
|
+
{ key: "warp", label: "Warp", min: 0, max: 0.6, step: 0.01 },
|
|
530
|
+
{ key: "trail", label: "Trails", min: 0, max: 0.95, step: 0.01 },
|
|
531
|
+
{ key: "spin", label: "Spin", min: -0.5, max: 0.5, step: 0.01 },
|
|
532
|
+
{ key: "hue", label: "Colour drift", min: 0, max: 0.3, step: 0.01 },
|
|
533
|
+
];
|
|
534
|
+
const START = { sides: 4, warp: 0.2, trail: 0.6, spin: 0.1, hue: 0.05 };
|
|
535
|
+
|
|
536
|
+
function toSketch(k, camera) {
|
|
537
|
+
const source = camera ? "src(s0).saturate(1.4)" : "osc(10, 0.08, 1.2)";
|
|
538
|
+
return [
|
|
539
|
+
`${source}`,
|
|
540
|
+
` .modulate(noise(2.5), ${k.warp})`,
|
|
541
|
+
` .kaleid(${k.sides})`,
|
|
542
|
+
` .rotate(() => time * ${k.spin})`,
|
|
543
|
+
` .colorama(${k.hue})`,
|
|
544
|
+
` .blend(src(o0).scale(1.01), ${k.trail})`,
|
|
545
|
+
` .out()`,
|
|
546
|
+
].join("\n");
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
export default function App() {
|
|
550
|
+
const stage = useRef(null);
|
|
551
|
+
const [knobs, setKnobs] = useState(START);
|
|
552
|
+
const [camera, setCamera] = useState(false);
|
|
553
|
+
const [live, setLive] = useState(false);
|
|
554
|
+
const [note, setNote] = useState(null);
|
|
555
|
+
const cameraOff = useRef(null);
|
|
556
|
+
const alive = useRef(true); // false once the synth unmounts, so a late camera is stopped at once
|
|
557
|
+
const asking = useRef(false); // one camera request at a time
|
|
558
|
+
const code = toSketch(knobs, camera);
|
|
559
|
+
|
|
560
|
+
useEffect(() => {
|
|
561
|
+
let gone = false;
|
|
562
|
+
let detach = () => {};
|
|
563
|
+
attach(stage.current).then((d) => {
|
|
564
|
+
if (gone) return d?.();
|
|
565
|
+
if (!d) return setNote("The video engine did not load. Check the connection and reload the page.");
|
|
566
|
+
detach = d;
|
|
567
|
+
setLive(true);
|
|
568
|
+
});
|
|
569
|
+
return () => {
|
|
570
|
+
gone = true;
|
|
571
|
+
alive.current = false;
|
|
572
|
+
detach();
|
|
573
|
+
cameraOff.current?.();
|
|
574
|
+
};
|
|
575
|
+
}, []);
|
|
576
|
+
|
|
577
|
+
// The interface writes the sketch: any change re-runs it, and the synth swaps without a gap.
|
|
578
|
+
useEffect(() => {
|
|
579
|
+
if (live) run(code).then((r) => setNote(r.ok ? null : r.message));
|
|
580
|
+
}, [live, code]);
|
|
581
|
+
|
|
582
|
+
async function cameraOn() {
|
|
583
|
+
if (asking.current) return;
|
|
584
|
+
asking.current = true;
|
|
585
|
+
try {
|
|
586
|
+
const off = await startCamera("s0"); // asks from this press; the sketch reads it as s0
|
|
587
|
+
if (!alive.current) return off(); // the synth closed while the permission prompt was up
|
|
588
|
+
cameraOff.current = off;
|
|
589
|
+
setCamera(true);
|
|
590
|
+
setNote(null);
|
|
591
|
+
} catch {
|
|
592
|
+
setNote("The camera stayed off, so the synth plays its own stripes. Allow the camera and press again.");
|
|
593
|
+
} finally {
|
|
594
|
+
asking.current = false;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
function cameraBack() {
|
|
599
|
+
cameraOff.current?.();
|
|
600
|
+
cameraOff.current = null;
|
|
601
|
+
setCamera(false);
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
return (
|
|
605
|
+
<main className="min-h-screen bg-background text-foreground p-4 md:p-8">
|
|
606
|
+
<Stack gap={4}>
|
|
607
|
+
<Row gap={2} align="center" wrap>
|
|
608
|
+
<Heading level={1}>Video Synth</Heading>
|
|
609
|
+
<Spacer />
|
|
610
|
+
<Badge tone={live ? "up" : "idle"}>{live ? (camera ? "Camera in" : "Live") : "Warming up…"}</Badge>
|
|
611
|
+
</Row>
|
|
612
|
+
|
|
613
|
+
<div ref={stage} className="relative aspect-video w-full overflow-hidden rounded-md bg-neutral">
|
|
614
|
+
{!live && <div aria-busy="true" className="absolute inset-0"><Skeleton variant="card" /></div>}
|
|
615
|
+
</div>
|
|
616
|
+
|
|
617
|
+
<Card variant="tight">
|
|
618
|
+
<Stack gap={3}>
|
|
619
|
+
{KNOBS.map((k) => (
|
|
620
|
+
<Row key={k.key} gap={3} align="center">
|
|
621
|
+
<Slider value={[knobs[k.key]]} onChange={([v]) => setKnobs((now) => ({ ...now, [k.key]: v }))} min={k.min} max={k.max} step={k.step} label={k.label} />
|
|
622
|
+
<Text size="sm" muted>{k.label} {knobs[k.key]}</Text>
|
|
623
|
+
</Row>
|
|
624
|
+
))}
|
|
625
|
+
</Stack>
|
|
626
|
+
</Card>
|
|
627
|
+
|
|
628
|
+
<Row gap={2} wrap>
|
|
629
|
+
<Button onClick={camera ? cameraBack : cameraOn}>{camera ? "Back to stripes" : "Use my camera"}</Button>
|
|
630
|
+
<Button variant="quiet" onClick={() => setKnobs(START)}>Reset knobs</Button>
|
|
631
|
+
<Button variant="quiet" onClick={() => stage.current?.requestFullscreen?.()}>Full screen</Button>
|
|
632
|
+
</Row>
|
|
633
|
+
{note && <Text size="sm" tone="down">{note}</Text>}
|
|
634
|
+
|
|
635
|
+
<Card variant="tight">
|
|
636
|
+
<Stack gap={1}>
|
|
637
|
+
<Text size="sm" muted>The sketch these knobs write — paste it into any Hydra editor</Text>
|
|
638
|
+
<pre className="whitespace-pre-wrap font-mono text-sm">{code}</pre>
|
|
639
|
+
</Stack>
|
|
640
|
+
</Card>
|
|
641
|
+
|
|
642
|
+
<Text size="sm" muted>
|
|
643
|
+
Video by <a className="underline" href="https://hydra.ojack.xyz" target="_blank" rel="noreferrer">Hydra</a> (AGPL), fetched from its own address when the page opens.
|
|
644
|
+
</Text>
|
|
645
|
+
</Stack>
|
|
646
|
+
</main>
|
|
647
|
+
);
|
|
648
|
+
}
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
**The camera is a press, then `s0`.** `startCamera("s0")` asks for the
|
|
652
|
+
camera from the press that called it, plays it into a `<video>` with
|
|
653
|
+
`playsInline` (iOS shows a camera inline only with it), and hands it to the
|
|
654
|
+
slot; the sketch reads it as `src(s0)`. When the person says no, the call
|
|
655
|
+
throws, and the app says the synth plays its own stripes until the camera is
|
|
656
|
+
allowed. The function it returns stops the camera; call it on the way back
|
|
657
|
+
and in the unmount cleanup, so the camera light goes off with the page.
|
|
658
|
+
|
|
659
|
+
## Sound makes it move
|
|
660
|
+
|
|
661
|
+
**A sketch reads sound as `a.fft[0]` (bass) to `a.fft[3]` (treble), each from
|
|
662
|
+
0 to about 1**, the same names Hydra's own editor uses, so sketches people
|
|
663
|
+
share in the Hydra community run as written. The engine's own audio reader
|
|
664
|
+
asks for the microphone when the page opens, so it stays off
|
|
665
|
+
(`detectAudio: false`) and `lib/hydra.js` owns `a` instead. Two things fill it:
|
|
666
|
+
|
|
667
|
+
- **The room, through `listen()`**: from a "Listen" press it opens the
|
|
668
|
+
microphone, reads four bands from an `AnalyserNode` every frame, and returns
|
|
669
|
+
the function that closes the microphone. A sketch such as
|
|
670
|
+
`shape(6, () => 0.25 + a.fft[0] * 0.5).out()` breathes with whatever is
|
|
671
|
+
playing in the room.
|
|
672
|
+
- **The app's own music, through `hit(band, amount)`**: each event the app
|
|
673
|
+
plays kicks one band to `amount`, and the frame loop lets it fall back
|
|
674
|
+
(each band keeps 90% per frame), so a kick is a flash that fades in about
|
|
675
|
+
half a second.
|
|
676
|
+
|
|
677
|
+
A Strudel pattern driving a Hydra sketch is the second case. Strudel's
|
|
678
|
+
`onTrigger` hands every sounding event to the app at the moment it is
|
|
679
|
+
scheduled; a `setTimeout` of `(targetTime - time) * 1000` lands the `hit` on
|
|
680
|
+
the beat, and the event's sound name picks the band (kick to `a.fft[0]`,
|
|
681
|
+
snare and clap to `a.fft[1]`, hats to `a.fft[2]`, notes to `a.fft[3]`). The
|
|
682
|
+
pattern side is the Strudel doc's `lib/strudel.js`, unchanged; this is the
|
|
683
|
+
visual half, and a set is the pair:
|
|
684
|
+
|
|
685
|
+
### `lib/sets.js`
|
|
686
|
+
```js app=beat-visuals
|
|
687
|
+
// lib/sets.js — a set is a Strudel pattern and the Hydra sketch it drives.
|
|
688
|
+
// The beat reaches the sketch as a.fft: kick → a.fft[0], snare and clap → a.fft[1], hats → a.fft[2], notes → a.fft[3].
|
|
689
|
+
export const SETS = [
|
|
690
|
+
{
|
|
691
|
+
name: "kick bloom",
|
|
692
|
+
pattern: `stack(\n s("bd*4, ~ cp ~ cp, hh*8").bank("RolandTR909"),\n note("<c2 c2 eb2 g1>").s("sawtooth").lpf(700).gain(0.5)\n).cpm(124/4)`,
|
|
693
|
+
sketch: `shape(4, () => 0.15 + a.fft[0] * 0.35, 0.02)\n .color(1, 0.3, () => 0.5 + a.fft[1] * 0.5)\n .rotate(() => time * 0.2)\n .modulate(noise(3), () => a.fft[2] * 0.15)\n .out()`,
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
name: "tunnel break",
|
|
697
|
+
pattern: `s("bd ~ [~ bd] ~, ~ sd ~ sd, hh*8").bank("RolandTR808").cpm(92/4)`,
|
|
698
|
+
sketch: `src(o0)\n .scale(() => 1.01 + a.fft[0] * 0.05)\n .rotate(0.004)\n .blend(osc(20, 0.05, 1).kaleid(4).mask(shape(4, 0.2, 0.05)), () => 0.05 + a.fft[1] * 0.3)\n .out()`,
|
|
699
|
+
},
|
|
700
|
+
{
|
|
701
|
+
name: "acid voronoi",
|
|
702
|
+
pattern: `stack(\n s("bd*4"),\n note("c2 [eb2 c2] g1 [c2 bb1]").s("sawtooth").lpf(sine.range(300, 2000).slow(4)).resonance(10).gain(0.6)\n).cpm(130/4)`,
|
|
703
|
+
sketch: `voronoi(6, 0.3, 0.2)\n .color(0.2, () => 0.6 + a.fft[3] * 0.4, 1)\n .modulateScale(osc(4), () => a.fft[0] * 0.4)\n .colorama(() => a.fft[3] * 0.1)\n .out()`,
|
|
704
|
+
},
|
|
705
|
+
];
|
|
706
|
+
|
|
707
|
+
/** Which band of a.fft a sounding event kicks. */
|
|
708
|
+
export function bandFor(value) {
|
|
709
|
+
const s = String(value?.s ?? "");
|
|
710
|
+
if (/bd|kick/.test(s)) return 0;
|
|
711
|
+
if (/sd|cp|rim|snare|clap/.test(s)) return 1;
|
|
712
|
+
if (/hh|oh|cr|hat/.test(s)) return 2;
|
|
713
|
+
return 3;
|
|
714
|
+
}
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
### `App.jsx`
|
|
718
|
+
```jsx app=beat-visuals
|
|
719
|
+
import React, { useEffect, useMemo, useRef, useState } from "react";
|
|
720
|
+
import { useFireproof } from "use-fireproof";
|
|
721
|
+
import { useVibe, useViewer } from "use-vibes";
|
|
722
|
+
import { Badge, Button, Card, Field, Heading, Input, Row, Skeleton, Spacer, Stack, Text } from "@vibes.diy/ui";
|
|
723
|
+
import { attach, hit, run } from "./lib/hydra.js";
|
|
724
|
+
import { onPatternError, play, stop } from "./lib/strudel.js";
|
|
725
|
+
import { SETS, bandFor } from "./lib/sets.js";
|
|
726
|
+
|
|
727
|
+
const editorClass = "w-full rounded-md border border-border bg-card p-3 font-mono text-sm text-foreground outline-none";
|
|
728
|
+
|
|
729
|
+
export default function App() {
|
|
730
|
+
const { database, useLiveQuery } = useFireproof("beatVisuals");
|
|
731
|
+
const { me, can, ready } = useVibe("beatVisuals");
|
|
732
|
+
const { requestLogin, ViewerTag } = useViewer();
|
|
733
|
+
const { docs } = useLiveQuery("type", { key: "set" });
|
|
734
|
+
const saved = useMemo(() => [...docs].sort((a, b) => (b.createdAt ?? 0) - (a.createdAt ?? 0)), [docs]);
|
|
735
|
+
|
|
736
|
+
const stage = useRef(null);
|
|
737
|
+
const timers = useRef([]);
|
|
738
|
+
const [pattern, setPattern] = useState(SETS[0].pattern);
|
|
739
|
+
const [sketch, setSketch] = useState(SETS[0].sketch);
|
|
740
|
+
const [live, setLive] = useState(false);
|
|
741
|
+
const [sound, setSound] = useState("idle"); // idle | loading | playing
|
|
742
|
+
const [problem, setProblem] = useState(null);
|
|
743
|
+
const [name, setName] = useState("");
|
|
744
|
+
|
|
745
|
+
useEffect(() => {
|
|
746
|
+
let gone = false;
|
|
747
|
+
let detach = () => {};
|
|
748
|
+
attach(stage.current).then(async (d) => {
|
|
749
|
+
if (gone) return d?.();
|
|
750
|
+
if (!d) return setProblem("the video engine, which did not load — check the connection and reload the page");
|
|
751
|
+
detach = d;
|
|
752
|
+
await run(sketch);
|
|
753
|
+
setLive(true);
|
|
754
|
+
});
|
|
755
|
+
return () => {
|
|
756
|
+
gone = true;
|
|
757
|
+
detach();
|
|
758
|
+
stop();
|
|
759
|
+
timers.current.forEach(clearTimeout);
|
|
760
|
+
};
|
|
761
|
+
}, []);
|
|
762
|
+
useEffect(() => onPatternError((e) => setProblem(`the pattern: ${e.message || e}`)), []);
|
|
763
|
+
|
|
764
|
+
// Every sounding event kicks a band of a.fft at the moment it sounds.
|
|
765
|
+
function onEvent(hap, time, cps, target) {
|
|
766
|
+
const delay = Math.max(0, (target - time) * 1000);
|
|
767
|
+
timers.current.push(setTimeout(() => hit(bandFor(hap.value), hap.value?.gain ?? 1), delay));
|
|
768
|
+
if (timers.current.length > 256) timers.current = timers.current.slice(-128);
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
async function go(nextPattern = pattern, nextSketch = sketch) {
|
|
772
|
+
setProblem(null);
|
|
773
|
+
const wasPlaying = sound === "playing";
|
|
774
|
+
if (!wasPlaying) setSound("loading");
|
|
775
|
+
// play() first: it unlocks audio before its first await, while this is still the press.
|
|
776
|
+
const playing = play(nextPattern, onEvent);
|
|
777
|
+
const shown = await run(nextSketch);
|
|
778
|
+
if (!shown.ok) setProblem(`the sketch: ${shown.message}`);
|
|
779
|
+
const ok = await playing;
|
|
780
|
+
setSound(ok ? "playing" : wasPlaying ? "playing" : "idle");
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
async function halt() {
|
|
784
|
+
await stop();
|
|
785
|
+
timers.current.forEach(clearTimeout);
|
|
786
|
+
timers.current = [];
|
|
787
|
+
setSound("idle");
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
function pick(set) {
|
|
791
|
+
setPattern(set.pattern);
|
|
792
|
+
setSketch(set.sketch);
|
|
793
|
+
if (sound === "playing") go(set.pattern, set.sketch);
|
|
794
|
+
else run(set.sketch);
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
const draft = { type: "set", name: name || "untitled", pattern, sketch, authorHandle: me?.userHandle };
|
|
798
|
+
const verdict = can.create(draft);
|
|
799
|
+
|
|
800
|
+
async function keep() {
|
|
801
|
+
setName("");
|
|
802
|
+
const { ok } = await database.put({ ...draft, createdAt: Date.now() });
|
|
803
|
+
if (!ok) setName((now) => now || name);
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
const runKeys = (e) => {
|
|
807
|
+
if ((e.ctrlKey || e.metaKey) && e.key === "Enter") {
|
|
808
|
+
e.preventDefault();
|
|
809
|
+
go();
|
|
810
|
+
}
|
|
811
|
+
};
|
|
812
|
+
|
|
813
|
+
return (
|
|
814
|
+
<main className="min-h-screen bg-background text-foreground p-4 md:p-8">
|
|
815
|
+
<Stack gap={4}>
|
|
816
|
+
<Row gap={2} align="center" wrap>
|
|
817
|
+
<Heading level={1}>Beat Visuals</Heading>
|
|
818
|
+
<Spacer />
|
|
819
|
+
<Badge tone={sound === "playing" ? "up" : "idle"}>{sound === "playing" ? "Playing" : sound === "loading" ? "Fetching the drum kit…" : live ? "Press play" : "Warming up the synth…"}</Badge>
|
|
820
|
+
</Row>
|
|
821
|
+
|
|
822
|
+
<div ref={stage} className="relative aspect-video w-full overflow-hidden rounded-md bg-neutral">
|
|
823
|
+
{!live && <div aria-busy="true" className="absolute inset-0"><Skeleton variant="card" /></div>}
|
|
824
|
+
</div>
|
|
825
|
+
|
|
826
|
+
<Row gap={2} align="center" wrap>
|
|
827
|
+
<Button onClick={() => (sound === "playing" ? halt() : go())}>{sound === "playing" ? "Stop" : "Play"}</Button>
|
|
828
|
+
<Button variant="quiet" onClick={() => go()}>Update</Button>
|
|
829
|
+
<Button variant="quiet" onClick={() => stage.current?.requestFullscreen?.()}>Full screen</Button>
|
|
830
|
+
{SETS.map((s) => (
|
|
831
|
+
<Button key={s.name} size="sm" variant="quiet" onClick={() => pick(s)}>{s.name}</Button>
|
|
832
|
+
))}
|
|
833
|
+
</Row>
|
|
834
|
+
|
|
835
|
+
<div className="grid gap-4 md:grid-cols-2">
|
|
836
|
+
<Stack gap={1}>
|
|
837
|
+
<Text size="sm" muted>Pattern (Strudel)</Text>
|
|
838
|
+
<textarea aria-label="Strudel pattern" value={pattern} onChange={(e) => setPattern(e.target.value)} onKeyDown={runKeys} spellCheck={false} rows={7} className={editorClass} />
|
|
839
|
+
</Stack>
|
|
840
|
+
<Stack gap={1}>
|
|
841
|
+
<Text size="sm" muted>Sketch (Hydra) — kick is a.fft[0], snare a.fft[1], hats a.fft[2], notes a.fft[3]</Text>
|
|
842
|
+
<textarea aria-label="Hydra sketch" value={sketch} onChange={(e) => setSketch(e.target.value)} onKeyDown={runKeys} spellCheck={false} rows={7} className={editorClass} />
|
|
843
|
+
</Stack>
|
|
844
|
+
</div>
|
|
845
|
+
{problem && <Text size="sm" tone="down">Needs a tweak in {problem}. The last good one keeps going.</Text>}
|
|
846
|
+
|
|
847
|
+
<Card variant="tight">
|
|
848
|
+
<Stack gap={3}>
|
|
849
|
+
<Heading level={2}>Keep this set</Heading>
|
|
850
|
+
{!ready && <div aria-busy="true"><Skeleton variant="row" /></div>}
|
|
851
|
+
{ready && !me && <Row gap={2} align="center" wrap><Text muted>Sign in to keep sets and share them here.</Text><Button size="sm" variant="quiet" onClick={requestLogin}>Sign in</Button></Row>}
|
|
852
|
+
{ready && me && verdict.ok && (
|
|
853
|
+
<Row gap={2} align="top" wrap>
|
|
854
|
+
<Field label="Set name">{(id, d) => <Input id={id} describedBy={d} value={name} onChange={setName} placeholder="friday opener" />}</Field>
|
|
855
|
+
<Button size="sm" onClick={keep}>Keep</Button>
|
|
856
|
+
</Row>
|
|
857
|
+
)}
|
|
858
|
+
{saved.map((s) => (
|
|
859
|
+
<Row key={s._id} gap={2} align="center" wrap>
|
|
860
|
+
<Button size="sm" variant="quiet" onClick={() => pick(s)}>{s.name}</Button>
|
|
861
|
+
{s.authorHandle && <ViewerTag userHandle={s.authorHandle} />}
|
|
862
|
+
<Spacer />
|
|
863
|
+
{can.delete(s).ok && <Button size="sm" variant="quiet" tone="down" onClick={() => database.del(s._id)}>Remove</Button>}
|
|
864
|
+
</Row>
|
|
865
|
+
))}
|
|
866
|
+
</Stack>
|
|
867
|
+
</Card>
|
|
868
|
+
|
|
869
|
+
<Text size="sm" muted>
|
|
870
|
+
Sound by <a className="underline" href="https://strudel.cc" target="_blank" rel="noreferrer">Strudel</a> and video by <a className="underline" href="https://hydra.ojack.xyz" target="_blank" rel="noreferrer">Hydra</a> (both AGPL), each fetched from its own address.
|
|
871
|
+
</Text>
|
|
872
|
+
</Stack>
|
|
873
|
+
</main>
|
|
874
|
+
);
|
|
875
|
+
}
|
|
876
|
+
```
|
|
877
|
+
|
|
878
|
+
The sets are a public gallery with author-owned writes, the same rule as
|
|
879
|
+
the pad's:
|
|
880
|
+
|
|
881
|
+
### `access.js`
|
|
882
|
+
```js app=beat-visuals
|
|
883
|
+
// set: a Strudel pattern and the Hydra sketch it drives. Anyone signed in keeps their own; everyone can read the gallery.
|
|
884
|
+
export function beatVisuals(doc, oldDoc, user, ctx) {
|
|
885
|
+
if (!user) throw { forbidden: "sign in to keep sets" };
|
|
886
|
+
if (doc.type === "set" || (doc._deleted && oldDoc && oldDoc.type === "set")) {
|
|
887
|
+
const author = oldDoc ? oldDoc.authorHandle : doc.authorHandle;
|
|
888
|
+
if (author !== user.userHandle || (!doc._deleted && doc.authorHandle !== user.userHandle)) throw { forbidden: "sign your set with your own handle" };
|
|
889
|
+
return { channels: ["sets"], grant: { public: ["sets"] } };
|
|
890
|
+
}
|
|
891
|
+
throw { forbidden: "unknown document type" };
|
|
892
|
+
}
|
|
893
|
+
```
|
|
894
|
+
|
|
895
|
+
## The text-to-sketch prompt, verbatim
|
|
896
|
+
|
|
897
|
+
`lib/sketch-prompt.js` above is the system prompt for a text box that turns a
|
|
898
|
+
sentence into a sketch, or an app that rewrites the sketch on request. Use it
|
|
899
|
+
as written: it names only functions the engine has, with their argument
|
|
900
|
+
order, its four examples were run on the engine as the doc was written, and
|
|
901
|
+
it keeps the amounts in the range that stays watchable (a feedback scale past
|
|
902
|
+
1.05 floods the frame). `rewritePrompt(request, code)` appends the ask and
|
|
903
|
+
the sketch that is showing; the `callAI` schema is
|
|
904
|
+
`{ name: string, code: string }`, and the app shows `code` through `run()`, so
|
|
905
|
+
a sketch the model got wrong surfaces as a message while the last good one
|
|
906
|
+
plays on.
|
|
907
|
+
|
|
908
|
+
## The stage and its lifecycle
|
|
909
|
+
|
|
910
|
+
- **One canvas, made once by the module, moved into the stage.** `attach(el)`
|
|
911
|
+
appends it and starts the loop; the function it returns cancels the loop and
|
|
912
|
+
takes the canvas out. A remount appends the same canvas again, so the WebGL
|
|
913
|
+
context and every output survive (a second `new Hydra` on a second canvas
|
|
914
|
+
is a second GPU context and the first one's sketch is lost).
|
|
915
|
+
- **The mount effect guards the async attach**: when the component unmounts
|
|
916
|
+
before the engine arrives, the late `detach` runs at once (the `gone` flag
|
|
917
|
+
in the examples), so a fast remount never leaves two loops.
|
|
918
|
+
- **The canvas renders at 1280×720 and CSS scales it** into a 16:9 stage
|
|
919
|
+
(`aspect-video`). That is sharp on a laptop and light enough for a phone;
|
|
920
|
+
`hydra.setResolution(w, h)` changes it when an app needs more.
|
|
921
|
+
- **`hush()` blanks every output and forgets `update`**; a "Blank" button and
|
|
922
|
+
a scene change between sets call it. The loop keeps running, so the next
|
|
923
|
+
`run()` shows at once.
|
|
924
|
+
- **Full screen is the stage element's own `requestFullscreen()`**, which
|
|
925
|
+
the vibe frame allows; the canvas fills it and keeps its aspect.
|
|
926
|
+
|
|
927
|
+
## Mobile
|
|
928
|
+
|
|
929
|
+
The stage sits at the top at full width, and the editor or knobs follow
|
|
930
|
+
under it. Typing a sketch on a phone is slow, so a phone-first app leads with
|
|
931
|
+
example chips, knobs and a "describe it" box, and keeps the editor one tap
|
|
932
|
+
away. The camera button names what it does ("Use my camera"); the front camera
|
|
933
|
+
is the default. Phones render Hydra at `highp` precision (the engine picks it
|
|
934
|
+
on iOS); a 1280×720 canvas keeps frames smooth on a recent phone.
|
|
935
|
+
|
|
936
|
+
## Persistence — the sketch text is the document
|
|
937
|
+
|
|
938
|
+
**Save the sketch text itself** (`code`, or the knob values a sketch compiles
|
|
939
|
+
from) with a name, the author's handle and a timestamp; the engine rebuilds
|
|
940
|
+
the picture from it on every run, so a saved document is tiny and remixable.
|
|
941
|
+
A set that pairs music and picture saves both strings. The shared gallery is
|
|
942
|
+
one `useLiveQuery` over the `sketch` type, and the access rule above makes it
|
|
943
|
+
public to read and author-owned to write; a signed-out visitor plays with the
|
|
944
|
+
pad and is invited to sign in at "Keep".
|
|
945
|
+
|
|
946
|
+
## Shapes a Hydra vibe takes
|
|
947
|
+
|
|
948
|
+
- **A sketch pad** — stage, editor, examples, a prompt box that rewrites the
|
|
949
|
+
sketch, saved sketches. The starter above.
|
|
950
|
+
- **A video synth** — knobs that write the sketch, the camera as a source,
|
|
951
|
+
the written sketch shown underneath. The second example above.
|
|
952
|
+
- **Beat visuals** — a Strudel pattern and a Hydra sketch played together,
|
|
953
|
+
the beat kicking `a.fft`. The third example above.
|
|
954
|
+
- **A VJ deck** — a row of saved sketches as pads, `hush()` between them, a
|
|
955
|
+
full-screen stage on a second screen, the room's sound through `listen()`.
|
|
956
|
+
- **A photo booth** — the camera through kaleidoscopes and feedback, and a
|
|
957
|
+
"Keep this frame" press. Add a `snapshot()` to `lib/hydra.js` that wraps the
|
|
958
|
+
engine's `hydra.getScreenImage((blob) => …)`, which captures the next frame
|
|
959
|
+
as a PNG blob; a plain `canvas.toDataURL()` reads blank, because the WebGL
|
|
960
|
+
canvas is cleared after every frame.
|
|
961
|
+
- **A jam room** — the sketch document is shared, every member's edit is a
|
|
962
|
+
version, and the gallery doubles as the set list.
|
|
963
|
+
|
|
964
|
+
## Common gotchas
|
|
965
|
+
|
|
966
|
+
- **Every name in the sketch is undefined** — the sketch went through
|
|
967
|
+
`hydra.eval()` with `makeGlobal: false`. Run it through `run()` and its
|
|
968
|
+
`with` blocks.
|
|
969
|
+
- **The microphone prompt appears on load** — `detectAudio` was left on. Set
|
|
970
|
+
it false and call `listen()` from a press.
|
|
971
|
+
- **`a.fft` reads undefined** — the sketch ran outside `run()`, which passes
|
|
972
|
+
the module's `audio` as `a`.
|
|
973
|
+
- **The picture floods to one colour** — a feedback chain scales or blends
|
|
974
|
+
too much. Keep `src(o0).scale` within 0.95 to 1.05 and the blend under 0.2.
|
|
975
|
+
- **An image or video source stays black** — the URL is not CORS-open. Use a
|
|
976
|
+
host that sends `Access-Control-Allow-Origin` (jsDelivr, a vibe's own
|
|
977
|
+
assets), or the camera.
|
|
978
|
+
- **The camera light stays on after leaving** — the stop function from
|
|
979
|
+
`startCamera()` was dropped. Keep it in a ref and call it in the cleanup.
|
|
980
|
+
- **Two pictures fight or the frame rate halves** — two loops or two engines.
|
|
981
|
+
One memoized loader, one canvas, one `attach` per stage.
|
|
982
|
+
- **A sketch built from typed text breaks on a quote** — strip or escape the
|
|
983
|
+
quotes before dropping a person's text into a sketch string.
|
package/llms/index.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ export { stripeConfig } from "./stripe.js";
|
|
|
46
46
|
export { stripeSubscriptionsConfig } from "./stripe-subscriptions.js";
|
|
47
47
|
export { blocklyConfig } from "./blockly.js";
|
|
48
48
|
export { strudelConfig } from "./strudel.js";
|
|
49
|
+
export { hydraConfig } from "./hydra.js";
|
|
49
50
|
export { physicsConfig } from "./physics.js";
|
|
50
51
|
export { worldsConfig } from "./worlds.js";
|
|
51
52
|
export { motionConfig } from "./motion.js";
|
|
@@ -83,7 +84,7 @@ export { uiTestimonialsConfig } from "./ui-testimonials.js";
|
|
|
83
84
|
export type { LlmConfig, SkillCredential, SkillEgress } from "./types.js";
|
|
84
85
|
export { cueMatches, cueMatchedSkills, type CueCatalogEntry } from "./cues.js";
|
|
85
86
|
export { expandSkills, onSkillMenu, skillGraphProblems, universalSkillNames, type NeedsCatalogEntry } from "./needs.js";
|
|
86
|
-
export declare const allConfigs: readonly [LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig];
|
|
87
|
+
export declare const allConfigs: readonly [LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig];
|
|
87
88
|
export { mapsConfig } from "./maps.js";
|
|
88
89
|
export declare const SKILL_ALIASES: ReadonlyMap<string, string>;
|
|
89
90
|
export declare function canonicalSkillName(name: string): string;
|
package/llms/index.js
CHANGED
|
@@ -46,6 +46,7 @@ import { stripeConfig } from "./stripe.js";
|
|
|
46
46
|
import { stripeSubscriptionsConfig } from "./stripe-subscriptions.js";
|
|
47
47
|
import { blocklyConfig } from "./blockly.js";
|
|
48
48
|
import { strudelConfig } from "./strudel.js";
|
|
49
|
+
import { hydraConfig } from "./hydra.js";
|
|
49
50
|
import { physicsConfig } from "./physics.js";
|
|
50
51
|
import { worldsConfig } from "./worlds.js";
|
|
51
52
|
import { motionConfig } from "./motion.js";
|
|
@@ -127,6 +128,7 @@ export { stripeConfig } from "./stripe.js";
|
|
|
127
128
|
export { stripeSubscriptionsConfig } from "./stripe-subscriptions.js";
|
|
128
129
|
export { blocklyConfig } from "./blockly.js";
|
|
129
130
|
export { strudelConfig } from "./strudel.js";
|
|
131
|
+
export { hydraConfig } from "./hydra.js";
|
|
130
132
|
export { physicsConfig } from "./physics.js";
|
|
131
133
|
export { worldsConfig } from "./worlds.js";
|
|
132
134
|
export { motionConfig } from "./motion.js";
|
|
@@ -211,6 +213,7 @@ export const allConfigs = [
|
|
|
211
213
|
groupPlanConfig,
|
|
212
214
|
blocklyConfig,
|
|
213
215
|
strudelConfig,
|
|
216
|
+
hydraConfig,
|
|
214
217
|
physicsConfig,
|
|
215
218
|
worldsConfig,
|
|
216
219
|
motionConfig,
|
package/llms/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../jsr/llms/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MA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YAAY,GAAsF,IAAI,GAAG,CAAC;IACrH,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IAC7D,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,CAAC,aAAa,EAAE,gBAAgB,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IACtE,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;CACvD,CAAC,CAAC;AAWH,MAAM,UAAU,gBAAgB,CAAC,KAAwB,EAAE,OAAgB;IACzE,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,SAAS,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAC3C,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC1C,MAAM,IAAI,GAAG,KAAK,KAAK,SAAS,IAAI,CAAC,OAAO,KAAK,SAAS,IAAI,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QAChH,KAAK,MAAM,CAAC,IAAI,IAAI;YAAE,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,KAAK;gBAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/llms/strudel.md
CHANGED
|
@@ -601,6 +601,9 @@ clock now and `targetTime` is when the sound plays, so a `setTimeout` of
|
|
|
601
601
|
the engine's own sound output in place; the default replaces it, which is
|
|
602
602
|
how a visualiser goes silent. Clear the pending timers in `stop`.
|
|
603
603
|
|
|
604
|
+
Live-coded visuals that move with the pattern are the `hydra` skill's: its
|
|
605
|
+
beat-visuals example feeds these same events to a Hydra sketch.
|
|
606
|
+
|
|
604
607
|
## Play, stop and the lifecycle
|
|
605
608
|
|
|
606
609
|
- **Stop calls `hush()`**, which silences every pattern the engine holds
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibes.diy/prompts",
|
|
3
|
-
"version": "14.3.
|
|
3
|
+
"version": "14.3.310",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"exports": {
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"license": "Apache-2.0",
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@adviser/cement": "~0.5.34",
|
|
42
|
-
"@vibes.diy/api-types": "14.3.
|
|
43
|
-
"@vibes.diy/call-ai-v2": "14.3.
|
|
44
|
-
"@vibes.diy/identity": "14.3.
|
|
45
|
-
"@vibes.diy/use-vibes-types": "14.3.
|
|
42
|
+
"@vibes.diy/api-types": "14.3.310",
|
|
43
|
+
"@vibes.diy/call-ai-v2": "14.3.310",
|
|
44
|
+
"@vibes.diy/identity": "14.3.310",
|
|
45
|
+
"@vibes.diy/use-vibes-types": "14.3.310",
|
|
46
46
|
"arktype": "~2.2.9",
|
|
47
47
|
"json-schema-faker": "~0.6.3"
|
|
48
48
|
},
|