@hraness/dawg 0.6.0 → 0.6.1
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 +34 -0
- package/DAWG.md +338 -51
- package/README.md +4 -4
- package/core/chords.ts +492 -4
- package/core/diff.ts +5 -0
- package/core/expression.ts +143 -6
- package/core/fx.ts +258 -6
- package/core/granular.ts +91 -0
- package/core/instruments.ts +161 -0
- package/core/keys.ts +573 -4
- package/core/resonators.ts +291 -3
- package/core/score.ts +349 -3
- package/core/sdk/print.ts +78 -3
- package/core/sdk/v1.ts +1320 -36
- package/core/sections.ts +12 -4
- package/core/strings.ts +237 -2
- package/core/winds.ts +652 -0
- package/guides/automation.md +1 -0
- package/guides/chords.md +3 -1
- package/guides/effects.md +3 -2
- package/guides/media.md +1 -1
- package/guides/performance.md +3 -0
- package/guides/resample.md +26 -0
- package/guides/sounds.md +7 -6
- package/package.json +1 -1
- package/src/agent/agent.ts +8 -2
- package/src/agent/chord-tools.ts +153 -1
- package/src/agent/expression-tools.ts +91 -0
- package/src/agent/ops.ts +4 -1
- package/src/agent/preview-tool.ts +2 -1
- package/src/agent/resample-tool.ts +131 -0
- package/src/agent/tools.ts +200 -15
- package/src/agent/xcb-agent.ts +8 -2
- package/src/audio/arrange.ts +21 -0
- package/src/audio/dsp/envelope.ts +161 -0
- package/src/audio/dsp/shift.ts +256 -0
- package/src/audio/effects/chain.ts +18 -3
- package/src/audio/effects/common.ts +14 -0
- package/src/audio/effects/convolution.ts +106 -1
- package/src/audio/effects/gaze.ts +354 -0
- package/src/audio/engine.ts +46 -5
- package/src/audio/fit.ts +45 -0
- package/src/audio/granular.ts +352 -21
- package/src/audio/instrument-check.ts +9 -5
- package/src/audio/instruments.ts +32 -3
- package/src/audio/keys/electric.ts +420 -0
- package/src/audio/keys/engine.ts +143 -19
- package/src/audio/keys/organ.ts +1335 -0
- package/src/audio/keys/piano.ts +50 -6
- package/src/audio/keys/sympathetic.ts +127 -0
- package/src/audio/live-worker.ts +3 -1
- package/src/audio/live.ts +136 -9
- package/src/audio/preview.ts +15 -1
- package/src/audio/resample.ts +285 -0
- package/src/audio/resonators.ts +10 -2
- package/src/audio/sampler.ts +168 -21
- package/src/audio/samples.ts +26 -1
- package/src/audio/strings/body.ts +29 -16
- package/src/audio/strings/bow.ts +656 -0
- package/src/audio/strings/engine.ts +266 -20
- package/src/audio/strings/measure.test-helpers.ts +2 -0
- package/src/audio/wav.ts +119 -19
- package/src/audio/winds/engine.ts +302 -0
- package/src/audio/winds/filters.ts +153 -0
- package/src/audio/winds/pitch.ts +104 -0
- package/src/audio/winds/trim.ts +80 -0
- package/src/audio/winds/trims.ts +917 -0
- package/src/audio/winds/voice.ts +479 -0
- package/src/commands/expression.ts +103 -22
- package/src/commands/fx.ts +4 -1
- package/src/commands/granular.ts +7 -2
- package/src/commands/help.ts +91 -8
- package/src/commands/keys.ts +287 -11
- package/src/commands/modal.ts +67 -4
- package/src/commands/resample.ts +281 -0
- package/src/commands/rig.ts +5 -1
- package/src/commands/sample.ts +49 -2
- package/src/commands/shift.ts +119 -0
- package/src/commands/string.ts +28 -2
- package/src/commands/strum.ts +473 -0
- package/src/commands/wind.ts +244 -0
- package/src/main.ts +129 -7
- package/src/project/check.ts +5 -1
- package/src/render.ts +16 -0
- package/src/session/presence.ts +16 -3
- package/src/tui/audition.ts +1 -1
- package/src/tui/menu.ts +637 -35
- package/src/tui/modal-menu.ts +34 -7
- package/src/tui/performance-menu.ts +42 -0
- package/src/tui/play-chords.ts +104 -3
- package/src/tui/play-mode.ts +1 -0
- package/src/tui/play-session.ts +34 -9
- package/src/tui/wind-menu.ts +144 -0
|
@@ -120,26 +120,39 @@ export function bodyFor(name: string, size: number): Body {
|
|
|
120
120
|
/** Body over `x` in place: direct + modes, then a 10 Hz DC blocker. */
|
|
121
121
|
export function applyBody(x: Float64Array, body: Body, sr: number): void {
|
|
122
122
|
if (body.modes.length === 0 && body.direct === 1) return;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
123
|
+
// Every mode per sample in one pass, summed in mode order (the same
|
|
124
|
+
// arithmetic as a pass per mode, so the output is bit-identical), with
|
|
125
|
+
// the coefficients in flat arrays: about 7x faster under JSC.
|
|
126
|
+
const live = body.modes.filter(([f]) => f < 0.45 * sr);
|
|
127
|
+
const m = live.length;
|
|
128
|
+
const B0 = new Float64Array(m);
|
|
129
|
+
const A1 = new Float64Array(m);
|
|
130
|
+
const A2 = new Float64Array(m);
|
|
131
|
+
const G = new Float64Array(m);
|
|
132
|
+
const Z1 = new Float64Array(m);
|
|
133
|
+
const Z2 = new Float64Array(m);
|
|
134
|
+
for (let k = 0; k < m; k += 1) {
|
|
135
|
+
const [f, q, g] = live[k]!;
|
|
127
136
|
const w = (2 * Math.PI * f) / sr;
|
|
128
137
|
const alpha = Math.sin(w) / (2 * q);
|
|
129
138
|
const a0 = 1 + alpha;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
B0[k] = alpha / a0;
|
|
140
|
+
A1[k] = (-2 * Math.cos(w)) / a0;
|
|
141
|
+
A2[k] = (1 - alpha) / a0;
|
|
142
|
+
G[k] = g;
|
|
143
|
+
}
|
|
144
|
+
const direct = body.direct;
|
|
145
|
+
for (let i = 0; i < x.length; i += 1) {
|
|
146
|
+
const xi = x[i]!;
|
|
147
|
+
let acc = direct * xi;
|
|
148
|
+
for (let k = 0; k < m; k += 1) {
|
|
149
|
+
const b0 = B0[k]!;
|
|
150
|
+
const y = b0 * xi + Z1[k]!;
|
|
151
|
+
Z1[k] = -A1[k]! * y + Z2[k]!;
|
|
152
|
+
Z2[k] = -b0 * xi - A2[k]! * y;
|
|
153
|
+
acc = acc + G[k]! * y;
|
|
142
154
|
}
|
|
155
|
+
x[i] = acc;
|
|
143
156
|
}
|
|
144
157
|
const R = Math.exp((-2 * Math.PI * 10) / sr);
|
|
145
158
|
let x1 = 0;
|