@hraness/dawg 0.0.0-stage → 0.3.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 +126 -0
- package/DAWG.md +327 -0
- package/LICENSE +21 -0
- package/README.md +213 -2
- package/core/diff.ts +249 -0
- package/core/drums.ts +102 -0
- package/core/key.ts +43 -0
- package/core/loop.ts +78 -0
- package/core/pitch.ts +60 -0
- package/core/score.ts +1388 -0
- package/core/sdk/eval-child.ts +113 -0
- package/core/sdk/eval.ts +257 -0
- package/core/sdk/print.ts +393 -0
- package/core/sdk/v1.ts +954 -0
- package/core/slug.ts +19 -0
- package/package.json +45 -4
- package/src/agent/agent.ts +853 -0
- package/src/agent/brief.ts +160 -0
- package/src/agent/gateway.ts +441 -0
- package/src/agent/models.ts +633 -0
- package/src/agent/ops.ts +157 -0
- package/src/agent/planner.ts +259 -0
- package/src/agent/provider.ts +454 -0
- package/src/agent/sse.ts +114 -0
- package/src/agent/tools.ts +1373 -0
- package/src/agent/usage.ts +296 -0
- package/src/agent/workspace.ts +683 -0
- package/src/agent/xcb-agent.ts +262 -0
- package/src/agent/xcb.ts +579 -0
- package/src/audio/click.ts +125 -0
- package/src/audio/clock.ts +68 -0
- package/src/audio/engine.ts +841 -0
- package/src/audio/live.ts +152 -0
- package/src/audio/lock.ts +57 -0
- package/src/audio/player.ts +134 -0
- package/src/audio/render-worker.ts +68 -0
- package/src/audio/renderer.ts +174 -0
- package/src/audio/sampler.ts +292 -0
- package/src/audio/samples.ts +683 -0
- package/src/audio/wav.ts +861 -0
- package/src/auth/cli.ts +231 -0
- package/src/auth/credentials.ts +411 -0
- package/src/auth/discover.ts +481 -0
- package/src/auth/login.ts +1191 -0
- package/src/auth/openrouter.ts +206 -0
- package/src/auth/picker.ts +282 -0
- package/src/auth/runner.ts +207 -0
- package/src/auth/tui.ts +107 -0
- package/src/commands/edit.ts +170 -0
- package/src/commands/help.ts +247 -0
- package/src/commands/history.ts +69 -0
- package/src/commands/music.ts +461 -0
- package/src/commands/sample.ts +302 -0
- package/src/daemon.ts +31 -0
- package/src/main.ts +2209 -0
- package/src/media/analyze.ts +364 -0
- package/src/media/backend.ts +253 -0
- package/src/media/cli.ts +173 -0
- package/src/media/download.ts +281 -0
- package/src/media/dsp.ts +281 -0
- package/src/media/import.ts +130 -0
- package/src/media/lyrics.ts +201 -0
- package/src/media/notes.ts +363 -0
- package/src/media/paths.ts +168 -0
- package/src/media/process.ts +226 -0
- package/src/media/registry.ts +9 -0
- package/src/media/sidecar.ts +72 -0
- package/src/media/stemdeck.ts +254 -0
- package/src/media/stems.ts +173 -0
- package/src/media/tools.ts +292 -0
- package/src/media/types.ts +92 -0
- package/src/media/vendor/basic-pitch.ts +261 -0
- package/src/media/vendor/drums.ts +817 -0
- package/src/media/vendor/grid.ts +203 -0
- package/src/media/vendor/util.ts +139 -0
- package/src/media/vendor/wav.ts +233 -0
- package/src/project/check.ts +80 -0
- package/src/project/init.ts +253 -0
- package/src/project/sync.ts +432 -0
- package/src/project/typecheck.ts +149 -0
- package/src/render.ts +121 -0
- package/src/session/attach.ts +181 -0
- package/src/session/client.ts +498 -0
- package/src/session/daemon.ts +740 -0
- package/src/session/delta.ts +249 -0
- package/src/session/list.ts +180 -0
- package/src/session/lock.ts +92 -0
- package/src/session/meta.ts +253 -0
- package/src/session/naming.ts +430 -0
- package/src/session/port.ts +481 -0
- package/src/session/presence.ts +159 -0
- package/src/session/protocol.ts +618 -0
- package/src/session/rebase.ts +168 -0
- package/src/session/store.ts +581 -0
- package/src/tui/menu.ts +1083 -0
- package/src/tui/play-mode.ts +442 -0
- package/src/tui/play-session.ts +636 -0
- package/src/web/fetch.ts +340 -0
- package/src/web/http.ts +137 -0
- package/src/web/search.ts +681 -0
- package/tui/activity.ts +364 -0
- package/tui/app.ts +1372 -0
- package/tui/drums.ts +65 -0
- package/tui/highway.ts +921 -0
- package/tui/input.ts +63 -0
- package/tui/keys.ts +102 -0
- package/tui/layers.ts +80 -0
- package/tui/play-strip.ts +143 -0
- package/tui/prompt.ts +609 -0
- package/tui/render.ts +124 -0
- package/tui/screen.ts +247 -0
- package/tui/text.ts +72 -0
- package/tui/theme.ts +451 -0
package/tui/drums.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Drum-track adapter for the highway: drum hits stream in one lane per voice
|
|
3
|
+
* (kick, snare, clap, rim, tom, hat, open hat) instead of by pitch.
|
|
4
|
+
*/
|
|
5
|
+
import { DRUM_VOICES, drumLane, isDrumInstrument } from "../core/drums.ts";
|
|
6
|
+
import {
|
|
7
|
+
isSamplerInstrument,
|
|
8
|
+
samplerVoiceSlots,
|
|
9
|
+
type Track,
|
|
10
|
+
} from "../core/score.ts";
|
|
11
|
+
import type { NoteSnapshot, TrackScoreSnapshot } from "./render.ts";
|
|
12
|
+
|
|
13
|
+
export function drumSnapshotFields(
|
|
14
|
+
instrument: string | undefined,
|
|
15
|
+
notes: readonly NoteSnapshot[],
|
|
16
|
+
): Partial<TrackScoreSnapshot> {
|
|
17
|
+
if (instrument === undefined || !isDrumInstrument(instrument)) return {};
|
|
18
|
+
return {
|
|
19
|
+
laneCount: DRUM_VOICES.length,
|
|
20
|
+
laneLabels: DRUM_VOICES.map((info) => info.label),
|
|
21
|
+
notes: notes.map((note) => ({
|
|
22
|
+
...note,
|
|
23
|
+
lane: drumLane(note.pitch ?? 0),
|
|
24
|
+
})),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Sampler adapter: oneshot samplers stream one lane per voice (named, in
|
|
30
|
+
* pitch-slot order from 36); keyed samplers keep the pitch axis, labelled by
|
|
31
|
+
* note name like any melodic track.
|
|
32
|
+
*/
|
|
33
|
+
export function samplerSnapshotFields(
|
|
34
|
+
track: Pick<Track, "instrument" | "sampler"> | undefined,
|
|
35
|
+
notes: readonly NoteSnapshot[],
|
|
36
|
+
): Partial<TrackScoreSnapshot> {
|
|
37
|
+
const lanes = samplerLanes(track);
|
|
38
|
+
if (!lanes) return {};
|
|
39
|
+
return {
|
|
40
|
+
laneCount: lanes.labels.length,
|
|
41
|
+
laneLabels: lanes.labels,
|
|
42
|
+
notes: notes.flatMap((note) => {
|
|
43
|
+
const lane = lanes.laneOf(note.pitch ?? -1);
|
|
44
|
+
return lane === undefined ? [] : [{ ...note, lane }];
|
|
45
|
+
}),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Oneshot sampler lanes, or undefined for keyed/non-sampler tracks. */
|
|
50
|
+
export function samplerLanes(
|
|
51
|
+
track: Pick<Track, "instrument" | "sampler"> | undefined,
|
|
52
|
+
):
|
|
53
|
+
| { labels: string[]; laneOf: (pitch: number) => number | undefined }
|
|
54
|
+
| undefined {
|
|
55
|
+
if (!track || !isSamplerInstrument(track.instrument) || !track.sampler)
|
|
56
|
+
return undefined;
|
|
57
|
+
if (track.sampler.mode !== "oneshot") return undefined;
|
|
58
|
+
const slots = [...samplerVoiceSlots(track.sampler)];
|
|
59
|
+
if (slots.length === 0) return undefined;
|
|
60
|
+
const byPitch = new Map(slots.map(([, slot], index) => [slot, index]));
|
|
61
|
+
return {
|
|
62
|
+
labels: slots.map(([voice]) => voice),
|
|
63
|
+
laneOf: (pitch) => byPitch.get(pitch),
|
|
64
|
+
};
|
|
65
|
+
}
|