Spaces:
Running
Running
php2shell: 导出背景音乐可选项(3 种配乐/无 × 音量 × 音效,20 种组合响度校准)(推送 #6)
Browse files- .gitattributes +5 -0
- php2shell/README.md +2 -1
- php2shell/dist/assets/{index-D2Vbdm6o.css → index-BUFCtSWz.css} +1 -1
- php2shell/dist/assets/index-CiV4ZY-L.js +0 -0
- php2shell/dist/assets/index-D2R5Edvl.js +0 -0
- php2shell/dist/audio/{mix.mp3 → stem_ambient.mp3} +2 -2
- php2shell/dist/audio/stem_brief.mp3 +3 -0
- php2shell/dist/audio/stem_pulse.mp3 +3 -0
- php2shell/dist/audio/stem_sfx.mp3 +3 -0
- php2shell/dist/audio/stem_voice.mp3 +3 -0
- php2shell/dist/index.html +2 -2
- php2shell/studio/qa/bgm_options_loudness.json +110 -0
- php2shell/tools/calibrate_bgm.mjs +48 -0
- php2shell/tools/render_stems_node.mjs +92 -0
- php2shell/web/src/audio/stems.ts +55 -0
- php2shell/web/src/audio/synth.ts +121 -2
- php2shell/web/src/data/stems.json +30 -0
- php2shell/web/src/main.ts +66 -29
- php2shell/web/src/ui/style.css +3 -0
.gitattributes
CHANGED
|
@@ -230,3 +230,8 @@ php2shell/dist/live/php2shell-livephotos.zip filter=lfs diff=lfs merge=lfs -text
|
|
| 230 |
php2shell/studio/qa/qa_sheet_round1.jpg filter=lfs diff=lfs merge=lfs -text
|
| 231 |
php2shell/dist/audio/mix.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 232 |
php2shell/studio/qa/qa_sheet_round2.jpg filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 230 |
php2shell/studio/qa/qa_sheet_round1.jpg filter=lfs diff=lfs merge=lfs -text
|
| 231 |
php2shell/dist/audio/mix.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 232 |
php2shell/studio/qa/qa_sheet_round2.jpg filter=lfs diff=lfs merge=lfs -text
|
| 233 |
+
php2shell/dist/audio/stem_pulse.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 234 |
+
php2shell/dist/audio/stem_brief.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 235 |
+
php2shell/dist/audio/stem_sfx.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 236 |
+
php2shell/dist/audio/stem_voice.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 237 |
+
php2shell/dist/audio/stem_ambient.mp3 filter=lfs diff=lfs merge=lfs -text
|
php2shell/README.md
CHANGED
|
@@ -102,7 +102,7 @@ php2shell/
|
|
| 102 |
| 交付物 | 位置 / 用法 |
|
| 103 |
|---|---|
|
| 104 |
| 网页视频(旁白 + 配乐 + 音效) | 页面左侧播放器:播放/暂停(空格键)、拖动进度、按章节跳转、横屏 16:9 ↔ 竖屏 9:16 切换 |
|
| 105 |
-
| 浏览器本地导出 MP4 | 「导出 MP4」卡片:画幅(横 1920×1080 / 竖 1080×1920)× 帧率(24 / 30 / 60)× 清晰度(高清 / 流畅),全程本地 WebCodecs 编码,建议桌面版 Chrome / Edge |
|
| 106 |
| 四平台标题 · 描述 · 标签 | 「标题 · 描述 · 标签」卡片:小红书 / 抖音 / 微信视频号 / 哔哩哔哩,实时字数与话题数校验,一键复制 |
|
| 107 |
| 封面 | 9 张:16:9 ×3、4:3 ×3、3:4 ×3,可按比例筛选、多选后下载 JPG |
|
| 108 |
| 实况图 | 「实况图」卡片 → 下载 ZIP:6 组 1080×1440 的 `jpg + mov`(Apple Live Photo 配对元数据),附图文标题 / 正文 / 标签 |
|
|
@@ -123,3 +123,4 @@ php2shell/
|
|
| 123 |
- 2026-10-22 · 质检第 2 轮(新排版重渲代理片):0 失败 / 2 警告 —— ①代理片 960×540(有意为之,网页导出为 1080p);②时间线镜头字幕 OCR 0%:tesseract 把“十月二十一日”误认为“HEREEH”(笔画简单的数字字),用 1920×1080 全分辨率静帧复测识别完全正确,判定为代理分辨率下的 OCR 误差。报告见 `studio/qa/qa_round2.json`。
|
| 124 |
- 2026-10-22 · 稳定性:浏览器内整轨离线合成在 2GB 内存环境会崩溃 → 改为发布已质检的成品混音 `audio/mix.mp3`(−14.2 LUFS,与 Node 端同一套合成代码生成),播放与导出共用,秒开且不占内存;无头浏览器实测导出 24fps 横屏、60fps 竖屏片段,ffprobe/ffmpeg 完整解码通过、有声。
|
| 125 |
- 2026-10-22 · 文案校对:B站标题“5分钟”改“3分钟”;去掉“近7成网站连夜抢修”这类把使用率说成受影响率的表述;四平台标题字数全部在限制内(小红书 ≤20、抖音 ≤30、视频号 ≤16、B站 ≤80)。
|
|
|
|
|
|
| 102 |
| 交付物 | 位置 / 用法 |
|
| 103 |
|---|---|
|
| 104 |
| 网页视频(旁白 + 配乐 + 音效) | 页面左侧播放器:播放/暂停(空格键)、拖动进度、按章节跳转、横屏 16:9 ↔ 竖屏 9:16 切换 |
|
| 105 |
+
| 浏览器本地导出 MP4 | 「导出 MP4」卡片:画幅(横 1920×1080 / 竖 1080×1920)× 帧率(24 / 30 / 60)× 清晰度(高清 / 流畅)× **背景音乐**(应急简报 / 深夜氛围 / 电子脉冲 / 无)× **音乐音量**(低 / 标准 / 高)× **音效**(开 / 关),全程本地 WebCodecs 编码,建议桌面版 Chrome / Edge;播放器按所选配乐实时试听 |
|
| 106 |
| 四平台标题 · 描述 · 标签 | 「标题 · 描述 · 标签」卡片:小红书 / 抖音 / 微信视频号 / 哔哩哔哩,实时字数与话题数校验,一键复制 |
|
| 107 |
| 封面 | 9 张:16:9 ×3、4:3 ×3、3:4 ×3,可按比例筛选、多选后下载 JPG |
|
| 108 |
| 实况图 | 「实况图」卡片 → 下载 ZIP:6 组 1080×1440 的 `jpg + mov`(Apple Live Photo 配对元数据),附图文标题 / 正文 / 标签 |
|
|
|
|
| 123 |
- 2026-10-22 · 质检第 2 轮(新排版重渲代理片):0 失败 / 2 警告 —— ①代理片 960×540(有意为之,网页导出为 1080p);②时间线镜头字幕 OCR 0%:tesseract 把“十月二十一日”误认为“HEREEH”(笔画简单的数字字),用 1920×1080 全分辨率静帧复测识别完全正确,判定为代理分辨率下的 OCR 误差。报告见 `studio/qa/qa_round2.json`。
|
| 124 |
- 2026-10-22 · 稳定性:浏览器内整轨离线合成在 2GB 内存环境会崩溃 → 改为发布已质检的成品混音 `audio/mix.mp3`(−14.2 LUFS,与 Node 端同一套合成代码生成),播放与导出共用,秒开且不占内存;无头浏览器实测导出 24fps 横屏、60fps 竖屏片段,ffprobe/ffmpeg 完整解码通过、有声。
|
| 125 |
- 2026-10-22 · 文案校对:B站标题“5分钟”改“3分钟”;去掉“近7成网站连夜抢修”这类把使用率说成受影响率的表述;四平台标题字数全部在限制内(小红书 ≤20、抖音 ≤30、视频号 ≤16、B站 ≤80)。
|
| 126 |
+
- 2026-10-22 · 新增「导出背景音乐可选项」(用户需求):音轨拆为分轨 —— 旁白 / 音效 / 3 种原创配乐(应急简报、深夜氛围、电子脉冲,同一和弦与情绪分段,与画面节拍对齐)+ 无背景音乐;音乐音量低/标准/高,音效开/关。共用 `src/audio/stems.ts` 混音图:播放实时试听、导出离线渲染、Node 校准三处一致;分轨按需加载。`tools/calibrate_bgm.mjs` 对全部 20 种组合实测校准:AAC 编码后响度 −13.6~−14.8 LUFS、真峰值 ≤ −1.2 dBTP(报告 `studio/qa/bgm_options_loudness.json`)。默认选项 `vibe qa` 复核:响度 −13.7 LUFS、真峰值 −1.3 dBTP。
|
php2shell/dist/assets/{index-D2Vbdm6o.css → index-BUFCtSWz.css}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
:root{--bg:#070C16;--bg2:#0A1120;--panel:#0E1626;--panel2:#13203a;--line:#22304e;--ink:#EAF0F8;--dim:#8494B5;--faint:#52618a;--orange:#FF9F1C;--red:#FF4D4D;--green:#2EE6A6;--cyan:#5CC8FF;--php:#8D97D6;--radius:16px;--shadow:0 10px 40px rgba(0,0,0,.45)}*{box-sizing:border-box}html,body{margin:0;padding:0;color:var(--ink);font-family:PingFang SC,Hiragino Sans GB,Microsoft YaHei,Noto Sans SC,system-ui,sans-serif;-webkit-font-smoothing:antialiased}body{background:radial-gradient(1200px 700px at 50% -8%,#122038 0%,transparent 62%),var(--bg)}a{color:var(--cyan);text-decoration:none}.wrap{max-width:1280px;margin:0 auto;padding:28px 20px 80px}.topbar{display:flex;align-items:center;gap:14px;flex-wrap:wrap;margin-bottom:22px}.brand{display:flex;align-items:center;gap:12px}.livedot{width:10px;height:10px;border-radius:50%;background:var(--red);box-shadow:0 0 12px var(--red);animation:blink 1.6s infinite}@keyframes blink{0%,to{opacity:1}50%{opacity:.35}}.brand h1{font-size:19px;margin:0;font-weight:800;letter-spacing:.5px}.brand .sub{color:var(--dim);font-size:13px;margin-top:2px}.tag{font-size:12px;color:var(--orange);border:1px solid var(--orange);padding:3px 9px;border-radius:999px;font-family:ui-monospace,Menlo,monospace}.tag.red{color:var(--red);border-color:var(--red)}.grid{display:grid;grid-template-columns:1.55fr 1fr;gap:22px;align-items:start}@media(max-width:980px){.grid{grid-template-columns:1fr}}.card{background:linear-gradient(180deg,var(--panel),#0b1220);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow)}.card.pad{padding:18px}.stage{position:relative;background:#05070d;border-radius:var(--radius);overflow:hidden;border:1px solid var(--line)}.stage canvas{display:block;width:100%;height:auto}.stage.portrait{max-width:420px;margin:0 auto}.controls{display:flex;align-items:center;gap:12px;padding:12px 14px;flex-wrap:wrap}.btn{appearance:none;border:1px solid var(--line);background:var(--panel2);color:var(--ink);padding:9px 15px;border-radius:10px;font-size:14px;font-weight:600;cursor:pointer;transition:.15s;display:inline-flex;align-items:center;gap:7px}.btn:hover{border-color:var(--cyan);background:#17233c}.btn.primary{background:linear-gradient(180deg,#ffb347,#ff9f1c);color:#1a1205;border:none}.btn.primary:hover{filter:brightness(1.08)}.btn.play{width:46px;height:46px;justify-content:center;border-radius:50%;font-size:17px;padding:0}.btn:disabled{opacity:.45;cursor:not-allowed}.btn.sm{padding:6px 11px;font-size:13px}.btn.ghost{background:transparent}.btn.active{border-color:var(--orange);color:var(--orange);background:#ff9f1c1a}.seek{flex:1;min-width:140px;display:flex;align-items:center;gap:10px}input[type=range]{-webkit-appearance:none;appearance:none;width:100%;height:5px;border-radius:5px;background:#24324f;outline:none}input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:15px;height:15px;border-radius:50%;background:var(--orange);cursor:pointer;box-shadow:0 0 8px #ff9f1c99}input[type=range]::-moz-range-thumb{width:15px;height:15px;border:none;border-radius:50%;background:var(--orange);cursor:pointer}.time{font-family:ui-monospace,Menlo,monospace;font-size:13px;color:var(--dim);min-width:92px;text-align:right}.chips{display:flex;gap:7px;flex-wrap:wrap;padding:0 14px 12px}.chip{font-size:12px;color:var(--dim);background:#121d31;border:1px solid var(--line);border-radius:8px;padding:5px 9px;cursor:pointer;white-space:nowrap;transition:.12s}.chip:hover{color:var(--ink);border-color:var(--cyan)}.chip.on{color:var(--orange);border-color:var(--orange)}h2.sec{font-size:15px;margin:0 0 4px;font-weight:800;display:flex;align-items:center;gap:8px}h2.sec .n{width:22px;height:22px;border-radius:7px;background:var(--orange);color:#1a1205;font-size:12px;display:inline-flex;align-items:center;justify-content:center;font-weight:900}.hint{color:var(--dim);font-size:12.5px;line-height:1.6;margin:3px 0 14px}.row{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin-bottom:12px}.seg{display:inline-flex;border:1px solid var(--line);border-radius:10px;overflow:hidden}.seg button{appearance:none;border:none;background:var(--panel2);color:var(--dim);padding:8px 13px;font-size:13px;font-weight:600;cursor:pointer}.seg button.on{background:var(--orange);color:#1a1205}.label{font-size:12px;color:var(--faint);margin-right:4px;align-self:center}.progress{height:6px;border-radius:6px;background:#1a2640;overflow:hidden;margin:10px 0}.progress>i{display:block;height:100%;background:linear-gradient(90deg,var(--orange),var(--green));width:0;transition:width .2s}.status{font-size:12.5px;color:var(--dim);font-family:ui-monospace,Menlo,monospace;min-height:18px}.tabs{display:flex;gap:6px;margin-bottom:14px;flex-wrap:wrap}.tab{padding:8px 14px;border-radius:10px;background:var(--panel2);border:1px solid var(--line);color:var(--dim);font-size:13.5px;font-weight:700;cursor:pointer}.tab.on{background:#17233c;color:var(--ink);border-color:var(--cyan)}.pub{display:grid;gap:12px}.pfield{background:#0b1220;border:1px solid var(--line);border-radius:12px;padding:12px 13px}.pfield .hd{display:flex;justify-content:space-between;align-items:center;margin-bottom:7px}.pfield .hd b{font-size:13.5px}.counter{font-size:11.5px;color:var(--faint);font-family:ui-monospace,monospace}.counter.bad{color:var(--red)}.pval{font-size:14px;line-height:1.6;color:var(--ink);white-space:pre-wrap;word-break:break-word}.tags{display:flex;flex-wrap:wrap;gap:6px;margin-top:4px}.tg{font-size:12.5px;color:var(--cyan);background:#5cc8ff14;border:1px solid rgba(92,200,255,.3);border-radius:7px;padding:3px 8px}.copy{font-size:12px;color:var(--dim);border:1px solid var(--line);background:transparent;border-radius:8px;padding:5px 10px;cursor:pointer}.copy:hover{color:var(--orange);border-color:var(--orange)}.covers{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:12px}.cov{position:relative;border:2px solid var(--line);border-radius:12px;overflow:hidden;cursor:pointer;background:#05070d}.cov.sel{border-color:var(--orange);box-shadow:0 0 0 2px #ff9f1c4d}.cov canvas{display:block;width:100%;height:auto}.cov .meta{position:absolute;top:6px;left:6px;font-size:10.5px;font-family:ui-monospace,monospace;color:#fff;background:#0000008c;padding:2px 6px;border-radius:5px}.cov .pick{position:absolute;top:6px;right:6px;width:20px;height:20px;border-radius:50%;background:#00000080;border:1.5px solid #fff;display:flex;align-items:center;justify-content:center;font-size:12px;color:transparent}.cov.sel .pick{background:var(--orange);border-color:var(--orange);color:#1a1205}.foot{margin-top:40px;color:var(--faint);font-size:12px;line-height:1.8;border-top:1px solid var(--line);padding-top:18px}.note{background:#ff9f1c12;border:1px solid rgba(255,159,28,.3);border-radius:10px;padding:10px 12px;font-size:12.5px;color:var(--orange);line-height:1.6;margin-bottom:12px}.spinner{width:14px;height:14px;border:2px solid rgba(255,255,255,.25);border-top-color:#fff;border-radius:50%;display:inline-block;animation:spin .8s linear infinite;vertical-align:-2px}@keyframes spin{to{transform:rotate(360deg)}}.badge{display:inline-flex;gap:6px;align-items:center;font-size:11.5px;color:var(--green);background:#2ee6a61a;border:1px solid rgba(46,230,166,.3);padding:3px 8px;border-radius:999px}.toast{position:fixed;left:50%;bottom:28px;transform:translate(-50%);background:#17233c;border:1px solid var(--cyan);color:var(--ink);padding:10px 18px;border-radius:12px;font-size:13.5px;box-shadow:var(--shadow);z-index:50;opacity:0;transition:.25s;pointer-events:none}.toast.show{opacity:1}.kbd{font-family:ui-monospace,monospace;font-size:11px;color:var(--faint);border:1px solid var(--line);border-radius:5px;padding:1px 5px}
|
|
|
|
| 1 |
+
:root{--bg:#070C16;--bg2:#0A1120;--panel:#0E1626;--panel2:#13203a;--line:#22304e;--ink:#EAF0F8;--dim:#8494B5;--faint:#52618a;--orange:#FF9F1C;--red:#FF4D4D;--green:#2EE6A6;--cyan:#5CC8FF;--php:#8D97D6;--radius:16px;--shadow:0 10px 40px rgba(0,0,0,.45)}*{box-sizing:border-box}html,body{margin:0;padding:0;color:var(--ink);font-family:PingFang SC,Hiragino Sans GB,Microsoft YaHei,Noto Sans SC,system-ui,sans-serif;-webkit-font-smoothing:antialiased}body{background:radial-gradient(1200px 700px at 50% -8%,#122038 0%,transparent 62%),var(--bg)}a{color:var(--cyan);text-decoration:none}.wrap{max-width:1280px;margin:0 auto;padding:28px 20px 80px}.topbar{display:flex;align-items:center;gap:14px;flex-wrap:wrap;margin-bottom:22px}.brand{display:flex;align-items:center;gap:12px}.livedot{width:10px;height:10px;border-radius:50%;background:var(--red);box-shadow:0 0 12px var(--red);animation:blink 1.6s infinite}@keyframes blink{0%,to{opacity:1}50%{opacity:.35}}.brand h1{font-size:19px;margin:0;font-weight:800;letter-spacing:.5px}.brand .sub{color:var(--dim);font-size:13px;margin-top:2px}.tag{font-size:12px;color:var(--orange);border:1px solid var(--orange);padding:3px 9px;border-radius:999px;font-family:ui-monospace,Menlo,monospace}.tag.red{color:var(--red);border-color:var(--red)}.grid{display:grid;grid-template-columns:1.55fr 1fr;gap:22px;align-items:start}@media(max-width:980px){.grid{grid-template-columns:1fr}}.card{background:linear-gradient(180deg,var(--panel),#0b1220);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow)}.card.pad{padding:18px}.stage{position:relative;background:#05070d;border-radius:var(--radius);overflow:hidden;border:1px solid var(--line)}.stage canvas{display:block;width:100%;height:auto}.stage.portrait{max-width:420px;margin:0 auto}.controls{display:flex;align-items:center;gap:12px;padding:12px 14px;flex-wrap:wrap}.btn{appearance:none;border:1px solid var(--line);background:var(--panel2);color:var(--ink);padding:9px 15px;border-radius:10px;font-size:14px;font-weight:600;cursor:pointer;transition:.15s;display:inline-flex;align-items:center;gap:7px}.btn:hover{border-color:var(--cyan);background:#17233c}.btn.primary{background:linear-gradient(180deg,#ffb347,#ff9f1c);color:#1a1205;border:none}.btn.primary:hover{filter:brightness(1.08)}.btn.play{width:46px;height:46px;justify-content:center;border-radius:50%;font-size:17px;padding:0}.btn:disabled{opacity:.45;cursor:not-allowed}.btn.sm{padding:6px 11px;font-size:13px}.btn.ghost{background:transparent}.btn.active{border-color:var(--orange);color:var(--orange);background:#ff9f1c1a}.seek{flex:1;min-width:140px;display:flex;align-items:center;gap:10px}input[type=range]{-webkit-appearance:none;appearance:none;width:100%;height:5px;border-radius:5px;background:#24324f;outline:none}input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:15px;height:15px;border-radius:50%;background:var(--orange);cursor:pointer;box-shadow:0 0 8px #ff9f1c99}input[type=range]::-moz-range-thumb{width:15px;height:15px;border:none;border-radius:50%;background:var(--orange);cursor:pointer}.time{font-family:ui-monospace,Menlo,monospace;font-size:13px;color:var(--dim);min-width:92px;text-align:right}.chips{display:flex;gap:7px;flex-wrap:wrap;padding:0 14px 12px}.chip{font-size:12px;color:var(--dim);background:#121d31;border:1px solid var(--line);border-radius:8px;padding:5px 9px;cursor:pointer;white-space:nowrap;transition:.12s}.chip:hover{color:var(--ink);border-color:var(--cyan)}.chip.on{color:var(--orange);border-color:var(--orange)}h2.sec{font-size:15px;margin:0 0 4px;font-weight:800;display:flex;align-items:center;gap:8px}h2.sec .n{width:22px;height:22px;border-radius:7px;background:var(--orange);color:#1a1205;font-size:12px;display:inline-flex;align-items:center;justify-content:center;font-weight:900}.hint{color:var(--dim);font-size:12.5px;line-height:1.6;margin:3px 0 14px}.row{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin-bottom:12px}.seg{display:inline-flex;border:1px solid var(--line);border-radius:10px;overflow:hidden}.seg button{appearance:none;border:none;background:var(--panel2);color:var(--dim);padding:8px 13px;font-size:13px;font-weight:600;cursor:pointer}.seg button.on{background:var(--orange);color:#1a1205}.label{font-size:12px;color:var(--faint);margin-right:4px;align-self:center}.progress{height:6px;border-radius:6px;background:#1a2640;overflow:hidden;margin:10px 0}.progress>i{display:block;height:100%;background:linear-gradient(90deg,var(--orange),var(--green));width:0;transition:width .2s}.status{font-size:12.5px;color:var(--dim);font-family:ui-monospace,Menlo,monospace;min-height:18px}.tabs{display:flex;gap:6px;margin-bottom:14px;flex-wrap:wrap}.tab{padding:8px 14px;border-radius:10px;background:var(--panel2);border:1px solid var(--line);color:var(--dim);font-size:13.5px;font-weight:700;cursor:pointer}.tab.on{background:#17233c;color:var(--ink);border-color:var(--cyan)}.pub{display:grid;gap:12px}.pfield{background:#0b1220;border:1px solid var(--line);border-radius:12px;padding:12px 13px}.pfield .hd{display:flex;justify-content:space-between;align-items:center;margin-bottom:7px}.pfield .hd b{font-size:13.5px}.counter{font-size:11.5px;color:var(--faint);font-family:ui-monospace,monospace}.counter.bad{color:var(--red)}.pval{font-size:14px;line-height:1.6;color:var(--ink);white-space:pre-wrap;word-break:break-word}.tags{display:flex;flex-wrap:wrap;gap:6px;margin-top:4px}.tg{font-size:12.5px;color:var(--cyan);background:#5cc8ff14;border:1px solid rgba(92,200,255,.3);border-radius:7px;padding:3px 8px}.copy{font-size:12px;color:var(--dim);border:1px solid var(--line);background:transparent;border-radius:8px;padding:5px 10px;cursor:pointer}.copy:hover{color:var(--orange);border-color:var(--orange)}.covers{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:12px}.cov{position:relative;border:2px solid var(--line);border-radius:12px;overflow:hidden;cursor:pointer;background:#05070d}.cov.sel{border-color:var(--orange);box-shadow:0 0 0 2px #ff9f1c4d}.cov canvas{display:block;width:100%;height:auto}.cov .meta{position:absolute;top:6px;left:6px;font-size:10.5px;font-family:ui-monospace,monospace;color:#fff;background:#0000008c;padding:2px 6px;border-radius:5px}.cov .pick{position:absolute;top:6px;right:6px;width:20px;height:20px;border-radius:50%;background:#00000080;border:1.5px solid #fff;display:flex;align-items:center;justify-content:center;font-size:12px;color:transparent}.cov.sel .pick{background:var(--orange);border-color:var(--orange);color:#1a1205}.foot{margin-top:40px;color:var(--faint);font-size:12px;line-height:1.8;border-top:1px solid var(--line);padding-top:18px}.note{background:#ff9f1c12;border:1px solid rgba(255,159,28,.3);border-radius:10px;padding:10px 12px;font-size:12.5px;color:var(--orange);line-height:1.6;margin-bottom:12px}.spinner{width:14px;height:14px;border:2px solid rgba(255,255,255,.25);border-top-color:#fff;border-radius:50%;display:inline-block;animation:spin .8s linear infinite;vertical-align:-2px}@keyframes spin{to{transform:rotate(360deg)}}.badge{display:inline-flex;gap:6px;align-items:center;font-size:11.5px;color:var(--green);background:#2ee6a61a;border:1px solid rgba(46,230,166,.3);padding:3px 8px;border-radius:999px}.toast{position:fixed;left:50%;bottom:28px;transform:translate(-50%);background:#17233c;border:1px solid var(--cyan);color:var(--ink);padding:10px 18px;border-radius:12px;font-size:13.5px;box-shadow:var(--shadow);z-index:50;opacity:0;transition:.25s;pointer-events:none}.toast.show{opacity:1}.kbd{font-family:ui-monospace,monospace;font-size:11px;color:var(--faint);border:1px solid var(--line);border-radius:5px;padding:1px 5px}.seg{flex-wrap:wrap}.seg button:disabled{opacity:.38;cursor:not-allowed}.seg button+button{border-left:1px solid rgba(255,255,255,.04)}
|
php2shell/dist/assets/index-CiV4ZY-L.js
DELETED
|
The diff for this file is too large to render.
See raw diff
|
|
|
php2shell/dist/assets/index-D2R5Edvl.js
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
php2shell/dist/audio/{mix.mp3 → stem_ambient.mp3}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bc7cb8ae6d00cdfeaac27b54a3fd68ff6cb18889bdd8676e2e7e2541bca77241
|
| 3 |
+
size 2354444
|
php2shell/dist/audio/stem_brief.mp3
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:faa93e9d7fb3a7fb8607055d2931d1d7fb4a08a8520fed1a3debbb3315edc8f9
|
| 3 |
+
size 2354444
|
php2shell/dist/audio/stem_pulse.mp3
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c492a5cef75617e10c50d2b9dc53fa9920bd35b77944d9ee645787fdc65ca66a
|
| 3 |
+
size 2354444
|
php2shell/dist/audio/stem_sfx.mp3
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1c47a17376d486085ddbdd793e5fec86efa36d83460cbe757cc304f0bf4bfa73
|
| 3 |
+
size 2354444
|
php2shell/dist/audio/stem_voice.mp3
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3c42a97045b87f302c50725cf3507385b14843958e40bee0a28c14cfd19ff15e
|
| 3 |
+
size 2306348
|
php2shell/dist/index.html
CHANGED
|
@@ -5,8 +5,8 @@
|
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
| 6 |
<title>PHP2Shell:后厨里的两扇暗门 · 网页视频工作室</title>
|
| 7 |
<meta name="description" content="PHP2Shell 双漏洞科普动画,网页实时渲染播放,浏览器本地导出 MP4(24/30/60fps,横屏/竖屏),附四平台文案、多比例封面与实况图。" />
|
| 8 |
-
<script type="module" crossorigin src="./assets/index-
|
| 9 |
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
| 10 |
</head>
|
| 11 |
<body>
|
| 12 |
<div id="app"></div>
|
|
|
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
| 6 |
<title>PHP2Shell:后厨里的两扇暗门 · 网页视频工作室</title>
|
| 7 |
<meta name="description" content="PHP2Shell 双漏洞科普动画,网页实时渲染播放,浏览器本地导出 MP4(24/30/60fps,横屏/竖屏),附四平台文案、多比例封面与实况图。" />
|
| 8 |
+
<script type="module" crossorigin src="./assets/index-D2R5Edvl.js"></script>
|
| 9 |
+
<link rel="stylesheet" crossorigin href="./assets/index-BUFCtSWz.css">
|
| 10 |
</head>
|
| 11 |
<body>
|
| 12 |
<div id="app"></div>
|
php2shell/studio/qa/bgm_options_loudness.json
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"target": {
|
| 3 |
+
"lufs": -14,
|
| 4 |
+
"tolerance": 1.5,
|
| 5 |
+
"truePeakMax": -1
|
| 6 |
+
},
|
| 7 |
+
"codec": "AAC 192k",
|
| 8 |
+
"report": {
|
| 9 |
+
"brief:low:1": {
|
| 10 |
+
"trim": -2.3,
|
| 11 |
+
"I": -14,
|
| 12 |
+
"TP": -1.9
|
| 13 |
+
},
|
| 14 |
+
"brief:low:0": {
|
| 15 |
+
"trim": -2.94,
|
| 16 |
+
"I": -14.4,
|
| 17 |
+
"TP": -1.4
|
| 18 |
+
},
|
| 19 |
+
"brief:std:1": {
|
| 20 |
+
"trim": -1.8,
|
| 21 |
+
"I": -13.9,
|
| 22 |
+
"TP": -1.4
|
| 23 |
+
},
|
| 24 |
+
"brief:std:0": {
|
| 25 |
+
"trim": -1.8,
|
| 26 |
+
"I": -14,
|
| 27 |
+
"TP": -1.2
|
| 28 |
+
},
|
| 29 |
+
"brief:high:1": {
|
| 30 |
+
"trim": -3.3,
|
| 31 |
+
"I": -14.4,
|
| 32 |
+
"TP": -1.5
|
| 33 |
+
},
|
| 34 |
+
"brief:high:0": {
|
| 35 |
+
"trim": -2.3,
|
| 36 |
+
"I": -13.9,
|
| 37 |
+
"TP": -1.6
|
| 38 |
+
},
|
| 39 |
+
"ambient:low:1": {
|
| 40 |
+
"trim": -2.16,
|
| 41 |
+
"I": -13.9,
|
| 42 |
+
"TP": -1.4
|
| 43 |
+
},
|
| 44 |
+
"ambient:low:0": {
|
| 45 |
+
"trim": -2.16,
|
| 46 |
+
"I": -14,
|
| 47 |
+
"TP": -1.6
|
| 48 |
+
},
|
| 49 |
+
"ambient:std:1": {
|
| 50 |
+
"trim": -2.66,
|
| 51 |
+
"I": -14.2,
|
| 52 |
+
"TP": -1.4
|
| 53 |
+
},
|
| 54 |
+
"ambient:std:0": {
|
| 55 |
+
"trim": -2.16,
|
| 56 |
+
"I": -14,
|
| 57 |
+
"TP": -1.4
|
| 58 |
+
},
|
| 59 |
+
"ambient:high:1": {
|
| 60 |
+
"trim": -2.88,
|
| 61 |
+
"I": -14,
|
| 62 |
+
"TP": -1.4
|
| 63 |
+
},
|
| 64 |
+
"ambient:high:0": {
|
| 65 |
+
"trim": -2.16,
|
| 66 |
+
"I": -13.7,
|
| 67 |
+
"TP": -1.5
|
| 68 |
+
},
|
| 69 |
+
"pulse:low:1": {
|
| 70 |
+
"trim": -1.89,
|
| 71 |
+
"I": -14,
|
| 72 |
+
"TP": -1.3
|
| 73 |
+
},
|
| 74 |
+
"pulse:low:0": {
|
| 75 |
+
"trim": -1.89,
|
| 76 |
+
"I": -14.1,
|
| 77 |
+
"TP": -1.2
|
| 78 |
+
},
|
| 79 |
+
"pulse:std:1": {
|
| 80 |
+
"trim": -1.89,
|
| 81 |
+
"I": -13.9,
|
| 82 |
+
"TP": -1.2
|
| 83 |
+
},
|
| 84 |
+
"pulse:std:0": {
|
| 85 |
+
"trim": -2.45,
|
| 86 |
+
"I": -14.3,
|
| 87 |
+
"TP": -1.4
|
| 88 |
+
},
|
| 89 |
+
"pulse:high:1": {
|
| 90 |
+
"trim": -1.89,
|
| 91 |
+
"I": -13.6,
|
| 92 |
+
"TP": -1.8
|
| 93 |
+
},
|
| 94 |
+
"pulse:high:0": {
|
| 95 |
+
"trim": -2.89,
|
| 96 |
+
"I": -14.3,
|
| 97 |
+
"TP": -1.2
|
| 98 |
+
},
|
| 99 |
+
"none:std:1": {
|
| 100 |
+
"trim": -3.8,
|
| 101 |
+
"I": -14.7,
|
| 102 |
+
"TP": -1.6
|
| 103 |
+
},
|
| 104 |
+
"none:std:0": {
|
| 105 |
+
"trim": -3.8,
|
| 106 |
+
"I": -14.8,
|
| 107 |
+
"TP": -1.5
|
| 108 |
+
}
|
| 109 |
+
}
|
| 110 |
+
}
|
php2shell/tools/calibrate_bgm.mjs
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env node
|
| 2 |
+
// 对每种背景音乐组合(配乐 × 音量 × 音效)实测校准增益:AAC 192k 编码后真峰值 ≤ −1.2 dBTP,响度尽量接近 −14 LUFS。
|
| 3 |
+
// 结果写回 web/src/data/stems.json 的 trims(键 style:volume:sfx),并输出报告 studio/qa/bgm_options_loudness.json
|
| 4 |
+
import { OfflineAudioContext, AudioBuffer as NAB } from 'node-web-audio-api'
|
| 5 |
+
import { writeFileSync, readFileSync, mkdirSync } from 'node:fs'
|
| 6 |
+
import { join, dirname, resolve } from 'node:path'
|
| 7 |
+
import { fileURLToPath } from 'node:url'
|
| 8 |
+
import { spawnSync } from 'node:child_process'
|
| 9 |
+
globalThis.OfflineAudioContext = OfflineAudioContext
|
| 10 |
+
const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..'), SR = 48000
|
| 11 |
+
const AUD = join(ROOT, 'web/public/audio'), TMP = join(ROOT, 'tools/.stems'), META = join(ROOT, 'web/src/data/stems.json')
|
| 12 |
+
mkdirSync(TMP, { recursive: true })
|
| 13 |
+
spawnSync('bun', ['build', join(ROOT, 'web/src/audio/stems.ts'), '--target=node', '--format=esm', '--outfile', join(TMP, 'stems.mjs')], { stdio: 'ignore' })
|
| 14 |
+
const S = await import('file://' + join(TMP, 'stems.mjs'))
|
| 15 |
+
const dec = (f) => { const r = spawnSync('ffmpeg', ['-loglevel', 'error', '-i', f, '-ac', '1', '-ar', String(SR), '-f', 'f32le', '-'], { maxBuffer: 1 << 30 }); const a = new Float32Array(r.stdout.buffer.slice(r.stdout.byteOffset, r.stdout.byteOffset + r.stdout.length)); const b = new NAB({ length: a.length, numberOfChannels: 1, sampleRate: SR }); b.getChannelData(0).set(a); return b }
|
| 16 |
+
const base = { voice: dec(join(AUD, 'stem_voice.mp3')), sfx: dec(join(AUD, 'stem_sfx.mp3')) }
|
| 17 |
+
const total = base.voice.duration + 3
|
| 18 |
+
const mus = {}
|
| 19 |
+
function wav(b, f) { const L = b.getChannelData(0), R = b.getChannelData(1), n = L.length, buf = Buffer.alloc(44 + n * 4); buf.write('RIFF', 0); buf.writeUInt32LE(36 + n * 4, 4); buf.write('WAVE', 8); buf.write('fmt ', 12); buf.writeUInt32LE(16, 16); buf.writeUInt16LE(1, 20); buf.writeUInt16LE(2, 22); buf.writeUInt32LE(SR, 24); buf.writeUInt32LE(SR * 4, 28); buf.writeUInt16LE(4, 32); buf.writeUInt16LE(16, 34); buf.write('data', 36); buf.writeUInt32LE(n * 4, 40); let o = 44; for (let i = 0; i < n; i++) for (const c of [L, R]) { const v = Math.max(-1, Math.min(1, c[i])); buf.writeInt16LE((v < 0 ? v * 0x8000 : v * 0x7fff) | 0, o); o += 2 } writeFileSync(f, buf) }
|
| 20 |
+
function measure(b) {
|
| 21 |
+
const w = join(TMP, 'cal.wav'), m = join(TMP, 'cal.m4a'); wav(b, w)
|
| 22 |
+
spawnSync('ffmpeg', ['-loglevel', 'error', '-y', '-i', w, '-c:a', 'aac', '-b:a', '192k', m])
|
| 23 |
+
const e = spawnSync('ffmpeg', ['-nostats', '-i', m, '-filter_complex', 'ebur128=peak=true', '-f', 'null', '-'], { encoding: 'utf8' }).stderr
|
| 24 |
+
return { I: +[...e.matchAll(/I:\s+(-?[\d.]+) LUFS/g)].pop()[1], TP: +[...e.matchAll(/Peak:\s+(-?[\d.]+) dBFS/g)].pop()[1] }
|
| 25 |
+
}
|
| 26 |
+
const meta = JSON.parse(readFileSync(META, 'utf8'))
|
| 27 |
+
const styleTrim = { brief: meta.trims.brief ?? -1.8, ambient: meta.trims.ambient ?? -2.2, pulse: meta.trims.pulse ?? -1.9, none: meta.trims.none ?? -3.8 }
|
| 28 |
+
const combos = []
|
| 29 |
+
for (const style of ['brief', 'ambient', 'pulse']) for (const volume of ['low', 'std', 'high']) for (const sfx of [true, false]) combos.push({ style, volume, sfx })
|
| 30 |
+
for (const sfx of [true, false]) combos.push({ style: 'none', volume: 'std', sfx })
|
| 31 |
+
const trims = { brief: styleTrim.brief, ambient: styleTrim.ambient, pulse: styleTrim.pulse, none: styleTrim.none }
|
| 32 |
+
const report = {}
|
| 33 |
+
for (const o of combos) {
|
| 34 |
+
if (o.style !== 'none' && !mus[o.style]) mus[o.style] = dec(join(AUD, `stem_${o.style}.mp3`))
|
| 35 |
+
const set = { ...base, music: o.style === 'none' ? null : mus[o.style] }
|
| 36 |
+
let trim = styleTrim[o.style], r
|
| 37 |
+
for (let it = 0; it < 6; it++) {
|
| 38 |
+
r = measure(await S.renderStemsMix(set, o, total, SR, trim))
|
| 39 |
+
if (r.TP <= -1.2 && r.I <= -13) break
|
| 40 |
+
trim -= r.TP > -1.2 ? Math.max(0.5, (r.TP + 1.2) * 0.8) : 0.5
|
| 41 |
+
}
|
| 42 |
+
const key = S.comboKey(o)
|
| 43 |
+
trims[key] = +trim.toFixed(2); report[key] = { trim: trims[key], ...r }
|
| 44 |
+
console.log(key.padEnd(16), 'trim', trims[key].toFixed(2).padStart(6), '→', r.I, 'LUFS TP', r.TP)
|
| 45 |
+
}
|
| 46 |
+
writeFileSync(META, JSON.stringify({ ...meta, trims }, null, 1))
|
| 47 |
+
writeFileSync(join(ROOT, 'studio/qa/bgm_options_loudness.json'), JSON.stringify({ target: { lufs: -14, tolerance: 1.5, truePeakMax: -1.0 }, codec: 'AAC 192k', report }, null, 1))
|
| 48 |
+
console.log('done', Object.keys(report).length, 'combos')
|
php2shell/tools/render_stems_node.mjs
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env node
|
| 2 |
+
// 渲染分轨(旁白 / 音效 / 3 种配乐)→ web/public/audio/stem_*.mp3,并为每种配乐选项校准响度(−14 LUFS)→ web/src/data/stems.json
|
| 3 |
+
// 用 node-web-audio-api 跑与浏览器完全相同的 synth / stems 代码。
|
| 4 |
+
import { OfflineAudioContext, AudioBuffer as NAB } from 'node-web-audio-api'
|
| 5 |
+
import { writeFileSync, mkdirSync, existsSync, readFileSync, rmSync } from 'node:fs'
|
| 6 |
+
import { join, dirname, resolve } from 'node:path'
|
| 7 |
+
import { fileURLToPath } from 'node:url'
|
| 8 |
+
import { spawnSync } from 'node:child_process'
|
| 9 |
+
|
| 10 |
+
globalThis.OfflineAudioContext = OfflineAudioContext
|
| 11 |
+
const HERE = dirname(fileURLToPath(import.meta.url))
|
| 12 |
+
const ROOT = resolve(HERE, '..')
|
| 13 |
+
const SR = 48000
|
| 14 |
+
const SCALE = 0.5 // 分轨以 0.5 倍幅度存储(留峰值余量),播放时 ×2 还原
|
| 15 |
+
const VOICE_GAIN = 1.15
|
| 16 |
+
const AUD = join(ROOT, 'web/public/audio')
|
| 17 |
+
const TMP = join(ROOT, 'tools/.stems'); mkdirSync(TMP, { recursive: true }); mkdirSync(AUD, { recursive: true })
|
| 18 |
+
const META_PATH = join(ROOT, 'web/src/data/stems.json')
|
| 19 |
+
|
| 20 |
+
// 先写一个占位 meta(stems.ts 编译时需要)
|
| 21 |
+
if (!existsSync(META_PATH)) writeFileSync(META_PATH, JSON.stringify({ scale: SCALE, voiceGain: VOICE_GAIN, trims: {} }))
|
| 22 |
+
|
| 23 |
+
const ff = (args, opt = {}) => { const r = spawnSync('ffmpeg', ['-loglevel', 'error', '-y', ...args], { maxBuffer: 1 << 30, ...opt }); if (r.status !== 0) throw new Error(r.stderr?.toString()); return r }
|
| 24 |
+
const decodeMono = (file) => { const r = ff(['-i', file, '-ac', '1', '-ar', String(SR), '-f', 'f32le', '-']); return new Float32Array(r.stdout.buffer.slice(r.stdout.byteOffset, r.stdout.byteOffset + r.stdout.length)) }
|
| 25 |
+
const toBuf = (data, ch = 1) => { const b = new NAB({ length: data.length, numberOfChannels: ch, sampleRate: SR }); for (let c = 0; c < ch; c++) b.getChannelData(c).set(data); return b }
|
| 26 |
+
function writeWav(path, chans) {
|
| 27 |
+
const n = chans[0].length, ch = chans.length, bytes = 44 + n * ch * 2, b = Buffer.alloc(bytes)
|
| 28 |
+
b.write('RIFF', 0); b.writeUInt32LE(bytes - 8, 4); b.write('WAVE', 8); b.write('fmt ', 12); b.writeUInt32LE(16, 16); b.writeUInt16LE(1, 20); b.writeUInt16LE(ch, 22); b.writeUInt32LE(SR, 24); b.writeUInt32LE(SR * ch * 2, 28); b.writeUInt16LE(ch * 2, 32); b.writeUInt16LE(16, 34); b.write('data', 36); b.writeUInt32LE(n * ch * 2, 40)
|
| 29 |
+
let o = 44; for (let i = 0; i < n; i++) for (let c = 0; c < ch; c++) { const v = Math.max(-1, Math.min(1, chans[c][i])); b.writeInt16LE((v < 0 ? v * 0x8000 : v * 0x7fff) | 0, o); o += 2 }
|
| 30 |
+
writeFileSync(path, b)
|
| 31 |
+
}
|
| 32 |
+
const lufs = (file) => { const e = spawnSync('ffmpeg', ['-nostats', '-i', file, '-filter_complex', 'ebur128=peak=true', '-f', 'null', '-'], { encoding: 'utf8' }).stderr; const I = [...e.matchAll(/I:\s+(-?[\d.]+) LUFS/g)].pop(); const P = [...e.matchAll(/Peak:\s+(-?[\d.]+) dBFS/g)].pop(); return { I: I ? +I[1] : NaN, TP: P ? +P[1] : NaN } }
|
| 33 |
+
const peak = (a) => { let m = 0; for (let i = 0; i < a.length; i++) { const v = Math.abs(a[i]); if (v > m) m = v } return m }
|
| 34 |
+
|
| 35 |
+
// 现编译 synth / stems(与网页同源)
|
| 36 |
+
const bundle = (src, out) => { const r = spawnSync('bun', ['build', src, '--target=node', '--format=esm', '--outfile', out], { stdio: 'inherit' }); if (r.status !== 0) process.exit(1) }
|
| 37 |
+
bundle(join(ROOT, 'web/src/audio/synth.ts'), join(TMP, 'synth.mjs'))
|
| 38 |
+
const { renderStem } = await import('file://' + join(TMP, 'synth.mjs'))
|
| 39 |
+
|
| 40 |
+
// 1) 旁白
|
| 41 |
+
const voice = decodeMono(join(ROOT, 'studio/audio/voice.wav'))
|
| 42 |
+
const voiceBuf = toBuf(voice)
|
| 43 |
+
const total = voice.length / SR + 4
|
| 44 |
+
console.log('voice', (voice.length / SR).toFixed(2), 's, peak', peak(voice).toFixed(3))
|
| 45 |
+
|
| 46 |
+
// 2) 分轨渲染
|
| 47 |
+
const stems = { voice }
|
| 48 |
+
for (const kind of ['sfx', 'brief', 'ambient', 'pulse']) {
|
| 49 |
+
const t0 = Date.now()
|
| 50 |
+
const b = await renderStem(voiceBuf, kind, SR)
|
| 51 |
+
stems[kind] = new Float32Array(b.getChannelData(0))
|
| 52 |
+
console.log(kind, 'rendered', ((Date.now() - t0) / 1000).toFixed(1) + 's', 'peak', peak(stems[kind]).toFixed(3))
|
| 53 |
+
}
|
| 54 |
+
// 3) 三种配乐响度对齐到 brief
|
| 55 |
+
const mLufs = {}
|
| 56 |
+
for (const k of ['brief', 'ambient', 'pulse']) { const f = join(TMP, `m_${k}.wav`); writeWav(f, [stems[k].map((v) => v * SCALE)]); mLufs[k] = lufs(f).I }
|
| 57 |
+
console.log('music stem LUFS', mLufs)
|
| 58 |
+
for (const k of ['ambient', 'pulse']) { const g = Math.pow(10, (mLufs.brief - mLufs[k]) / 20); const a = stems[k]; for (let i = 0; i < a.length; i++) a[i] *= g }
|
| 59 |
+
|
| 60 |
+
// 4) 写分轨 MP3(单声道,×SCALE)
|
| 61 |
+
for (const [k, br] of [['voice', '96k'], ['sfx', '96k'], ['brief', '96k'], ['ambient', '96k'], ['pulse', '96k']]) {
|
| 62 |
+
const a = stems[k], scaled = new Float32Array(a.length); for (let i = 0; i < a.length; i++) scaled[i] = a[i] * SCALE
|
| 63 |
+
const pk = peak(scaled); if (pk >= 0.99) console.warn('⚠', k, 'stem peak', pk)
|
| 64 |
+
const wav = join(TMP, `${k}.wav`); writeWav(wav, [scaled])
|
| 65 |
+
ff(['-i', wav, '-c:a', 'libmp3lame', '-b:a', br, '-ar', String(SR), '-ac', '1', join(AUD, `stem_${k}.mp3`)])
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
// 5) 用与网页相同的 buildGraph 校准每个选项的响度(读回 MP3,模拟浏览器解码)
|
| 69 |
+
writeFileSync(META_PATH, JSON.stringify({ scale: SCALE, voiceGain: VOICE_GAIN, trims: {} }))
|
| 70 |
+
bundle(join(ROOT, 'web/src/audio/stems.ts'), join(TMP, 'stems.mjs'))
|
| 71 |
+
const S = await import('file://' + join(TMP, 'stems.mjs') + '?v=' + Date.now())
|
| 72 |
+
const load = (k) => toBuf(decodeMono(join(AUD, `stem_${k}.mp3`)))
|
| 73 |
+
const set = { voice: load('voice'), sfx: load('sfx') }
|
| 74 |
+
const trims = {}
|
| 75 |
+
const report = {}
|
| 76 |
+
for (const style of ['brief', 'ambient', 'pulse', 'none']) {
|
| 77 |
+
const music = style === 'none' ? null : load(style)
|
| 78 |
+
let trim = 0, res
|
| 79 |
+
for (let it = 0; it < 3; it++) {
|
| 80 |
+
const b = await S.renderStemsMix({ ...set, music }, { style, volume: 'std', sfx: true }, total, SR, trim)
|
| 81 |
+
const f = join(TMP, `mix_${style}.wav`); writeWav(f, [b.getChannelData(0), b.getChannelData(1)])
|
| 82 |
+
res = lufs(f)
|
| 83 |
+
if (Math.abs(res.I + 14) < 0.3) break
|
| 84 |
+
trim += (-14 - res.I) * 0.9
|
| 85 |
+
}
|
| 86 |
+
trims[style] = +trim.toFixed(2)
|
| 87 |
+
report[style] = res
|
| 88 |
+
console.log('option', style, 'trim', trims[style], 'dB →', res.I, 'LUFS, peak', res.TP, 'dBFS')
|
| 89 |
+
}
|
| 90 |
+
writeFileSync(META_PATH, JSON.stringify({ scale: SCALE, voiceGain: VOICE_GAIN, trims }, null, 1))
|
| 91 |
+
writeFileSync(join(ROOT, 'studio/qa/bgm_options_loudness.json'), JSON.stringify({ target: -14, report, trims }, null, 1))
|
| 92 |
+
console.log('stems.json →', trims)
|
php2shell/web/src/audio/stems.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// 分轨混合:旁白 / 音效 / 配乐(3 种风格之一或无)→ 母带链。
|
| 2 |
+
// 播放(实时 AudioContext)、导出(OfflineAudioContext)、Node 端响度校准都调用 buildGraph,保证三处一致。
|
| 3 |
+
import { masterChain, MusicStyle } from './synth'
|
| 4 |
+
import STEMS_META from '../data/stems.json'
|
| 5 |
+
|
| 6 |
+
export type BgmStyle = MusicStyle | 'none'
|
| 7 |
+
export type BgmVolume = 'low' | 'std' | 'high'
|
| 8 |
+
export interface BgmOpts { style: BgmStyle; volume: BgmVolume; sfx: boolean }
|
| 9 |
+
export const DEFAULT_BGM: BgmOpts = { style: 'brief', volume: 'std', sfx: true }
|
| 10 |
+
export const VOLUMES: { id: BgmVolume; name: string; gain: number }[] = [
|
| 11 |
+
{ id: 'low', name: '低', gain: 0.5 }, // −6 dB
|
| 12 |
+
{ id: 'std', name: '标准', gain: 1 },
|
| 13 |
+
{ id: 'high', name: '高', gain: 1.41 }, // +3 dB
|
| 14 |
+
]
|
| 15 |
+
|
| 16 |
+
export interface StemMeta { scale: number; voiceGain: number; trims: Record<string, number> }
|
| 17 |
+
export const META = STEMS_META as unknown as StemMeta
|
| 18 |
+
|
| 19 |
+
export interface StemSet { voice: AudioBuffer; sfx: AudioBuffer; music: AudioBuffer | null }
|
| 20 |
+
|
| 21 |
+
export const stemUrl = (name: string) => `./audio/stem_${name}.mp3`
|
| 22 |
+
|
| 23 |
+
/** 每种组合(配乐 × 音量 × 音效)的实测增益(tools/calibrate_bgm.mjs 生成:响度 −14±1 LUFS、AAC 后真峰值 ≤ −1.2 dBTP) */
|
| 24 |
+
export const comboKey = (o: BgmOpts) => `${o.style}:${o.style === 'none' ? 'std' : o.volume}:${o.sfx ? 1 : 0}`
|
| 25 |
+
export function trimFor(o: BgmOpts) { const t = META.trims ?? {}; return t[comboKey(o)] ?? t[o.style] ?? 0 }
|
| 26 |
+
|
| 27 |
+
/** 搭建混音图并在 when 时刻从 offset 秒开始播放;返回所有 source 以便停止。 */
|
| 28 |
+
export function buildGraph(ctx: BaseAudioContext, stems: StemSet, opts: BgmOpts, when: number, offset: number, trimOverride?: number): AudioBufferSourceNode[] {
|
| 29 |
+
const inv = 1 / META.scale
|
| 30 |
+
const trimDb = trimOverride ?? trimFor(opts)
|
| 31 |
+
const pre = ctx.createGain(); pre.gain.value = Math.pow(10, trimDb / 20)
|
| 32 |
+
const master = masterChain(ctx, ctx.destination)
|
| 33 |
+
pre.connect(master)
|
| 34 |
+
const srcs: AudioBufferSourceNode[] = []
|
| 35 |
+
const add = (buf: AudioBuffer | null, gain: number) => {
|
| 36 |
+
if (!buf || gain <= 0) return
|
| 37 |
+
const s = ctx.createBufferSource(); s.buffer = buf
|
| 38 |
+
const g = ctx.createGain(); g.gain.value = gain * inv
|
| 39 |
+
s.connect(g); g.connect(pre)
|
| 40 |
+
s.start(when, Math.min(offset, buf.duration - 0.01))
|
| 41 |
+
srcs.push(s)
|
| 42 |
+
}
|
| 43 |
+
add(stems.voice, META.voiceGain)
|
| 44 |
+
if (opts.sfx) add(stems.sfx, 1)
|
| 45 |
+
if (opts.style !== 'none') add(stems.music, VOLUMES.find((v) => v.id === opts.volume)!.gain)
|
| 46 |
+
return srcs
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
/** 离线渲染一条完整混音(导出用)。只有 3 个音源 + 母带链,内存占用小。 */
|
| 50 |
+
export async function renderStemsMix(stems: StemSet, opts: BgmOpts, total: number, sampleRate = 48000, trimOverride?: number): Promise<AudioBuffer> {
|
| 51 |
+
const len = Math.ceil(total * sampleRate)
|
| 52 |
+
const ctx = new OfflineAudioContext(2, len, sampleRate)
|
| 53 |
+
buildGraph(ctx, stems, opts, 0, 0, trimOverride)
|
| 54 |
+
return await ctx.startRendering()
|
| 55 |
+
}
|
php2shell/web/src/audio/synth.ts
CHANGED
|
@@ -79,7 +79,7 @@ function scheduleSfx(ctx: BaseAudioContext, dest: AudioNode, map: Mapper) {
|
|
| 79 |
}
|
| 80 |
|
| 81 |
// ---------- 音乐
|
| 82 |
-
function
|
| 83 |
const beat = 60 / BPM, barLen = beat * 4
|
| 84 |
for (let si = 0; si < MUSIC.length; si++) {
|
| 85 |
const m = MUSIC[si]
|
|
@@ -132,6 +132,113 @@ function scheduleMusic(ctx: BaseAudioContext, dest: AudioNode, map: Mapper) {
|
|
| 132 |
}
|
| 133 |
}
|
| 134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
// 旁白 RMS → ducking 增益自动化(在 music 总线上)
|
| 136 |
function duck(voice: AudioBuffer, gain: AudioParam, map: Mapper, base: number, ducked: number) {
|
| 137 |
const sr = voice.sampleRate, ch = voice.getChannelData(0), win = Math.floor(sr * 0.05), step = 0.05
|
|
@@ -149,7 +256,7 @@ function duck(voice: AudioBuffer, gain: AudioParam, map: Mapper, base: number, d
|
|
| 149 |
|
| 150 |
// ---------- 母带链:压缩 → 补偿 → 限幅 → 软削波(天花板 −1.5 dBFS)。播放与导出共用,响度目标约 −14 LUFS。
|
| 151 |
export const MASTER = { drive: 1.15, makeup: 0.9, ceiling: 0.7 }
|
| 152 |
-
function masterChain(ctx: BaseAudioContext, dest: AudioNode): GainNode {
|
| 153 |
const input = ctx.createGain(); input.gain.value = MASTER.drive
|
| 154 |
const comp = ctx.createDynamicsCompressor()
|
| 155 |
comp.threshold.value = -18; comp.knee.value = 8; comp.ratio.value = 4; comp.attack.value = 0.004; comp.release.value = 0.25
|
|
@@ -199,3 +306,15 @@ export async function renderMix(voiceBuf: AudioBuffer, sampleRate = 48000): Prom
|
|
| 199 |
scheduleSfx(ctx, sfxGain, map)
|
| 200 |
return await ctx.startRendering()
|
| 201 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
}
|
| 80 |
|
| 81 |
// ---------- 音乐
|
| 82 |
+
function musicBrief(ctx: BaseAudioContext, dest: AudioNode, map: Mapper) {
|
| 83 |
const beat = 60 / BPM, barLen = beat * 4
|
| 84 |
for (let si = 0; si < MUSIC.length; si++) {
|
| 85 |
const m = MUSIC[si]
|
|
|
|
| 132 |
}
|
| 133 |
}
|
| 134 |
|
| 135 |
+
|
| 136 |
+
export type MusicStyle = 'brief' | 'ambient' | 'pulse'
|
| 137 |
+
export const MUSIC_STYLES: { id: MusicStyle | 'none'; name: string; desc: string }[] = [
|
| 138 |
+
{ id: 'brief', name: '应急简报', desc: '默认:和弦铺底 + 琶音 + 轻打击' },
|
| 139 |
+
{ id: 'ambient', name: '深夜氛围', desc: '柔和长音,无鼓点,更安静' },
|
| 140 |
+
{ id: 'pulse', name: '电子脉冲', desc: '底鼓 + 锯齿低音,节奏更强' },
|
| 141 |
+
{ id: 'none', name: '无背景音乐', desc: '只保留旁白(与音效)' },
|
| 142 |
+
]
|
| 143 |
+
|
| 144 |
+
// 深夜氛围:慢起慢收的正弦长音 + 每小节一次的高八度微光,无鼓、无琶音
|
| 145 |
+
function musicAmbient(ctx: BaseAudioContext, dest: AudioNode, map: Mapper) {
|
| 146 |
+
const beat = 60 / BPM, barLen = beat * 4
|
| 147 |
+
for (let si = 0; si < MUSIC.length; si++) {
|
| 148 |
+
const m = MUSIC[si]
|
| 149 |
+
const end = si + 1 < MUSIC.length ? MUSIC[si + 1].start : TOTAL
|
| 150 |
+
const chords = CHORDS[m.mood], key = m.key ?? 0
|
| 151 |
+
let bar = 0
|
| 152 |
+
for (let t = m.start; t < end - 0.05; t += barLen * 2, bar++) {
|
| 153 |
+
const chord = chords[bar % chords.length].map((x) => x + key)
|
| 154 |
+
const dur = Math.min(barLen * 2, end - t)
|
| 155 |
+
const w0 = map(t); if (w0 == null) continue
|
| 156 |
+
chord.forEach((n, i) => {
|
| 157 |
+
const o = ctx.createOscillator(); o.type = 'sine'; o.frequency.value = noteHz(n)
|
| 158 |
+
o.detune.value = (i % 2 ? 6 : -6)
|
| 159 |
+
const ga = ctx.createGain(); const lp = ctx.createBiquadFilter(); lp.type = 'lowpass'; lp.frequency.value = 1400
|
| 160 |
+
o.connect(ga); ga.connect(lp); lp.connect(dest)
|
| 161 |
+
adsr(ga.gain, w0, 0.055, Math.min(1.2, dur * 0.3), 0.3, 0.85, Math.max(0, dur - 2.2), 0.9); o.start(w0); o.stop(w0 + dur + 1)
|
| 162 |
+
})
|
| 163 |
+
// 低音长音
|
| 164 |
+
{ const o = ctx.createOscillator(); o.type = 'sine'; o.frequency.value = noteHz(chord[0] - 24)
|
| 165 |
+
const ga = ctx.createGain(); o.connect(ga); ga.connect(dest)
|
| 166 |
+
adsr(ga.gain, w0, 0.11, 0.8, 0.3, 0.8, Math.max(0, dur - 1.8), 0.8); o.start(w0); o.stop(w0 + dur + 1) }
|
| 167 |
+
// 微光
|
| 168 |
+
const ws = map(t + barLen); if (ws != null && t + barLen < end) {
|
| 169 |
+
const o = ctx.createOscillator(); o.type = 'sine'; o.frequency.value = noteHz(chord[chord.length - 1] + 24)
|
| 170 |
+
const ga = ctx.createGain(); o.connect(ga); ga.connect(dest)
|
| 171 |
+
adsr(ga.gain, ws, 0.02, 0.02, 0.4, 0.3, 0.3, 1.6); o.start(ws); o.stop(ws + 2.5)
|
| 172 |
+
}
|
| 173 |
+
}
|
| 174 |
+
}
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
// 电子脉冲:每拍底鼓 + 八分锯齿低音 + 方波琶音 + 反拍镲,pad 更薄
|
| 178 |
+
function musicPulse(ctx: BaseAudioContext, dest: AudioNode, map: Mapper) {
|
| 179 |
+
const beat = 60 / BPM, barLen = beat * 4
|
| 180 |
+
for (let si = 0; si < MUSIC.length; si++) {
|
| 181 |
+
const m = MUSIC[si]
|
| 182 |
+
const end = si + 1 < MUSIC.length ? MUSIC[si + 1].start : TOTAL
|
| 183 |
+
const chords = CHORDS[m.mood], key = m.key ?? 0
|
| 184 |
+
const calm = m.mood === 'ambient' || m.mood === 'reveal'
|
| 185 |
+
let bar = 0
|
| 186 |
+
for (let t = m.start; t < end - 0.05; t += barLen, bar++) {
|
| 187 |
+
const chord = chords[bar % chords.length].map((x) => x + key)
|
| 188 |
+
const barDur = Math.min(barLen, end - t)
|
| 189 |
+
const w0 = map(t)
|
| 190 |
+
if (w0 != null) for (const n of chord) {
|
| 191 |
+
const o = ctx.createOscillator(); o.type = 'sawtooth'; o.frequency.value = noteHz(n)
|
| 192 |
+
const ga = ctx.createGain(); const lp = ctx.createBiquadFilter(); lp.type = 'lowpass'; lp.frequency.value = 700
|
| 193 |
+
o.connect(ga); ga.connect(lp); lp.connect(dest)
|
| 194 |
+
adsr(ga.gain, w0, 0.03, 0.15, 0.2, 0.7, Math.max(0, barDur - 0.5), 0.3); o.start(w0); o.stop(w0 + barDur + 0.2)
|
| 195 |
+
}
|
| 196 |
+
for (let b = 0; b < 4; b++) {
|
| 197 |
+
const at = t + b * beat; if (at >= end) break
|
| 198 |
+
const w = map(at); if (w == null) continue
|
| 199 |
+
// 底鼓(紧张段只在 1、3 拍;安静段不打)
|
| 200 |
+
if (!calm && (m.mood !== 'tense' || b % 2 === 0)) {
|
| 201 |
+
const o = ctx.createOscillator(); o.type = 'sine'; o.frequency.setValueAtTime(130, w); o.frequency.exponentialRampToValueAtTime(42, w + 0.18)
|
| 202 |
+
const ga = ctx.createGain(); o.connect(ga); ga.connect(dest)
|
| 203 |
+
adsr(ga.gain, w, 0.32, 0.002, 0.12, 0.2, 0, 0.12); o.start(w); o.stop(w + 0.35)
|
| 204 |
+
}
|
| 205 |
+
// 八分低音
|
| 206 |
+
for (let e = 0; e < 2; e++) {
|
| 207 |
+
const ww = w + e * beat / 2
|
| 208 |
+
const o = ctx.createOscillator(); o.type = 'sawtooth'; o.frequency.value = noteHz(chord[0] - 12)
|
| 209 |
+
const ga = ctx.createGain(); const lp = ctx.createBiquadFilter(); lp.type = 'lowpass'; lp.frequency.value = 420; lp.Q.value = 4
|
| 210 |
+
o.connect(ga); ga.connect(lp); lp.connect(dest)
|
| 211 |
+
adsr(ga.gain, ww, calm ? 0.05 : 0.1, 0.004, 0.08, 0.4, 0, 0.08); o.start(ww); o.stop(ww + beat / 2 + 0.1)
|
| 212 |
+
}
|
| 213 |
+
// 反拍镲
|
| 214 |
+
if (!calm) {
|
| 215 |
+
const wh = w + beat / 2
|
| 216 |
+
const src = ctx.createBufferSource(); src.buffer = noiseBuf(ctx, 0.05)
|
| 217 |
+
const hp = ctx.createBiquadFilter(); hp.type = 'highpass'; hp.frequency.value = 8000
|
| 218 |
+
const ga = ctx.createGain(); src.connect(hp); hp.connect(ga); ga.connect(dest)
|
| 219 |
+
adsr(ga.gain, wh, 0.05, 0.001, 0.025, 0.1, 0, 0.02); src.start(wh); src.stop(wh + 0.06)
|
| 220 |
+
}
|
| 221 |
+
}
|
| 222 |
+
// 方波琶音(16 分,非紧张段)
|
| 223 |
+
if (!calm && m.mood !== 'tense') for (let i = 0; i < 8; i++) {
|
| 224 |
+
const at = t + i * (barLen / 8); if (at >= end) break
|
| 225 |
+
const w = map(at); if (w == null) continue
|
| 226 |
+
const n = chord[i % chord.length] + 12 + (i >= 4 ? 12 : 0)
|
| 227 |
+
const o = ctx.createOscillator(); o.type = 'square'; o.frequency.value = noteHz(n)
|
| 228 |
+
const ga = ctx.createGain(); const lp = ctx.createBiquadFilter(); lp.type = 'lowpass'; lp.frequency.value = 2400
|
| 229 |
+
o.connect(ga); ga.connect(lp); lp.connect(dest)
|
| 230 |
+
adsr(ga.gain, w, 0.022, 0.003, 0.04, 0.3, 0, 0.05); o.start(w); o.stop(w + barLen / 8 + 0.05)
|
| 231 |
+
}
|
| 232 |
+
}
|
| 233 |
+
}
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
function scheduleMusic(ctx: BaseAudioContext, dest: AudioNode, map: Mapper, style: MusicStyle = 'brief') {
|
| 237 |
+
if (style === 'ambient') return musicAmbient(ctx, dest, map)
|
| 238 |
+
if (style === 'pulse') return musicPulse(ctx, dest, map)
|
| 239 |
+
return musicBrief(ctx, dest, map)
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
// 旁白 RMS → ducking 增益自动化(在 music 总线上)
|
| 243 |
function duck(voice: AudioBuffer, gain: AudioParam, map: Mapper, base: number, ducked: number) {
|
| 244 |
const sr = voice.sampleRate, ch = voice.getChannelData(0), win = Math.floor(sr * 0.05), step = 0.05
|
|
|
|
| 256 |
|
| 257 |
// ---------- 母带链:压缩 → 补偿 → 限幅 → 软削波(天花板 −1.5 dBFS)。播放与导出共用,响度目标约 −14 LUFS。
|
| 258 |
export const MASTER = { drive: 1.15, makeup: 0.9, ceiling: 0.7 }
|
| 259 |
+
export function masterChain(ctx: BaseAudioContext, dest: AudioNode): GainNode {
|
| 260 |
const input = ctx.createGain(); input.gain.value = MASTER.drive
|
| 261 |
const comp = ctx.createDynamicsCompressor()
|
| 262 |
comp.threshold.value = -18; comp.knee.value = 8; comp.ratio.value = 4; comp.attack.value = 0.004; comp.release.value = 0.25
|
|
|
|
| 306 |
scheduleSfx(ctx, sfxGain, map)
|
| 307 |
return await ctx.startRendering()
|
| 308 |
}
|
| 309 |
+
|
| 310 |
+
export type StemKind = 'sfx' | MusicStyle
|
| 311 |
+
/** 离线渲染单条分轨(不经母带链,单声道):sfx = 音效总线;brief/ambient/pulse = 已按旁白做闪避的配乐总线 */
|
| 312 |
+
export async function renderStem(voiceBuf: AudioBuffer, kind: StemKind, sampleRate = 48000): Promise<AudioBuffer> {
|
| 313 |
+
const len = Math.ceil((TOTAL + 1) * sampleRate)
|
| 314 |
+
const ctx = new OfflineAudioContext(1, len, sampleRate)
|
| 315 |
+
const map: Mapper = (abs) => abs
|
| 316 |
+
const bus = ctx.createGain(); bus.connect(ctx.destination)
|
| 317 |
+
if (kind === 'sfx') { bus.gain.value = 0.6; scheduleSfx(ctx, bus, map) }
|
| 318 |
+
else { scheduleMusic(ctx, bus, map, kind); duck(voiceBuf, bus.gain, map, 0.5, 0.17) }
|
| 319 |
+
return await ctx.startRendering()
|
| 320 |
+
}
|
php2shell/web/src/data/stems.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"scale": 0.5,
|
| 3 |
+
"voiceGain": 1.15,
|
| 4 |
+
"trims": {
|
| 5 |
+
"brief": -1.8,
|
| 6 |
+
"ambient": -2.16,
|
| 7 |
+
"pulse": -1.89,
|
| 8 |
+
"none": -3.8,
|
| 9 |
+
"brief:low:1": -2.3,
|
| 10 |
+
"brief:low:0": -2.94,
|
| 11 |
+
"brief:std:1": -1.8,
|
| 12 |
+
"brief:std:0": -1.8,
|
| 13 |
+
"brief:high:1": -3.3,
|
| 14 |
+
"brief:high:0": -2.3,
|
| 15 |
+
"ambient:low:1": -2.16,
|
| 16 |
+
"ambient:low:0": -2.16,
|
| 17 |
+
"ambient:std:1": -2.66,
|
| 18 |
+
"ambient:std:0": -2.16,
|
| 19 |
+
"ambient:high:1": -2.88,
|
| 20 |
+
"ambient:high:0": -2.16,
|
| 21 |
+
"pulse:low:1": -1.89,
|
| 22 |
+
"pulse:low:0": -1.89,
|
| 23 |
+
"pulse:std:1": -1.89,
|
| 24 |
+
"pulse:std:0": -2.45,
|
| 25 |
+
"pulse:high:1": -1.89,
|
| 26 |
+
"pulse:high:0": -2.89,
|
| 27 |
+
"none:std:1": -3.8,
|
| 28 |
+
"none:std:0": -3.8
|
| 29 |
+
}
|
| 30 |
+
}
|
php2shell/web/src/main.ts
CHANGED
|
@@ -2,6 +2,8 @@ import './ui/style.css'
|
|
| 2 |
import { render } from './engine/render'
|
| 3 |
import { TL, sceneAt } from './engine/core'
|
| 4 |
import { exportMP4, exportSupported, FpsOpt, Orient, Quality } from './ui/export'
|
|
|
|
|
|
|
| 5 |
import { PLATFORMS, LIVE_POST, cleanTitle } from './ui/publish'
|
| 6 |
import { COVERS, coverCanvas, CoverDef } from './ui/covers'
|
| 7 |
import { LIVE_PRESETS, livePreview, LIVE_ZIP_URL } from './ui/live'
|
|
@@ -34,9 +36,11 @@ let rafId = 0
|
|
| 34 |
let startWall = 0
|
| 35 |
let startAt = 0
|
| 36 |
let audioCtx: AudioContext | null = null
|
| 37 |
-
let
|
| 38 |
-
|
| 39 |
-
let
|
|
|
|
|
|
|
| 40 |
|
| 41 |
const canvas = el('canvas') as HTMLCanvasElement
|
| 42 |
const ctx = canvas.getContext('2d', { alpha: false })!
|
|
@@ -48,30 +52,30 @@ function drawFrame(t: number) {
|
|
| 48 |
render(ctx, Math.max(0, Math.min(TL.total - 0.001, t)), W, H, { subtitles: true, hud: true, grain: true })
|
| 49 |
}
|
| 50 |
|
| 51 |
-
// 音轨:旁白
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
|
|
|
| 64 |
}
|
| 65 |
|
| 66 |
-
function stopAudio() {
|
| 67 |
async function startAudio(from: number): Promise<number> {
|
| 68 |
-
const
|
| 69 |
-
|
| 70 |
-
if (
|
| 71 |
stopAudio()
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
srcNode.start(when, Math.min(from, mix.duration - 0.01))
|
| 75 |
return when
|
| 76 |
}
|
| 77 |
|
|
@@ -86,7 +90,7 @@ function loop() {
|
|
| 86 |
async function play() {
|
| 87 |
if (playing) return
|
| 88 |
const btn = $('#playBtn'); if (btn) btn.innerHTML = '⏸'
|
| 89 |
-
if (!
|
| 90 |
if (cur >= TL.total) cur = 0
|
| 91 |
const started = await startAudio(cur)
|
| 92 |
setStatus('player', '')
|
|
@@ -172,6 +176,13 @@ function build() {
|
|
| 172 |
<div class="seg" id="expFps">
|
| 173 |
<button data-f="24">24 fps</button><button data-f="30">30 fps</button><button data-f="60">60 fps</button>
|
| 174 |
</div></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
<div class="row"><span class="label">清晰度</span>
|
| 176 |
<div class="seg" id="expQ">
|
| 177 |
<button data-q="high">高清</button><button data-q="medium">流畅(更快)</button>
|
|
@@ -236,7 +247,7 @@ function build() {
|
|
| 236 |
buildLive()
|
| 237 |
drawFrame(0); syncBar()
|
| 238 |
// 预解码旁白(不阻塞)
|
| 239 |
-
|
| 240 |
}
|
| 241 |
|
| 242 |
function sceneStart(id: string) { return TL.scenes.find((s) => s.id === id)?.start ?? 0 }
|
|
@@ -267,6 +278,7 @@ function wireControls() {
|
|
| 267 |
segPick('#expFps', (v) => ef = Number(v) as FpsOpt, '30')
|
| 268 |
segPick('#expQ', (v) => eq = v as Quality, 'high')
|
| 269 |
|
|
|
|
| 270 |
const abort = { aborted: false }
|
| 271 |
$('#exportBtn').addEventListener('click', async () => {
|
| 272 |
const sup = exportSupported()
|
|
@@ -277,11 +289,12 @@ function wireControls() {
|
|
| 277 |
const bar = $('#expBar') as HTMLElement
|
| 278 |
const wasPlaying = playing; if (wasPlaying) pause()
|
| 279 |
try {
|
| 280 |
-
setStatus('export',
|
| 281 |
-
const
|
|
|
|
| 282 |
const blob = await exportMP4({ fps: ef, orient: eo, quality: eq, mix, signal: abort, onProgress: (p, label) => { bar.style.width = (p * 100).toFixed(0) + '%'; setStatus('export', `${label} · ${(p * 100).toFixed(0)}%`) } })
|
| 283 |
const url = URL.createObjectURL(blob)
|
| 284 |
-
const a = el('a') as HTMLAnchorElement; a.href = url; a.download = `PHP2Shell_${eo === 'portrait' ? '竖屏' : '横屏'}_${ef}
|
| 285 |
setTimeout(() => URL.revokeObjectURL(url), 10000)
|
| 286 |
setStatus('export', `✅ 导出完成:${(blob.size / 1048576).toFixed(1)} MB`); toast('MP4 已开始下载')
|
| 287 |
} catch (err: any) {
|
|
@@ -387,9 +400,33 @@ build()
|
|
| 387 |
|
| 388 |
// QA 辅助:导出前 N 秒(验证编码/封装链路)
|
| 389 |
;(window as any).__qaExport = async (seconds = 4, fps: FpsOpt = 30, orient: Orient = 'landscape') => {
|
| 390 |
-
const
|
|
|
|
| 391 |
const blob = await exportMP4({ fps, orient, quality: 'medium', mix, seconds })
|
| 392 |
const buf = new Uint8Array(await blob.arrayBuffer())
|
| 393 |
let bin = ''; for (let i = 0; i < buf.length; i += 0x8000) bin += String.fromCharCode(...buf.subarray(i, i + 0x8000))
|
| 394 |
return btoa(bin)
|
| 395 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
import { render } from './engine/render'
|
| 3 |
import { TL, sceneAt } from './engine/core'
|
| 4 |
import { exportMP4, exportSupported, FpsOpt, Orient, Quality } from './ui/export'
|
| 5 |
+
import { buildGraph, renderStemsMix, stemUrl, BgmOpts, BgmStyle, BgmVolume, DEFAULT_BGM, VOLUMES, StemSet } from './audio/stems'
|
| 6 |
+
import { MUSIC_STYLES } from './audio/synth'
|
| 7 |
import { PLATFORMS, LIVE_POST, cleanTitle } from './ui/publish'
|
| 8 |
import { COVERS, coverCanvas, CoverDef } from './ui/covers'
|
| 9 |
import { LIVE_PRESETS, livePreview, LIVE_ZIP_URL } from './ui/live'
|
|
|
|
| 36 |
let startWall = 0
|
| 37 |
let startAt = 0
|
| 38 |
let audioCtx: AudioContext | null = null
|
| 39 |
+
let srcNodes: AudioBufferSourceNode[] = []
|
| 40 |
+
// 背景音乐选项(播放与导出共用,记住上次选择)
|
| 41 |
+
let bgm: BgmOpts = (() => { try { return { ...DEFAULT_BGM, ...JSON.parse(localStorage.getItem('p2s.bgm') || '{}') } } catch { return { ...DEFAULT_BGM } } })()
|
| 42 |
+
const saveBgm = () => { try { localStorage.setItem('p2s.bgm', JSON.stringify(bgm)) } catch { } }
|
| 43 |
+
const stemCache = new Map<string, Promise<AudioBuffer>>()
|
| 44 |
|
| 45 |
const canvas = el('canvas') as HTMLCanvasElement
|
| 46 |
const ctx = canvas.getContext('2d', { alpha: false })!
|
|
|
|
| 52 |
render(ctx, Math.max(0, Math.min(TL.total - 0.001, t)), W, H, { subtitles: true, hud: true, grain: true })
|
| 53 |
}
|
| 54 |
|
| 55 |
+
// 音轨分轨:旁白 / 音效 / 配乐(按需加载)。由 tools/render_stems_node.mjs 用同一套合成代码生成,各选项均校准到约 −14 LUFS。
|
| 56 |
+
function getCtx() { if (!audioCtx) audioCtx = new (window.AudioContext || (window as any).webkitAudioContext)(); return audioCtx }
|
| 57 |
+
function loadStem(name: string): Promise<AudioBuffer> {
|
| 58 |
+
let p = stemCache.get(name)
|
| 59 |
+
if (!p) {
|
| 60 |
+
p = fetch(stemUrl(name)).then((r) => { if (!r.ok) throw new Error('音轨加载失败:' + name); return r.arrayBuffer() }).then((a) => getCtx().decodeAudioData(a))
|
| 61 |
+
p.catch(() => stemCache.delete(name))
|
| 62 |
+
stemCache.set(name, p)
|
| 63 |
+
}
|
| 64 |
+
return p
|
| 65 |
+
}
|
| 66 |
+
async function ensureStems(style: BgmStyle = bgm.style): Promise<StemSet> {
|
| 67 |
+
const [voice, sfx, music] = await Promise.all([loadStem('voice'), loadStem('sfx'), style === 'none' ? Promise.resolve(null) : loadStem(style)])
|
| 68 |
+
return { voice, sfx, music }
|
| 69 |
}
|
| 70 |
|
| 71 |
+
function stopAudio() { for (const n of srcNodes) { try { n.stop() } catch { } n.disconnect() } srcNodes = [] }
|
| 72 |
async function startAudio(from: number): Promise<number> {
|
| 73 |
+
const stems = await ensureStems()
|
| 74 |
+
const ctx = getCtx()
|
| 75 |
+
if (ctx.state === 'suspended') await ctx.resume()
|
| 76 |
stopAudio()
|
| 77 |
+
const when = ctx.currentTime + 0.05
|
| 78 |
+
srcNodes = buildGraph(ctx, stems, bgm, when, from)
|
|
|
|
| 79 |
return when
|
| 80 |
}
|
| 81 |
|
|
|
|
| 90 |
async function play() {
|
| 91 |
if (playing) return
|
| 92 |
const btn = $('#playBtn'); if (btn) btn.innerHTML = '⏸'
|
| 93 |
+
if (!stemCache.has('voice')) setStatus('player', '正在载入音轨…')
|
| 94 |
if (cur >= TL.total) cur = 0
|
| 95 |
const started = await startAudio(cur)
|
| 96 |
setStatus('player', '')
|
|
|
|
| 176 |
<div class="seg" id="expFps">
|
| 177 |
<button data-f="24">24 fps</button><button data-f="30">30 fps</button><button data-f="60">60 fps</button>
|
| 178 |
</div></div>
|
| 179 |
+
<div class="row"><span class="label">背景音乐</span>
|
| 180 |
+
<div class="seg" id="expBgm">${MUSIC_STYLES.map((m) => `<button data-b="${m.id}" title="${m.desc}">${m.name}</button>`).join('')}</div></div>
|
| 181 |
+
<div class="row"><span class="label">音乐音量</span>
|
| 182 |
+
<div class="seg" id="expVol">${VOLUMES.map((v) => `<button data-v="${v.id}">${v.name}</button>`).join('')}</div>
|
| 183 |
+
<span class="label" style="margin-left:8px">音效</span>
|
| 184 |
+
<div class="seg" id="expSfx"><button data-s="1">开</button><button data-s="0">关</button></div></div>
|
| 185 |
+
<div class="hint" id="bgmHint" style="margin-top:-4px"></div>
|
| 186 |
<div class="row"><span class="label">清晰度</span>
|
| 187 |
<div class="seg" id="expQ">
|
| 188 |
<button data-q="high">高清</button><button data-q="medium">流畅(更快)</button>
|
|
|
|
| 247 |
buildLive()
|
| 248 |
drawFrame(0); syncBar()
|
| 249 |
// 预解码旁白(不阻塞)
|
| 250 |
+
ensureStems().catch(() => { })
|
| 251 |
}
|
| 252 |
|
| 253 |
function sceneStart(id: string) { return TL.scenes.find((s) => s.id === id)?.start ?? 0 }
|
|
|
|
| 278 |
segPick('#expFps', (v) => ef = Number(v) as FpsOpt, '30')
|
| 279 |
segPick('#expQ', (v) => eq = v as Quality, 'high')
|
| 280 |
|
| 281 |
+
wireBgm()
|
| 282 |
const abort = { aborted: false }
|
| 283 |
$('#exportBtn').addEventListener('click', async () => {
|
| 284 |
const sup = exportSupported()
|
|
|
|
| 289 |
const bar = $('#expBar') as HTMLElement
|
| 290 |
const wasPlaying = playing; if (wasPlaying) pause()
|
| 291 |
try {
|
| 292 |
+
setStatus('export', `载入音轨并混音(配乐:${styleName(bgm.style)})…`); bar.style.width = '3%'
|
| 293 |
+
const stems = await ensureStems()
|
| 294 |
+
const mix = await renderStemsMix(stems, { ...bgm }, TL.total + 0.5, 48000)
|
| 295 |
const blob = await exportMP4({ fps: ef, orient: eo, quality: eq, mix, signal: abort, onProgress: (p, label) => { bar.style.width = (p * 100).toFixed(0) + '%'; setStatus('export', `${label} · ${(p * 100).toFixed(0)}%`) } })
|
| 296 |
const url = URL.createObjectURL(blob)
|
| 297 |
+
const a = el('a') as HTMLAnchorElement; a.href = url; a.download = `PHP2Shell_${eo === 'portrait' ? '竖屏' : '横屏'}_${ef}fps_${bgm.style === 'none' ? '无配乐' : styleName(bgm.style)}.mp4`; a.click()
|
| 298 |
setTimeout(() => URL.revokeObjectURL(url), 10000)
|
| 299 |
setStatus('export', `✅ 导出完成:${(blob.size / 1048576).toFixed(1)} MB`); toast('MP4 已开始下载')
|
| 300 |
} catch (err: any) {
|
|
|
|
| 400 |
|
| 401 |
// QA 辅助:导出前 N 秒(验证编码/封装链路)
|
| 402 |
;(window as any).__qaExport = async (seconds = 4, fps: FpsOpt = 30, orient: Orient = 'landscape') => {
|
| 403 |
+
const stems = await ensureStems()
|
| 404 |
+
const mix = await renderStemsMix(stems, { ...bgm }, seconds + 0.5, 48000)
|
| 405 |
const blob = await exportMP4({ fps, orient, quality: 'medium', mix, seconds })
|
| 406 |
const buf = new Uint8Array(await blob.arrayBuffer())
|
| 407 |
let bin = ''; for (let i = 0; i < buf.length; i += 0x8000) bin += String.fromCharCode(...buf.subarray(i, i + 0x8000))
|
| 408 |
return btoa(bin)
|
| 409 |
}
|
| 410 |
+
|
| 411 |
+
;(window as any).__qaSetBgm = (o: Partial<BgmOpts>) => { bgm = { ...bgm, ...o }; syncBgmUI() }
|
| 412 |
+
|
| 413 |
+
function styleName(id: BgmStyle) { return MUSIC_STYLES.find((m) => m.id === id)?.name ?? id }
|
| 414 |
+
function syncBgmUI() {
|
| 415 |
+
document.querySelectorAll('#expBgm button').forEach((b) => b.classList.toggle('on', (b as HTMLElement).dataset.b === bgm.style))
|
| 416 |
+
document.querySelectorAll('#expVol button').forEach((b) => { b.classList.toggle('on', (b as HTMLElement).dataset.v === bgm.volume); (b as HTMLButtonElement).disabled = bgm.style === 'none' })
|
| 417 |
+
document.querySelectorAll('#expSfx button').forEach((b) => b.classList.toggle('on', ((b as HTMLElement).dataset.s === '1') === bgm.sfx))
|
| 418 |
+
const h = document.getElementById('bgmHint')
|
| 419 |
+
if (h) h.textContent = `${MUSIC_STYLES.find((m) => m.id === bgm.style)?.desc ?? ''} · 播放器会按此设置实时试听,导出的 MP4 与试听一致。`
|
| 420 |
+
}
|
| 421 |
+
async function applyBgm(o: Partial<BgmOpts>) {
|
| 422 |
+
bgm = { ...bgm, ...o }; saveBgm(); syncBgmUI()
|
| 423 |
+
if (playing) { const started = await startAudio(cur); startWall = started; startAt = cur }
|
| 424 |
+
else ensureStems().catch(() => { })
|
| 425 |
+
toast(`配乐:${bgm.style === 'none' ? '无背景音乐' : styleName(bgm.style) + ' · 音量' + VOLUMES.find((v) => v.id === bgm.volume)!.name}${bgm.sfx ? '' : ' · 音效关'}`)
|
| 426 |
+
}
|
| 427 |
+
function wireBgm() {
|
| 428 |
+
document.querySelectorAll('#expBgm button').forEach((b) => b.addEventListener('click', () => applyBgm({ style: (b as HTMLElement).dataset.b as BgmStyle })))
|
| 429 |
+
document.querySelectorAll('#expVol button').forEach((b) => b.addEventListener('click', () => applyBgm({ volume: (b as HTMLElement).dataset.v as BgmVolume })))
|
| 430 |
+
document.querySelectorAll('#expSfx button').forEach((b) => b.addEventListener('click', () => applyBgm({ sfx: (b as HTMLElement).dataset.s === '1' })))
|
| 431 |
+
syncBgmUI()
|
| 432 |
+
}
|
php2shell/web/src/ui/style.css
CHANGED
|
@@ -86,3 +86,6 @@ h2.sec .n{width:22px;height:22px;border-radius:7px;background:var(--orange);colo
|
|
| 86 |
.toast{position:fixed;left:50%;bottom:28px;transform:translateX(-50%);background:#17233c;border:1px solid var(--cyan);color:var(--ink);padding:10px 18px;border-radius:12px;font-size:13.5px;box-shadow:var(--shadow);z-index:50;opacity:0;transition:.25s;pointer-events:none}
|
| 87 |
.toast.show{opacity:1}
|
| 88 |
.kbd{font-family:ui-monospace,monospace;font-size:11px;color:var(--faint);border:1px solid var(--line);border-radius:5px;padding:1px 5px}
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
.toast{position:fixed;left:50%;bottom:28px;transform:translateX(-50%);background:#17233c;border:1px solid var(--cyan);color:var(--ink);padding:10px 18px;border-radius:12px;font-size:13.5px;box-shadow:var(--shadow);z-index:50;opacity:0;transition:.25s;pointer-events:none}
|
| 87 |
.toast.show{opacity:1}
|
| 88 |
.kbd{font-family:ui-monospace,monospace;font-size:11px;color:var(--faint);border:1px solid var(--line);border-radius:5px;padding:1px 5px}
|
| 89 |
+
.seg{flex-wrap:wrap}
|
| 90 |
+
.seg button:disabled{opacity:.38;cursor:not-allowed}
|
| 91 |
+
.seg button + button{border-left:1px solid rgba(255,255,255,.04)}
|