@hraness/dawg 0.6.1 → 0.7.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 +92 -0
- package/DAWG.md +343 -116
- package/README.md +27 -25
- package/core/autotune.ts +1119 -0
- package/core/chords.ts +271 -23
- package/core/clips.ts +499 -0
- package/core/diff.ts +182 -104
- package/core/expression.ts +15 -0
- package/core/fx.ts +99 -29
- package/core/instruments.ts +19 -0
- package/core/keys.ts +3 -3
- package/core/loop.ts +5 -0
- package/core/lyrics.ts +297 -0
- package/core/master.ts +3 -3
- package/core/resonators.ts +16 -2
- package/core/routing.ts +165 -0
- package/core/score.ts +832 -13
- package/core/sdk/eval-child.ts +7 -2
- package/core/sdk/eval.ts +35 -6
- package/core/sdk/print.ts +276 -3
- package/core/sdk/sync-lyrics.ts +49 -0
- package/core/sdk/v1.ts +1849 -42
- package/core/sections.ts +292 -26
- package/core/sing.ts +815 -0
- package/core/style-provenance.ts +80 -0
- package/core/styles/africa-mena-southasia.ts +2893 -0
- package/core/styles/americas.ts +3810 -0
- package/core/styles/art.ts +4993 -0
- package/core/styles/base.ts +123 -0
- package/core/styles/cycles.ts +106 -0
- package/core/styles/electronic.ts +2723 -0
- package/core/styles/europe-asia-pacific.ts +2838 -0
- package/core/styles/excerpt.ts +29 -0
- package/core/styles/gamelan.ts +283 -0
- package/core/styles/generate.ts +2199 -0
- package/core/styles/index.ts +515 -0
- package/core/styles/parts.ts +106 -0
- package/core/styles/pop.ts +3189 -0
- package/core/styles/rock.ts +2993 -0
- package/core/styles/roots.ts +4175 -0
- package/core/styles/schema.ts +429 -0
- package/core/styles/taxonomy.ts +940 -0
- package/core/styles/validate.ts +528 -0
- package/core/tempo.ts +32 -2
- package/core/tuning.ts +19 -3
- package/core/vocoder.ts +524 -0
- package/guides/agent.md +29 -0
- package/guides/arrange.md +30 -0
- package/guides/audition.md +20 -14
- package/guides/automation.md +12 -7
- package/guides/chords.md +15 -15
- package/guides/effects.md +17 -16
- package/guides/faders.md +20 -16
- package/guides/files.md +13 -9
- package/guides/getting-started.md +15 -11
- package/guides/keys.md +19 -15
- package/guides/media.md +17 -12
- package/guides/mix.md +12 -6
- package/guides/music.md +23 -8
- package/guides/notes.md +15 -9
- package/guides/performance.md +15 -13
- package/guides/play.md +21 -13
- package/guides/project.md +25 -8
- package/guides/providers.md +20 -14
- package/guides/resample.md +15 -9
- package/guides/rhythm.md +17 -13
- package/guides/sessions.md +17 -7
- package/guides/show-me.md +31 -0
- package/guides/sound.md +25 -9
- package/guides/sounds.md +15 -13
- package/guides/styles.md +31 -0
- package/guides/tempo.md +15 -10
- package/guides/tracks.md +15 -10
- package/guides/tuning.md +32 -0
- package/guides/voice.md +31 -0
- package/guides/web-search.md +18 -8
- package/native/prebuilt/darwin-arm64/libdawg_sink.dylib +0 -0
- package/native/prebuilt/darwin-x64/libdawg_sink.dylib +0 -0
- package/native/prebuilt/linux-arm64/libdawg_sink.so +0 -0
- package/native/prebuilt/linux-x64/libdawg_sink.so +0 -0
- package/native/prebuilt/manifest.json +21 -0
- package/package.json +5 -2
- package/src/agent/agent.ts +126 -14
- package/src/agent/calibration-tools.ts +53 -0
- package/src/agent/clip-tools.ts +453 -0
- package/src/agent/command-agent.ts +369 -0
- package/src/agent/drum-tools.ts +2 -2
- package/src/agent/expression-tools.ts +1 -1
- package/src/agent/gateway.ts +246 -60
- package/src/agent/models.ts +53 -12
- package/src/agent/ops.ts +12 -1
- package/src/agent/pack-tools.ts +1 -1
- package/src/agent/planner.ts +13 -0
- package/src/agent/portable-schema.ts +80 -0
- package/src/agent/preview-tool.ts +4 -1
- package/src/agent/provider.ts +22 -8
- package/src/agent/rhythm-tools.ts +1 -1
- package/src/agent/section-tools.ts +1 -1
- package/src/agent/show-me.ts +497 -0
- package/src/agent/steer.ts +15 -0
- package/src/agent/style-tools.ts +217 -0
- package/src/agent/tool-error.ts +12 -0
- package/src/agent/tools.ts +108 -23
- package/src/agent/usage.ts +2 -2
- package/src/agent/voice-tools.ts +925 -0
- package/src/agent/xcb-agent.ts +11 -7
- package/src/argv.ts +38 -0
- package/src/audio/analysis.ts +253 -0
- package/src/audio/arrange.ts +37 -3
- package/src/audio/autotune-engine.ts +101 -0
- package/src/audio/autotune.ts +640 -0
- package/src/audio/clips.ts +240 -0
- package/src/audio/doctor.ts +86 -0
- package/src/audio/dsp/bandbank.ts +138 -0
- package/src/audio/dsp/envelope.ts +10 -0
- package/src/audio/dsp/follow.ts +120 -0
- package/src/audio/dsp/formant.ts +427 -0
- package/src/audio/dsp/glottal.ts +243 -0
- package/src/audio/dsp/interp.ts +7 -2
- package/src/audio/dsp/lpc.ts +50 -0
- package/src/audio/dsp/periodicity.ts +59 -0
- package/src/audio/dsp/pitch.ts +995 -0
- package/src/audio/dsp/psola.ts +199 -0
- package/src/audio/effects/chain.ts +3 -1
- package/src/audio/effects/common.ts +43 -0
- package/src/audio/effects/convolution.ts +7 -4
- package/src/audio/effects/filter.ts +48 -69
- package/src/audio/effects/formant.ts +263 -0
- package/src/audio/engine.ts +160 -28
- package/src/audio/fit.ts +35 -3
- package/src/audio/instrument-check.ts +59 -43
- package/src/audio/instruments.ts +4 -0
- package/src/audio/keys/calibration.ts +56 -0
- package/src/audio/keys/electric.ts +8 -1
- package/src/audio/keys/engine.ts +13 -1
- package/src/audio/keys/piano.ts +22 -2
- package/src/audio/kits.ts +135 -6
- package/src/audio/live.ts +114 -20
- package/src/audio/native.ts +615 -0
- package/src/audio/preview.ts +30 -2
- package/src/audio/render-worker.ts +2 -0
- package/src/audio/renderer.ts +2 -0
- package/src/audio/resample.ts +2 -1
- package/src/audio/sampler.ts +85 -4
- package/src/audio/samples.ts +20 -2
- package/src/audio/sing/analysis.ts +193 -0
- package/src/audio/sing/engine.ts +949 -0
- package/src/audio/strings/bow.ts +48 -5
- package/src/audio/strings/engine.ts +8 -2
- package/src/audio/synth/oscillators.ts +31 -21
- package/src/audio/synth/voice.ts +34 -1
- package/src/audio/vocoder/bank.ts +314 -0
- package/src/audio/vocoder/carrier.ts +165 -0
- package/src/audio/vocoder/control.ts +68 -0
- package/src/audio/vocoder/detect.ts +50 -0
- package/src/audio/vocoder/index.ts +304 -0
- package/src/audio/vocoder/talkbox.ts +143 -0
- package/src/audio/wav.ts +500 -77
- package/src/audio/winds/engine.ts +5 -1
- package/src/audio/winds/trim.ts +28 -4
- package/src/audio/winds/trims1.ts +297 -0
- package/src/audio/winds/voice.ts +15 -2
- package/src/auth/cli.ts +38 -36
- package/src/auth/credentials.ts +30 -1
- package/src/auth/login.ts +15 -9
- package/src/auth/tui.ts +19 -10
- package/src/commands/arrange.ts +44 -29
- package/src/commands/autotune.ts +421 -0
- package/src/commands/calibration.ts +74 -0
- package/src/commands/clips.ts +887 -0
- package/src/commands/drums.ts +3 -2
- package/src/commands/edit.ts +11 -4
- package/src/commands/expression.ts +1 -1
- package/src/commands/formant.ts +221 -0
- package/src/commands/fx.ts +101 -32
- package/src/commands/grammar.ts +558 -0
- package/src/commands/help.ts +610 -380
- package/src/commands/history.ts +18 -0
- package/src/commands/keys.ts +8 -8
- package/src/commands/modal.ts +1 -1
- package/src/commands/music.ts +1 -1
- package/src/commands/nearest.ts +53 -0
- package/src/commands/pack.ts +9 -2
- package/src/commands/param-range.ts +56 -0
- package/src/commands/parses.ts +130 -0
- package/src/commands/progression.ts +170 -0
- package/src/commands/rhythm.ts +3 -0
- package/src/commands/rig.ts +3 -24
- package/src/commands/sing.ts +478 -0
- package/src/commands/strum.ts +13 -1
- package/src/commands/style.ts +415 -0
- package/src/commands/time.ts +6 -3
- package/src/commands/tuning.ts +3 -3
- package/src/commands/vocal-pitch.ts +616 -0
- package/src/commands/vocal.ts +147 -0
- package/src/commands/vocoder.ts +627 -0
- package/src/commands/wind.ts +2 -2
- package/src/fs/durable.ts +50 -0
- package/src/lang/glossary.ts +493 -0
- package/src/launch-args.ts +163 -0
- package/src/main.ts +1397 -253
- package/src/media/cli.ts +20 -3
- package/src/media/import.ts +3 -1
- package/src/project/check.ts +21 -2
- package/src/project/clip-pins.ts +72 -0
- package/src/project/init.ts +23 -8
- package/src/project/sync.ts +418 -86
- package/src/render.ts +20 -1
- package/src/session/daemon.ts +3 -0
- package/src/session/meta.ts +14 -0
- package/src/session/origin.ts +154 -0
- package/src/session/port.ts +22 -4
- package/src/session/presence.ts +34 -4
- package/src/session/protocol.ts +5 -1
- package/src/session/rebase.ts +18 -5
- package/src/session/receipt.ts +258 -0
- package/src/session/store.ts +65 -43
- package/src/tui/arrange-menu.ts +65 -31
- package/src/tui/audition.ts +1 -1
- package/src/tui/euclid.ts +18 -13
- package/src/tui/fader.ts +228 -41
- package/src/tui/granular-menu.ts +2 -4
- package/src/tui/menu-clips.ts +297 -0
- package/src/tui/menu-time.ts +20 -13
- package/src/tui/menu-voice.ts +405 -0
- package/src/tui/menu.ts +759 -177
- package/src/tui/modal-menu.ts +6 -6
- package/src/tui/performance-menu.ts +5 -2
- package/src/tui/play-chords.ts +4 -2
- package/src/tui/play-mode.ts +15 -1
- package/src/tui/play-session.ts +47 -7
- package/src/tui/sing-menu.ts +278 -0
- package/src/tui/style-menu.ts +104 -0
- package/src/tui/vocoder-menu.ts +244 -0
- package/src/tui/wind-menu.ts +3 -3
- package/src/version.ts +8 -0
- package/src/web/fetch.ts +115 -29
- package/tui/activity.ts +180 -9
- package/tui/app.ts +274 -40
- package/tui/clip-row.ts +132 -0
- package/tui/delight.ts +144 -0
- package/tui/drawer.ts +70 -22
- package/tui/frame-gate.ts +76 -0
- package/tui/grammar.ts +112 -63
- package/tui/guide.ts +42 -4
- package/tui/highway.ts +269 -25
- package/tui/hints.ts +192 -0
- package/tui/input.ts +60 -9
- package/tui/keys.ts +1 -1
- package/tui/play-strip.ts +68 -14
- package/tui/prompt.ts +1 -1
- package/tui/screen.ts +144 -14
- package/tui/theme.ts +27 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Linear prediction (0.7 talkbox): autocorrelation with a deterministic
|
|
3
|
+
* white-noise floor and a 60 Hz Gaussian lag window, and Levinson-Durbin.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/** Autocorrelation r[0..order] of `x` into `r`. */
|
|
7
|
+
export function autocorrelate(
|
|
8
|
+
x: Float64Array,
|
|
9
|
+
order: number,
|
|
10
|
+
r: Float64Array,
|
|
11
|
+
sampleRate: number,
|
|
12
|
+
): Float64Array {
|
|
13
|
+
for (let lag = 0; lag <= order; lag += 1) {
|
|
14
|
+
let s = 0;
|
|
15
|
+
for (let i = lag; i < x.length; i += 1) s += x[i]! * x[i - lag]!;
|
|
16
|
+
r[lag] = s;
|
|
17
|
+
}
|
|
18
|
+
r[0] = r[0]! * (1 + 1e-6) + 1e-12;
|
|
19
|
+
for (let lag = 1; lag <= order; lag += 1)
|
|
20
|
+
r[lag] =
|
|
21
|
+
r[lag]! * Math.exp(-0.5 * ((2 * Math.PI * 60 * lag) / sampleRate) ** 2);
|
|
22
|
+
return r;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Levinson-Durbin: predictor `a` (a[0] = 1) from autocorrelation `r`.
|
|
27
|
+
* Returns the prediction error (0 when the recursion goes unstable).
|
|
28
|
+
*/
|
|
29
|
+
export function levinson(
|
|
30
|
+
r: Float64Array,
|
|
31
|
+
order: number,
|
|
32
|
+
a: Float64Array,
|
|
33
|
+
): number {
|
|
34
|
+
a.fill(0);
|
|
35
|
+
a[0] = 1;
|
|
36
|
+
let err = r[0]!;
|
|
37
|
+
if (err <= 0) return 0;
|
|
38
|
+
const tmp = new Float64Array(order + 1);
|
|
39
|
+
for (let i = 1; i <= order; i += 1) {
|
|
40
|
+
let acc = r[i]!;
|
|
41
|
+
for (let j = 1; j < i; j += 1) acc += a[j]! * r[i - j]!;
|
|
42
|
+
const k = -acc / err;
|
|
43
|
+
tmp.set(a);
|
|
44
|
+
for (let j = 1; j < i; j += 1) a[j] = tmp[j]! + k * tmp[i - j]!;
|
|
45
|
+
a[i] = k;
|
|
46
|
+
err *= 1 - k * k;
|
|
47
|
+
if (err <= 0) return 0;
|
|
48
|
+
}
|
|
49
|
+
return err;
|
|
50
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Periodicity (0.7 vocoder): 0..1 per sample, the best normalised
|
|
3
|
+
* autocorrelation over 2..20 ms lags (a YIN-style aperiodicity cue), on a
|
|
4
|
+
* ~8 kHz block-averaged copy, 30 ms frames every 5 ms. The frame grid sits on
|
|
5
|
+
* the absolute song sample (`origin` + index), so a render window and the
|
|
6
|
+
* full render agree after pre-roll.
|
|
7
|
+
*/
|
|
8
|
+
const posMod = (a: number, m: number): number => ((a % m) + m) % m;
|
|
9
|
+
|
|
10
|
+
export function periodicityCurve(
|
|
11
|
+
x: Float64Array,
|
|
12
|
+
sampleRate: number,
|
|
13
|
+
origin = 0,
|
|
14
|
+
): Float64Array {
|
|
15
|
+
const dec = Math.max(1, Math.round(sampleRate / 8000));
|
|
16
|
+
const dsr = sampleRate / dec;
|
|
17
|
+
const hop = Math.round(0.005 * sampleRate);
|
|
18
|
+
const win = Math.round(0.03 * dsr);
|
|
19
|
+
const lagLo = Math.round(dsr / 500);
|
|
20
|
+
const lagHi = Math.round(dsr / 50);
|
|
21
|
+
const out = new Float64Array(x.length);
|
|
22
|
+
const buf = new Float64Array(win + lagHi);
|
|
23
|
+
for (let s = -posMod(origin, hop); s < x.length; s += hop) {
|
|
24
|
+
for (let i = 0; i < buf.length; i += 1) {
|
|
25
|
+
let acc = 0;
|
|
26
|
+
for (let d = 0; d < dec; d += 1) {
|
|
27
|
+
const j = s + i * dec + d;
|
|
28
|
+
acc += j >= 0 && j < x.length ? x[j]! : 0;
|
|
29
|
+
}
|
|
30
|
+
buf[i] = acc / dec;
|
|
31
|
+
}
|
|
32
|
+
let e0 = 0;
|
|
33
|
+
for (let i = 0; i < win; i += 1) e0 += buf[i]! * buf[i]!;
|
|
34
|
+
let best = 0;
|
|
35
|
+
if (e0 > 1e-12)
|
|
36
|
+
for (let lag = lagLo; lag <= lagHi; lag += 1) {
|
|
37
|
+
let c = 0;
|
|
38
|
+
let el = 0;
|
|
39
|
+
for (let i = 0; i < win; i += 1) {
|
|
40
|
+
c += buf[i]! * buf[i + lag]!;
|
|
41
|
+
el += buf[i + lag]! * buf[i + lag]!;
|
|
42
|
+
}
|
|
43
|
+
const r = c / Math.sqrt(e0 * el + 1e-20);
|
|
44
|
+
if (r > best) best = r;
|
|
45
|
+
}
|
|
46
|
+
// The value labels the frame's middle hop.
|
|
47
|
+
const a = s + Math.round((win * dec) / 2) - (hop >> 1);
|
|
48
|
+
for (let i = Math.max(0, a); i < Math.min(x.length, a + hop); i += 1)
|
|
49
|
+
out[i] = best;
|
|
50
|
+
}
|
|
51
|
+
let first = 0;
|
|
52
|
+
for (let i = 0; i < out.length; i += 1)
|
|
53
|
+
if (out[i] !== 0) {
|
|
54
|
+
first = out[i]!;
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
for (let i = 0; i < out.length && out[i] === 0; i += 1) out[i] = first;
|
|
58
|
+
return out;
|
|
59
|
+
}
|