Skip to content

feat: AutoMix 智能混音过渡 - #429

Merged
imsyy merged 23 commits into
devfrom
feat/automix
Oct 29, 2026
Merged

imsyy merged 23 commits into
devfrom
feat/automix

Conversation

@imsyy

@imsyy imsyy commented Oct 29, 2026

Copy link
Copy Markdown
Member

改动类型

  • 新功能(feat)
  • 缺陷修复(fix)
  • 重构 / 优化(不改变对外行为)
  • 文档(docs)
  • 其他(请在「改动说明」中注明)

是否包含破坏性变更

  • 是(请在「改动说明」中详细描述)
  • 否

改动说明

新增 AutoMix 智能混音过渡模式,与「无过渡 / 交叉过渡」并列,位于 设置 → 播放 → 播放过渡。

  • 分析与规划:分析当前曲尾与下一曲首各 40 秒,做节拍与重拍检测(Beat This!)、调性与电平分析,按小节选择交接点。速度差 ≤ 8% 时对拍并变速;8%–25% 时原速桥接,鼓与贝斯在重拍上瞬时换手;超出范围则不混。
  • 声部分离与混音:交接窗口经 HT Demucs 分离为鼓、贝斯、人声、其他四个声部,各声部按独立包络依次换手。底鼓在重拍上交接;人声换手点避开字音,会截断主唱时放弃混音。
  • 回退:模型未就绪或曲目对不适合混音时,按「无法混音时交叉过渡」开关改用交叉过渡或直接切歌。变速或变调播放时不执行 AutoMix。

关联 Issue

无

测试情况

  • pnpm typecheck、pnpm lint 通过
  • vitest 全量 66 个文件 / 534 个用例通过,覆盖 AutoMix 规划、人声复核、推理、预载与过渡流程
  • 手动验证平台:

截图 / 录屏

自查清单

  • 本 PR 只包含一个主要功能 / 修复,没有夹带无关改动
  • 已在本地完整测试通过;AI 生成的代码同样自行测试并审阅过,未做未经验证的提交
  • 已运行 pnpm format,并确认 pnpm typecheck、pnpm lint 通过
  • 改动涉及原生模块时已 pnpm build:native 验证;未手写 native/*/index.d.ts
  • 已向 dev 分支提交

🤖 Generated with Claude Code

Copilot AI balanced review requested due to automatic review settings October 29, 2026 15:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved critical defects can break all six platform builds, exhaust user disk space through unbounded downloads, and trigger abrupt track changes when bridge plans exceed the native engine’s duration limit.

4 open issues
1 file not reviewed
  • pnpm-lock.yaml: Generated file
What changed in this PR

本 PR 为 SPlayer-Next 新增 AutoMix 智能混音过渡,将节拍分析、声部分离与原生音频混音接入现有预载和切歌流程,并提供模型管理与回退设置。

主要变更:

  • 新增分析组件下载、独立推理进程、节拍规划和人声交接复核。
  • 扩展原生引擎的声部处理、自动变速、过渡取消及跨进程接口。
  • 增加设置界面、过渡状态展示、相关测试、文档和组件发布流程。
文件 说明
src/​types/​settings.ts 扩展过渡模式及回退设置类型
src/​stores/​status.ts 保存当前过渡类型
src/​stores/​settings.ts 添加默认值与旧设置兼容处理
src/​settings/​categories/​player.ts 添加 AutoMix 设置与资源占用提示
src/​settings/​categories/​player.spec.ts 补充过渡开启确认测试
src/​settings/​categories/​localCache.ts 联动缓存关闭与过渡设置
src/​services/​nextTrackPreloader.spec.ts 覆盖预载时机、组件就绪和失败处理
src/​services/​automix.ts 共享模型组件状态与订阅
src/​i18n/​locales/​zh-CN.json 添加中文设置与状态文案
src/​i18n/​locales/​en-US.json 添加英文设置与状态文案
src/​core/​player/​preload.spec.ts 覆盖 AutoMix 交接和回退条件
src/​core/​player/​index.ts 接入计划交接与失败后的预载处理
src/​core/​player/​failure.spec.ts 更新预载服务测试桩
src/​core/​player/​events.ts 接收实际过渡模式
src/​components/​ui/​SSlider.vue 更新进度条发光与减弱动画支持
src/​components/​settings/​SettingsSection.vue 调整动态设置项入场动画
src/​components/​settings/​custom/​AutoMixComponents.vue 新增模型下载管理弹窗
src/​components/​player/​PlayerTimeInfo.vue 区分 AutoMix 与交叉过渡提示
src/​components/​player/​FullPlayer/​index.vue 全屏进度条显示过渡发光
shared/​types/​player.ts 扩展预载结果及过渡接口
shared/​types/​automix.ts 定义分析、编排和组件管理类型
shared/​constants/​playback.ts 定义 AutoMix 提交与预热时间
public/​licenses/​automix.txt 补充模型和运行时许可说明
package.json 增加压缩包处理与数学文档依赖
native/​taskbar-lyric/​src/​strategy/​win11.rs 简化任务栏扫描错误分支
native/​automix-worker/​src/​demucs.rs 实现分段声部分离推理
native/​automix-worker/​src/​beats.rs 实现节拍模型窗口推理
native/​automix-worker/​Cargo.toml 配置独立推理进程依赖
native/​audio-engine/​src/​tests/​decoder.rs 调整双声道采样测试遍历
native/​audio-engine/​src/​player/​tests/​preload.rs 验证取消预载释放声部资源
native/​audio-engine/​src/​player/​preload.rs 按预载代次清理声部
native/​audio-engine/​src/​player/​mod.rs 接入过渡模式和参数变更取消
native/​audio-engine/​src/​player/​events.rs 扩展原生过渡事件
native/​audio-engine/​src/​player/​crossfade.rs 安装声部并提交、取消混音计划
native/​audio-engine/​src/​output/​playback.rs 提供输出侧过渡取消入口
native/​audio-engine/​src/​lib.rs 注册音频分析模块
native/​audio-engine/​src/​dsp/​transition_mix.rs 实现声部增益和底鼓分频
native/​audio-engine/​src/​dsp/​tests/​limiter.rs 验证限幅后的声部一致性
native/​audio-engine/​src/​dsp/​tests/​automix_tempo.rs 验证自动变速时序和尾音排空
native/​audio-engine/​src/​dsp/​tempo.rs 接入独立自动倍率和源采样计数
native/​audio-engine/​src/​dsp/​mod.rs 注册混音信号处理模块
native/​audio-engine/​src/​dsp/​limiter.rs 对主路和声部应用一致限幅增益
native/​audio-engine/​src/​dsp/​fft.rs 调整立体声频谱采样遍历
native/​audio-engine/​src/​dsp/​equalizer.rs 支持克隆均衡器状态
native/​audio-engine/​src/​dsp/​automix_tempo.rs 实现自动变速预热与排空
native/​audio-engine/​src/​decoder/​tests/​source.rs 更新音频块测试结构
native/​audio-engine/​src/​decoder/​tests/​processing.rs 验证声部处理与主路对齐
native/​audio-engine/​src/​decoder/​tests/​buffer.rs 更新缓冲测试数据
native/​audio-engine/​src/​decoder/​stems.rs 载入并重采样有限声部窗口
native/​audio-engine/​src/​decoder/​stem_processing.rs 独立处理并重组各声部
native/​audio-engine/​src/​decoder/​source.rs 同步读取主路、声部和源位置
native/​audio-engine/​src/​decoder/​reader.rs 传递音频块响度增益
native/​audio-engine/​src/​decoder/​processing.rs 将声部接入后台处理链
native/​audio-engine/​src/​decoder/​mod.rs 注册声部解码模块
native/​audio-engine/​src/​decoder/​buffer.rs 管理声部窗口与音频块数据
native/​audio-engine/​src/​bindings/​player/​types.rs 定义原生混音参数类型
native/​audio-engine/​src/​bindings/​player/​transition.rs 转换计划参数并处理取消结果
native/​audio-engine/​src/​bindings/​player/​preload.rs 暴露声部安装和预载接口
native/​audio-engine/​src/​bindings/​player/​events.rs 转发过渡模式字段
native/​audio-engine/​src/​bindings/​mod.rs 导出分析接口
native/​audio-engine/​src/​bindings/​analysis.rs 暴露特征分析和音频窗口导出
native/​audio-engine/​index.d.ts 更新原生接口类型声明
eslint.config.mjs 允许测试文件定义多个桩组件
electron/​preload/​index.ts 暴露组件管理和扩展播放接口
electron/​preload/​index.d.ts 声明窗口侧 AutoMix API
electron/​main/​utils/​paths.ts 添加模型与临时声部目录
electron/​main/​services/​playerPreloadReset.spec.ts 补充分析模块测试桩
electron/​main/​services/​playerPreload.spec.ts 覆盖分析回退、通知和取消流程
electron/​main/​services/​automix/​vocals.spec.ts 验证人声活动与交接安排
electron/​main/​services/​automix/​runtime.ts 实现受限 ZIP 解压与取消
electron/​main/​services/​automix/​inference.ts 串行运行并管理推理子进程
electron/​main/​services/​automix/​inference.spec.ts 验证推理取消和排队行为
electron/​main/​services/​automix/​features.ts 构建节拍、电平和音级档案
electron/​main/​services/​automix/​enhancement.ts 分离候选窗口并复核人声
electron/​main/​services/​automix/​components.ts 管理组件状态、下载和安装
electron/​main/​services/​automix/​beats.ts 提取拍点并拟合稳定周期
electron/​main/​services/​automix/​assets.ts 定义组件清单与平台支持条件
electron/​main/​services/​automix/​arrangement.ts 编排对拍和原速桥接包络
electron/​main/​services/​automix/​analysisHost.ts 调度特征分析与有限档案缓存
electron/​main/​ipc/​player.ts 串联预载、计划提交和时间转换
electron/​main/​ipc/​index.ts 注册组件管理接口
electron/​main/​ipc/​automix.ts 处理组件请求与退出清理
electron.vite.config.ts 生产构建复用组件声明
electron-builder.config.ts 精确限定音频原生模块打包文件
docs/​crossfade.md 说明交叉过渡算法与局限
docs/​.vitepress/​config.ts 添加过渡文档导航和数学公式支持
components.d.ts 注册模型管理组件类型
Cargo.toml 将推理进程加入工作区
Cargo.lock 锁定新增 Rust 依赖
.gitignore 忽略 Python 缓存文件
.github/​workflows/​automix.yml 构建、校验并发布模型及运行包

Review effort: Balanced

name: automix-models
path: models
- name: 构建运行包并校验两个模型的实际推理
run: pnpm exec tsx scripts/package-automix-runtime.ts node_modules/.cache/automix-runtime models
const source = (async function* () {
for await (const chunk of body) {
hash.update(chunk);
model.received += chunk.byteLength;
signal.throwIfAborted();
const cached = completed.get(key);
if (cached) return cached.plan;
const separation = await separate(
profiles.map((profile, index) => {
const start = index ? candidate.inStartMs : candidate.outStartMs;
return {
startMs: Math.max(profile.startMs, start - 1500),
@imsyy
imsyy merged commit 3f5ea39 into dev Oct 29, 2026
9 checks passed
@imsyy
imsyy deleted the feat/automix branch October 29, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants