@dsh-gis/dsh-video-studio-skill 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +49 -0
- package/README.md +84 -108
- package/THIRD_PARTY_NOTICES.md +2 -2
- package/package.json +1 -1
- package/schemas/design.schema.json +5 -5
- package/schemas/film.schema.json +31 -31
- package/skills/video-studio/SKILL.md +168 -268
- package/skills/video-studio/assets/film.json +2 -3
- package/skills/video-studio/assets/golden_frames.json +11 -11
- package/skills/video-studio/assets/scenes.py +92 -49
- package/skills/video-studio/references/{style-packs.md → appearance.md} +17 -15
- package/skills/video-studio/references/audio-variation.md +73 -96
- package/skills/video-studio/references/audio.md +40 -44
- package/skills/video-studio/references/change-impact.md +2 -2
- package/skills/video-studio/references/{v08-quality.md → delivery-gates.md} +9 -11
- package/skills/video-studio/references/frame-qa.md +47 -15
- package/skills/video-studio/references/pipeline.md +4 -4
- package/skills/video-studio/references/pitfalls.md +22 -3
- package/skills/video-studio/references/proposal.md +19 -36
- package/skills/video-studio/references/quality-gates.md +11 -11
- package/skills/video-studio/references/scene-authoring.md +2 -2
- package/skills/video-studio/references/scene-grammar.md +17 -24
- package/skills/video-studio/references/sfx-design.md +7 -5
- package/skills/video-studio/references/web-engine.md +7 -7
- package/skills/video-studio/references/word-timeline.md +7 -7
- package/skills/video-studio/requirements.txt +9 -13
- package/skills/video-studio/scripts/designkit.py +84 -89
- package/skills/video-studio/scripts/filmcheck.py +19 -19
- package/skills/video-studio/scripts/filmkit.py +2949 -2948
- package/skills/video-studio/scripts/gates.py +4 -4
- package/skills/video-studio/scripts/grammar.py +10 -10
- package/skills/video-studio/scripts/musicgen.py +3 -4
- package/skills/video-studio/scripts/preflight.py +5 -5
- package/skills/video-studio/scripts/previewkit.py +11 -12
- package/skills/video-studio/scripts/propose.py +11 -11
- package/skills/video-studio/scripts/qa_frames.py +34 -35
- package/skills/video-studio/scripts/qaasr.py +26 -7
- package/skills/video-studio/scripts/qavmaf.py +19 -19
- package/skills/video-studio/scripts/render.py +137 -141
- package/skills/video-studio/scripts/scorekit.py +21 -23
- package/skills/video-studio/scripts/selfcheck.py +208 -135
- package/skills/video-studio/scripts/sfxkit.py +27 -26
- package/skills/video-studio/scripts/stagewatch.py +4 -4
- package/skills/video-studio/scripts/stylekit.py +77 -282
- package/skills/video-studio/scripts/voicekit.py +43 -44
- package/skills/video-studio/scripts/webengine.py +62 -64
- package/tools/audio_similarity.py +12 -12
- package/tools/ci_check.py +16 -16
- package/tools/estimate.py +24 -25
- package/tools/golden_frames.py +17 -18
- package/tools/silhouette_qa.py +13 -14
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
|
-
"""scorekit.py —
|
|
2
|
+
"""scorekit.py — 程序化配乐。
|
|
3
3
|
|
|
4
4
|
用代码写一张能贯穿整部片子的配乐:调性/和弦表、段落能量、节拍网格、律动层、
|
|
5
5
|
段落过门、自动电平与"吸气",全部由 numpy + sfxkit 现场合成,不用任何采样。
|
|
@@ -22,18 +22,16 @@
|
|
|
22
22
|
render(duration, bpm=120, key="Dm", anchors=None, sections=None, seed=7) -> (samples, report)
|
|
23
23
|
save(path, x, sr=SR) / load(path, sr=SR) / selftest()
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
指纹结构变奏那一整套)。本技能不再提供任何"配乐模板":需要现场编排的配乐请用
|
|
28
|
-
musicgen.py(参数化编排器),本模块只保留**技术原语**——
|
|
25
|
+
零模板:本模块不提供曲风表,只提供**技术原语**——配乐的调式/调性/BPM/情绪/编曲请用
|
|
26
|
+
musicgen.py(参数化编排器)现场编排:
|
|
29
27
|
* Score:和声表 / 段落能量 / 节拍网格 / 律动层 / 过门 / 吸气 / 自动电平;
|
|
30
28
|
* _Bus / _Bank:总线、混音、六类合成音色、乒乓延迟、侧链;
|
|
31
29
|
* _k_weighted_mono / _approx_lufs / _short_term_db:响度与频谱测量;
|
|
32
30
|
* save / load:24-bit PCM WAV 读写(NaN/Inf 拒绝写盘);
|
|
33
|
-
* render(duration, bpm, key, anchors, sections, seed)
|
|
31
|
+
* render(duration, bpm, key, anchors, sections, seed):确定性配乐路径,
|
|
34
32
|
逐样本可复现(自测第 18 条守着)。
|
|
35
|
-
render() 仍接受 style/mood/fingerprint/music_plan/pace
|
|
36
|
-
|
|
33
|
+
render() 仍接受 style/mood/fingerprint/music_plan/pace 这几个参数,只是为了
|
|
34
|
+
让既有调用方不因 TypeError 静默崩掉;非 legacy 的 style 一律明确报错并指向 musicgen.py。
|
|
37
35
|
"""
|
|
38
36
|
from __future__ import annotations
|
|
39
37
|
|
|
@@ -51,7 +49,7 @@ import numpy as np
|
|
|
51
49
|
|
|
52
50
|
import sfxkit as S # 唯一音频依赖:numpy + sfxkit
|
|
53
51
|
|
|
54
|
-
__version__ = "0.
|
|
52
|
+
__version__ = "1.0.4"
|
|
55
53
|
|
|
56
54
|
SR = 48000 # 采样率(与 filmkit / sfxkit 一致)
|
|
57
55
|
BEATS_PER_BAR = 4 # 4/4
|
|
@@ -115,7 +113,7 @@ _DEGREE_TABLE = (
|
|
|
115
113
|
("VII", 10, (0, 4, 7, 12), ""),
|
|
116
114
|
("I", 0, (0, 4, 7, 12), ""), # 结尾大三和弦(皮卡迪三度)
|
|
117
115
|
("sus2", 0, (0, 2, 7, 12), "sus2"), # 悬留色彩,过门/段首可用
|
|
118
|
-
# ----
|
|
116
|
+
# ---- 大调级数与七和弦色彩。只允许在表尾追加;前 10 项顺序不许动(_build_key 依赖) ----
|
|
119
117
|
("ii", 2, (0, 3, 7, 12), "m"),
|
|
120
118
|
("iii", 4, (0, 3, 7, 12), "m"),
|
|
121
119
|
("IV", 5, (0, 4, 7, 12), ""),
|
|
@@ -129,7 +127,7 @@ _DEGREE_TABLE = (
|
|
|
129
127
|
("V7", 7, (0, 4, 7, 10), "7"),
|
|
130
128
|
("vi7", 9, (0, 3, 7, 10), "m7"),
|
|
131
129
|
("i7", 0, (0, 3, 7, 10), "m7"),
|
|
132
|
-
# ----
|
|
130
|
+
# ---- 和弦替换用的七和弦色彩。同根音、同三音,只把五度后的音换成小七度;
|
|
133
131
|
# 只允许在表尾追加(前 10 项顺序被 _build_key / 老报告依赖),供 _CHORD_SWAPS 使用。 ----
|
|
134
132
|
("VI7", 8, (0, 4, 7, 10), "7"),
|
|
135
133
|
("III7", 3, (0, 4, 7, 10), "7"),
|
|
@@ -240,14 +238,14 @@ KEYS = {
|
|
|
240
238
|
"Em": _build_key("E", 4, "sharp", "E 小调"),
|
|
241
239
|
}
|
|
242
240
|
|
|
243
|
-
#
|
|
241
|
+
# 大调三档和声进行。小调那边 PROGRESSIONS 保持原样:legacy 路径只读 PROGRESSIONS。
|
|
244
242
|
PROGRESSIONS_MAJOR = {
|
|
245
243
|
"calm": ("I", "vi", "IV", "V"),
|
|
246
244
|
"body": ("I", "V", "vi", "IV"),
|
|
247
245
|
"drive": ("I", "IV", "V", "I"),
|
|
248
246
|
}
|
|
249
247
|
|
|
250
|
-
#
|
|
248
|
+
# 6 个大调(与 stylekit.MAJOR_KEYS 同名同义)。用同一个 _build_key 构建,
|
|
251
249
|
# 语义与小调键完全一致(级数表 -> 和弦名/低音/音名);只是 progression 换成大调级数。
|
|
252
250
|
# 写法按惯例挑:C/F/Bb 用降号、G/D/A 用升号。
|
|
253
251
|
KEYS_MAJOR = {
|
|
@@ -262,7 +260,7 @@ for _kname in KEYS_MAJOR:
|
|
|
262
260
|
KEYS_MAJOR[_kname]["progression"] = dict(PROGRESSIONS_MAJOR)
|
|
263
261
|
del _kname
|
|
264
262
|
|
|
265
|
-
# 全部可用调:4 个小调 + 6 个大调。KEYS 本身保持
|
|
263
|
+
# 全部可用调:4 个小调 + 6 个大调。KEYS 本身保持 4 个小调不变(兼容性锚点)。
|
|
266
264
|
KEYS_ALL = dict(KEYS)
|
|
267
265
|
KEYS_ALL.update(KEYS_MAJOR)
|
|
268
266
|
|
|
@@ -1541,21 +1539,21 @@ def render(duration, bpm: float = 120.0, key: str = "Dm", anchors=None, sections
|
|
|
1541
1539
|
anchors:timeline.json 的 [{id,kind,start,end}](自动按 kind 映射能量分段);
|
|
1542
1540
|
sections:显式段落(绝对时间或 at 引用),在 anchors 之后追加/覆盖空隙。
|
|
1543
1541
|
|
|
1544
|
-
|
|
1545
|
-
其它风格 id 一律抛 ValueError 并指向 musicgen.py ——
|
|
1546
|
-
mood / fingerprint / music_plan / pace 是为了签名兼容而保留的**废参数**:
|
|
1547
|
-
|
|
1542
|
+
没有配乐风格层。style 只接受 None / "" / "legacy"(都走本模块的确定性路径);
|
|
1543
|
+
其它风格 id 一律抛 ValueError 并指向 musicgen.py —— 本仓库不提供配乐模板。
|
|
1544
|
+
mood / fingerprint / music_plan / pace 是为了签名兼容而保留的**废参数**:
|
|
1545
|
+
它们只影响风格层,风格层不存在就一律忽略(不要靠它们调音色,那是模板思维)。
|
|
1548
1546
|
"""
|
|
1549
1547
|
sid = "" if style is None else str(style).strip().lower()
|
|
1550
1548
|
if sid not in ("", "legacy"):
|
|
1551
1549
|
raise ValueError(
|
|
1552
|
-
"scorekit
|
|
1550
|
+
"scorekit 的配乐风格层已删除(零模板):style=%r 不再可用。\n"
|
|
1553
1551
|
" 需要现场编排的配乐请用 musicgen.py:\n"
|
|
1554
1552
|
" import musicgen as MG\n"
|
|
1555
1553
|
" samples, report = MG.render(dur, bpm=110, key=%r, scale=\"minor\",\n"
|
|
1556
1554
|
" mood=%r, seed=7)\n"
|
|
1557
1555
|
" (成片链路见 render.py 的 _score_with_musicgen)" % (style, key, mood))
|
|
1558
|
-
# ----
|
|
1556
|
+
# ---- legacy 逐样本兼容是硬契约:这段代码别改任何东西 ----
|
|
1559
1557
|
sc = Score(duration, bpm=bpm, key=key, seed=seed)
|
|
1560
1558
|
for s in _merge_sections(anchors, sections, float(duration)):
|
|
1561
1559
|
sc.section(s["name"], s["start"], s["end"], s["energy"])
|
|
@@ -1870,7 +1868,7 @@ def selftest() -> int:
|
|
|
1870
1868
|
check("16. 集成形态:anchors+sections 同起点覆盖 / 无 end 自动补到片尾", ok_it,
|
|
1871
1869
|
" | ".join(f"{b['name']}:{b['start']}-{b['end']}:e{b['energy']}" for b in merged))
|
|
1872
1870
|
|
|
1873
|
-
# 17)
|
|
1871
|
+
# 17) 大调 & 七和弦表(KEYS 仍是 4 个小调)
|
|
1874
1872
|
bad_major = []
|
|
1875
1873
|
for kname, kv in KEYS_MAJOR.items():
|
|
1876
1874
|
for deg in ("I", "ii", "iii", "IV", "V", "vi", "vii", "sus4",
|
|
@@ -1887,7 +1885,7 @@ def selftest() -> int:
|
|
|
1887
1885
|
"; ".join(bad_major[:3]) if bad_major
|
|
1888
1886
|
else f"{len(KEYS_ALL)} 个调,{len(KEYS_ALL['C']['chords'])} 个级数/调")
|
|
1889
1887
|
|
|
1890
|
-
# 18)
|
|
1888
|
+
# 18) legacy 兼容:style=None / "legacy" / 任意 mood 都走同一条确定性路径,逐样本一致
|
|
1891
1889
|
xn, rn = render(6.0, bpm=120, key="Dm", seed=7)
|
|
1892
1890
|
xl, rl = render(6.0, bpm=120, key="Dm", seed=7, style="legacy")
|
|
1893
1891
|
xm, _rm = render(6.0, bpm=120, key="Dm", seed=7, style=None, mood="driving",
|
|
@@ -2005,7 +2003,7 @@ def main(argv=None) -> int:
|
|
|
2005
2003
|
sucks = _parse_suck_list(args.suck)
|
|
2006
2004
|
|
|
2007
2005
|
t0 = time.perf_counter()
|
|
2008
|
-
# legacy
|
|
2006
|
+
# legacy:与确定性路径完全同一段代码(逐字节兼容是硬契约)
|
|
2009
2007
|
if anchors or sections:
|
|
2010
2008
|
merged = _merge_sections(anchors, sections, float(args.duration))
|
|
2011
2009
|
else:
|