@hraness/dawg 0.4.1 → 0.6.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 +99 -0
- package/DAWG.md +551 -33
- package/README.md +4 -4
- package/core/chords.ts +288 -7
- package/core/diff.ts +41 -12
- package/core/expression.ts +1241 -0
- package/core/fx.ts +437 -2
- package/core/granular.ts +528 -0
- package/core/instruments.ts +281 -0
- package/core/keys.ts +386 -0
- package/core/loop.ts +23 -0
- package/core/master.ts +455 -0
- package/core/midi.ts +452 -0
- package/core/resonators.ts +574 -0
- package/core/rhythm.ts +7 -2
- package/core/score.ts +717 -62
- package/core/sdk/eval-child.ts +40 -3
- package/core/sdk/print.ts +614 -27
- package/core/sdk/sync-instruments.ts +58 -0
- package/core/sdk/v1.ts +2824 -45
- package/core/sections.ts +2072 -0
- package/core/strings.ts +845 -0
- package/core/synth.ts +11 -1
- package/core/tempo.ts +1318 -0
- package/core/tuning.ts +1180 -0
- package/guides/audition.md +26 -0
- package/guides/automation.md +26 -0
- package/guides/chords.md +28 -0
- package/guides/effects.md +29 -0
- package/guides/faders.md +29 -0
- package/guides/files.md +28 -0
- package/guides/getting-started.md +26 -0
- package/guides/index.ts +75 -0
- package/guides/keys.md +27 -0
- package/guides/media.md +27 -0
- package/guides/mix.md +23 -0
- package/guides/music.md +14 -0
- package/guides/notes.md +26 -0
- package/guides/performance.md +26 -0
- package/guides/play.md +24 -0
- package/guides/project.md +13 -0
- package/guides/providers.md +25 -0
- package/guides/rhythm.md +26 -0
- package/guides/sessions.md +21 -0
- package/guides/sound.md +15 -0
- package/guides/sounds.md +29 -0
- package/guides/tempo.md +27 -0
- package/guides/tracks.md +25 -0
- package/guides/web-search.md +21 -0
- package/package.json +3 -1
- package/src/agent/agent.ts +9 -0
- package/src/agent/brief.ts +77 -3
- package/src/agent/chord-tools.ts +9 -1
- package/src/agent/expression-tools.ts +336 -0
- package/src/agent/granular-tools.ts +138 -0
- package/src/agent/master-tools.ts +299 -0
- package/src/agent/models.ts +4 -4
- package/src/agent/ops.ts +68 -6
- package/src/agent/planner.ts +45 -2
- package/src/agent/preview-tool.ts +27 -4
- package/src/agent/section-tools.ts +411 -0
- package/src/agent/time-tools.ts +290 -0
- package/src/agent/tools.ts +574 -16
- package/src/agent/tuning-tools.ts +301 -0
- package/src/agent/xcb-agent.ts +9 -0
- package/src/audio/arrange.ts +489 -0
- package/src/audio/audition.ts +16 -3
- package/src/audio/click.ts +113 -1
- package/src/audio/clock.ts +71 -5
- package/src/audio/dsp/bank.ts +233 -0
- package/src/audio/dsp/fft.ts +6 -0
- package/src/audio/dsp/filters.ts +57 -0
- package/src/audio/dsp/interp.ts +112 -0
- package/src/audio/dsp/modal.ts +684 -0
- package/src/audio/dsp/onset.ts +197 -0
- package/src/audio/dsp/oversample.ts +202 -0
- package/src/audio/dsp/rng.ts +37 -0
- package/src/audio/dsp/shape.ts +81 -0
- package/src/audio/dsp/stft.ts +73 -0
- package/src/audio/dsp/window.ts +77 -0
- package/src/audio/effects/bus.ts +5 -4
- package/src/audio/effects/chain.ts +6 -1
- package/src/audio/effects/common.ts +30 -1
- package/src/audio/effects/dynamics.ts +2 -1
- package/src/audio/effects/filter.ts +5 -3
- package/src/audio/effects/modulation.ts +5 -1
- package/src/audio/effects/rig/cab.ts +99 -0
- package/src/audio/effects/rig/filters.ts +152 -0
- package/src/audio/effects/rig/gate.ts +39 -0
- package/src/audio/effects/rig/head.ts +487 -0
- package/src/audio/effects/rig/index.ts +170 -0
- package/src/audio/effects/rig/section.ts +78 -0
- package/src/audio/effects/rig/stomp.ts +238 -0
- package/src/audio/effects/space.ts +92 -2
- package/src/audio/engine.ts +100 -21
- package/src/audio/fit.ts +402 -0
- package/src/audio/granular.ts +664 -0
- package/src/audio/instrument-check.ts +133 -0
- package/src/audio/instruments.ts +111 -0
- package/src/audio/keys/dsp.ts +323 -0
- package/src/audio/keys/engine.ts +361 -0
- package/src/audio/keys/piano.ts +432 -0
- package/src/audio/live-worker.ts +54 -0
- package/src/audio/live.ts +263 -17
- package/src/audio/loudness.ts +596 -0
- package/src/audio/master.ts +660 -0
- package/src/audio/measure-worker.ts +45 -0
- package/src/audio/measure.ts +110 -0
- package/src/audio/player.ts +11 -6
- package/src/audio/preview.ts +76 -14
- package/src/audio/render-worker.ts +6 -1
- package/src/audio/renderer.ts +7 -1
- package/src/audio/resonators.ts +287 -0
- package/src/audio/sampler.ts +269 -34
- package/src/audio/samples.ts +30 -7
- package/src/audio/strings/body.ts +250 -0
- package/src/audio/strings/engine.ts +369 -0
- package/src/audio/strings/loop.ts +119 -0
- package/src/audio/strings/measure.test-helpers.ts +198 -0
- package/src/audio/strings/pluck.ts +354 -0
- package/src/audio/synth/voice.ts +60 -13
- package/src/audio/synth/zzfx.ts +10 -4
- package/src/audio/warp.ts +147 -0
- package/src/audio/wav.ts +377 -30
- package/src/commands/arrange.ts +949 -0
- package/src/commands/expression.ts +941 -0
- package/src/commands/fit.ts +135 -0
- package/src/commands/fx.ts +31 -0
- package/src/commands/granular.ts +427 -0
- package/src/commands/help.ts +355 -27
- package/src/commands/keys.ts +353 -0
- package/src/commands/master.ts +361 -0
- package/src/commands/modal.ts +247 -0
- package/src/commands/music.ts +6 -1
- package/src/commands/rig.ts +260 -0
- package/src/commands/sample.ts +3 -0
- package/src/commands/string.ts +175 -0
- package/src/commands/synth.ts +11 -1
- package/src/commands/time.ts +967 -0
- package/src/commands/tuning.ts +490 -0
- package/src/main.ts +919 -41
- package/src/project/check.ts +13 -0
- package/src/render.ts +139 -8
- package/src/session/daemon.ts +18 -8
- package/src/session/naming.ts +8 -1
- package/src/session/rebase.ts +21 -0
- package/src/tui/arrange-menu.ts +390 -0
- package/src/tui/audition.ts +38 -5
- package/src/tui/fader.ts +409 -0
- package/src/tui/granular-menu.ts +278 -0
- package/src/tui/menu-time.ts +401 -0
- package/src/tui/menu.ts +967 -23
- package/src/tui/modal-menu.ts +118 -0
- package/src/tui/performance-menu.ts +235 -0
- package/src/tui/play-chords.ts +3 -1
- package/src/tui/play-mode.ts +150 -6
- package/src/tui/play-session.ts +459 -43
- package/tui/app.ts +262 -13
- package/tui/arrange-strip.ts +174 -0
- package/tui/drawer.ts +478 -0
- package/tui/grammar.ts +63 -1
- package/tui/guide.ts +351 -0
- package/tui/highway.ts +87 -4
- package/tui/hits.ts +68 -0
- package/tui/input.ts +7 -0
- package/tui/keys.ts +72 -0
package/core/sdk/eval-child.ts
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Runs inside the evaluation subprocess (`bun --no-addons --no-install
|
|
3
3
|
* --smol eval-child.ts <project>`): imports the project's `song.ts`, fills
|
|
4
|
-
* sample hashes, and prints one JSON line. Never
|
|
4
|
+
* sample hashes and Scala tuning files, and prints one JSON line. Never
|
|
5
|
+
* imported by dawg itself.
|
|
5
6
|
*/
|
|
6
7
|
|
|
7
8
|
import { createHash } from "node:crypto";
|
|
8
|
-
import { realpathSync } from "node:fs";
|
|
9
|
+
import { readFileSync, realpathSync, statSync } from "node:fs";
|
|
9
10
|
import { readFile, stat } from "node:fs/promises";
|
|
10
11
|
import { isAbsolute, join, relative, resolve } from "node:path";
|
|
11
12
|
import { pathToFileURL } from "node:url";
|
|
13
|
+
import { readTuningFiles } from "../tuning.ts";
|
|
12
14
|
|
|
13
15
|
const MAX_SAMPLE_FILE_BYTES = 50 * 1024 * 1024;
|
|
16
|
+
const MAX_TUNING_FILE_BYTES = 1024 * 1024;
|
|
14
17
|
|
|
15
18
|
type Diagnostic = {
|
|
16
19
|
message: string;
|
|
@@ -30,7 +33,10 @@ async function main(): Promise<void> {
|
|
|
30
33
|
const song = module.default;
|
|
31
34
|
if (typeof song !== "object" || song === null)
|
|
32
35
|
throw new Error("song.ts must `export default song({...})`");
|
|
33
|
-
output = {
|
|
36
|
+
output = {
|
|
37
|
+
ok: true,
|
|
38
|
+
score: withTuningFiles(await withSampleHashes(song, project), project),
|
|
39
|
+
};
|
|
34
40
|
} catch (error) {
|
|
35
41
|
output = { ok: false, error: diagnostic(error, project) };
|
|
36
42
|
}
|
|
@@ -98,6 +104,8 @@ async function withSampleHashes(
|
|
|
98
104
|
const wavetable = track.wavetable;
|
|
99
105
|
if (isObject(wavetable) && isObject(wavetable.table))
|
|
100
106
|
refs.push(wavetable.table);
|
|
107
|
+
const granular = track.granular;
|
|
108
|
+
if (isObject(granular) && isObject(granular.src)) refs.push(granular.src);
|
|
101
109
|
}
|
|
102
110
|
for (const ref of refs) {
|
|
103
111
|
if (
|
|
@@ -122,4 +130,33 @@ async function withSampleHashes(
|
|
|
122
130
|
return plain;
|
|
123
131
|
}
|
|
124
132
|
|
|
133
|
+
/**
|
|
134
|
+
* Reads the Scala `.scl` and `.kbm` files a song or track tuning names, so
|
|
135
|
+
* the score carries the resolved table and renders without file access.
|
|
136
|
+
*/
|
|
137
|
+
function withTuningFiles(score: unknown, project: string): unknown {
|
|
138
|
+
if (typeof score !== "object" || score === null) return score;
|
|
139
|
+
const plain = score as Record<string, unknown>;
|
|
140
|
+
const read = (path: string): string | undefined => {
|
|
141
|
+
const file = resolve(project, path);
|
|
142
|
+
if (relative(project, file).startsWith("..")) return undefined;
|
|
143
|
+
try {
|
|
144
|
+
const info = statSync(file);
|
|
145
|
+
if (!info.isFile() || info.size > MAX_TUNING_FILE_BYTES) return undefined;
|
|
146
|
+
return readFileSync(file, "utf8");
|
|
147
|
+
} catch {
|
|
148
|
+
return undefined;
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
if (plain.tuning) plain.tuning = readTuningFiles(plain.tuning, read, "song");
|
|
152
|
+
for (const track of Array.isArray(plain.tracks) ? plain.tracks : [])
|
|
153
|
+
if (typeof track === "object" && track !== null && track.tuning)
|
|
154
|
+
track.tuning = readTuningFiles(
|
|
155
|
+
track.tuning,
|
|
156
|
+
read,
|
|
157
|
+
`track ${String(track.name ?? track.id)}`,
|
|
158
|
+
);
|
|
159
|
+
return plain;
|
|
160
|
+
}
|
|
161
|
+
|
|
125
162
|
await main();
|