@hraness/dawg 0.3.0 → 0.4.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/CHANGELOG.md +122 -0
- package/DAWG.md +605 -39
- package/README.md +4 -4
- package/core/chords.ts +1724 -0
- package/core/diff.ts +13 -1
- package/core/euclid.ts +670 -0
- package/core/fx.ts +1065 -0
- package/core/kits.ts +320 -0
- package/core/params.ts +111 -0
- package/core/rhythm.ts +287 -0
- package/core/score.ts +735 -18
- package/core/sdk/eval-child.ts +34 -22
- package/core/sdk/eval.ts +4 -1
- package/core/sdk/print.ts +304 -22
- package/core/sdk/sync-chords.ts +54 -0
- package/core/sdk/v1.ts +3226 -21
- package/core/synth.ts +1001 -0
- package/package.json +1 -1
- package/src/agent/agent.ts +38 -3
- package/src/agent/brief.ts +29 -4
- package/src/agent/chord-tools.ts +357 -0
- package/src/agent/drum-tools.ts +135 -0
- package/src/agent/models.ts +4 -4
- package/src/agent/pack-tools.ts +369 -0
- package/src/agent/planner.ts +17 -2
- package/src/agent/preview-tool.ts +270 -0
- package/src/agent/rhythm-tools.ts +145 -0
- package/src/agent/tools.ts +308 -14
- package/src/agent/xcb-agent.ts +8 -2
- package/src/audio/audition.ts +93 -0
- package/src/audio/cache.ts +160 -0
- package/src/audio/effects/bus.ts +147 -0
- package/src/audio/effects/chain.ts +99 -0
- package/src/audio/effects/common.ts +251 -0
- package/src/audio/effects/convolution.ts +301 -0
- package/src/audio/effects/drive.ts +142 -0
- package/src/audio/effects/duck.ts +122 -0
- package/src/audio/effects/dynamics.ts +121 -0
- package/src/audio/effects/filter.ts +319 -0
- package/src/audio/effects/modulation.ts +174 -0
- package/src/audio/effects/space.ts +337 -0
- package/src/audio/engine.ts +27 -4
- package/src/audio/kits.ts +200 -0
- package/src/audio/packs.ts +1787 -0
- package/src/audio/preview.ts +470 -0
- package/src/audio/random.ts +15 -0
- package/src/audio/sampler.ts +157 -29
- package/src/audio/samples.ts +386 -44
- package/src/audio/synth/oscillators.ts +268 -0
- package/src/audio/synth/voice.ts +555 -0
- package/src/audio/synth/zzfx.ts +137 -0
- package/src/audio/wav.ts +280 -278
- package/src/audio/wavetable-maker.ts +717 -0
- package/src/audio/wavetable.ts +624 -0
- package/src/commands/drums.ts +299 -0
- package/src/commands/edit.ts +26 -4
- package/src/commands/fx.ts +360 -0
- package/src/commands/help.ts +298 -10
- package/src/commands/music.ts +10 -8
- package/src/commands/pack.ts +423 -0
- package/src/commands/rhythm.ts +230 -0
- package/src/commands/sample.ts +162 -2
- package/src/commands/synth.ts +229 -0
- package/src/commands/wavetable.ts +370 -0
- package/src/main.ts +1119 -30
- package/src/media/cli.ts +15 -2
- package/src/media/tools.ts +106 -1
- package/src/media/wavetable.ts +202 -0
- package/src/render.ts +22 -1
- package/src/session/naming.ts +3 -1
- package/src/tui/audition.ts +501 -0
- package/src/tui/euclid.ts +472 -0
- package/src/tui/menu.ts +1286 -244
- package/src/tui/play-chords.ts +538 -0
- package/src/tui/play-session.ts +364 -16
- package/src/tui/sketch.ts +108 -0
- package/src/web/search.ts +4 -1
- package/tui/app.ts +161 -39
- package/tui/grammar.ts +281 -0
- package/tui/highway.ts +7 -1
- package/tui/play-strip.ts +59 -14
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wavetable commands (prompt grammar, menu and agent share these):
|
|
3
|
+
*
|
|
4
|
+
* wt show the focused track's table and parameters
|
|
5
|
+
* wt list built-in tables and the uzu-wavetables sets
|
|
6
|
+
* wt <table> play a table: basic, pwm, formant, harmonics,
|
|
7
|
+
* wt_digital:2 (Strudel's uzu-wavetables), any
|
|
8
|
+
* pack:<pack>/<sound>[:<n>], or a project WAV
|
|
9
|
+
* (vox.wav, wavetables/vox.wav, tracks/x/…/vox.wav;
|
|
10
|
+
* the agent's make_wavetable writes these)
|
|
11
|
+
* wt <0..1> position
|
|
12
|
+
* wtenv|wtattack|wtdecay|wtsustain|wtrelease|wtrate|wtdepth|warp|wtphaserand <n>
|
|
13
|
+
* warpmode <none|asym|bendp|bendm|bendmp|sync|quant>
|
|
14
|
+
*
|
|
15
|
+
* Any of these turns the focused track into a wavetable track. Parsing is
|
|
16
|
+
* pure; picking a pack table pins it (sha256 + url) through the PackStore.
|
|
17
|
+
*/
|
|
18
|
+
import {
|
|
19
|
+
BUILTIN_TABLE_PREFIX,
|
|
20
|
+
WARP_MODES,
|
|
21
|
+
WAVETABLE_INSTRUMENT,
|
|
22
|
+
WAVETABLE_PARAMS,
|
|
23
|
+
SCORE_LIMITS,
|
|
24
|
+
isLocalTableSrc,
|
|
25
|
+
isWavetableInstrument,
|
|
26
|
+
normalizeWavetable,
|
|
27
|
+
wavetableOf,
|
|
28
|
+
type ScoreOperation,
|
|
29
|
+
type TrackScore,
|
|
30
|
+
type TrackWavetable,
|
|
31
|
+
type WarpMode,
|
|
32
|
+
type WavetableParam,
|
|
33
|
+
} from "../../core/score.ts";
|
|
34
|
+
import { createHash } from "node:crypto";
|
|
35
|
+
import { readdirSync } from "node:fs";
|
|
36
|
+
import { readFile, stat } from "node:fs/promises";
|
|
37
|
+
import { join } from "node:path";
|
|
38
|
+
import { trackDirectories } from "../../core/sdk/print.ts";
|
|
39
|
+
import { resolveReadPath } from "../agent/workspace.ts";
|
|
40
|
+
import { PackError, type PackStore } from "../audio/packs.ts";
|
|
41
|
+
import {
|
|
42
|
+
BUILTIN_TABLES,
|
|
43
|
+
BUILTIN_TABLE_NAMES,
|
|
44
|
+
wavetableFromWav,
|
|
45
|
+
} from "../audio/wavetable.ts";
|
|
46
|
+
|
|
47
|
+
/** The pack Strudel's `wt_` sounds come from. */
|
|
48
|
+
export const WAVETABLE_PACK = "uzu-wavetables";
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Table names in uzu-wavetables' strudel.json (read 2026-10), for the menu,
|
|
52
|
+
* which cannot wait on a fetch. `wt list` reads the live manifest.
|
|
53
|
+
*/
|
|
54
|
+
export const UZU_WAVETABLES: Readonly<Record<string, readonly string[]>> =
|
|
55
|
+
Object.freeze({
|
|
56
|
+
wt_digital: ["bad_day", "basique", "crickets", "curses", "echoes"],
|
|
57
|
+
wt_vgame: Array.from({ length: 11 }, (_, i) => `vgame${10 + i}`),
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export type WavetableCommand =
|
|
61
|
+
| Readonly<{ kind: "show" }>
|
|
62
|
+
| Readonly<{ kind: "list" }>
|
|
63
|
+
| Readonly<{ kind: "table"; table: string }>
|
|
64
|
+
| Readonly<{ kind: "param"; param: WavetableParam; value: number }>
|
|
65
|
+
| Readonly<{ kind: "warpmode"; mode: WarpMode }>
|
|
66
|
+
| Readonly<{ kind: "usage"; message: string }>;
|
|
67
|
+
|
|
68
|
+
const PARAM_WORDS = Object.keys(WAVETABLE_PARAMS).filter(
|
|
69
|
+
(name) => name !== "wt",
|
|
70
|
+
) as WavetableParam[];
|
|
71
|
+
const NUMBER = /^-?(?:\d+(?:\.\d+)?|\.\d+)$/;
|
|
72
|
+
|
|
73
|
+
export function parseWavetableCommand(
|
|
74
|
+
command: string,
|
|
75
|
+
): WavetableCommand | undefined {
|
|
76
|
+
const parsed = parseWords(command.trim().replace(/^\//, ""));
|
|
77
|
+
// Without a slash, only well-formed commands are ours; anything else
|
|
78
|
+
// ("warp the bass up") is a prompt for the agent.
|
|
79
|
+
if (parsed?.kind === "usage" && !command.trim().startsWith("/"))
|
|
80
|
+
return undefined;
|
|
81
|
+
return parsed;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function parseWords(text: string): WavetableCommand | undefined {
|
|
85
|
+
const words = text.split(/\s+/);
|
|
86
|
+
const head = words[0]!.toLowerCase();
|
|
87
|
+
if (head === "wavetable" || head === "wt") {
|
|
88
|
+
if (words.length === 1) return { kind: "show" };
|
|
89
|
+
if (words.length !== 2)
|
|
90
|
+
return { kind: "usage", message: "wt <table> | wt <0..1> | wt list" };
|
|
91
|
+
const arg = words[1]!;
|
|
92
|
+
if (/^(list|ls)$/i.test(arg)) return { kind: "list" };
|
|
93
|
+
if (NUMBER.test(arg)) {
|
|
94
|
+
const value = Number(arg);
|
|
95
|
+
if (value < 0 || value > 1)
|
|
96
|
+
return { kind: "usage", message: "wt position is 0..1" };
|
|
97
|
+
return { kind: "param", param: "wt", value };
|
|
98
|
+
}
|
|
99
|
+
return { kind: "table", table: arg };
|
|
100
|
+
}
|
|
101
|
+
if (head === "warpmode") {
|
|
102
|
+
const mode = words[1]?.toLowerCase();
|
|
103
|
+
if (words.length !== 2 || !WARP_MODES.includes(mode as WarpMode))
|
|
104
|
+
return {
|
|
105
|
+
kind: "usage",
|
|
106
|
+
message: `warpmode ${WARP_MODES.join("|")}`,
|
|
107
|
+
};
|
|
108
|
+
return { kind: "warpmode", mode: mode as WarpMode };
|
|
109
|
+
}
|
|
110
|
+
if ((PARAM_WORDS as string[]).includes(head)) {
|
|
111
|
+
const param = head as WavetableParam;
|
|
112
|
+
const [min, max] = WAVETABLE_PARAMS[param];
|
|
113
|
+
if (words.length !== 2 || !NUMBER.test(words[1]!))
|
|
114
|
+
return { kind: "usage", message: `${param} <${min}..${max}>` };
|
|
115
|
+
const value = Number(words[1]);
|
|
116
|
+
if (value < min || value > max)
|
|
117
|
+
return { kind: "usage", message: `${param} is ${min}..${max}` };
|
|
118
|
+
return { kind: "param", param, value };
|
|
119
|
+
}
|
|
120
|
+
return undefined;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* `basic` → builtin, `wt_digital:2`/`wt_digital` → the uzu pack, `x/y[:n]`
|
|
125
|
+
* or `pack:x/y[:n]` → that pack sound. Undefined when malformed.
|
|
126
|
+
*/
|
|
127
|
+
export function wavetableSource(name: string): string | undefined {
|
|
128
|
+
const value = name.trim();
|
|
129
|
+
const lower = value.toLowerCase();
|
|
130
|
+
if (lower.startsWith(BUILTIN_TABLE_PREFIX))
|
|
131
|
+
return BUILTIN_TABLES[lower.slice(BUILTIN_TABLE_PREFIX.length)]
|
|
132
|
+
? lower
|
|
133
|
+
: undefined;
|
|
134
|
+
if (BUILTIN_TABLES[lower]) return `${BUILTIN_TABLE_PREFIX}${lower}`;
|
|
135
|
+
if (/^wt_[a-z0-9_]+(?::[0-9]+)?$/i.test(value))
|
|
136
|
+
return `pack:${WAVETABLE_PACK}/${value}`;
|
|
137
|
+
if (
|
|
138
|
+
/^(?:pack:)?[a-z0-9._-]+\/[A-Za-z0-9._-]+(?::[A-Za-z0-9._-]+)?$/.test(value)
|
|
139
|
+
)
|
|
140
|
+
return value.startsWith("pack:") ? value : `pack:${value}`;
|
|
141
|
+
return undefined;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** One operation that sets the track's wavetable (and makes it a wavetable track). */
|
|
145
|
+
export function wavetableOperation(
|
|
146
|
+
score: TrackScore,
|
|
147
|
+
trackId: string,
|
|
148
|
+
next: TrackWavetable,
|
|
149
|
+
): ScoreOperation {
|
|
150
|
+
const wavetable = normalizeWavetable(next)!;
|
|
151
|
+
if (!score.tracks.some((track) => track.id === trackId))
|
|
152
|
+
return {
|
|
153
|
+
type: "addTrack",
|
|
154
|
+
track: {
|
|
155
|
+
id: trackId,
|
|
156
|
+
name: trackId,
|
|
157
|
+
instrument: WAVETABLE_INSTRUMENT,
|
|
158
|
+
wavetable,
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
return {
|
|
162
|
+
type: "updateTrack",
|
|
163
|
+
trackId,
|
|
164
|
+
patch: { instrument: WAVETABLE_INSTRUMENT, wavetable },
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function current(score: TrackScore, trackId: string): TrackWavetable {
|
|
169
|
+
const track = score.tracks.find((item) => item.id === trackId);
|
|
170
|
+
return track ? wavetableOf(track) : wavetableOf({} as never);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** Pure parameter edit; the receipt line and the operation. */
|
|
174
|
+
export function wavetableParamEdit(
|
|
175
|
+
score: TrackScore,
|
|
176
|
+
trackId: string,
|
|
177
|
+
command: Extract<WavetableCommand, { kind: "param" | "warpmode" }>,
|
|
178
|
+
): { operation: ScoreOperation; summary: string } {
|
|
179
|
+
const base = current(score, trackId);
|
|
180
|
+
const next: Record<string, unknown> = { ...base };
|
|
181
|
+
let summary: string;
|
|
182
|
+
if (command.kind === "warpmode") {
|
|
183
|
+
next.warpmode = command.mode;
|
|
184
|
+
summary = `warpmode · ${command.mode}`;
|
|
185
|
+
} else {
|
|
186
|
+
next[command.param] = command.value;
|
|
187
|
+
summary = `${command.param} · ${formatNumber(command.value)}`;
|
|
188
|
+
}
|
|
189
|
+
return {
|
|
190
|
+
operation: wavetableOperation(score, trackId, next as TrackWavetable),
|
|
191
|
+
summary,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/** Directory project tables live in, under a track's directory. */
|
|
196
|
+
export const LOCAL_TABLE_DIR = "wavetables";
|
|
197
|
+
/** Most project tables `wt list` and the menu show. */
|
|
198
|
+
const MAX_LISTED_TABLES = 200;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Project wavetables: `tracks/<dir>/wavetables/*.wav`, sorted. Sync and
|
|
202
|
+
* bounded, so the menu can call it while it builds.
|
|
203
|
+
*/
|
|
204
|
+
export function listLocalWavetables(projectRoot: string | undefined): string[] {
|
|
205
|
+
if (!projectRoot) return [];
|
|
206
|
+
const out: string[] = [];
|
|
207
|
+
let dirs: string[];
|
|
208
|
+
try {
|
|
209
|
+
dirs = readdirSync(join(projectRoot, "tracks")).sort();
|
|
210
|
+
} catch {
|
|
211
|
+
return [];
|
|
212
|
+
}
|
|
213
|
+
for (const dir of dirs) {
|
|
214
|
+
if (dir.startsWith(".")) continue;
|
|
215
|
+
let files: string[];
|
|
216
|
+
try {
|
|
217
|
+
files = readdirSync(join(projectRoot, "tracks", dir, LOCAL_TABLE_DIR));
|
|
218
|
+
} catch {
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
for (const file of files.sort())
|
|
222
|
+
if (/\.wav$/i.test(file) && !file.startsWith("."))
|
|
223
|
+
out.push(`tracks/${dir}/${LOCAL_TABLE_DIR}/${file}`);
|
|
224
|
+
if (out.length >= MAX_LISTED_TABLES) break;
|
|
225
|
+
}
|
|
226
|
+
return out.slice(0, MAX_LISTED_TABLES);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/** True when a `wt` argument names a project WAV rather than a table name. */
|
|
230
|
+
export function isLocalTableName(name: string): boolean {
|
|
231
|
+
return /\.wav$/i.test(name.trim()) && !name.trim().startsWith("pack:");
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* The project path for a local table argument: `tracks/…` as is, otherwise
|
|
236
|
+
* relative to the track's directory (`vox.wav` → its `wavetables/vox.wav`),
|
|
237
|
+
* falling back to the only project table with that file name.
|
|
238
|
+
*/
|
|
239
|
+
export function localTablePath(
|
|
240
|
+
score: TrackScore,
|
|
241
|
+
trackId: string,
|
|
242
|
+
name: string,
|
|
243
|
+
projectRoot?: string,
|
|
244
|
+
): string {
|
|
245
|
+
const bare = name.trim().replace(/^\.\//, "");
|
|
246
|
+
if (bare.startsWith("tracks/")) return bare;
|
|
247
|
+
const dir = trackDirectories(score).get(trackId) ?? trackId;
|
|
248
|
+
const own = `tracks/${dir}/${bare.includes("/") ? bare : `${LOCAL_TABLE_DIR}/${bare}`}`;
|
|
249
|
+
if (bare.includes("/")) return own;
|
|
250
|
+
const all = listLocalWavetables(projectRoot);
|
|
251
|
+
if (all.includes(own)) return own;
|
|
252
|
+
const matches = all.filter((path) => path.endsWith(`/${bare}`));
|
|
253
|
+
return matches.length === 1 ? matches[0]! : own;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/** Resolves and pins a table name; pack tables are fetched once to pin them. */
|
|
257
|
+
export async function pickWavetable(
|
|
258
|
+
store: PackStore,
|
|
259
|
+
score: TrackScore,
|
|
260
|
+
trackId: string,
|
|
261
|
+
name: string,
|
|
262
|
+
projectRoot?: string,
|
|
263
|
+
): Promise<{ operation: ScoreOperation; summary: string }> {
|
|
264
|
+
if (isLocalTableName(name)) {
|
|
265
|
+
if (!projectRoot)
|
|
266
|
+
throw new PackError("project tables need an open project");
|
|
267
|
+
const src = localTablePath(score, trackId, name, projectRoot);
|
|
268
|
+
let sha256: string;
|
|
269
|
+
try {
|
|
270
|
+
const resolved = await resolveReadPath(
|
|
271
|
+
{ root: projectRoot, trackSlug: "" },
|
|
272
|
+
src,
|
|
273
|
+
"wavetable",
|
|
274
|
+
);
|
|
275
|
+
const info = await stat(resolved.real);
|
|
276
|
+
if (!info.isFile()) throw new Error("not a file");
|
|
277
|
+
if (info.size > SCORE_LIMITS.maxSampleFileBytes)
|
|
278
|
+
throw new Error("over the 50 MiB file limit");
|
|
279
|
+
const bytes = new Uint8Array(await readFile(resolved.real));
|
|
280
|
+
wavetableFromWav(src, "check", bytes);
|
|
281
|
+
sha256 = createHash("sha256").update(bytes).digest("hex");
|
|
282
|
+
} catch (error) {
|
|
283
|
+
const why = error instanceof Error ? error.message : String(error);
|
|
284
|
+
throw new PackError(
|
|
285
|
+
`${src.slice(0, 80)} · ${why.slice(0, 120)} · wt list shows the project's tables`,
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
const base = current(score, trackId);
|
|
289
|
+
return {
|
|
290
|
+
operation: wavetableOperation(score, trackId, {
|
|
291
|
+
...base,
|
|
292
|
+
table: { src, sha256 },
|
|
293
|
+
}),
|
|
294
|
+
summary: `wavetable · ${describeTable(src)}`,
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
const src = wavetableSource(name);
|
|
298
|
+
if (!src)
|
|
299
|
+
throw new PackError(
|
|
300
|
+
`${name.slice(0, 40)} is not a table · wt list shows ${BUILTIN_TABLE_NAMES.join(", ")} and the wt_ sets`,
|
|
301
|
+
);
|
|
302
|
+
const base = current(score, trackId);
|
|
303
|
+
const table = src.startsWith(BUILTIN_TABLE_PREFIX)
|
|
304
|
+
? { src }
|
|
305
|
+
: await store.pin(src);
|
|
306
|
+
return {
|
|
307
|
+
operation: wavetableOperation(score, trackId, { ...base, table }),
|
|
308
|
+
summary: `wavetable · ${describeTable(table.src)}`,
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
export function describeTable(src: string): string {
|
|
313
|
+
if (src.startsWith(BUILTIN_TABLE_PREFIX)) {
|
|
314
|
+
const name = src.slice(BUILTIN_TABLE_PREFIX.length);
|
|
315
|
+
return `${name} (${BUILTIN_TABLES[name]?.title ?? "built-in"})`;
|
|
316
|
+
}
|
|
317
|
+
if (isLocalTableSrc(src)) return `${src.split("/").pop()} (project)`;
|
|
318
|
+
return src.replace(`pack:${WAVETABLE_PACK}/`, "");
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/** `wt` reply: table and the parameters that differ from default. */
|
|
322
|
+
export function describeWavetable(score: TrackScore, trackId: string): string {
|
|
323
|
+
const track = score.tracks.find((item) => item.id === trackId);
|
|
324
|
+
if (!track || !isWavetableInstrument(track.instrument))
|
|
325
|
+
return `${trackId} is not a wavetable track · wt basic makes it one`;
|
|
326
|
+
const settings = wavetableOf(track);
|
|
327
|
+
const params = (Object.keys(WAVETABLE_PARAMS) as WavetableParam[])
|
|
328
|
+
.filter((name) => settings[name] !== undefined)
|
|
329
|
+
.map((name) => `${name} ${formatNumber(settings[name]!)}`);
|
|
330
|
+
if (settings.warpmode) params.push(`warpmode ${settings.warpmode}`);
|
|
331
|
+
return `wavetable · ${describeTable(settings.table.src)}${params.length ? ` · ${params.join(" · ")}` : ""}`;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/** Lines for `wt list`: built-ins, then each uzu set with its table count. */
|
|
335
|
+
export async function wavetableListLines(
|
|
336
|
+
store: PackStore | undefined,
|
|
337
|
+
projectRoot?: string,
|
|
338
|
+
): Promise<string[]> {
|
|
339
|
+
const lines = ["built-in (offline):"];
|
|
340
|
+
for (const name of BUILTIN_TABLE_NAMES)
|
|
341
|
+
lines.push(` ${name.padEnd(10)} ${BUILTIN_TABLES[name]!.title}`);
|
|
342
|
+
const local = listLocalWavetables(projectRoot);
|
|
343
|
+
lines.push("", "project (tracks/<slug>/wavetables/, made by the agent):");
|
|
344
|
+
if (local.length === 0)
|
|
345
|
+
lines.push(
|
|
346
|
+
" none yet · ask the agent to make_wavetable from any audio file",
|
|
347
|
+
);
|
|
348
|
+
for (const path of local) lines.push(` wt ${path}`);
|
|
349
|
+
lines.push("", `${WAVETABLE_PACK} (Strudel wt_ sounds, fetched on use):`);
|
|
350
|
+
try {
|
|
351
|
+
if (!store) throw new PackError("offline");
|
|
352
|
+
const manifest = await store.manifest(WAVETABLE_PACK);
|
|
353
|
+
for (const [sound, entry] of manifest.sounds) {
|
|
354
|
+
if (!sound.startsWith("wt_") || entry.kind !== "list") continue;
|
|
355
|
+
const count = entry.files.length;
|
|
356
|
+
lines.push(
|
|
357
|
+
` ${sound.padEnd(12)} ${count} tables · wt ${sound}:0 … ${sound}:${count - 1}`,
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
} catch {
|
|
361
|
+
lines.push(
|
|
362
|
+
" wt_digital, wt_vgame · wt wt_digital:0 (needs the network once)",
|
|
363
|
+
);
|
|
364
|
+
}
|
|
365
|
+
return lines;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
function formatNumber(value: number): string {
|
|
369
|
+
return String(Math.round(value * 1000) / 1000);
|
|
370
|
+
}
|