pixi-effects 0.27.2 → 0.28.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 +12 -0
- package/README.md +6 -6
- package/ai/chat-template.html +3 -3
- package/ai/tools/check.mjs +30 -0
- package/dist/{Base-CKGl6jCo.d.ts → Base-C6f0fE8j.d.ts} +1 -1
- package/dist/{Base-DjhdL8B1.d.cts → Base-DI1FCGcH.d.cts} +1 -1
- package/dist/Composition-HFEVIYHN.js +7 -0
- package/dist/{Composition-TZHVYIGH.js.map → Composition-HFEVIYHN.js.map} +1 -1
- package/dist/Composition-NI74UJT3.cjs +16 -0
- package/dist/{Composition-DRCTWIYH.cjs.map → Composition-NI74UJT3.cjs.map} +1 -1
- package/dist/Controller.d.cts +2 -2
- package/dist/Controller.d.ts +2 -2
- package/dist/{Movie-CbYwTs6U.d.cts → Movie-CHcM8HNB.d.ts} +3 -1
- package/dist/{Movie-ILKq2fw_.d.ts → Movie-Cx5ozUGb.d.cts} +3 -1
- package/dist/Presenter.d.cts +2 -2
- package/dist/Presenter.d.ts +2 -2
- package/dist/chunk-4LEX3G3M.cjs +259 -0
- package/dist/chunk-4LEX3G3M.cjs.map +1 -0
- package/dist/{chunk-BQNNZEAX.js → chunk-AK54FIWM.js} +7 -4
- package/dist/chunk-AK54FIWM.js.map +1 -0
- package/dist/{chunk-YOV6MEXH.cjs → chunk-MZCDBRTY.cjs} +7 -4
- package/dist/chunk-MZCDBRTY.cjs.map +1 -0
- package/dist/{chunk-C7HJJ7MZ.cjs → chunk-SBOVUZZY.cjs} +61 -61
- package/dist/{chunk-C7HJJ7MZ.cjs.map → chunk-SBOVUZZY.cjs.map} +1 -1
- package/dist/{chunk-K3F2YKL4.js → chunk-WEJAQAFX.js} +3 -3
- package/dist/{chunk-K3F2YKL4.js.map → chunk-WEJAQAFX.js.map} +1 -1
- package/dist/chunk-ZHUUIF6A.js +250 -0
- package/dist/chunk-ZHUUIF6A.js.map +1 -0
- package/dist/events-EE3SM5LM.cjs +16 -0
- package/dist/events-EE3SM5LM.cjs.map +1 -0
- package/dist/events-KXBWR4IV.js +3 -0
- package/dist/events-KXBWR4IV.js.map +1 -0
- package/dist/index.cjs +49 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -5
- package/dist/index.d.ts +19 -5
- package/dist/index.js +18 -7
- package/dist/index.js.map +1 -1
- package/dist/loader.css +1 -1
- package/dist/{music-6MTHQEXS.cjs → music-6WFTPVHU.cjs} +43 -202
- package/dist/music-6WFTPVHU.cjs.map +1 -0
- package/dist/{music-72YJAMXH.js → music-JKOM5YK6.js} +8 -192
- package/dist/music-JKOM5YK6.js.map +1 -0
- package/dist/three.cjs +5 -5
- package/dist/three.d.cts +2 -2
- package/dist/three.d.ts +2 -2
- package/dist/three.js +1 -1
- package/dist/{types-BNVsBBZf.d.ts → types-DpK1vwcl.d.cts} +79 -1
- package/dist/{types-BNVsBBZf.d.cts → types-DpK1vwcl.d.ts} +79 -1
- package/docs/api.md +28 -0
- package/docs/dsl.md +8 -4
- package/llms-full.txt +39 -6
- package/package.json +1 -1
- package/skills/pixi-effects/SKILL.md +1 -1
- package/skills/pixi-effects/reference/cheatsheet.md +1 -1
- package/skills/pixi-effects/reference/pitfalls.md +1 -0
- package/skills/pixi-effects/template.html +6 -6
- package/dist/Composition-DRCTWIYH.cjs +0 -16
- package/dist/Composition-TZHVYIGH.js +0 -7
- package/dist/chunk-BQNNZEAX.js.map +0 -1
- package/dist/chunk-YOV6MEXH.cjs.map +0 -1
- package/dist/music-6MTHQEXS.cjs.map +0 -1
- package/dist/music-72YJAMXH.js.map +0 -1
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
// src/audio/music/notation.ts
|
|
2
|
+
var SEMI = { c: 0, d: 2, e: 4, f: 5, g: 7, a: 9, b: 11 };
|
|
3
|
+
var accidental = (s) => s === "#" ? 1 : s === "b" ? -1 : 0;
|
|
4
|
+
var CHORD_KINDS = {
|
|
5
|
+
"": [0, 4, 7],
|
|
6
|
+
m: [0, 3, 7],
|
|
7
|
+
5: [0, 7],
|
|
8
|
+
aug: [0, 4, 8],
|
|
9
|
+
dim: [0, 3, 6],
|
|
10
|
+
sus2: [0, 2, 7],
|
|
11
|
+
sus4: [0, 5, 7],
|
|
12
|
+
6: [0, 4, 7, 9],
|
|
13
|
+
m6: [0, 3, 7, 9],
|
|
14
|
+
add9: [0, 4, 7, 14],
|
|
15
|
+
madd9: [0, 3, 7, 14],
|
|
16
|
+
add11: [0, 4, 7, 17],
|
|
17
|
+
7: [0, 4, 7, 10],
|
|
18
|
+
maj7: [0, 4, 7, 11],
|
|
19
|
+
m7: [0, 3, 7, 10],
|
|
20
|
+
mMaj7: [0, 3, 7, 11],
|
|
21
|
+
dim7: [0, 3, 6, 9],
|
|
22
|
+
m7b5: [0, 3, 6, 10],
|
|
23
|
+
"7sus4": [0, 5, 7, 10],
|
|
24
|
+
"7b9": [0, 4, 7, 10, 13],
|
|
25
|
+
"7#9": [0, 4, 7, 10, 15],
|
|
26
|
+
9: [0, 4, 7, 10, 14],
|
|
27
|
+
maj9: [0, 4, 7, 11, 14],
|
|
28
|
+
m9: [0, 3, 7, 10, 14],
|
|
29
|
+
11: [0, 4, 7, 10, 14, 17],
|
|
30
|
+
m11: [0, 3, 7, 10, 14, 17],
|
|
31
|
+
13: [0, 4, 7, 10, 14, 21],
|
|
32
|
+
maj13: [0, 4, 7, 11, 14, 21],
|
|
33
|
+
m13: [0, 3, 7, 10, 14, 21],
|
|
34
|
+
"maj7#11": [0, 4, 7, 11, 18]
|
|
35
|
+
};
|
|
36
|
+
var NOTE_FORMS = "a note in lowercase like c4, f#3, bb2; a chord starting with a capital like Am7, G7, C@4, Am7/e; [c4 e4 g4]; _ for a rest; ~ to hold";
|
|
37
|
+
var KIND_SPELLINGS = {
|
|
38
|
+
maj: "",
|
|
39
|
+
M: "",
|
|
40
|
+
major: "",
|
|
41
|
+
min: "m",
|
|
42
|
+
minor: "m",
|
|
43
|
+
mi: "m",
|
|
44
|
+
"-": "m",
|
|
45
|
+
min7: "m7",
|
|
46
|
+
mi7: "m7",
|
|
47
|
+
"-7": "m7",
|
|
48
|
+
minor7: "m7",
|
|
49
|
+
min9: "m9",
|
|
50
|
+
min6: "m6",
|
|
51
|
+
min11: "m11",
|
|
52
|
+
M7: "maj7",
|
|
53
|
+
Maj7: "maj7",
|
|
54
|
+
ma7: "maj7",
|
|
55
|
+
major7: "maj7",
|
|
56
|
+
M9: "maj9",
|
|
57
|
+
Maj9: "maj9",
|
|
58
|
+
sus: "sus4",
|
|
59
|
+
dom7: "7",
|
|
60
|
+
dom: "7",
|
|
61
|
+
"+": "aug",
|
|
62
|
+
o: "dim",
|
|
63
|
+
o7: "dim7",
|
|
64
|
+
"\xF8": "m7b5",
|
|
65
|
+
"m7-5": "m7b5",
|
|
66
|
+
add: "add9",
|
|
67
|
+
"7sus": "7sus4",
|
|
68
|
+
"sus7": "7sus4",
|
|
69
|
+
"9sus4": "7sus4",
|
|
70
|
+
"6/9": "6",
|
|
71
|
+
"69": "6"
|
|
72
|
+
};
|
|
73
|
+
function capitalHint(tok) {
|
|
74
|
+
if (/^[A-G][#b]?-?\d$/.test(tok)) return `it starts with a capital letter, so it is read as a chord; write the note in lowercase: ${tok.toLowerCase()}`;
|
|
75
|
+
const m = /^([A-G][#b]?)([^@/\s]*)((?:@\d)?(?:\/[a-gA-G][#b]?)?)$/.exec(tok);
|
|
76
|
+
if (!m) return null;
|
|
77
|
+
const fix = KIND_SPELLINGS[m[2]];
|
|
78
|
+
return fix === void 0 ? null : `the chord kind "${m[2]}" is not known; did you mean "${m[1]}${fix}${m[3]}"?`;
|
|
79
|
+
}
|
|
80
|
+
function noteToMidi(name) {
|
|
81
|
+
const m = /^([a-gA-G])([#b]?)(-?\d)$/.exec(name);
|
|
82
|
+
if (!m) return null;
|
|
83
|
+
return 12 * (Number(m[3]) + 1) + SEMI[m[1].toLowerCase()] + accidental(m[2]);
|
|
84
|
+
}
|
|
85
|
+
function chordToMidi(sym) {
|
|
86
|
+
const m = /^([A-G])([#b]?)([^@/\s]*)(?:@(\d))?(?:\/([a-gA-G][#b]?))?$/.exec(sym);
|
|
87
|
+
if (!m) return null;
|
|
88
|
+
const kind = CHORD_KINDS[m[3]];
|
|
89
|
+
if (!kind) return null;
|
|
90
|
+
const root = SEMI[m[1].toLowerCase()] + accidental(m[2]);
|
|
91
|
+
const oct = m[4] !== void 0 ? Number(m[4]) : 3;
|
|
92
|
+
const notes = kind.map((i) => 12 * (oct + 1) + root + i);
|
|
93
|
+
if (m[5]) notes.unshift(12 * oct + SEMI[m[5][0].toLowerCase()] + accidental(m[5][1] ?? ""));
|
|
94
|
+
return notes;
|
|
95
|
+
}
|
|
96
|
+
function parseNotes(str, step = 1) {
|
|
97
|
+
const events = [];
|
|
98
|
+
let t = 0;
|
|
99
|
+
for (const raw of String(str).replace(/\|/g, " ").match(/\[[^\]]*\](?::[\d.]+)?[!,]?|\S+/g) ?? []) {
|
|
100
|
+
let tok = raw, vel = 0.8;
|
|
101
|
+
const mark = (c) => {
|
|
102
|
+
vel = c === "!" ? 1 : 0.55;
|
|
103
|
+
};
|
|
104
|
+
if (/[!,]$/.test(tok)) {
|
|
105
|
+
mark(tok.slice(-1));
|
|
106
|
+
tok = tok.slice(0, -1);
|
|
107
|
+
}
|
|
108
|
+
let dur = step;
|
|
109
|
+
const dm = /:([\d.]+)$/.exec(tok);
|
|
110
|
+
if (dm) {
|
|
111
|
+
dur = Number(dm[1]);
|
|
112
|
+
tok = tok.slice(0, dm.index);
|
|
113
|
+
}
|
|
114
|
+
if (/[!,]$/.test(tok)) {
|
|
115
|
+
mark(tok.slice(-1));
|
|
116
|
+
tok = tok.slice(0, -1);
|
|
117
|
+
}
|
|
118
|
+
if (!(dur > 0) || !Number.isFinite(dur)) throw new Error(`"${raw}" has a length of ${dm?.[1]} beats; a length must be a positive number of beats (c4:2)`);
|
|
119
|
+
if (tok === "_") {
|
|
120
|
+
t += dur;
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (tok === "~") {
|
|
124
|
+
if (events.length) events[events.length - 1].dur += dur;
|
|
125
|
+
t += dur;
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
let midi;
|
|
129
|
+
if (tok.startsWith("[")) midi = tok.slice(1, -1).trim().split(/\s+/).map(noteToMidi);
|
|
130
|
+
else if (/^[A-G]/.test(tok)) midi = chordToMidi(tok);
|
|
131
|
+
else midi = [noteToMidi(tok)];
|
|
132
|
+
if (!midi || midi.length === 0 || midi.some((x) => x === null)) {
|
|
133
|
+
const hint = /^[A-G]/.test(tok) && !tok.startsWith("[") ? capitalHint(tok) : null;
|
|
134
|
+
throw new Error(`cannot read "${raw}"${hint ? `: ${hint}` : ""} (${NOTE_FORMS})`);
|
|
135
|
+
}
|
|
136
|
+
events.push({ t, dur, midi, vel, name: tok });
|
|
137
|
+
t += dur;
|
|
138
|
+
}
|
|
139
|
+
return { events, length: t };
|
|
140
|
+
}
|
|
141
|
+
function parseDrumGrid(grid) {
|
|
142
|
+
const hits = [];
|
|
143
|
+
let i = 0;
|
|
144
|
+
for (const ch of String(grid).replace(/[\s|]/g, "")) {
|
|
145
|
+
if (ch === "x" || ch === "X") hits.push({ i, vel: 1 });
|
|
146
|
+
else if (ch === "o" || ch === "O") hits.push({ i, vel: 0.5 });
|
|
147
|
+
else if (ch !== "." && ch !== "-" && ch !== "_") throw new Error(`"${ch}" in the drum pattern "${grid}": use x (hit), o (soft hit), . (nothing)`);
|
|
148
|
+
i++;
|
|
149
|
+
}
|
|
150
|
+
return { hits, steps: i };
|
|
151
|
+
}
|
|
152
|
+
var TempoMap = class _TempoMap {
|
|
153
|
+
points;
|
|
154
|
+
secAt = [0];
|
|
155
|
+
constructor(bpm) {
|
|
156
|
+
this.points = typeof bpm === "number" ? [[0, bpm]] : [...bpm].sort((a, b) => a[0] - b[0]);
|
|
157
|
+
if (this.points[0][0] > 0) this.points.unshift([0, this.points[0][1]]);
|
|
158
|
+
for (let i = 1; i < this.points.length; i++) {
|
|
159
|
+
const [b0, t0] = this.points[i - 1], [b1, t1] = this.points[i];
|
|
160
|
+
this.secAt.push(this.secAt[i - 1] + _TempoMap.span(b1 - b0, t0, t1));
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/** Seconds taken by `db` beats while the tempo goes from `t0` to `t1` bpm. */
|
|
164
|
+
static span(db, t0, t1) {
|
|
165
|
+
return Math.abs(t1 - t0) < 1e-9 ? 60 * db / t0 : 60 * db * Math.log(t1 / t0) / (t1 - t0);
|
|
166
|
+
}
|
|
167
|
+
seconds(beat) {
|
|
168
|
+
if (beat <= 0) return 60 * beat / this.points[0][1];
|
|
169
|
+
let i = this.points.length - 1;
|
|
170
|
+
while (i > 0 && this.points[i][0] > beat) i--;
|
|
171
|
+
const [b0, t0] = this.points[i];
|
|
172
|
+
const next = this.points[i + 1];
|
|
173
|
+
if (!next) return this.secAt[i] + 60 * (beat - b0) / t0;
|
|
174
|
+
const t = t0 + (next[1] - t0) * (beat - b0) / (next[0] - b0);
|
|
175
|
+
return this.secAt[i] + _TempoMap.span(beat - b0, t0, t);
|
|
176
|
+
}
|
|
177
|
+
/** The tempo at a beat. */
|
|
178
|
+
bpmAt(beat) {
|
|
179
|
+
if (beat <= this.points[0][0]) return this.points[0][1];
|
|
180
|
+
for (let i = 1; i < this.points.length; i++) {
|
|
181
|
+
const [b0, t0] = this.points[i - 1], [b1, t1] = this.points[i];
|
|
182
|
+
if (beat < b1) return t0 + (t1 - t0) * (beat - b0) / (b1 - b0);
|
|
183
|
+
}
|
|
184
|
+
return this.points[this.points.length - 1][1];
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
// src/audio/music/events.ts
|
|
189
|
+
var round = (x, digits = 4) => Math.round(x * 10 ** digits) / 10 ** digits;
|
|
190
|
+
var barOf = (beat, meter) => Math.floor(beat / meter + 1e-9) + 1;
|
|
191
|
+
function describeEvents(m) {
|
|
192
|
+
const map = new TempoMap(m.tempo);
|
|
193
|
+
const place = (beat) => {
|
|
194
|
+
const bar = barOf(beat, m.meter);
|
|
195
|
+
return { beat: round(beat), time: round(map.seconds(beat), 6), bar, beatInBar: round(beat - (bar - 1) * m.meter + 1) };
|
|
196
|
+
};
|
|
197
|
+
const tracks = m.tracks.map((t) => ({
|
|
198
|
+
inst: t.inst,
|
|
199
|
+
beats: t.length,
|
|
200
|
+
bars: round(t.length / m.meter),
|
|
201
|
+
notes: t.events.map((e) => ({
|
|
202
|
+
...place(e.t),
|
|
203
|
+
duration: round(e.dur),
|
|
204
|
+
seconds: round(map.seconds(e.t + e.dur) - map.seconds(e.t), 6),
|
|
205
|
+
midi: e.midi.map((n) => n + t.transpose),
|
|
206
|
+
name: e.name,
|
|
207
|
+
chord: e.midi.length > 1,
|
|
208
|
+
velocity: e.vel
|
|
209
|
+
}))
|
|
210
|
+
}));
|
|
211
|
+
const byKind = /* @__PURE__ */ new Map();
|
|
212
|
+
for (const s of m.drums) {
|
|
213
|
+
const end = Math.min(s.to, m.beats);
|
|
214
|
+
for (let rep = 0; s.from + rep * s.repeat < end - 1e-6; rep++) for (const d of s.drums) for (const h of d.hits) {
|
|
215
|
+
const beat = s.from + rep * s.repeat + h.i / m.grid;
|
|
216
|
+
if (beat >= end) continue;
|
|
217
|
+
const list = byKind.get(d.kind) ?? [];
|
|
218
|
+
list.push({ ...place(beat), velocity: h.vel });
|
|
219
|
+
byKind.set(d.kind, list);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
const drums = [...byKind].map(([kind, hits]) => ({ kind, hits: hits.sort((a, b) => a.beat - b.beat) }));
|
|
223
|
+
return { bpm: round(map.bpmAt(0), 2), meter: m.meter, beats: m.beats, bars: round(m.beats / m.meter), seconds: m.seconds, tracks, drums };
|
|
224
|
+
}
|
|
225
|
+
function summarizeMusic(m) {
|
|
226
|
+
const map = new TempoMap(m.tempo);
|
|
227
|
+
return {
|
|
228
|
+
bpm: round(map.bpmAt(0), 2),
|
|
229
|
+
meter: m.meter,
|
|
230
|
+
meterSet: m.meterSet,
|
|
231
|
+
beats: m.beats,
|
|
232
|
+
bars: round(m.beats / m.meter),
|
|
233
|
+
seconds: m.seconds,
|
|
234
|
+
tail: m.tail,
|
|
235
|
+
tracks: m.tracks.map((t) => {
|
|
236
|
+
const perBar = Array.from({ length: Math.max(1, Math.ceil(t.length / m.meter - 1e-9)) }, () => []);
|
|
237
|
+
for (const e of t.events) {
|
|
238
|
+
const bar = barOf(e.t, m.meter), at = round(e.t - (bar - 1) * m.meter + 1);
|
|
239
|
+
perBar[Math.min(perBar.length - 1, bar - 1)].push(at === 1 ? e.name : `${e.name}(${at})`);
|
|
240
|
+
}
|
|
241
|
+
return { inst: t.inst, beats: t.length, bars: round(t.length / m.meter), events: t.events.length, perBar: perBar.map((names) => names.join(" ")) };
|
|
242
|
+
}),
|
|
243
|
+
// a section that starts at or after the end (or ends before it starts) never plays: render skips it, so the read-back does not list it
|
|
244
|
+
drums: m.drums.filter((s) => s.from < Math.min(s.to, m.beats) - 1e-6).map((s) => ({ from: s.from, to: Math.min(s.to, m.beats), kinds: s.drums.filter((d) => d.hits.length > 0).map((d) => d.kind) }))
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export { CHORD_KINDS, TempoMap, chordToMidi, describeEvents, noteToMidi, parseDrumGrid, parseNotes, summarizeMusic };
|
|
249
|
+
//# sourceMappingURL=chunk-ZHUUIF6A.js.map
|
|
250
|
+
//# sourceMappingURL=chunk-ZHUUIF6A.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/audio/music/notation.ts","../src/audio/music/events.ts"],"names":[],"mappings":";AAKA,IAAM,IAAA,GAA+B,EAAE,CAAA,EAAG,CAAA,EAAG,GAAG,CAAA,EAAG,CAAA,EAAG,CAAA,EAAG,CAAA,EAAG,GAAG,CAAA,EAAG,CAAA,EAAG,CAAA,EAAG,CAAA,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IAAA,EAAM,CAAA,CAAE,IAAA,EAAM,KAAA,EAAO,CAAA,CAAE,MAAA,EAAQ,IAAA,EAAM,KAAA,CAAM,CAAA,CAAE,MAAA,GAAS,CAAA,CAAE,KAAK,GAAG,MAAA,EAAQ,CAAA,CAAE,MAAA,CAAO,MAAA,EAAQ,MAAA,EAAQ,MAAA,CAAO,GAAA,CAAI,CAAA,KAAA,KAAS,KAAA,CAAM,IAAA,CAAK,GAAG,CAAC,CAAA,EAAE;AAAA,IACjJ,CAAC,CAAA;AAAA;AAAA,IAED,KAAA,EAAO,EAAE,KAAA,CAAM,MAAA,CAAO,OAAK,CAAA,CAAE,IAAA,GAAO,KAAK,GAAA,CAAI,CAAA,CAAE,IAAI,CAAA,CAAE,KAAK,IAAI,IAAI,CAAA,CAAE,IAAI,CAAA,CAAA,MAAM,EAAE,MAAM,CAAA,CAAE,IAAA,EAAM,IAAI,IAAA,CAAK,GAAA,CAAI,EAAE,EAAA,EAAI,CAAA,CAAE,KAAK,CAAA,EAAG,KAAA,EAAO,EAAE,KAAA,CAAM,MAAA,CAAO,OAAK,CAAA,CAAE,IAAA,CAAK,SAAS,CAAC,CAAA,CAAE,IAAI,CAAA,CAAA,KAAK,CAAA,CAAE,IAAI,CAAA,EAAE,CAAE;AAAA,GAC9L;AACF","file":"chunk-ZHUUIF6A.js","sourcesContent":["/**\n * The text notation of `music`: notes, chords, rests and drum grids, and the tempo map. Pure functions, no audio.\n * Ported from the spike the owner approved by ear (a score of 8 lines of text → a lo-fi tune that sounds like one).\n */\n\nconst SEMI: Record<string, number> = { c: 0, d: 2, e: 4, f: 5, g: 7, a: 9, b: 11 };\nconst accidental = (s: string): number => (s === '#' ? 1 : s === 'b' ? -1 : 0);\n\n/** Chord kinds as semitones above the root (a ninth is 14, an eleventh 17, a thirteenth 21). Voiced close, around octave 3. */\nexport const CHORD_KINDS: Record<string, number[]> = {\n '': [0, 4, 7], m: [0, 3, 7], 5: [0, 7], aug: [0, 4, 8], dim: [0, 3, 6], sus2: [0, 2, 7], sus4: [0, 5, 7],\n 6: [0, 4, 7, 9], m6: [0, 3, 7, 9], add9: [0, 4, 7, 14], madd9: [0, 3, 7, 14], add11: [0, 4, 7, 17],\n 7: [0, 4, 7, 10], maj7: [0, 4, 7, 11], m7: [0, 3, 7, 10], mMaj7: [0, 3, 7, 11], dim7: [0, 3, 6, 9], m7b5: [0, 3, 6, 10],\n '7sus4': [0, 5, 7, 10], '7b9': [0, 4, 7, 10, 13], '7#9': [0, 4, 7, 10, 15],\n 9: [0, 4, 7, 10, 14], maj9: [0, 4, 7, 11, 14], m9: [0, 3, 7, 10, 14],\n 11: [0, 4, 7, 10, 14, 17], m11: [0, 3, 7, 10, 14, 17], 13: [0, 4, 7, 10, 14, 21], maj13: [0, 4, 7, 11, 14, 21], m13: [0, 3, 7, 10, 14, 21],\n 'maj7#11': [0, 4, 7, 11, 18],\n};\n\nexport const NOTE_FORMS = 'a note in lowercase like c4, f#3, bb2; a chord starting with a capital like Am7, G7, C@4, Am7/e; [c4 e4 g4]; _ for a rest; ~ to hold';\n\n/** Spellings people reach for that are not chord kinds here, and the kind they mean (`Cmin7` → `Cm7`). */\nconst KIND_SPELLINGS: Record<string, string> = {\n maj: '', M: '', major: '', min: 'm', minor: 'm', mi: 'm', '-': 'm', min7: 'm7', mi7: 'm7', '-7': 'm7', minor7: 'm7', min9: 'm9', min6: 'm6', min11: 'm11',\n M7: 'maj7', Maj7: 'maj7', ma7: 'maj7', major7: 'maj7', M9: 'maj9', Maj9: 'maj9', sus: 'sus4', dom7: '7', dom: '7', '+': 'aug', o: 'dim', o7: 'dim7',\n 'ø': 'm7b5', 'm7-5': 'm7b5', add: 'add9', '7sus': '7sus4', 'sus7': '7sus4', '9sus4': '7sus4', '6/9': '6', '69': '6',\n};\n\n/** Why a bare token that starts with a capital letter is not a chord, as one sentence with the fix (or null when it is something else). */\nfunction capitalHint(tok: string): string | null {\n if (/^[A-G][#b]?-?\\d$/.test(tok)) return `it starts with a capital letter, so it is read as a chord; write the note in lowercase: ${tok.toLowerCase()}`;\n const m = /^([A-G][#b]?)([^@/\\s]*)((?:@\\d)?(?:\\/[a-gA-G][#b]?)?)$/.exec(tok);\n if (!m) return null;\n const fix = KIND_SPELLINGS[m[2]!];\n return fix === undefined ? null : `the chord kind \"${m[2]}\" is not known; did you mean \"${m[1]}${fix}${m[3]}\"?`;\n}\n\n/** `c4` / `f#3` / `Bb2` → MIDI number (c4 = 60), or null. */\nexport function noteToMidi(name: string): number | null {\n const m = /^([a-gA-G])([#b]?)(-?\\d)$/.exec(name);\n if (!m) return null;\n return 12 * (Number(m[3]) + 1) + SEMI[m[1]!.toLowerCase()]! + accidental(m[2]!);\n}\n\n/** `Am7` → MIDI notes (root in octave 3); `C@4` puts the root in octave 4, `Am7/e` puts e in the bass. Null when it is not a chord. */\nexport function chordToMidi(sym: string): number[] | null {\n const m = /^([A-G])([#b]?)([^@/\\s]*)(?:@(\\d))?(?:\\/([a-gA-G][#b]?))?$/.exec(sym);\n if (!m) return null;\n const kind = CHORD_KINDS[m[3]!];\n if (!kind) return null;\n const root = SEMI[m[1]!.toLowerCase()]! + accidental(m[2]!);\n const oct = m[4] !== undefined ? Number(m[4]) : 3;\n const notes = kind.map(i => 12 * (oct + 1) + root + i);\n if (m[5]) notes.unshift(12 * oct + SEMI[m[5][0]!.toLowerCase()]! + accidental(m[5][1] ?? ''));\n return notes;\n}\n\n/** One note or chord of a track: where (beats from the start), how long (beats), which MIDI notes, how hard (0–1). */\nexport interface MusicEvent {\n t: number; dur: number; midi: number[]; vel: number;\n /** What the score called it, without length or accent: `Am7`, `c4`, `[c4 e4 g4]`. */\n name: string;\n}\n\n/**\n * A track's `notes` string → events. Tokens are separated by spaces (`|` is ignored: use it for bars).\n * `c4`, `c4:2`, `c4:0.5` a note (`:` = length in beats, default `step`) · `Am7:4`, `C@4:2`, `Am7/e:4` a chord · `[c4 e4 g4]:2` a chord note by note ·\n * `_`, `_:2` a rest · `~`, `~:1` hold (lengthens the note before) · `!` accent, `,` soft, before or after the length: `c4!:1`, `c4:1!`.\n * Throws an Error that names the token.\n */\nexport function parseNotes(str: string, step = 1): { events: MusicEvent[]; length: number } {\n const events: MusicEvent[] = [];\n let t = 0;\n for (const raw of String(str).replace(/\\|/g, ' ').match(/\\[[^\\]]*\\](?::[\\d.]+)?[!,]?|\\S+/g) ?? []) {\n let tok = raw, vel = 0.8;\n const mark = (c: string) => { vel = c === '!' ? 1 : 0.55; };\n if (/[!,]$/.test(tok)) { mark(tok.slice(-1)); tok = tok.slice(0, -1); }\n let dur = step;\n const dm = /:([\\d.]+)$/.exec(tok);\n if (dm) { dur = Number(dm[1]); tok = tok.slice(0, dm.index); }\n if (/[!,]$/.test(tok)) { mark(tok.slice(-1)); tok = tok.slice(0, -1); }\n if (!(dur > 0) || !Number.isFinite(dur)) throw new Error(`\"${raw}\" has a length of ${dm?.[1]} beats; a length must be a positive number of beats (c4:2)`);\n if (tok === '_') { t += dur; continue; }\n if (tok === '~') { if (events.length) events[events.length - 1]!.dur += dur; t += dur; continue; }\n let midi: Array<number | null> | null;\n if (tok.startsWith('[')) midi = tok.slice(1, -1).trim().split(/\\s+/).map(noteToMidi);\n else if (/^[A-G]/.test(tok)) midi = chordToMidi(tok); // a capital letter starts a chord (G7, C5, C6), a lowercase one a note (g7, c5, c6): never both\n else midi = [noteToMidi(tok)];\n if (!midi || midi.length === 0 || midi.some(x => x === null)) {\n const hint = /^[A-G]/.test(tok) && !tok.startsWith('[') ? capitalHint(tok) : null;\n throw new Error(`cannot read \"${raw}\"${hint ? `: ${hint}` : ''} (${NOTE_FORMS})`);\n }\n events.push({ t, dur, midi: midi as number[], vel, name: tok });\n t += dur;\n }\n return { events, length: t };\n}\n\n/** A drum pattern: `x` a hit, `o` a soft hit, `.` nothing (spaces and `|` are ignored). Step = 1/`grid` of a beat. */\nexport function parseDrumGrid(grid: string): { hits: Array<{ i: number; vel: number }>; steps: number } {\n const hits: Array<{ i: number; vel: number }> = [];\n let i = 0;\n for (const ch of String(grid).replace(/[\\s|]/g, '')) {\n if (ch === 'x' || ch === 'X') hits.push({ i, vel: 1 });\n else if (ch === 'o' || ch === 'O') hits.push({ i, vel: 0.5 });\n else if (ch !== '.' && ch !== '-' && ch !== '_') throw new Error(`\"${ch}\" in the drum pattern \"${grid}\": use x (hit), o (soft hit), . (nothing)`);\n i++;\n }\n return { hits, steps: i };\n}\n\n/** Tempo as `[beat, bpm]` points; between two points the tempo changes linearly (a ritardando), before / after it holds. */\nexport type TempoPoints = Array<[number, number]>;\n\n/** Beats → seconds for a tempo map (exact integral of 60 / bpm). */\nexport class TempoMap {\n private readonly points: TempoPoints;\n private readonly secAt: number[] = [0];\n\n constructor(bpm: number | TempoPoints) {\n this.points = typeof bpm === 'number' ? [[0, bpm]] : [...bpm].sort((a, b) => a[0] - b[0]);\n if (this.points[0]![0] > 0) this.points.unshift([0, this.points[0]![1]]);\n for (let i = 1; i < this.points.length; i++) {\n const [b0, t0] = this.points[i - 1]!, [b1, t1] = this.points[i]!;\n this.secAt.push(this.secAt[i - 1]! + TempoMap.span(b1 - b0, t0, t1));\n }\n }\n\n /** Seconds taken by `db` beats while the tempo goes from `t0` to `t1` bpm. */\n private static span(db: number, t0: number, t1: number): number {\n return Math.abs(t1 - t0) < 1e-9 ? (60 * db) / t0 : (60 * db * Math.log(t1 / t0)) / (t1 - t0);\n }\n\n seconds(beat: number): number {\n if (beat <= 0) return (60 * beat) / this.points[0]![1];\n let i = this.points.length - 1;\n while (i > 0 && this.points[i]![0] > beat) i--;\n const [b0, t0] = this.points[i]!;\n const next = this.points[i + 1];\n if (!next) return this.secAt[i]! + (60 * (beat - b0)) / t0;\n const t = t0 + ((next[1] - t0) * (beat - b0)) / (next[0] - b0);\n return this.secAt[i]! + TempoMap.span(beat - b0, t0, t);\n }\n\n /** The tempo at a beat. */\n bpmAt(beat: number): number {\n if (beat <= this.points[0]![0]) return this.points[0]![1];\n for (let i = 1; i < this.points.length; i++) {\n const [b0, t0] = this.points[i - 1]!, [b1, t1] = this.points[i]!;\n if (beat < b1) return t0 + ((t1 - t0) * (beat - b0)) / (b1 - b0);\n }\n return this.points[this.points.length - 1]![1];\n }\n}\n","import { TempoMap } from './notation';\nimport type { ResolvedMusic } from './resolve';\n\n/** One note or chord of a track, as a score reader sees it. */\nexport interface MusicNote {\n /** Where it starts: beats from the start, and the same moment in seconds (the tempo map applied; swing and humanize are not). */\n beat: number;\n time: number;\n /** How long it is held, in beats and in seconds. */\n duration: number;\n seconds: number;\n /** The bar it starts in (1-based, from `meter`) and its beat inside that bar (1 = the downbeat, 1.5 = the \"and\" of 1). */\n bar: number;\n beatInBar: number;\n /** The audible MIDI notes (`music.transpose` and the track's `transpose` are in). */\n midi: number[];\n /** What the score called it: `Am7`, `c4`, `[c4 e4 g4]`. */\n name: string;\n /** More than one note at once. */\n chord: boolean;\n /** 0–1 (0.8 normal, 1 accented with `!`, 0.55 soft with `,`). */\n velocity: number;\n}\n\nexport interface MusicTrackEvents {\n inst: string;\n /** The track's length in beats and in bars (not a whole number when a bar is short: that is what to look for). */\n beats: number;\n bars: number;\n notes: MusicNote[];\n}\n\nexport interface MusicDrumHit { beat: number; time: number; bar: number; beatInBar: number; velocity: number }\nexport interface MusicDrumEvents { kind: string; hits: MusicDrumHit[] }\n\nexport interface MusicEvents {\n /** The tempo at the start. */\n bpm: number;\n meter: number;\n beats: number;\n bars: number;\n /** The music without its reverb tail. */\n seconds: number;\n tracks: MusicTrackEvents[];\n /** Every drum that is hit, over all sections, with every hit written out. */\n drums: MusicDrumEvents[];\n}\n\n/** What the `check` tool prints about a music layer: lengths in bars (a short track shows), what starts in each bar, where the drums play. */\nexport interface MusicSummary {\n bpm: number;\n meter: number;\n /** The score set `meter`; when false 4 is only assumed. */\n meterSet: boolean;\n beats: number;\n bars: number;\n seconds: number;\n tail: number;\n tracks: Array<{ inst: string; beats: number; bars: number; events: number; perBar: string[] }>;\n drums: Array<{ from: number; to: number; kinds: string[] }>;\n}\n\nconst round = (x: number, digits = 4): number => Math.round(x * 10 ** digits) / 10 ** digits;\nconst barOf = (beat: number, meter: number): number => Math.floor(beat / meter + 1e-9) + 1;\n\nexport function describeEvents(m: ResolvedMusic): MusicEvents {\n const map = new TempoMap(m.tempo);\n const place = (beat: number) => { const bar = barOf(beat, m.meter); return { beat: round(beat), time: round(map.seconds(beat), 6), bar, beatInBar: round(beat - (bar - 1) * m.meter + 1) }; };\n const tracks = m.tracks.map(t => ({\n inst: t.inst,\n beats: t.length,\n bars: round(t.length / m.meter),\n notes: t.events.map((e): MusicNote => ({\n ...place(e.t), duration: round(e.dur), seconds: round(map.seconds(e.t + e.dur) - map.seconds(e.t), 6),\n midi: e.midi.map(n => n + t.transpose), name: e.name, chord: e.midi.length > 1, velocity: e.vel,\n })),\n }));\n const byKind = new Map<string, MusicDrumHit[]>();\n for (const s of m.drums) {\n const end = Math.min(s.to, m.beats);\n for (let rep = 0; s.from + rep * s.repeat < end - 1e-6; rep++) for (const d of s.drums) for (const h of d.hits) {\n const beat = s.from + rep * s.repeat + h.i / m.grid;\n if (beat >= end) continue;\n const list = byKind.get(d.kind) ?? [];\n list.push({ ...place(beat), velocity: h.vel });\n byKind.set(d.kind, list);\n }\n }\n const drums = [...byKind].map(([kind, hits]) => ({ kind, hits: hits.sort((a, b) => a.beat - b.beat) }));\n return { bpm: round(map.bpmAt(0), 2), meter: m.meter, beats: m.beats, bars: round(m.beats / m.meter), seconds: m.seconds, tracks, drums };\n}\n\nexport function summarizeMusic(m: ResolvedMusic): MusicSummary {\n const map = new TempoMap(m.tempo);\n return {\n bpm: round(map.bpmAt(0), 2), meter: m.meter, meterSet: m.meterSet, beats: m.beats, bars: round(m.beats / m.meter), seconds: m.seconds, tail: m.tail,\n tracks: m.tracks.map(t => {\n const perBar: string[][] = Array.from({ length: Math.max(1, Math.ceil(t.length / m.meter - 1e-9)) }, () => []);\n for (const e of t.events) {\n const bar = barOf(e.t, m.meter), at = round(e.t - (bar - 1) * m.meter + 1);\n perBar[Math.min(perBar.length - 1, bar - 1)]!.push(at === 1 ? e.name : `${e.name}(${at})`); // the beat in the bar, unless it is the downbeat (a bracket: `@` already means the octave in `C@4`)\n }\n return { inst: t.inst, beats: t.length, bars: round(t.length / m.meter), events: t.events.length, perBar: perBar.map(names => names.join(' ')) };\n }),\n // a section that starts at or after the end (or ends before it starts) never plays: render skips it, so the read-back does not list it\n drums: m.drums.filter(s => s.from < Math.min(s.to, m.beats) - 1e-6).map(s => ({ from: s.from, to: Math.min(s.to, m.beats), kinds: s.drums.filter(d => d.hits.length > 0).map(d => d.kind) })),\n };\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk4LEX3G3M_cjs = require('./chunk-4LEX3G3M.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "describeEvents", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunk4LEX3G3M_cjs.describeEvents; }
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(exports, "summarizeMusic", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunk4LEX3G3M_cjs.summarizeMusic; }
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=events-EE3SM5LM.cjs.map
|
|
16
|
+
//# sourceMappingURL=events-EE3SM5LM.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"events-EE3SM5LM.cjs"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"events-KXBWR4IV.js"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkSBOVUZZY_cjs = require('./chunk-SBOVUZZY.cjs');
|
|
4
|
+
var chunkMZCDBRTY_cjs = require('./chunk-MZCDBRTY.cjs');
|
|
5
5
|
var chunkP4GY3Z4G_cjs = require('./chunk-P4GY3Z4G.cjs');
|
|
6
6
|
var chunkZMAD3KJU_cjs = require('./chunk-ZMAD3KJU.cjs');
|
|
7
7
|
var chunkTWZNOUM7_cjs = require('./chunk-TWZNOUM7.cjs');
|
|
@@ -499,7 +499,7 @@ function analyzeAudio(mix, sources, stats, movieDuration, opts = {}) {
|
|
|
499
499
|
issues.push(`${layer} (${source}) is cut off by the end of the movie at ${movieDuration}s (it runs to ${s.end.toFixed(2)}s)`);
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
|
-
return { layer, source, start: s.start, end: s.end, peakDb, sound };
|
|
502
|
+
return { layer, source, start: s.start, end: s.end, peakDb, sound, ...s.music ? { music: s.music } : {} };
|
|
503
503
|
});
|
|
504
504
|
const whole = measureLoudness(chans, sr);
|
|
505
505
|
const silences = findSilences(chans, sr, { minLength: 1 });
|
|
@@ -1485,8 +1485,8 @@ function expandTransitions(spec) {
|
|
|
1485
1485
|
}
|
|
1486
1486
|
const transitions = out.transitions;
|
|
1487
1487
|
const sequences = out.sequences ?? [];
|
|
1488
|
-
const remap = out.duration !== void 0 ?
|
|
1489
|
-
const parentDuration = remap ?
|
|
1488
|
+
const remap = out.duration !== void 0 ? chunkMZCDBRTY_cjs.timeRemapOf(out) : null;
|
|
1489
|
+
const parentDuration = remap ? chunkMZCDBRTY_cjs.contentLength(remap, out.duration) : out.duration ?? Infinity;
|
|
1490
1490
|
const compW = out.width;
|
|
1491
1491
|
const compH = out.height;
|
|
1492
1492
|
const threeDByName = new Set(sequences.filter((s) => s.name && s.threeD).map((s) => s.name));
|
|
@@ -1554,16 +1554,16 @@ function expandTransitions(spec) {
|
|
|
1554
1554
|
if (toUses > 1) {
|
|
1555
1555
|
throw new Error(`pixi-effects: ${tag} sequence "${t.to}" is used as \`to\` in more than one transition`);
|
|
1556
1556
|
}
|
|
1557
|
-
const tStart =
|
|
1557
|
+
const tStart = chunkMZCDBRTY_cjs.resolveAt(t.at, parentDuration);
|
|
1558
1558
|
const tEnd = tStart + t.duration;
|
|
1559
1559
|
const fromSeq = fromEntry.seq;
|
|
1560
|
-
const fromStart =
|
|
1560
|
+
const fromStart = chunkMZCDBRTY_cjs.resolveAt(fromSeq.at, parentDuration);
|
|
1561
1561
|
const fromEnd = fromStart + (fromSeq.duration ?? parentDuration);
|
|
1562
1562
|
if (tStart < fromStart - EPS || tEnd > fromEnd + EPS) {
|
|
1563
1563
|
throw new Error(`pixi-effects: ${tag} window [${tStart}, ${tEnd}] is not covered by \`from\` "${t.from}" (lives [${fromStart}, ${fromEnd}], so it ends at ${fromEnd})`);
|
|
1564
1564
|
}
|
|
1565
1565
|
const toSeq = toEntry.seq;
|
|
1566
|
-
const toStart =
|
|
1566
|
+
const toStart = chunkMZCDBRTY_cjs.resolveAt(toSeq.at, parentDuration);
|
|
1567
1567
|
const toEnd = toStart + (toSeq.duration ?? parentDuration);
|
|
1568
1568
|
if (tStart < toStart - EPS || tEnd > toEnd + EPS) {
|
|
1569
1569
|
throw new Error(`pixi-effects: ${tag} window [${tStart}, ${tEnd}] is not covered by \`to\` "${t.to}" (lives [${toStart}, ${toEnd}], so it starts at ${toStart})`);
|
|
@@ -1623,7 +1623,7 @@ function wrapAsFullComposition(seq, compW, compH) {
|
|
|
1623
1623
|
delete inner.at;
|
|
1624
1624
|
delete inner.duration;
|
|
1625
1625
|
const m = inner.mask;
|
|
1626
|
-
const carriesMatte = m !== void 0 &&
|
|
1626
|
+
const carriesMatte = m !== void 0 && chunkSBOVUZZY_cjs.maskSourceOf(m).kind === "refs";
|
|
1627
1627
|
if (carriesMatte) delete inner.mask;
|
|
1628
1628
|
return {
|
|
1629
1629
|
...carriesMatte ? { mask: m } : {},
|
|
@@ -1950,7 +1950,7 @@ function inspectScene(root, frame, time, canvas, opts = {}) {
|
|
|
1950
1950
|
const group = parentScene ?? (name !== void 0 && blending.has(name) ? name : void 0);
|
|
1951
1951
|
if (group) scene.set(info, group);
|
|
1952
1952
|
if (zero || seq.showsNothingYet) scaledToNothing.add(info);
|
|
1953
|
-
if (seq instanceof
|
|
1953
|
+
if (seq instanceof chunkSBOVUZZY_cjs.CompositionSequence) walk2(seq, prefix + label + "/", insideThreeD || threeD, visible, group, moving, zero);
|
|
1954
1954
|
});
|
|
1955
1955
|
};
|
|
1956
1956
|
walk2(root, "", false, true);
|
|
@@ -2011,10 +2011,10 @@ function walk(comp, parentStart, parentEnd, depth, prefix, rows, transitions, lo
|
|
|
2011
2011
|
const start = parentStart + (seq.at ?? 0);
|
|
2012
2012
|
const end = Math.min(parentEnd, seq.duration !== void 0 ? start + seq.duration : parentEnd);
|
|
2013
2013
|
const span = end - start;
|
|
2014
|
-
const keys = (seq.spec.keyframes ?? []).map((kf) => round(start +
|
|
2014
|
+
const keys = (seq.spec.keyframes ?? []).map((kf) => round(start + chunkMZCDBRTY_cjs.resolveAt(kf.at, span))).sort((a, b) => a - b).slice(0, MAX_KEYS);
|
|
2015
2015
|
const row = { path: prefix + name, name, type: seq.spec.type, depth, start: round(start), end: round(end), keys, detail: detailOf(seq), ...local ? { local } : {} };
|
|
2016
2016
|
const inner = [];
|
|
2017
|
-
const isComp = seq instanceof
|
|
2017
|
+
const isComp = seq instanceof chunkSBOVUZZY_cjs.CompositionSequence;
|
|
2018
2018
|
if (isComp) {
|
|
2019
2019
|
const label = seq.remapLabel();
|
|
2020
2020
|
walk(seq, label ? 0 : start, label ? seq.contentSpan : end, depth + 1, prefix + name + "/", inner, transitions, label ? `${name} ${label}` : local);
|
|
@@ -2671,8 +2671,8 @@ var Movie = class {
|
|
|
2671
2671
|
this.stops = normalizeStops(options.composition?.stops, this.duration, this.frameRate);
|
|
2672
2672
|
this._posterFrame = poster.frame;
|
|
2673
2673
|
this.background = options.background ?? "#000000";
|
|
2674
|
-
this.timeline =
|
|
2675
|
-
|
|
2674
|
+
this.timeline = chunkMZCDBRTY_cjs.createTimeline({ paused: true, defaults: { ease: "none" } });
|
|
2675
|
+
chunkMZCDBRTY_cjs.lengthen(this.timeline, this.duration);
|
|
2676
2676
|
const baseAppOptions = {
|
|
2677
2677
|
width: this.width,
|
|
2678
2678
|
height: this.height,
|
|
@@ -2731,7 +2731,7 @@ var Movie = class {
|
|
|
2731
2731
|
height: options.composition.height ?? this.height,
|
|
2732
2732
|
duration: options.composition.duration ?? this.duration
|
|
2733
2733
|
} : void 0;
|
|
2734
|
-
await
|
|
2734
|
+
await chunkMZCDBRTY_cjs.ensureFilterLibrary(seededComposition);
|
|
2735
2735
|
const userComposition = seededComposition ? expandTransitions(seededComposition) : void 0;
|
|
2736
2736
|
const rootSeqSpec = {
|
|
2737
2737
|
type: "composition",
|
|
@@ -2741,7 +2741,7 @@ var Movie = class {
|
|
|
2741
2741
|
...userComposition
|
|
2742
2742
|
};
|
|
2743
2743
|
if (userComposition) carryTransitionWindows(userComposition, rootSeqSpec);
|
|
2744
|
-
const composition = new
|
|
2744
|
+
const composition = new chunkSBOVUZZY_cjs.CompositionSequence(rootSeqSpec, null, rootShape);
|
|
2745
2745
|
lp.begin("build", countLayers(rootSeqSpec));
|
|
2746
2746
|
await composition.build();
|
|
2747
2747
|
this._rootSequence = composition;
|
|
@@ -3468,8 +3468,8 @@ function splitText(text, style = {}, opts = {}) {
|
|
|
3468
3468
|
|
|
3469
3469
|
// src/presets/_ease.ts
|
|
3470
3470
|
function parseEase2(name) {
|
|
3471
|
-
|
|
3472
|
-
return
|
|
3471
|
+
chunkMZCDBRTY_cjs.checkEase(name, "a preset");
|
|
3472
|
+
return chunkMZCDBRTY_cjs.parseEase(name);
|
|
3473
3473
|
}
|
|
3474
3474
|
|
|
3475
3475
|
// src/presets/kenBurns.ts
|
|
@@ -3604,17 +3604,17 @@ function orbit(opts) {
|
|
|
3604
3604
|
throw new Error("pixi-effects: orbit() cannot combine `radius` with `dollyZoom` \u2014 the radius follows the animated fov");
|
|
3605
3605
|
}
|
|
3606
3606
|
const [cx, cy] = opts.center ?? [width / 2, height / 2];
|
|
3607
|
-
const fixedR = opts.radius ??
|
|
3607
|
+
const fixedR = opts.radius ?? chunkMZCDBRTY_cjs.homeDistance(height, fov ?? chunkMZCDBRTY_cjs.DEFAULT_FOV);
|
|
3608
3608
|
const start = opts.start ?? -degrees / 2;
|
|
3609
3609
|
const steps = Math.max(1, Math.round(duration * stepsPerSecond));
|
|
3610
3610
|
const easeFn = parseEase2(ease);
|
|
3611
3611
|
const dollyEase = dolly ? parseEase2(dolly.ease ?? ease) : null;
|
|
3612
3612
|
const pos = (i) => {
|
|
3613
3613
|
const p = i / steps;
|
|
3614
|
-
const a = (start + degrees * easeFn(p)) *
|
|
3614
|
+
const a = (start + degrees * easeFn(p)) * chunkMZCDBRTY_cjs.DEG;
|
|
3615
3615
|
if (!dolly) return { x: cx + fixedR * Math.sin(a), z: fixedR * Math.cos(a) };
|
|
3616
3616
|
const f = dolly.from + (dolly.to - dolly.from) * dollyEase(p);
|
|
3617
|
-
const R =
|
|
3617
|
+
const R = chunkMZCDBRTY_cjs.homeDistance(height, f);
|
|
3618
3618
|
return { x: cx + R * Math.sin(a), z: R * Math.cos(a), fov: f };
|
|
3619
3619
|
};
|
|
3620
3620
|
const keyframes = [];
|
|
@@ -3669,7 +3669,7 @@ function particles(opts) {
|
|
|
3669
3669
|
const round3 = (v) => Math.round(v * 1e6) / 1e6;
|
|
3670
3670
|
const out = [];
|
|
3671
3671
|
for (let i = 0; i < count; i++) {
|
|
3672
|
-
const r =
|
|
3672
|
+
const r = chunkMZCDBRTY_cjs.random(seed * 1000003 + i * 7919 + 17);
|
|
3673
3673
|
const pick = ([a2, b]) => a2 + r() * (b - a2);
|
|
3674
3674
|
const born = at + r() * emit;
|
|
3675
3675
|
const lifetime = pick(life);
|
|
@@ -3682,7 +3682,7 @@ function particles(opts) {
|
|
|
3682
3682
|
const turn = spin ? pick(spin) : 0;
|
|
3683
3683
|
const startAngle = spin ? r() * 360 : 0;
|
|
3684
3684
|
const swayAmp = sway?.amp ?? 0, swayFreq = sway?.freq ?? 1;
|
|
3685
|
-
const n0 = sway ?
|
|
3685
|
+
const n0 = sway ? chunkMZCDBRTY_cjs.noise(0, seed * 1000003 + i) : 0;
|
|
3686
3686
|
const at_ = (t) => {
|
|
3687
3687
|
const axis = (p0, v0, acc) => {
|
|
3688
3688
|
if (drag > 0) {
|
|
@@ -3691,7 +3691,7 @@ function particles(opts) {
|
|
|
3691
3691
|
}
|
|
3692
3692
|
return p0 + v0 * t + 0.5 * acc * t * t;
|
|
3693
3693
|
};
|
|
3694
|
-
const sw = sway ? swayAmp * (
|
|
3694
|
+
const sw = sway ? swayAmp * (chunkMZCDBRTY_cjs.noise(t * swayFreq, seed * 1000003 + i) - n0) : 0;
|
|
3695
3695
|
return { x: axis(x0, vx, wind) + sw, y: axis(y0, vy, gravity) };
|
|
3696
3696
|
};
|
|
3697
3697
|
const kfs = [];
|
|
@@ -3753,7 +3753,7 @@ function followPath(opts) {
|
|
|
3753
3753
|
if (steps > MAX_STEPS) throw new Error(`followPath(): ${steps} samples is too many (max ${MAX_STEPS}); lower frameRate or duration`);
|
|
3754
3754
|
const segments = [];
|
|
3755
3755
|
let total = 0;
|
|
3756
|
-
for (const line of
|
|
3756
|
+
for (const line of chunkMZCDBRTY_cjs.flattenSvgPath(d)) {
|
|
3757
3757
|
const p = line.closed ? [...line.pts, line.pts[0], line.pts[1]] : line.pts;
|
|
3758
3758
|
for (let i = 2; i < p.length; i += 2) {
|
|
3759
3759
|
const len = Math.hypot(p[i] - p[i - 2], p[i + 1] - p[i - 1]);
|
|
@@ -3907,7 +3907,7 @@ function distances(n, from, grid, seed) {
|
|
|
3907
3907
|
if (n === 0) return [];
|
|
3908
3908
|
if (from === "random") {
|
|
3909
3909
|
const order = Array.from({ length: n }, (_, i) => i);
|
|
3910
|
-
const r =
|
|
3910
|
+
const r = chunkMZCDBRTY_cjs.random(seed);
|
|
3911
3911
|
for (let i = n - 1; i > 0; i--) {
|
|
3912
3912
|
const j = Math.floor(r() * (i + 1));
|
|
3913
3913
|
[order[i], order[j]] = [order[j], order[i]];
|
|
@@ -3969,7 +3969,7 @@ function wiggle(opts) {
|
|
|
3969
3969
|
to[n] = p.around;
|
|
3970
3970
|
return;
|
|
3971
3971
|
}
|
|
3972
|
-
const off = (
|
|
3972
|
+
const off = (chunkMZCDBRTY_cjs.rand(seed * 7919 + pi * 104729 + s * 31 + 1) * 2 - 1) * p.amp;
|
|
3973
3973
|
to[n] = typeof p.around === "number" ? p.around + off : `(${p.around}) ${off < 0 ? "-" : "+"} ${Math.abs(off)}`;
|
|
3974
3974
|
});
|
|
3975
3975
|
out.push({ at: at + s * stepLen, to, duration: stepLen, ease });
|
|
@@ -4333,7 +4333,7 @@ async function audioEnvelope(source, options = {}) {
|
|
|
4333
4333
|
|
|
4334
4334
|
// src/audio/musicEnvelope.ts
|
|
4335
4335
|
async function musicEnvelope(music, options = {}) {
|
|
4336
|
-
const { resolveMusic, renderMusic, musicLength, musicBeatTimes, TempoMap } = await import('./music-
|
|
4336
|
+
const { resolveMusic, renderMusic, musicLength, musicBeatTimes, TempoMap } = await import('./music-6WFTPVHU.cjs');
|
|
4337
4337
|
const messages = [];
|
|
4338
4338
|
const m = resolveMusic(music, "musicEnvelope()", (msg) => messages.push(msg));
|
|
4339
4339
|
if (!m) throw new Error(`pixi-effects: musicEnvelope(): ${messages.join(" ") || "the music has nothing to play"}`);
|
|
@@ -4346,7 +4346,7 @@ async function musicEnvelope(music, options = {}) {
|
|
|
4346
4346
|
|
|
4347
4347
|
// src/audio/musicBuffer.ts
|
|
4348
4348
|
async function musicBuffer(music, options = {}) {
|
|
4349
|
-
const { resolveMusic, renderMusic, musicLength } = await import('./music-
|
|
4349
|
+
const { resolveMusic, renderMusic, musicLength } = await import('./music-6WFTPVHU.cjs');
|
|
4350
4350
|
const messages = [];
|
|
4351
4351
|
const m = resolveMusic(music, "musicBuffer()", (msg) => messages.push(msg));
|
|
4352
4352
|
if (!m) throw new Error(`pixi-effects: musicBuffer(): ${messages.join(" ") || "the music has nothing to play"}`);
|
|
@@ -4361,6 +4361,17 @@ async function musicBuffer(music, options = {}) {
|
|
|
4361
4361
|
return buffer;
|
|
4362
4362
|
}
|
|
4363
4363
|
|
|
4364
|
+
// src/audio/musicEvents.ts
|
|
4365
|
+
async function musicEvents(music) {
|
|
4366
|
+
const { resolveMusic } = await import('./music-6WFTPVHU.cjs');
|
|
4367
|
+
const { describeEvents } = await import('./events-EE3SM5LM.cjs');
|
|
4368
|
+
const messages = [];
|
|
4369
|
+
const m = resolveMusic(music, "musicEvents()", (msg) => messages.push(msg));
|
|
4370
|
+
if (!m) throw new Error(`pixi-effects: musicEvents(): ${messages.join(" ") || "the music has nothing to play"}`);
|
|
4371
|
+
for (const msg of messages) console.warn(msg);
|
|
4372
|
+
return describeEvents(m);
|
|
4373
|
+
}
|
|
4374
|
+
|
|
4364
4375
|
// src/presets/deck.ts
|
|
4365
4376
|
var PAGE_KEYS = ["name", "duration", "sequences", "stops", "notes", "advance", "initial", "keyframes", "filters", "filterArea", "blendMode", "mask", "maskInverted"];
|
|
4366
4377
|
var DECK_KEYS = ["pages", "transition", "width", "height", "frameRate", "background", "canvas", "assets", "poster", "motionBlur", "loader"];
|
|
@@ -4442,21 +4453,25 @@ function withFade(spec, opts) {
|
|
|
4442
4453
|
return spec;
|
|
4443
4454
|
}
|
|
4444
4455
|
|
|
4456
|
+
Object.defineProperty(exports, "Sequence", {
|
|
4457
|
+
enumerable: true,
|
|
4458
|
+
get: function () { return chunkMZCDBRTY_cjs.Sequence; }
|
|
4459
|
+
});
|
|
4445
4460
|
Object.defineProperty(exports, "noise", {
|
|
4446
4461
|
enumerable: true,
|
|
4447
|
-
get: function () { return
|
|
4462
|
+
get: function () { return chunkMZCDBRTY_cjs.noise; }
|
|
4448
4463
|
});
|
|
4449
4464
|
Object.defineProperty(exports, "rand", {
|
|
4450
4465
|
enumerable: true,
|
|
4451
|
-
get: function () { return
|
|
4466
|
+
get: function () { return chunkMZCDBRTY_cjs.rand; }
|
|
4452
4467
|
});
|
|
4453
4468
|
Object.defineProperty(exports, "random", {
|
|
4454
4469
|
enumerable: true,
|
|
4455
|
-
get: function () { return
|
|
4470
|
+
get: function () { return chunkMZCDBRTY_cjs.random; }
|
|
4456
4471
|
});
|
|
4457
4472
|
Object.defineProperty(exports, "registerSequenceType", {
|
|
4458
4473
|
enumerable: true,
|
|
4459
|
-
get: function () { return
|
|
4474
|
+
get: function () { return chunkMZCDBRTY_cjs.registerSequenceType; }
|
|
4460
4475
|
});
|
|
4461
4476
|
exports.Movie = Movie;
|
|
4462
4477
|
exports.animateText = animateText;
|
|
@@ -4473,6 +4488,7 @@ exports.kenBurns = kenBurns;
|
|
|
4473
4488
|
exports.measureText = measureText;
|
|
4474
4489
|
exports.musicBuffer = musicBuffer;
|
|
4475
4490
|
exports.musicEnvelope = musicEnvelope;
|
|
4491
|
+
exports.musicEvents = musicEvents;
|
|
4476
4492
|
exports.normalizeStops = normalizeStops;
|
|
4477
4493
|
exports.orbit = orbit;
|
|
4478
4494
|
exports.particles = particles;
|