Skip to content

音频降噪和节拍检测 - #86

Open
devin-ai-integration[bot] wants to merge 8 commits into
devin/1796517396-stickers-shapesfrom
devin/1796518381-denoise-beats
Open

devin-ai-integration[bot] wants to merge 8 commits into
devin/1796517396-stickers-shapesfrom
devin/1796518381-denoise-beats

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Dec 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

叠在 #85 上。

降噪:视频和音频片段属性里新增「降噪」开关(track.denoise)。降噪链在 src/utils/denoise.ts:

source -> highpass 100Hz -> lowpass 8kHz -> AudioWorklet 噪声门 -> gain
噪声门:峰值包络 < -45 dBFS 时衰减到 -24 dB(attack 5ms / release 80ms,初始为关闭)
  • 预览(setElementGain(el, gain, denoise))和导出(mixAudio 的 OfflineAudioContext)用同一个 worklet,听到的就是导出的。worklet 模块加载完成前预览先直连,加载后下一帧切到降噪链。
  • 工程保存为 dn: 1;分割、分离音频会带上这个开关;MCP update_clip({ denoise });剪映草稿不支持,导出时会提示跳过「声音「降噪」」。
  • 这是滤波加噪声门,不是频谱降噪:只压掉停顿处的底噪和嗡声、嘶声,说话时的背景噪声还在。

节拍检测:工具栏新增「节拍检测」按钮,MCP 新增 detect_beats({ clipId })。对片段可见区间的声音降采样到约 11kHz,按约 23ms 一帧计算能量的上升量(简化的谱通量),超过自适应阈值(0.5s 窗口内均值 + 1.5σ)并且是局部峰值时记为一拍,两拍至少间隔 0.25s;再用 timelineFrameAt 换算到时间轴帧,在每拍处添加时间轴标记。倒放片段不支持。

测试:src/utils/beats.test.ts 覆盖节拍检测和噪声门 worklet。e2e MCP detects beats and exports denoised audio 生成一段带底噪的鼓点 WAV,检查 5 个节拍和对应标记,并检查导出的 MP4 中停顿处的 RMS:不降噪时约 0.0027,开启降噪后低于 0.001,鼓点保留。

Link to Devin session: https://app.devin.ai/sessions/a882af08b80c444280600c6cdc988c2e
Open in Devin Desktop: https://app.devin.ai/desktop/session/a882af08b80c444280600c6cdc988c2e?variant=devin
Requested by: @x007xyz


🟢 Devin fixed all 4 findings · Follow Devin's work

Devin Review

devin-ai-integration Bot and others added 4 commits December 6, 2026 00:54
Co-Authored-By: zhangxiang chen <x007xyzabc@gmail.com>
Co-Authored-By: zhangxiang chen <x007xyzabc@gmail.com>
Co-Authored-By: zhangxiang chen <x007xyzabc@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@vercel

vercel Bot commented Dec 6, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
fly-cut Ready Ready Preview Dec 6, 2026 1:14am UTC

devin-ai-integration Bot and others added 3 commits December 6, 2026 01:09
…tinuous

Co-Authored-By: zhangxiang chen <x007xyzabc@gmail.com>
Co-Authored-By: zhangxiang chen <x007xyzabc@gmail.com>
Co-Authored-By: zhangxiang chen <x007xyzabc@gmail.com>
…markers

Co-Authored-By: zhangxiang chen <x007xyzabc@gmail.com>

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Devin Review found 4 findings. Devin automatically fixed all 4 findings.

Fixed by Devin (4)
  • Missing beat markers at trim starts — detectBeats takes a range: padded audio is used only for comparison, and beats outside the visible source window are skipped before the minimum-gap check. Unit test added.
  • Noise reduction dips at export boundaries — A new gate sets its level and open/closed state from the first 10 ms of input, so continuous sound stays open at export window boundaries; unit test added.
  • Paused previews leave noise gates alive — Disconnecting a preview route posts 'stop' to the gate; process() then returns false so the processor is released.
  • Missing beat markers at clip edges — detectBeats tests the first and last frames (missing neighbours count as 0) and clip analysis pads 0.1 s on each side so edge beats compare against the surrounding audio; unit test added.

View findings in Devin Review · Follow Devin's work

Devin Review

This branch was successfully deployed

1 active deployment
Preview — 77f6d81b Deployed Dec 6, 2026 by vercel[bot]
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.

1 participant