@biunow/agent-biutalk 2.0.0 → 2.0.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.
Files changed (79) hide show
  1. package/_shared/lib/panel-llm.mjs +82 -0
  2. package/_shared/lib/panel-settings.mjs +16 -0
  3. package/bin/server.js +3 -2
  4. package/manifest.json +3 -3
  5. package/package.json +1 -1
  6. package/_shared/.tmp-panel-smoke/art/smoke.mp4 +0 -0
  7. package/_shared/.tmp-panel-smoke/art-pipe/out/biuart-01_cave-mwq5kfpm.mp4 +0 -0
  8. package/_shared/.tmp-panel-smoke/art-pipe/panel-delivery.json +0 -7
  9. package/_shared/.tmp-panel-smoke/reel-pipe/film/index.html +0 -7
  10. package/_shared/.tmp-panel-smoke/reel-pipe/film/main.js +0 -68
  11. package/_shared/.tmp-panel-smoke/reel-pipe/film/panel-beats.json +0 -20
  12. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/CREDITS +0 -20
  13. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/build.sh +0 -17
  14. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/ease.js +0 -43
  15. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/events.json +0 -1
  16. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/film.js +0 -533
  17. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/fonts/OFL-Archivo.txt +0 -93
  18. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/fonts/OFL-DMSerifDisplay.txt +0 -93
  19. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/fonts/OFL-UnifrakturMaguntia.txt +0 -94
  20. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/fonts/fonts.css +0 -3
  21. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/index.html +0 -6
  22. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/lines.json +0 -10
  23. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/main.js +0 -15
  24. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/mix.py +0 -116
  25. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/music/score.py +0 -168
  26. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/music/score_meta.json +0 -59
  27. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/score.json +0 -235
  28. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/stills/styleframe.jpg +0 -0
  29. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/tools/fonts.sh +0 -17
  30. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/tools/subs.py +0 -11
  31. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/tools/words.py +0 -20
  32. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/voices/dur.json +0 -10
  33. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/voices/words.json +0 -213
  34. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/voices/words_rel.json +0 -56
  35. package/_shared/.tmp-panel-smoke/reel-pipe/style-ref.json +0 -5
  36. package/_shared/.tmp-panel-smoke/reel-pipe2/film/index.html +0 -7
  37. package/_shared/.tmp-panel-smoke/reel-pipe2/film/main.js +0 -68
  38. package/_shared/.tmp-panel-smoke/reel-pipe2/film/panel-beats.json +0 -20
  39. package/_shared/.tmp-panel-smoke/reel-pipe2/out/video.mp4 +0 -0
  40. package/_shared/.tmp-panel-smoke/reel-pipe2/panel-delivery.json +0 -8
  41. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/CREDITS +0 -20
  42. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/build.sh +0 -17
  43. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/ease.js +0 -43
  44. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/events.json +0 -1
  45. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/film.js +0 -533
  46. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/fonts/OFL-Archivo.txt +0 -93
  47. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/fonts/OFL-DMSerifDisplay.txt +0 -93
  48. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/fonts/OFL-UnifrakturMaguntia.txt +0 -94
  49. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/fonts/fonts.css +0 -3
  50. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/index.html +0 -6
  51. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/lines.json +0 -10
  52. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/main.js +0 -15
  53. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/mix.py +0 -116
  54. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/music/score.py +0 -168
  55. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/music/score_meta.json +0 -59
  56. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/score.json +0 -235
  57. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/stills/styleframe.jpg +0 -0
  58. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/tools/fonts.sh +0 -17
  59. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/tools/subs.py +0 -11
  60. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/tools/words.py +0 -20
  61. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/voices/dur.json +0 -10
  62. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/voices/words.json +0 -213
  63. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/voices/words_rel.json +0 -56
  64. package/_shared/.tmp-panel-smoke/reel-pipe2/style-ref.json +0 -5
  65. package/_shared/.tmp-panel-smoke/remo-pipe/brief.md +0 -2
  66. package/_shared/.tmp-panel-smoke/remo-pipe/remo-job.json +0 -4
  67. package/_shared/.tmp-panel-smoke/remo-pipe2/brief.md +0 -1
  68. package/_shared/.tmp-panel-smoke/remo-pipe2/out/final.mp4 +0 -0
  69. package/_shared/.tmp-panel-smoke/remo-pipe2/panel-delivery.json +0 -8
  70. package/_shared/.tmp-panel-smoke/remo-pipe2/remo-job.json +0 -4
  71. package/_shared/.tmp-panel-smoke/vibe-pipe-ok/ep00-demo.mp4 +0 -0
  72. package/_shared/.tmp-panel-smoke/vibe-pipe-ok/out/ep00-demo.mp4 +0 -0
  73. package/_shared/.tmp-panel-smoke/vibe-pipe-ok/panel-delivery.json +0 -7
  74. package/_shared/.tmp-panel-smoke/vibe-pipe-ok/publish.json +0 -10
  75. package/_shared/.tmp-panel-smoke/vibe-still.jpg +0 -0
  76. package/_shared/.tmp-panel-smoke/vibe-still.log +0 -6
  77. package/_shared/.tmp-panel-smoke/vibe-still.log.err +0 -0
  78. package/_shared/.tmp-panel-smoke/vibe-still2.log +0 -26
  79. package/_shared/.tmp-panel-smoke/vibe-still2.log.err +0 -0
@@ -0,0 +1,82 @@
1
+ import { panelLlmSettings, hasPanelLlm } from './panel-settings.mjs';
2
+
3
+ export { hasPanelLlm };
4
+
5
+ function resolveBaseUrl(llm) {
6
+ const raw = (llm.baseUrl || '').replace(/\/$/, '');
7
+ if (raw) return raw.endsWith('/v1') ? raw : `${raw}/v1`;
8
+ const p = (llm.provider || '').toLowerCase();
9
+ if (p === 'deepseek') return 'https://api.deepseek.com/v1';
10
+ return 'https://api.openai.com/v1';
11
+ }
12
+
13
+ function resolveModel(llm) {
14
+ if (llm.model) return llm.model;
15
+ const p = (llm.provider || '').toLowerCase();
16
+ if (p === 'deepseek') return 'deepseek-chat';
17
+ return 'gpt-4o-mini';
18
+ }
19
+
20
+ /**
21
+ * OpenAI-compatible chat completions using panel settings.
22
+ * @returns {Promise<string>} assistant text
23
+ */
24
+ export async function panelChat(messages, opts = {}) {
25
+ if (!hasPanelLlm()) {
26
+ const err = new Error('未配置面板大模型。请到 BN 面板「设置 → 大模型」填写 Provider / Base URL / API Key / Model');
27
+ err.code = 'PANEL_LLM_MISSING';
28
+ throw err;
29
+ }
30
+ const llm = panelLlmSettings();
31
+ const base = resolveBaseUrl(llm);
32
+ const model = resolveModel(llm);
33
+ const doFetch = typeof opts.fetchImpl === 'function' ? opts.fetchImpl : fetch;
34
+ const res = await doFetch(`${base}/chat/completions`, {
35
+ method: 'POST',
36
+ headers: {
37
+ authorization: `Bearer ${llm.apiKey}`,
38
+ 'content-type': 'application/json',
39
+ },
40
+ body: JSON.stringify({
41
+ model,
42
+ temperature: opts.temperature ?? 0.35,
43
+ messages,
44
+ }),
45
+ signal: opts.signal || AbortSignal.timeout(opts.timeoutMs || 120_000),
46
+ });
47
+ const data = await res.json().catch(() => ({}));
48
+ if (!res.ok) {
49
+ const msg = data?.error?.message || data?.message || `大模型请求失败 HTTP ${res.status}`;
50
+ const err = new Error(msg);
51
+ err.code = 'PANEL_LLM_HTTP';
52
+ err.status = res.status;
53
+ throw err;
54
+ }
55
+ const text = data?.choices?.[0]?.message?.content;
56
+ if (!text || !String(text).trim()) {
57
+ const err = new Error('大模型返回为空');
58
+ err.code = 'PANEL_LLM_EMPTY';
59
+ throw err;
60
+ }
61
+ return String(text).trim();
62
+ }
63
+
64
+ /** 用面板大模型把中文提示词转英文;未配置面板模型时返回 null,由调用方回退。 */
65
+ export async function panelTranslateToEnglish(text, fetchImpl) {
66
+ const source = String(text || '').trim();
67
+ if (!source) return '';
68
+ if (!/[\u4e00-\u9fff]/.test(source)) return source;
69
+ if (!hasPanelLlm()) return null; // caller falls back
70
+ const out = await panelChat(
71
+ [
72
+ {
73
+ role: 'system',
74
+ content:
75
+ 'Translate the user text to natural English for a video creative brief. Keep style names as-is. Output English only, no quotes.',
76
+ },
77
+ { role: 'user', content: source },
78
+ ],
79
+ { temperature: 0.2, fetchImpl },
80
+ );
81
+ return out.replace(/^["']|["']$/g, '').trim();
82
+ }
@@ -0,0 +1,16 @@
1
+ /** Read panel-injected settings from env (set by BN panel supervisor). */
2
+
3
+ export function panelLlmSettings() {
4
+ return {
5
+ provider: String(process.env.PANEL_LLM_PROVIDER || '').trim(),
6
+ baseUrl: String(process.env.PANEL_LLM_BASE_URL || '').trim(),
7
+ apiKey: String(process.env.PANEL_LLM_API_KEY || '').trim(),
8
+ model: String(process.env.PANEL_LLM_MODEL || '').trim(),
9
+ preferDsh: process.env.PANEL_LLM_PREFER_DSH !== '0',
10
+ };
11
+ }
12
+
13
+ export function hasPanelLlm() {
14
+ const llm = panelLlmSettings();
15
+ return !!(llm.apiKey && (llm.baseUrl || llm.provider));
16
+ }
package/bin/server.js CHANGED
@@ -152,8 +152,9 @@ createAgentServer({
152
152
  promptEn = await toEnglishPrompt(prompt);
153
153
  titleEn = await modelTitle(title, prompt, promptEn);
154
154
  } catch {
155
- sendJson(res, 503, { error: '英文提示词没有生成,请再试一次' });
156
- return true;
155
+ // 翻译失败(面板大模型未配置且 MyMemory 不可用)时降级:保留中文提示词继续生成,避免阻断用户
156
+ promptEn = prompt;
157
+ titleEn = title;
157
158
  }
158
159
  const projectSlug = `${slugify(title)}-${Date.now().toString(36)}`;
159
160
 
package/manifest.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "schemaVersion": 1,
3
3
  "id": "biutalk",
4
4
  "name": "BiuTalk",
5
- "version": "2.0.0",
5
+ "version": "2.0.1",
6
6
  "publisher": "Biunow",
7
7
  "description": "BiuTalk 解说视频 Studio:模板、尺寸、附件与本地渲染引擎。",
8
8
  "entry": {
@@ -48,8 +48,8 @@
48
48
  "requiresEntitlement": "export"
49
49
  },
50
50
  "integrity": {
51
- "sha256": "573d415d25944080682c802819a8bbeee6c1f7cc82747d853afb066e9b16dd5b",
52
- "signature": "TZiertAVK9k1WRdfPGUuYsqaQEGp57lKOEEvWBejTK7+KCRhUc7aRsnVvNYgJSep7fGqU82+vsMzj3dVVGiCBg==",
51
+ "sha256": "9a8d1bfdbb9b22d3c8c783aa6d79f6df4a63f1f3dec25906834475aa02007a64",
52
+ "signature": "dVzMrunsB5jFymT4/BZUuDwabnqq1ypjbol9lhTBo1bSOeJvcVvR+TiCtX7aOft+CkZ8qHz0atSrB+bfwPQ5DA==",
53
53
  "signedBy": "publisher-key"
54
54
  }
55
55
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@biunow/agent-biutalk",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "BiuTalk",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {
@@ -1,7 +0,0 @@
1
- {
2
- "agent": "biuart",
3
- "solo": "01_cave",
4
- "video": "e:\\BiunowPanel\\Agents\\products\\_shared\\.tmp-panel-smoke\\art-pipe\\out\\biuart-01_cave-mwq5kfpm.mp4",
5
- "title": "洞穴",
6
- "createdAt": "2026-11-21T08:36:13.372Z"
7
- }
@@ -1,7 +0,0 @@
1
- <!doctype html>
2
- <html><head><meta charset="utf-8"><title>测试</title>
3
- <style>html,body{margin:0;background:#0a0a0c;overflow:hidden}canvas{display:block}</style>
4
- </head><body>
5
- <canvas id="c" width="960" height="540"></canvas>
6
- <script type="module" src="./main.js"></script>
7
- </body></html>
@@ -1,68 +0,0 @@
1
- // Panel kinetic film — rendered by lemo core/render/video.mjs
2
- const W = 960, H = 540;
3
- const BEATS = [
4
- {
5
- "id": "hook",
6
- "headline": "测试",
7
- "caption": "",
8
- "durationSec": 3
9
- },
10
- {
11
- "id": "body",
12
- "headline": "Key point",
13
- "caption": "一句话",
14
- "durationSec": 5
15
- },
16
- {
17
- "id": "cta",
18
- "headline": "Next step",
19
- "caption": "",
20
- "durationSec": 3
21
- }
22
- ];
23
- const DUR = 11;
24
- window.DUR = DUR;
25
- const cv = document.getElementById('c');
26
- const g = cv.getContext('2d');
27
- const RED = '#e11d48', FG = '#f4f4f5', BG = '#0a0a0c', MUTE = '#a1a1aa';
28
-
29
- function ease(t) { return t < 0.5 ? 2 * t * t : 1 - Math.pow(-2 * t + 2, 2) / 2; }
30
-
31
- function beatAt(t) {
32
- let acc = 0;
33
- for (const b of BEATS) {
34
- if (t < acc + b.durationSec) return { b, local: t - acc, p: (t - acc) / b.durationSec };
35
- acc += b.durationSec;
36
- }
37
- const last = BEATS[BEATS.length - 1];
38
- return { b: last, local: last.durationSec, p: 1 };
39
- }
40
-
41
- window.render = function render(t) {
42
- const { b, p } = beatAt(Math.max(0, Math.min(DUR - 0.001, t)));
43
- const a = ease(Math.min(1, p * 3));
44
- g.fillStyle = BG;
45
- g.fillRect(0, 0, W, H);
46
- g.fillStyle = RED;
47
- g.fillRect(0, 0, Math.max(4, W * 0.012), H);
48
- g.save();
49
- g.globalAlpha = 0.15 + 0.85 * a;
50
- g.fillStyle = FG;
51
- g.font = '700 ' + Math.round(H * 0.08) + 'px system-ui, sans-serif';
52
- g.textBaseline = 'middle';
53
- const hx = W * 0.08;
54
- const hy = H * 0.42;
55
- g.fillText(b.headline, hx, hy);
56
- if (b.caption) {
57
- g.fillStyle = MUTE;
58
- g.font = '500 ' + Math.round(H * 0.035) + 'px system-ui, sans-serif';
59
- g.fillText(b.caption, hx, hy + H * 0.1);
60
- }
61
- g.restore();
62
- g.fillStyle = RED;
63
- g.globalAlpha = 0.9;
64
- g.fillRect(W * 0.08, H * 0.78, W * 0.35 * Math.min(1, p), Math.max(3, H * 0.006));
65
- g.globalAlpha = 1;
66
- };
67
-
68
- window.READY = true;
@@ -1,20 +0,0 @@
1
- [
2
- {
3
- "id": "hook",
4
- "headline": "测试",
5
- "caption": "",
6
- "durationSec": 3
7
- },
8
- {
9
- "id": "body",
10
- "headline": "Key point",
11
- "caption": "一句话",
12
- "durationSec": 5
13
- },
14
- {
15
- "id": "cta",
16
- "headline": "Next step",
17
- "caption": "",
18
- "durationSec": 3
19
- }
20
- ]
@@ -1,20 +0,0 @@
1
- Five Rules for a Poster — Swiss Motion Graphics · LemoLab × Claude Opus 5.5
2
-
3
- Picture, typography, motion, score composition, foley: generated by code in this folder (original).
4
-
5
- Fonts (SIL Open Font License 1.1):
6
- - Archivo — The Archivo Project Authors (Omnibus-Type), https://github.com/Omnibus-Type/Archivo (fonts/OFL-Archivo.txt)
7
- - UnifrakturMaguntia — j. 'mach' wust, Peter Wiegel (fonts/OFL-UnifrakturMaguntia.txt) — only in the "wrong typeface" gag
8
- - DM Serif Display — Colophon Foundry / Google, based on Source Serif by Adobe (fonts/OFL-DMSerifDisplay.txt) — only in the "wrong typeface" gag
9
-
10
- Music samples:
11
- - Drums: "MuldjordKit" by Lars Muldjord (drumgizmo.org), FreePats version, licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
12
- - Electric bass: FreePats project (freepats.zenvoid.org), CC0 1.0
13
- - Glockenspiel: Versilian Community Sample Library (Versilian Studios), CC0 1.0
14
- - Arpeggio synth, square lead, glide: numpy synthesis (original)
15
-
16
- Voice: Kokoro-82M (Apache-2.0) via kokoro-onnx, voice af_sarah.
17
- Speech check: faster-whisper (MIT).
18
-
19
- ON SCREEN
20
- The CC BY material above is credited on the end card, in fine print held at least 2.5 s: Drums MuldjordKit / Lars Muldjord · CC BY 4.0.
@@ -1,17 +0,0 @@
1
- #!/bin/sh
2
- # Rebuild 《Five Rules for a Poster》 from scratch: sh styles/swiss-motion/demo/build.sh (runs from any folder)
3
- set -e
4
- sh "$(dirname "$0")/tools/fonts.sh" # fonts: not in git (CREDITS names them) → fonts/
5
- cd "$(dirname "$0")/../../.."
6
- PY=.venv/bin/python; D=styles/swiss-motion/demo; S=styles/swiss-motion
7
- $PY core/tts/tts.py $D/lines.json $D/voices # 1. Kokoro voice-over (af_sarah, speed 1.0)
8
- $PY core/tts/asr_check.py $D/lines.json $D/voices # 2. whisper line-by-line check (should give mismatches: 0)
9
- $PY $D/tools/words.py # 3. word timings → subtitles snap in word by word
10
- $PY $D/music/score.py # 4. original motorik score (reads score.json, ~4 s)
11
- node core/render/events.mjs $D # 5. timeline → events.json (foley events)
12
- $PY $D/mix.py # 6. foley + voice-over ducking + score → mix.wav
13
- $PY $D/tools/subs.py && $PY core/render/srt.py $D/out/subs.json $S/swiss-motion.srt # 7. subtitles (asserts on-screen durations)
14
- node core/render/video.mjs $D --fps 24 --workers 3 --out $D/out/video24.mp4 # 8. frame-by-frame render (~12 s)
15
- sh core/render/mux.sh $D/out/video24.mp4 $D/mix.wav $S/swiss-motion.mp4 24 0 # 9. mux: −14 LUFS, grain 0
16
- node core/render/still.mjs $D 33.4 --q nosub=1 --out $D/out/still --prefix sf_ && cp $D/out/still/sf_33.4.jpg $D/stills/styleframe.jpg
17
- node core/render/still.mjs $D 43.5 --q 'nosub=1&poster=1' --out $D/out/still --prefix po_ && cp $D/out/still/po_43.5.jpg $S/poster.jpg
@@ -1,43 +0,0 @@
1
- // Precise easing and snap tools. Swiss motion graphics allows only two curves: the precise ease cubic-bezier(.7,0,.2,1) and linear.
2
- export const clamp = (x, a = 0, b = 1) => Math.max(a, Math.min(b, x));
3
- export const lerp = (a, b, t) => a + (b - a) * t;
4
- export const seg = (t, a, b) => clamp((t - a) / (b - a));
5
-
6
- export function cubicBezier(x1, y1, x2, y2) {
7
- const bx = u => 3 * (1 - u) * (1 - u) * u * x1 + 3 * (1 - u) * u * u * x2 + u * u * u;
8
- const by = u => 3 * (1 - u) * (1 - u) * u * y1 + 3 * (1 - u) * u * u * y2 + u * u * u;
9
- return t => {
10
- if (t <= 0) return 0; if (t >= 1) return 1;
11
- let lo = 0, hi = 1, u = t;
12
- for (let i = 0; i < 30; i++) { const x = bx(u); if (Math.abs(x - t) < 1e-6) break; if (x < t) lo = u; else hi = u; u = (lo + hi) / 2; }
13
- return by(u);
14
- };
15
- }
16
- export const E = cubicBezier(.7, 0, .2, 1); // the only ease in the whole film
17
-
18
- export const BPM = 120, BEAT = 60 / BPM, E8 = BEAT / 2, E16 = BEAT / 4, BAR = BEAT * 4;
19
-
20
- // snap: lands in place at time t1, starting d seconds earlier (default one eighth note)
21
- export const snap = (t, t1, d = E8) => E(seg(t, t1 - d, t1));
22
- // linear segment
23
- export const lin = (t, a, b) => seg(t, a, b);
24
- // stepped rise: n steps, one precise ease per step ("one cell at a time")
25
- export function steps(t, a, b, n) {
26
- const p = seg(t, a, b) * n, i = Math.floor(p);
27
- if (i >= n) return 1;
28
- return (i + E(p - i)) / n;
29
- }
30
- // multi-segment snap track: keys = [[t_arrive, value, dur?], ...]; value can be a number or an array
31
- export function track(keys) {
32
- return t => {
33
- let v = keys[0][1];
34
- for (let i = 1; i < keys.length; i++) {
35
- const [t1, v1, d = E8] = keys[i];
36
- if (t < t1 - d) break;
37
- const p = snap(t, t1, d);
38
- v = Array.isArray(v1) ? v1.map((x, j) => lerp(v[j], x, p)) : lerp(v, v1, p);
39
- if (p < 1) break;
40
- }
41
- return v;
42
- };
43
- }
@@ -1 +0,0 @@
1
- {"dur":44,"ev":[{"t":0,"type":"knife","g":1},{"t":0.5625,"type":"rule","g":0.5},{"t":0.6875,"type":"rule","g":0.5},{"t":0.8125,"type":"rule","g":0.5},{"t":0.9375,"type":"rule","g":0.5},{"t":1.0625,"type":"rule","g":0.5},{"t":1.1875,"type":"rule","g":0.5},{"t":1.3125,"type":"rule","g":0.5},{"t":1.4375,"type":"rule","g":0.5},{"t":1.5625,"type":"rule","g":0.5},{"t":1.6875,"type":"rule","g":0.5},{"t":1.8125,"type":"rule","g":0.5},{"t":1.9375,"type":"rule","g":0.5},{"t":2,"type":"clack","g":0.9},{"t":2.25,"type":"clack","g":0.9},{"t":2.5,"type":"clack","g":0.9},{"t":2.75,"type":"clack","g":0.9},{"t":3,"type":"clack","g":0.9},{"t":3.5,"type":"paper","g":1},{"t":4.125,"type":"thunk","g":0.45},{"t":4.25,"type":"thunk","g":0.45},{"t":4.25,"type":"rule","g":0.7},{"t":4.375,"type":"thunk","g":0.45},{"t":4.4,"type":"voice","id":"l1"},{"t":4.5,"type":"thunk","g":0.6},{"t":4.5,"type":"rule","g":0.7},{"t":4.75,"type":"rule","g":0.7},{"t":5,"type":"rule","g":0.7},{"t":5.25,"type":"rule","g":0.7},{"t":5.5,"type":"rule","g":0.7},{"t":5.75,"type":"rule","g":0.7},{"t":5.875,"type":"rule","g":0.45},{"t":6,"type":"rule","g":0.7},{"t":6,"type":"rule","g":0.45},{"t":6.125,"type":"rule","g":0.45},{"t":6.25,"type":"rule","g":0.45},{"t":6.375,"type":"rule","g":0.45},{"t":6.5,"type":"rule","g":0.45},{"t":6.625,"type":"rule","g":0.45},{"t":6.75,"type":"rule","g":0.45},{"t":6.875,"type":"rule","g":0.45},{"t":7,"type":"rule","g":0.45},{"t":7.125,"type":"rule","g":0.45},{"t":7.25,"type":"rule","g":0.45},{"t":7.375,"type":"rule","g":0.45},{"t":7.5,"type":"rule","g":0.45},{"t":7.625,"type":"rule","g":0.45},{"t":7.75,"type":"rule","g":0.45},{"t":7.875,"type":"rule","g":0.45},{"t":8.125,"type":"thunk","g":0.45},{"t":8.125,"type":"clack","g":0.7},{"t":8.25,"type":"thunk","g":0.45},{"t":8.25,"type":"clack","g":0.7},{"t":8.375,"type":"thunk","g":0.45},{"t":8.375,"type":"clack","g":0.7},{"t":8.4,"type":"voice","id":"l2"},{"t":8.5,"type":"thunk","g":0.6},{"t":8.5,"type":"clack","g":0.7},{"t":8.625,"type":"clack","g":0.7},{"t":8.75,"type":"clack","g":0.7},{"t":8.875,"type":"clack","g":0.7},{"t":9,"type":"clack","g":0.7},{"t":9.125,"type":"clack","g":0.7},{"t":9.25,"type":"clack","g":0.7},{"t":10,"type":"clackBig","g":1},{"t":12.125,"type":"thunk","g":0.45},{"t":12.25,"type":"thunk","g":0.45},{"t":12.375,"type":"thunk","g":0.45},{"t":12.4,"type":"voice","id":"l3"},{"t":12.5,"type":"thunk","g":0.6},{"t":12.5,"type":"knife","g":0.8},{"t":13,"type":"knife","g":0.8},{"t":13.5,"type":"knife","g":0.8},{"t":14,"type":"knife","g":0.8},{"t":15,"type":"slide","g":0.5},{"t":15.0625,"type":"slide","g":0.5},{"t":15.125,"type":"slide","g":0.5},{"t":15.1875,"type":"slide","g":0.5},{"t":15.25,"type":"slide","g":0.5},{"t":15.3125,"type":"slide","g":0.5},{"t":16,"type":"clackBig","g":0.9},{"t":16,"type":"slide","g":0.7},{"t":16.125,"type":"thunk","g":0.45},{"t":16.25,"type":"thunk","g":0.45},{"t":16.375,"type":"thunk","g":0.45},{"t":16.4,"type":"voice","id":"l4"},{"t":16.5,"type":"thunk","g":0.6},{"t":18.125,"type":"snap","g":0.5},{"t":18.25,"type":"snap","g":0.5},{"t":18.375,"type":"snap","g":0.5},{"t":18.5,"type":"snap","g":0.5},{"t":18.625,"type":"snap","g":0.5},{"t":18.75,"type":"snap","g":0.5},{"t":18.875,"type":"snap","g":0.5},{"t":19,"type":"snap","g":0.5},{"t":19.125,"type":"snap","g":0.5},{"t":19.25,"type":"snap","g":0.5},{"t":19.375,"type":"snap","g":0.5},{"t":19.5,"type":"snap","g":0.5},{"t":19.625,"type":"snap","g":0.5},{"t":19.75,"type":"snap","g":0.5},{"t":19.875,"type":"snap","g":0.5},{"t":20,"type":"snap","g":0.5},{"t":20,"type":"thump","g":1},{"t":20.1,"type":"voice","id":"l4b"},{"t":22.125,"type":"thunk","g":0.45},{"t":22.15,"type":"voice","id":"l5"},{"t":22.25,"type":"thunk","g":0.45},{"t":22.375,"type":"thunk","g":0.45},{"t":22.5,"type":"thunk","g":0.6},{"t":23.625,"type":"tick","g":0.7},{"t":24,"type":"tick","g":0.6},{"t":24,"type":"slide","g":1},{"t":24.6,"type":"voice","id":"l5b"},{"t":26,"type":"thump","g":1.1},{"t":26.125,"type":"snap","g":0.6},{"t":26.25,"type":"snap","g":0.6},{"t":26.375,"type":"snap","g":0.6},{"t":26.5,"type":"snap","g":0.6},{"t":26.625,"type":"snap","g":0.6},{"t":26.75,"type":"snap","g":0.6},{"t":26.875,"type":"snap","g":0.6},{"t":27,"type":"snap","g":0.6},{"t":27.125,"type":"clack","g":0.6},{"t":27.25,"type":"clack","g":0.6},{"t":27.375,"type":"clack","g":0.6},{"t":27.5,"type":"clack","g":0.6},{"t":27.625,"type":"clack","g":0.6},{"t":27.75,"type":"clack","g":0.6},{"t":29.25,"type":"swish","g":1,"d":0.75},{"t":30.625,"type":"tick","g":0.35},{"t":30.6875,"type":"tick","g":0.35},{"t":30.75,"type":"tick","g":0.35},{"t":30.8125,"type":"tick","g":0.35},{"t":30.875,"type":"tick","g":0.35},{"t":30.9375,"type":"tick","g":0.35},{"t":31,"type":"tick","g":0.35},{"t":31.75,"type":"rule","g":0.8},{"t":36,"type":"swish","g":0.8,"d":1},{"t":36.5,"type":"voice","id":"l6"},{"t":39,"type":"knife","g":1.1},{"t":39.5,"type":"swish","g":0.6,"d":0.5},{"t":40.25,"type":"clack","g":0.7},{"t":40.5,"type":"clack","g":0.7},{"t":40.75,"type":"clack","g":0.7},{"t":41,"type":"clack","g":0.7}]}