v1.3.0 — My Presets
让 demo 变成"真正可用的工具"——调好的角色现在可以一键存档、导出、导入、跨设备复用。
Turning the demo into something you can actually keep — your tuned voices now save, export, import, and travel between devices.
✨ 新功能 / What's new
「我的角色」自定义保存库 / My Presets library
在高级面板调好参数后,点 preset 区顶部的 「保存为角色」,输入名字即可。新角色会接在官方 9 个 preset 之后,带星形角标 + 暖纸底色区分。
Tune any voice in the Advanced panel, click the new Save as Preset button at the top of the preset row, name it, done. Custom cards sit alongside the official nine with a star badge and a warm-paper tint.
- localStorage 持久化,下次打开还在
- 重新选中 = 完整恢复参数(同 seed 同输出)
- 鼠标悬停在自定义卡上 → 右上角浮现 ⤓ 导出 + × 删除两个圆形按钮
- 卡片角色脸沿用 basedOn preset 的 SVG 形象
localStorage-persisted, hover for ⤓ + × actions, faces inherited from the source preset.
配置文件导入 / 导出 / Config import & export
任意 preset(官方 + 自定义)都能导出成便携 JSON:mumble-voice-lab/preset schema 1.0 格式,包含所有 17 个参数 + 元信息。
Any preset can export as a portable mumble-voice-lab/preset schema 1.0 JSON — all 17 params + metadata.
- 导出当前按钮:直接导出当前调试中的参数,不需要先存
- 单卡 ⤓:导出某个具体的自定义角色
- 导入配置:从 JSON 文件加回库;schema 严格校验,损坏文件会被拒绝并显示具体原因(如
params.basicFreq 超出范围 [45, 900]),库不被污染
Export Current works on whatever is currently loaded; per-card ⤓ exports a specific saved one. Import validates the full schema and rejects with a precise reason on mismatch.
🛠 内部 / Internals
- 新模块
src/presets/customPresets.ts:localStorage 读写 + 完整 schema 校验(每个参数范围检查、hex 颜色格式、boolean 字段)+ 文件名 slug 工具 getPresetDisplayName加 customPresets fallback,状态栏显示用户起的名字而非 idAppStatus加 5 种新状态:presetSaved/presetImported/presetImportFailed/presetDeleted/configExported.preset-cell包装器统一 default + custom 渲染;hover overlay 用 pointer-events 切换避免误触
🔒 兼容性 / Compatibility
- 无破坏性改动,state shape 向后兼容
- 音频管线、
buildSchedule/renderEventsToWav契约、deterministic schedule 行为完全不变 - Crowd Chatter 当前仍只引用官方 9 个 preset;让 chatter 也支持自定义角色留作 v1.3.1 follow-up
📦 升级 / Upgrade
无破坏性改动。Cache-buster 已 bump 到 ?v=1.3.0-presets,浏览器会重抓 UI。
No breaking changes. Cache-busters bumped to ?v=1.3.0-presets.
Pull request: #2
Live demo: https://nightt5879.github.io/mumble-voice-lab/?v=1.3.0-presets