AGENT SKILL

pause-detector

Detect pauses and silence in audio using local dynamic thresholds. Use when you need to find natural pauses in lectures, board-writing silences, or breaks between sections. Uses local context comparison to avoid false positives from volume variation.

License 许可
Apache-2.0
最近更新
2026-11-14
Stars
★ 0
Forks
1

01 前言 Front Matter

name
pause-detector
description
Detect pauses and silence in audio using local dynamic thresholds. Use when you need to find natural pauses in lectures, board-writing silences, or breaks between sections. Uses local context comparison to avoid false positives from volume variation.

02 资源文件 1

03 SKILL.md 正文

Pause Detector

Detects pauses and low-energy segments using local dynamic thresholds on pre-computed energy data. Unlike global threshold methods, this compares energy to surrounding context, avoiding false positives when speaker volume varies.

Use Cases

  • Detecting natural pauses in lectures
  • Finding board-writing silences
  • Identifying breaks between sections

Usage

python3 /root/.claude/skills/pause-detector/scripts/detect_pauses.py \
    --energies /path/to/energies.json \
    --output /path/to/pauses.json

Parameters

  • --energies: Path to energy JSON file (from energy-calculator)
  • --output: Path to output JSON file
  • --start-time: Start analyzing from this second on the original per-second timeline (default: 0). Can be fed directly from silence-detector's silence_end.
  • --threshold-ratio: Ratio of local average that defines the low-energy cutoff (default: 0.5). A second is marked low-energy when energy < local_avg * threshold_ratio, so a smaller ratio means a stricter cutoff and fewer pauses (more conservative); a larger ratio relaxes the cutoff and detects more pauses (more aggressive).
  • --min-duration: Minimum pause duration in seconds (default: 2)
  • --window-size: Local average window size (default: 30)

Output Format

{
  "method": "local_dynamic_threshold",
  "segments": [
    {"start": 610, "end": 613, "duration": 3},
    {"start": 720, "end": 724, "duration": 4}
  ],
  "total_segments": 11,
  "total_duration_seconds": 28,
  "parameters": {
    "threshold_ratio": 0.5,
    "window_size": 30,
    "min_duration": 2
  }
}

How It Works

  1. Load pre-computed energy data
  2. Calculate local average using sliding window (centered uniform filter)
  3. Mark seconds where energy < local_avg * threshold_ratio
  4. Group consecutive low-energy seconds into segments
  5. Filter segments by minimum duration

Dependencies

  • Python 3.11+
  • numpy
  • scipy

Example

# Detect pauses after opening (start at 221s)
python3 /root/.claude/skills/pause-detector/scripts/detect_pauses.py \
    --energies energies.json \
    --start-time 221 \
    --output pauses.json

# Result: Found 11 pauses totaling 28 seconds

Parameters Tuning

Parameter Lower Value Higher Value
threshold_ratio More conservative — stricter low-energy cutoff, fewer / shorter pauses detected More aggressive — relaxed cutoff, more pauses detected
min_duration Shorter pauses allowed Longer pauses only
window_size Local context Broader context

Direction check: because the test is energy < local_avg * threshold_ratio, reducing threshold_ratio lowers the cutoff and makes fewer seconds qualify as low-energy. This is the OPPOSITE arithmetic direction of silence-detector's threshold_multiplier, which multiplies a baseline that energy must EXCEED; keep both in mind when tuning the full pipeline.

Notes

  • Requires energy data from energy-calculator skill
  • Use --start-time to skip the detected opening; the value from silence-detector is already on the original per-second timeline
  • Local threshold adapts to varying speaker volume
  • Preserve pauses whose duration equals --min-duration; the threshold is inclusive

04 同仓库更多 Skills