Skip to content

Auto Remove Silence: on-device silence detection, removal UI, and MCP tool#175

Open
ofcskn wants to merge 7 commits into
palmier-io:mainfrom
ofcskn:feat/auto-remove-silence
Open

Auto Remove Silence: on-device silence detection, removal UI, and MCP tool#175
ofcskn wants to merge 7 commits into
palmier-io:mainfrom
ofcskn:feat/auto-remove-silence

Conversation

@ofcskn

@ofcskn ofcskn commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Closes #174

Summary

Adds Auto Remove Silence — detect silent regions in a clip and ripple-delete them, closing the gaps. Detection runs fully on-device from the clip's RMS audio envelope; no AI/transcription dependency. Also exposes the capability to AI agents over MCP.

What's included

  • SilenceDetector — pure logic: walks AudioEnvelope RMS samples into source-second silence ranges (threshold, minimum duration, edge padding), then maps them to project FrameRanges honoring clip offset, trim, and speed. Out-of-bounds ranges are dropped.
  • EditorViewModel+SilenceRemoval — async bridge that extracts the envelope, detects silences, and feeds ranges to the existing rippleDeleteRangesOnTrack engine (linked A/V partners and sync-locked tracks ripple along; fully undoable).
  • SilenceRemovalSheet — SwiftUI sheet with threshold (dB), min duration, edge-padding sliders, and a smooth-cuts toggle, plus a live detected-count preview before committing. Styled entirely via AppTheme.
  • Toolbar button (waveform.badge.minus) — enabled when a single audio/video clip or a linked A/V pair is selected.
  • remove_silence MCP/agent tool — lets an AI model remove silence on a named clip via MCP (clipId, optional thresholdDb / minSilenceDuration / edgePadding). Auto-registered through ToolDefinitions.all.
  • Smooth cutsSilenceConfig.smoothCuts (default true) applies a 2-frame fadeInFrames to each new clip fragment, softening hard cut edges through the existing volume-ramp pipeline. Ripple and fade are grouped into one undoable action.
  • Docsdocs/remove-silence.md (English) + 13 translations (es, zh-CN, zh-TW, ja, ko, vi, hi, bn, ar, it, pt-BR, fr, ru).

Bug fixes

  • Linked A/V pair disables buttonsilenceRemovalCandidate now accepts multiple selected clips when they all share one linkGroupId, preferring the audio clip as the detection source.
  • Unlinked A/V desync — the existing rippleDeleteRangesOnTrack engine already cuts all clips in a linkGroupId together; no extra code needed.

Testing

  • New unit tests: SilenceDetectorTests (8), SilenceRemovalViewModelTests (8), RemoveSilenceTests (7).
  • Full suite passes. swift build clean.
  • Manual verification pending (sliders, detect/preview, apply + undo, button enable/disable states).

Notes

Detection is threshold-based on the RMS envelope (10 ms hops at 16 kHz) — the same envelope infrastructure already used for waveforms and audio sync.

ofcskn added 7 commits June 25, 2026 13:28
- Add English canonical doc at docs/remove-silence.md covering desktop
  workflow, parameters, linked clips, MCP tool reference, and tips
- Add 13 translated versions (es, zh-CN, zh-TW, ja, ko, vi, hi, bn,
  ar, it, pt-BR, fr, ru) each with AI disclaimer and language nav
- Add smoothCuts flag to SilenceConfig (default true) — applies a
  2-frame fadeInFrames to every new clip fragment after silence removal,
  softening hard cut edges through the existing volume ramp pipeline
- Expose smooth cuts toggle in SilenceRemovalSheet
- Consolidate undo management: removeSilences now owns its own undo
  group so the ripple and fade are undone together with a single ⌘Z
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.

Auto Remove Silence: detect and ripple-delete silent regions

1 participant