Spaces:
Running
Running
php2shell: 默认背景音乐换成《千年之后(氛围版)》(延长衔接 + 旁白闪避 + 响度校准)(推送 #7)
Browse files- .gitattributes +2 -0
- php2shell/README.md +2 -1
- php2shell/dist/assets/{index-D2R5Edvl.js → index-5PV9WapG.js} +0 -0
- php2shell/dist/audio/stem_qiannian.mp3 +3 -0
- php2shell/dist/index.html +1 -1
- php2shell/studio/music/qiannian_src.mp3 +3 -0
- php2shell/studio/qa/bgm_options_loudness.json +30 -0
- php2shell/studio/qa/qa_round3_qiannian.json +147 -0
- php2shell/tools/calibrate_bgm.mjs +7 -5
- php2shell/tools/make_track_stem.mjs +80 -0
- php2shell/web/src/audio/stems.ts +2 -2
- php2shell/web/src/audio/synth.ts +3 -2
- php2shell/web/src/data/stems.json +8 -1
- php2shell/web/src/main.ts +3 -3
.gitattributes
CHANGED
|
@@ -235,3 +235,5 @@ 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
|
|
|
|
|
|
|
|
|
| 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
|
| 238 |
+
php2shell/dist/audio/stem_qiannian.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 239 |
+
php2shell/studio/music/qiannian_src.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 配对元数据),附图文标题 / 正文 / 标签 |
|
|
@@ -124,3 +124,4 @@ php2shell/
|
|
| 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。
|
|
|
|
|
|
| 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 配对元数据),附图文标题 / 正文 / 标签 |
|
|
|
|
| 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。
|
| 127 |
+
- 2026-10-22 · 用户要求“背景音乐换这个”:默认配乐改为用户提供的《千年之后(氛围版)》(源 160.1 s / 44.1 kHz 立体声 / −10 LUFS),程序合成的 3 种配乐保留为备选。`tools/make_track_stem.mjs`:①估算曲速约 56 BPM(小节 4.27 s),在“整 8 小节”约束下用频谱相似度搜索衔接点 —— 源 68.75 s 以 4 s 等功率交叉淡化接回 34.57 s(相似度 0.861;接缝频谱突变 3.35 ≈ 全曲 99 分位,电平变化 < 0.7 dB),延长到 194.3 s,原曲收尾落在片尾;衔接点正好在“清理流程→暗门二”转场 + 关门音效处;②按旁白包络闪避 −9.4 dB(与程序配乐同规则);③响度对齐后再降 2.5 dB(真实歌曲中频更密,保证旁白清晰),存为立体声分轨 `stem_qiannian.mp3`。新增 6 种组合全部校准(−13.6~−15.0 LUFS、AAC 后真峰值 ≤ −1.3 dBTP);默认选项 `vibe qa`:响度 −14.0 LUFS、真峰值 −1.5 dBTP、0 失败。页面记忆键升级为 `p2s.bgm.v2`,老访客也会默认用新配乐。署名见页脚。
|
php2shell/dist/assets/{index-D2R5Edvl.js → index-5PV9WapG.js}
RENAMED
|
The diff for this file is too large to render.
See raw diff
|
|
|
php2shell/dist/audio/stem_qiannian.mp3
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a40f944e97e813ba9e39bb5c2688c946f29a143e7bac5d05fbf322776083d533
|
| 3 |
+
size 3139244
|
php2shell/dist/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
| 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-BUFCtSWz.css">
|
| 10 |
</head>
|
| 11 |
<body>
|
|
|
|
| 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-5PV9WapG.js"></script>
|
| 9 |
<link rel="stylesheet" crossorigin href="./assets/index-BUFCtSWz.css">
|
| 10 |
</head>
|
| 11 |
<body>
|
php2shell/studio/music/qiannian_src.mp3
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:daf0a23e864a240267582a0cb3ccc9ac9092760ed4b80076fc707df170f7b568
|
| 3 |
+
size 6440066
|
php2shell/studio/qa/bgm_options_loudness.json
CHANGED
|
@@ -105,6 +105,36 @@
|
|
| 105 |
"trim": -3.8,
|
| 106 |
"I": -14.8,
|
| 107 |
"TP": -1.5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
}
|
| 109 |
}
|
| 110 |
}
|
|
|
|
| 105 |
"trim": -3.8,
|
| 106 |
"I": -14.8,
|
| 107 |
"TP": -1.5
|
| 108 |
+
},
|
| 109 |
+
"qiannian:low:1": {
|
| 110 |
+
"trim": -1.8,
|
| 111 |
+
"I": -13.6,
|
| 112 |
+
"TP": -1.6
|
| 113 |
+
},
|
| 114 |
+
"qiannian:low:0": {
|
| 115 |
+
"trim": -2.3,
|
| 116 |
+
"I": -14,
|
| 117 |
+
"TP": -1.5
|
| 118 |
+
},
|
| 119 |
+
"qiannian:std:1": {
|
| 120 |
+
"trim": -2.3,
|
| 121 |
+
"I": -14.3,
|
| 122 |
+
"TP": -1.3
|
| 123 |
+
},
|
| 124 |
+
"qiannian:std:0": {
|
| 125 |
+
"trim": -3.3,
|
| 126 |
+
"I": -15,
|
| 127 |
+
"TP": -1.6
|
| 128 |
+
},
|
| 129 |
+
"qiannian:high:1": {
|
| 130 |
+
"trim": -2.8,
|
| 131 |
+
"I": -14.5,
|
| 132 |
+
"TP": -1.6
|
| 133 |
+
},
|
| 134 |
+
"qiannian:high:0": {
|
| 135 |
+
"trim": -1.8,
|
| 136 |
+
"I": -14,
|
| 137 |
+
"TP": -1.6
|
| 138 |
}
|
| 139 |
}
|
| 140 |
}
|
php2shell/studio/qa/qa_round3_qiannian.json
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"video": "/workspaces/hf-tz/php2shell/render/out/final.mp4",
|
| 3 |
+
"meta": {
|
| 4 |
+
"w": 960,
|
| 5 |
+
"h": 540,
|
| 6 |
+
"fps": 30.0,
|
| 7 |
+
"dur": 195.133333,
|
| 8 |
+
"audio": true
|
| 9 |
+
},
|
| 10 |
+
"results": [
|
| 11 |
+
{
|
| 12 |
+
"level": "WARN",
|
| 13 |
+
"check": "分辨率",
|
| 14 |
+
"msg": "960×540(时间轴 1920×1080)"
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
"level": "PASS",
|
| 18 |
+
"check": "帧率",
|
| 19 |
+
"msg": "30.0 fps"
|
| 20 |
+
},
|
| 21 |
+
{
|
| 22 |
+
"level": "PASS",
|
| 23 |
+
"check": "时长",
|
| 24 |
+
"msg": "195.13s(时间轴 195.13s)"
|
| 25 |
+
},
|
| 26 |
+
{
|
| 27 |
+
"level": "PASS",
|
| 28 |
+
"check": "音轨",
|
| 29 |
+
"msg": "有"
|
| 30 |
+
},
|
| 31 |
+
{
|
| 32 |
+
"level": "PASS",
|
| 33 |
+
"check": "响度",
|
| 34 |
+
"msg": "-14.0 LUFS(目标 −14)"
|
| 35 |
+
},
|
| 36 |
+
{
|
| 37 |
+
"level": "PASS",
|
| 38 |
+
"check": "真峰值",
|
| 39 |
+
"msg": "-1.5 dBTP(应 ≤ −1)"
|
| 40 |
+
},
|
| 41 |
+
{
|
| 42 |
+
"level": "PASS",
|
| 43 |
+
"check": "黑场",
|
| 44 |
+
"msg": "无"
|
| 45 |
+
},
|
| 46 |
+
{
|
| 47 |
+
"level": "PASS",
|
| 48 |
+
"check": "冻结画面",
|
| 49 |
+
"msg": "无"
|
| 50 |
+
},
|
| 51 |
+
{
|
| 52 |
+
"level": "PASS",
|
| 53 |
+
"check": "文字@hook",
|
| 54 |
+
"msg": "OCR 读出 25 字;字幕命中 83%"
|
| 55 |
+
},
|
| 56 |
+
{
|
| 57 |
+
"level": "PASS",
|
| 58 |
+
"check": "文字@title",
|
| 59 |
+
"msg": "OCR 读出 107 字;字幕命中 100%"
|
| 60 |
+
},
|
| 61 |
+
{
|
| 62 |
+
"level": "PASS",
|
| 63 |
+
"check": "文字@kitchen",
|
| 64 |
+
"msg": "OCR 读出 78 字;字幕命中 100%"
|
| 65 |
+
},
|
| 66 |
+
{
|
| 67 |
+
"level": "PASS",
|
| 68 |
+
"check": "文字@street",
|
| 69 |
+
"msg": "OCR 读出 86 字;字幕命中 100%"
|
| 70 |
+
},
|
| 71 |
+
{
|
| 72 |
+
"level": "PASS",
|
| 73 |
+
"check": "文字@door1",
|
| 74 |
+
"msg": "OCR 读出 55 字;字幕命中 100%"
|
| 75 |
+
},
|
| 76 |
+
{
|
| 77 |
+
"level": "PASS",
|
| 78 |
+
"check": "文字@oom",
|
| 79 |
+
"msg": "OCR 读出 93 字;字幕命中 100%"
|
| 80 |
+
},
|
| 81 |
+
{
|
| 82 |
+
"level": "PASS",
|
| 83 |
+
"check": "文字@cleanup",
|
| 84 |
+
"msg": "OCR 读出 59 字;字幕命中 100%"
|
| 85 |
+
},
|
| 86 |
+
{
|
| 87 |
+
"level": "PASS",
|
| 88 |
+
"check": "文字@door2",
|
| 89 |
+
"msg": "OCR 读出 75 字;字幕命中 100%"
|
| 90 |
+
},
|
| 91 |
+
{
|
| 92 |
+
"level": "PASS",
|
| 93 |
+
"check": "文字@key",
|
| 94 |
+
"msg": "OCR 读出 39 字;字幕命中 100%"
|
| 95 |
+
},
|
| 96 |
+
{
|
| 97 |
+
"level": "PASS",
|
| 98 |
+
"check": "文字@stale",
|
| 99 |
+
"msg": "OCR 读出 62 字;字幕命中 100%"
|
| 100 |
+
},
|
| 101 |
+
{
|
| 102 |
+
"level": "PASS",
|
| 103 |
+
"check": "文字@nologin",
|
| 104 |
+
"msg": "OCR 读出 75 字;字幕命中 100%"
|
| 105 |
+
},
|
| 106 |
+
{
|
| 107 |
+
"level": "PASS",
|
| 108 |
+
"check": "文字@scale",
|
| 109 |
+
"msg": "OCR 读出 75 字;字幕命中 100%"
|
| 110 |
+
},
|
| 111 |
+
{
|
| 112 |
+
"level": "PASS",
|
| 113 |
+
"check": "文字@funnel",
|
| 114 |
+
"msg": "OCR 读出 91 字;字幕命中 100%"
|
| 115 |
+
},
|
| 116 |
+
{
|
| 117 |
+
"level": "WARN",
|
| 118 |
+
"check": "文字@timeline",
|
| 119 |
+
"msg": "OCR 读出 82 字;字幕命中 0%(字太小、对比度不足或被遮挡?)"
|
| 120 |
+
},
|
| 121 |
+
{
|
| 122 |
+
"level": "PASS",
|
| 123 |
+
"check": "文字@response",
|
| 124 |
+
"msg": "OCR 读出 91 字;字幕命中 100%"
|
| 125 |
+
},
|
| 126 |
+
{
|
| 127 |
+
"level": "PASS",
|
| 128 |
+
"check": "文字@fix1",
|
| 129 |
+
"msg": "OCR 读出 100 字;字幕命中 100%"
|
| 130 |
+
},
|
| 131 |
+
{
|
| 132 |
+
"level": "PASS",
|
| 133 |
+
"check": "文字@fix2",
|
| 134 |
+
"msg": "OCR 读出 100 字;字幕命中 100%"
|
| 135 |
+
},
|
| 136 |
+
{
|
| 137 |
+
"level": "PASS",
|
| 138 |
+
"check": "文字@outro",
|
| 139 |
+
"msg": "OCR 读出 109 字;字幕命中 100%"
|
| 140 |
+
},
|
| 141 |
+
{
|
| 142 |
+
"level": "INFO",
|
| 143 |
+
"check": "接触表",
|
| 144 |
+
"msg": "/workspaces/hf-tz/php2shell/render/out/qa_sheet.jpg"
|
| 145 |
+
}
|
| 146 |
+
]
|
| 147 |
+
}
|
php2shell/tools/calibrate_bgm.mjs
CHANGED
|
@@ -24,13 +24,15 @@ function measure(b) {
|
|
| 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 = {
|
| 32 |
-
const
|
| 33 |
-
|
|
|
|
| 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
|
|
|
|
| 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 = { qiannian: meta.trims.qiannian ?? -1.8, 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 ONLY = process.argv.slice(2) // 可只校准指定配乐,如:node calibrate_bgm.mjs qiannian
|
| 29 |
const combos = []
|
| 30 |
+
for (const style of ['qiannian', 'brief', 'ambient', 'pulse']) for (const volume of ['low', 'std', 'high']) for (const sfx of [true, false]) combos.push({ style, volume, sfx })
|
| 31 |
for (const sfx of [true, false]) combos.push({ style: 'none', volume: 'std', sfx })
|
| 32 |
+
const trims = { ...meta.trims, qiannian: styleTrim.qiannian }
|
| 33 |
+
const prev = (() => { try { return JSON.parse(readFileSync(join(ROOT, 'studio/qa/bgm_options_loudness.json'), 'utf8')).report || {} } catch { return {} } })()
|
| 34 |
+
const report = { ...prev }
|
| 35 |
+
for (const o of combos.filter((c) => !ONLY.length || ONLY.includes(c.style))) {
|
| 36 |
if (o.style !== 'none' && !mus[o.style]) mus[o.style] = dec(join(AUD, `stem_${o.style}.mp3`))
|
| 37 |
const set = { ...base, music: o.style === 'none' ? null : mus[o.style] }
|
| 38 |
let trim = styleTrim[o.style], r
|
php2shell/tools/make_track_stem.mjs
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env node
|
| 2 |
+
// 把用户提供的配乐做成分轨 stem_qiannian.mp3:
|
| 3 |
+
// 1) 延长:在源 T1 秒处用 4 秒等功率交叉淡化接回源 X 秒(相差整 8 小节,曲速约 56 BPM),曲子自然收尾落在片尾;
|
| 4 |
+
// 2) 闪避:按旁白 RMS 包络压低(与程序配乐同一规则:0.5 → 0.17,约 −9.4 dB);
|
| 5 |
+
// 3) 响度:与默认程序配乐分轨对齐,再 ×SCALE 存储(立体声 128k)。
|
| 6 |
+
import { writeFileSync, mkdirSync, readFileSync } from 'node:fs'
|
| 7 |
+
import { join, dirname, resolve } from 'node:path'
|
| 8 |
+
import { fileURLToPath } from 'node:url'
|
| 9 |
+
import { spawnSync } from 'node:child_process'
|
| 10 |
+
|
| 11 |
+
const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..')
|
| 12 |
+
const SRC = join(ROOT, 'studio/music/qiannian_src.mp3')
|
| 13 |
+
const OUT = join(ROOT, 'web/public/audio/stem_qiannian.mp3')
|
| 14 |
+
const TMP = join(ROOT, 'tools/.stems'); mkdirSync(TMP, { recursive: true })
|
| 15 |
+
const SR = 48000, SCALE = 0.5
|
| 16 |
+
const T1 = 68.75, X = 34.574, XF = 4.0 // 衔接点(tools 里频谱相似度搜索得出,sim 0.861)
|
| 17 |
+
const TL = JSON.parse(readFileSync(join(ROOT, 'web/src/data/timeline.json'), 'utf8'))
|
| 18 |
+
const TOTAL = TL.total + 1
|
| 19 |
+
|
| 20 |
+
const dec = (f, ch) => { const r = spawnSync('ffmpeg', ['-loglevel', 'error', '-i', f, '-ac', String(ch), '-ar', String(SR), '-f', 'f32le', '-'], { maxBuffer: 1 << 30 }); if (r.status) throw new Error(r.stderr + ''); return new Float32Array(r.stdout.buffer.slice(r.stdout.byteOffset, r.stdout.byteOffset + r.stdout.length)) }
|
| 21 |
+
const src = dec(SRC, 2), n = src.length / 2
|
| 22 |
+
const L = new Float32Array(n), R = new Float32Array(n)
|
| 23 |
+
for (let i = 0; i < n; i++) { L[i] = src[2 * i]; R[i] = src[2 * i + 1] }
|
| 24 |
+
|
| 25 |
+
// 1) 延长
|
| 26 |
+
const N = Math.ceil(TOTAL * SR)
|
| 27 |
+
const oL = new Float32Array(N), oR = new Float32Array(N)
|
| 28 |
+
const t1 = Math.round(T1 * SR), x0 = Math.round(X * SR), xf = Math.round(XF * SR)
|
| 29 |
+
let o = 0
|
| 30 |
+
for (let i = 0; i < t1 && o < N; i++, o++) { oL[o] = L[i]; oR[o] = R[i] }
|
| 31 |
+
for (let i = 0; i < xf && o < N; i++, o++) {
|
| 32 |
+
const u = i / xf, a = Math.cos(u * Math.PI / 2), b = Math.sin(u * Math.PI / 2)
|
| 33 |
+
oL[o] = L[t1 + i] * a + L[x0 + i] * b; oR[o] = R[t1 + i] * a + R[x0 + i] * b
|
| 34 |
+
}
|
| 35 |
+
for (let i = x0 + xf; i < n && o < N; i++, o++) { oL[o] = L[i]; oR[o] = R[i] }
|
| 36 |
+
const musicEnd = o / SR
|
| 37 |
+
// 开头 0.3 秒淡入防咔哒;若曲子比片长,结尾 2.5 秒淡出
|
| 38 |
+
const fin = Math.round(0.3 * SR); for (let i = 0; i < fin; i++) { oL[i] *= i / fin; oR[i] *= i / fin }
|
| 39 |
+
if (musicEnd > TL.total) { const e = Math.round(TL.total * SR), f0 = e - Math.round(2.5 * SR); for (let i = f0; i < N; i++) { const g = i >= e ? 0 : 1 - (i - f0) / (e - f0); oL[i] *= g; oR[i] *= g } }
|
| 40 |
+
|
| 41 |
+
// 2) 闪避(与 synth.duck 相同:50ms 窗 RMS>0.012 → 目标 0.17,否则 0.5;每 50ms 平滑 0.35,线性插值)
|
| 42 |
+
const voice = dec(join(ROOT, 'studio/audio/voice.wav'), 1)
|
| 43 |
+
const step = 0.05, win = Math.floor(SR * 0.05), base = 0.5, ducked = 0.17
|
| 44 |
+
const pts = [[0, 1]]; let cur = base
|
| 45 |
+
for (let t = 0; t < TOTAL; t += step) {
|
| 46 |
+
let s = 0, c = 0; const i0 = Math.floor(t * SR)
|
| 47 |
+
for (let i = i0; i < i0 + win && i < voice.length; i++) { s += voice[i] * voice[i]; c++ }
|
| 48 |
+
const rms = c ? Math.sqrt(s / c) : 0
|
| 49 |
+
cur = cur + ((rms > 0.012 ? ducked : base) - cur) * 0.35
|
| 50 |
+
pts.push([t + step, cur / base])
|
| 51 |
+
}
|
| 52 |
+
let k = 0
|
| 53 |
+
for (let i = 0; i < N; i++) {
|
| 54 |
+
const t = i / SR
|
| 55 |
+
while (k < pts.length - 2 && pts[k + 1][0] < t) k++
|
| 56 |
+
const [ta, ga] = pts[k], [tb, gb] = pts[k + 1]
|
| 57 |
+
const g = tb > ta ? ga + (gb - ga) * Math.min(1, Math.max(0, (t - ta) / (tb - ta))) : ga
|
| 58 |
+
oL[i] *= g; oR[i] *= g
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
// 3) 响度对齐默认程序配乐分轨
|
| 62 |
+
function writeWav(path, chans) {
|
| 63 |
+
const n = chans[0].length, ch = chans.length, bytes = 44 + n * ch * 2, b = Buffer.alloc(bytes)
|
| 64 |
+
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)
|
| 65 |
+
let p = 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, p); p += 2 }
|
| 66 |
+
writeFileSync(path, b)
|
| 67 |
+
}
|
| 68 |
+
const lufs = (f) => { const e = spawnSync('ffmpeg', ['-nostats', '-i', f, '-filter_complex', 'ebur128=peak=true', '-f', 'null', '-'], { encoding: 'utf8' }).stderr; return { I: +[...e.matchAll(/I:\s+(-?[\d.]+) LUFS/g)].pop()[1], P: +[...e.matchAll(/Peak:\s+(-?[\d.]+) dBFS/g)].pop()[1] } }
|
| 69 |
+
const ref = lufs(join(ROOT, 'web/public/audio/stem_brief.mp3')).I
|
| 70 |
+
const probe = join(TMP, 'qn_probe.wav'); writeWav(probe, [oL.map((v) => v * SCALE), oR.map((v) => v * SCALE)])
|
| 71 |
+
const cur0 = lufs(probe).I
|
| 72 |
+
const EXTRA_DB = -2.5 // 真实歌曲中频更密,比程序配乐再低 2.5 dB,保证旁白清晰
|
| 73 |
+
const g = Math.pow(10, (ref - cur0 + EXTRA_DB) / 20) * SCALE
|
| 74 |
+
const fL = oL.map((v) => v * g), fR = oR.map((v) => v * g)
|
| 75 |
+
const wav = join(TMP, 'qiannian.wav'); writeWav(wav, [fL, fR])
|
| 76 |
+
spawnSync('ffmpeg', ['-loglevel', 'error', '-y', '-i', wav, '-c:a', 'libmp3lame', '-b:a', '128k', '-ar', String(SR), OUT])
|
| 77 |
+
const fin2 = lufs(OUT)
|
| 78 |
+
console.log(`源 ${(n / SR).toFixed(2)}s → 延长后 ${musicEnd.toFixed(2)}s(片长 ${TL.total.toFixed(2)}s);衔接 ${T1}s→${X}s,交叉淡化 ${XF}s`)
|
| 79 |
+
console.log(`响度对齐:参考 ${ref} LUFS,处理前 ${cur0} → 分轨 ${fin2.I} LUFS,峰值 ${fin2.P} dBFS`)
|
| 80 |
+
console.log('→', OUT)
|
php2shell/web/src/audio/stems.ts
CHANGED
|
@@ -3,10 +3,10 @@
|
|
| 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: '
|
| 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 },
|
|
|
|
| 3 |
import { masterChain, MusicStyle } from './synth'
|
| 4 |
import STEMS_META from '../data/stems.json'
|
| 5 |
|
| 6 |
+
export type BgmStyle = MusicStyle | 'qiannian' | '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: 'qiannian', 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 },
|
php2shell/web/src/audio/synth.ts
CHANGED
|
@@ -134,8 +134,9 @@ function musicBrief(ctx: BaseAudioContext, dest: AudioNode, map: Mapper) {
|
|
| 134 |
|
| 135 |
|
| 136 |
export type MusicStyle = 'brief' | 'ambient' | 'pulse'
|
| 137 |
-
export const MUSIC_STYLES: { id: MusicStyle | 'none'; name: string; desc: string }[] = [
|
| 138 |
-
{ id: '
|
|
|
|
| 139 |
{ id: 'ambient', name: '深夜氛围', desc: '柔和长音,无鼓点,更安静' },
|
| 140 |
{ id: 'pulse', name: '电子脉冲', desc: '底鼓 + 锯齿低音,节奏更强' },
|
| 141 |
{ id: 'none', name: '无背景音乐', desc: '只保留旁白(与音效)' },
|
|
|
|
| 134 |
|
| 135 |
|
| 136 |
export type MusicStyle = 'brief' | 'ambient' | 'pulse'
|
| 137 |
+
export const MUSIC_STYLES: { id: MusicStyle | 'qiannian' | 'none'; name: string; desc: string }[] = [
|
| 138 |
+
{ id: 'qiannian', name: '千年之后', desc: '默认:《千年之后(氛围版)》· 已延长至全片并随旁白自动压低' },
|
| 139 |
+
{ id: 'brief', name: '应急简报', desc: '程序合成:和弦铺底 + 琶音 + 轻打击' },
|
| 140 |
{ id: 'ambient', name: '深夜氛围', desc: '柔和长音,无鼓点,更安静' },
|
| 141 |
{ id: 'pulse', name: '电子脉冲', desc: '底鼓 + 锯齿低音,节奏更强' },
|
| 142 |
{ id: 'none', name: '无背景音乐', desc: '只保留旁白(与音效)' },
|
php2shell/web/src/data/stems.json
CHANGED
|
@@ -25,6 +25,13 @@
|
|
| 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 |
}
|
|
|
|
| 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 |
+
"qiannian": -1.8,
|
| 30 |
+
"qiannian:low:1": -1.8,
|
| 31 |
+
"qiannian:low:0": -2.3,
|
| 32 |
+
"qiannian:std:1": -2.3,
|
| 33 |
+
"qiannian:std:0": -3.3,
|
| 34 |
+
"qiannian:high:1": -2.8,
|
| 35 |
+
"qiannian:high:0": -1.8
|
| 36 |
}
|
| 37 |
}
|
php2shell/web/src/main.ts
CHANGED
|
@@ -38,8 +38,8 @@ 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
|
|
@@ -236,7 +236,7 @@ function build() {
|
|
| 236 |
foot.innerHTML = `
|
| 237 |
<div><b>资料来源</b>:PHP 官方安全公告(php.net, 2026-10-21)· GHSA-w8hw-w9fx-j79w / GHSA-6wmf-4rv5-p3rp · W3Techs 服务器端语言统计 · Help Net Security / JFrog / watchTowr / BleepingComputer。</div>
|
| 238 |
<div style="margin-top:6px">本片为科普示意,画面中的"厨房/钥匙/发动机"均为比喻,不展示任何真实攻击代码。信息截至 2026-10-21,请以官方公告为准;不构成安全或投资建议。</div>
|
| 239 |
-
<div style="margin-top:6px">用代码渲染 · 旁白 edge-tts · 配乐与音效程序合成 · 画面
|
| 240 |
wrap.appendChild(foot)
|
| 241 |
|
| 242 |
app.appendChild(wrap)
|
|
|
|
| 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.v2') || '{}') } } catch { return { ...DEFAULT_BGM } } })()
|
| 42 |
+
const saveBgm = () => { try { localStorage.setItem('p2s.bgm.v2', JSON.stringify(bgm)) } catch { } }
|
| 43 |
const stemCache = new Map<string, Promise<AudioBuffer>>()
|
| 44 |
|
| 45 |
const canvas = el('canvas') as HTMLCanvasElement
|
|
|
|
| 236 |
foot.innerHTML = `
|
| 237 |
<div><b>资料来源</b>:PHP 官方安全公告(php.net, 2026-10-21)· GHSA-w8hw-w9fx-j79w / GHSA-6wmf-4rv5-p3rp · W3Techs 服务器端语言统计 · Help Net Security / JFrog / watchTowr / BleepingComputer。</div>
|
| 238 |
<div style="margin-top:6px">本片为科普示意,画面中的"厨房/钥匙/发动机"均为比喻,不展示任何真实攻击代码。信息截至 2026-10-21,请以官方公告为准;不构成安全或投资建议。</div>
|
| 239 |
+
<div style="margin-top:6px">用代码渲染 · 旁白 edge-tts · 默认配乐《千年之后(氛围版)》(用户提供)· 备选配乐与音效为程序合成 · 画面与文案为本项目原创。</div>`
|
| 240 |
wrap.appendChild(foot)
|
| 241 |
|
| 242 |
app.appendChild(wrap)
|