Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.
Python asraudiochineseemotion-recognitionfunasrmcp-servermultilingual-asropenai-compatible-apiparaformerpunctuationpytorchreal-time-asrspeaker-diarizationspeech-recognitionspeech-to-textstreaming-asrtranscriptionvllmvoice-activity-detectionwhisper-alternative
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Voice Activity Detection in Python — Detect Speech, Remove Silence, Split Audio | FunASR Blog</title>
<meta name="description" content="How to do Voice Activity Detection (VAD) in Python? FunASR fsmn-vad returns start/end milliseconds of every speech region in 3 lines — remove silence, split long recordings on pauses, and preprocess any ASR (incl. Whisper) to cut cost and hallucinations. With real measured output.">
<meta name="keywords" content="voice activity detection python, vad python, voice activity detection, remove silence from audio python, split audio by silence, detect speech in audio, silero vad alternative, fsmn-vad, FunASR, audio preprocessing">
<link rel="icon" href="/logo.png">
<meta property="og:title" content="Voice Activity Detection in Python — Detect Speech, Remove Silence, Split Audio | FunASR Blog">
<meta property="og:description" content="How to do Voice Activity Detection (VAD) in Python? FunASR fsmn-vad returns start/end milliseconds of every speech region in 3 lines — remove silence, split long recordings on pauses, and preprocess any ASR (incl. Whisper) to cut cost and hallucinations. With real measured output.">
<meta property="og:type" content="article">
<meta property="og:url" content="https://www.funasr.com/en/blog/voice-activity-detection-python.html">
<meta property="og:image" content="https://www.funasr.com/logo.png">
<link rel="canonical" href="https://www.funasr.com/en/blog/voice-activity-detection-python.html">
<link rel="alternate" hreflang="en" href="https://www.funasr.com/en/blog/voice-activity-detection-python.html">
<link rel="alternate" hreflang="zh" href="https://www.funasr.com/blog/voice-activity-detection-python.html">
<link rel="alternate" hreflang="x-default" href="https://www.funasr.com/en/blog/voice-activity-detection-python.html">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","headline":"Voice Activity Detection in Python — Detect Speech, Remove Silence, Split Audio | FunASR Blog","description":"How to do Voice Activity Detection (VAD) in Python? FunASR fsmn-vad returns start/end milliseconds of every speech region in 3 lines — remove silence, split long recordings on pauses, and preprocess any ASR (incl. Whisper) to cut cost and hallucinations. With real measured output.","datePublished":"2026-06-22","dateModified":"2026-06-22","author":{"@type":"Organization","name":"FunASR / Tongyi Lab"},"publisher":{"@type":"Organization","name":"FunASR","logo":{"@type":"ImageObject","url":"https://www.funasr.com/logo.png"}},"mainEntityOfPage":{"@type":"WebPage","@id":"https://www.funasr.com/en/blog/voice-activity-detection-python.html"},"image":"https://www.funasr.com/logo.png"}
</script>
<style>:root{--primary:#2563eb;--primary-dark:#1d4ed8;--bg:#fff;--surface:#f8fafc;--border:#e2e8f0;--text:#0f172a;--text-soft:#475569;--text-muted:#94a3b8;--radius:12px}
*{margin:0;padding:0;box-sizing:border-box}
body{font-family:'Inter',-apple-system,sans-serif;color:var(--text);line-height:1.7}
a{color:var(--primary);text-decoration:none}a:hover{text-decoration:underline}
.container{max-width:800px;margin:0 auto;padding:0 24px}
.nav{position:fixed;top:0;left:0;right:0;z-index:100;background:rgba(255,255,255,0.9);backdrop-filter:blur(12px);border-bottom:1px solid var(--border);padding:14px 0}
.nav .container{max-width:1120px;display:flex;align-items:center;gap:24px}
.nav-logo{font-size:1.2rem;font-weight:800;color:var(--text)}.nav-logo span{color:var(--primary)}
.nav-links{display:flex;gap:20px;margin-left:auto;flex-wrap:wrap}
.nav-links a{font-size:0.85rem;font-weight:500;color:var(--text-soft)}
.nav-btn{padding:7px 16px;background:var(--primary);color:#fff;border-radius:7px;font-size:0.83rem;font-weight:600}
article{padding:120px 0 80px}
h1{font-size:2rem;font-weight:800;line-height:1.3;margin-bottom:14px}
h2{font-size:1.3rem;font-weight:700;margin:36px 0 14px;padding-top:16px;border-top:1px solid var(--border)}
h3{font-size:1.05rem;font-weight:700;margin:22px 0 10px}
p{margin-bottom:14px;color:var(--text-soft)}
ul,ol{margin:0 0 14px 22px;color:var(--text-soft)}li{margin-bottom:6px}
table{width:100%;border-collapse:collapse;margin:16px 0;font-size:0.86rem}
th,td{padding:10px 12px;text-align:left;border-bottom:1px solid var(--border)}
th{font-weight:600;background:var(--surface);font-size:0.78rem;color:var(--text-muted)}
pre{background:#1e293b;color:#e2e8f0;padding:18px;border-radius:10px;overflow-x:auto;font-size:0.82rem;line-height:1.7;margin:14px 0}
code{font-family:ui-monospace,Menlo,monospace}
p code,li code{background:var(--surface);padding:2px 6px;border-radius:5px;font-size:0.85em;color:var(--primary-dark)}
.post-meta{color:var(--text-muted);font-size:0.85rem;margin-bottom:24px}
.cta{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:24px;margin:28px 0;text-align:center}
.cta a.btn{display:inline-block;padding:10px 24px;background:var(--primary);color:#fff;border-radius:8px;font-weight:600}
.post-list{list-style:none;margin:0;padding:0}
.post-list li{margin:0 0 8px}
.post-card{display:block;border:1px solid var(--border);border-radius:var(--radius);padding:20px 22px;margin-bottom:14px}
.post-card:hover{border-color:var(--primary);text-decoration:none}
.post-card h2{border:none;padding:0;margin:0 0 6px;font-size:1.15rem;color:var(--text)}
.post-card p{margin:0;color:var(--text-soft);font-size:0.9rem}
.post-card .date{color:var(--text-muted);font-size:0.8rem}
footer{background:#0f172a;color:#94a3b8;padding:28px 0;text-align:center;font-size:0.8rem}
footer a{color:#94a3b8}</style>
</head>
<body>
<nav class="nav"><div class="container"><a href="/en/" class="nav-logo">Fun<span>ASR</span></a><div class="nav-links"><a href="/en/#capabilities">Capabilities</a><a href="/en/#usage">How to Use</a><a href="/en/#benchmark">Benchmark</a><a href="/en/#demo">Demo</a><a href="https://modelscope.github.io/FunASR/" target="_blank">Docs</a><a href="/en/quickstart.html">Quickstart</a><a href="/en/models.html">Models</a><a href="/en/ecosystem.html">Ecosystem</a><a href="/en/blog/">Blog</a><a href="/en/vs-whisper.html">vs Whisper</a><a href="/en/donors.html">Donors</a></div><a href="https://www.funasr.com/blog/voice-activity-detection-python.html" style="font-size:0.83rem;font-weight:500;color:var(--text-soft)">中文</a><a href="https://github.com/modelscope/FunASR" target="_blank" class="nav-btn">GitHub ★</a></div></nav>
<article><div class="container">
<h1>Voice Activity Detection in Python — Detect Speech, Remove Silence, Split Audio by Pauses</h1>
<p class="post-meta">2026-06-22 · FunASR Team</p>
<p><strong>Voice Activity Detection (VAD)</strong> is a foundational step in audio processing: finding <em>where someone is speaking</em> versus silence/noise in a recording. It's the first stage of almost every speech pipeline — drop silence to save compute, split long recordings into utterances on pauses, and preprocess audio for any downstream ASR (<strong>including feeding Whisper clean speech to cut cost and stop it from "hallucinating" text over silent stretches</strong>).</p>
<p><strong>FunASR's <code>fsmn-vad</code></strong> is an industrial-grade, lightweight, very fast open-source VAD model. Three lines of Python, and it returns the <strong>start/end milliseconds</strong> of every speech region. Everything below is real measured output.</p>
<h2>VAD in three lines</h2>
<pre>pip install funasr
from funasr import AutoModel
model = AutoModel(model="fsmn-vad", disable_update=True)
segments = model.generate(input="audio.wav")[0]["value"]
print(segments)
# [[610, 5530]] # milliseconds — speech from 0.61s to 5.53s; the leading 610ms of silence is dropped</pre>
<p>The return value is a list of <code>[start_ms, end_ms]</code> intervals, one per continuous speech region. In this 5.55s clip, the 0.61s of leading silence was removed automatically.</p>
<h2>Real example: a 13-second clip split into 2 segments</h2>
<p>Concatenating two utterances with a 1.5s pause between them gives a 13.31s recording (simulating a real clip with a pause). Actual VAD output:</p>
<table>
<tr><th>Segment</th><th>Span</th><th>Duration</th></tr>
<tr><td>seg0</td><td>0.61s → 5.45s</td><td>4.84s</td></tr>
<tr><td>seg1</td><td>7.28s → 13.29s</td><td>6.01s</td></tr>
</table>
<p>VAD cleanly isolates the two speech regions and marks both the 1.5s pause (5.45s–7.28s) and the leading silence as non-speech. Speech is 82% of the 13.31s clip — <strong>18% of silence removed</strong>. This took just <strong>0.12s on GPU (~110× real-time)</strong>: VAD is extremely light and adds almost no overhead.</p>
<h2>Three practical use cases</h2>
<h3>1. Remove silence / keep speech only</h3>
<pre>import soundfile as sf
import numpy as np
audio, sr = sf.read("audio.wav")
segments = model.generate(input="audio.wav")[0]["value"]
# concatenate all speech regions, drop silence
speech = np.concatenate([audio[int(s/1000*sr):int(e/1000*sr)] for s, e in segments])
sf.write("speech_only.wav", speech, sr)</pre>
<h3>2. Split a long recording into files on pauses (for batch ASR)</h3>
<pre>for i, (s, e) in enumerate(segments):
chunk = audio[int(s/1000*sr):int(e/1000*sr)]
sf.write(f"chunk_{i}.wav", chunk, sr)
# chunk_0.wav, chunk_1.wav, ... each file is one independent utterance</pre>
<h3>3. Preprocess for any ASR (including Whisper)</h3>
<p>Running VAD <strong>before</strong> recognition has two concrete benefits: (1) you never send silence/noise into the model = <strong>less compute, lower cost</strong>; (2) Whisper tends to hallucinate repeated text over long silences, and <strong>trimming silence with VAD first measurably reduces those hallucinations</strong>. With FunASR's own ASR models (SenseVoice / Paraformer) you can wire VAD in with a single <code>vad_model="fsmn-vad"</code> argument for automatic segmentation.</p>
<pre>from funasr import AutoModel
# attach VAD directly to ASR; long audio is auto-segmented
asr = AutoModel(model="iic/SenseVoiceSmall", vad_model="fsmn-vad")
result = asr.generate(input="long_audio.wav")</pre>
<h2>Why fsmn-vad</h2>
<table>
<tr><th></th><th>fsmn-vad (FunASR)</th></tr>
<tr><td>Usage</td><td>3 lines of Python, returns millisecond speech spans</td></tr>
<tr><td>Speed</td><td>measured 0.12s on 13s audio (~110× real-time)</td></tr>
<tr><td>Footprint</td><td>lightweight FSMN architecture, real-time even on CPU</td></tr>
<tr><td>Ecosystem</td><td>use standalone, or attach to FunASR ASR in one line for auto-segmentation</td></tr>
<tr><td>License</td><td>open-source, commercial-friendly</td></tr>
</table>
<p>If you already use FunASR for recognition, VAD is the same toolkit with zero extra dependencies; if you use Whisper or another ASR, fsmn-vad works as a standalone preprocessor. For full pipelines, see <a href="/en/blog/funasr-transcribe-long-audio.html">transcribing long audio</a> and <a href="/en/blog/funasr-speaker-diarization.html">speaker diarization</a>.</p>
<div class="cta"><p><strong>The whole FunASR stack is open-source</strong> — fsmn-vad, industrial-grade ASR, punctuation, speaker, emotion & events, LLM-ASR, ready to use. If it helps, a GitHub Star really supports the project 👇</p><p><a class="btn" href="https://github.com/modelscope/FunASR" target="_blank">⭐ Star FunASR</a></p><p style="margin-top:10px;font-size:0.85rem">Also star:<a href="https://github.com/QwenAudio/SenseVoice" target="_blank">SenseVoice</a> · <a href="https://github.com/QwenAudio/Fun-ASR" target="_blank">Fun-ASR</a> · <a href="https://github.com/modelscope/FunClip" target="_blank">FunClip</a></p></div>
<!--related-posts-->
<h2>Related posts</h2>
<ul class="post-list">
<li><a href="/en/blog/funasr-vs-whisper-benchmark.html">FunASR vs Whisper Benchmark</a></li>
<li><a href="/en/blog/sensevoice-deployment-guide.html">SenseVoice Deployment Guide</a></li>
<li><a href="/en/blog/fun-asr-nano-guide.html">Fun-ASR-Nano Guide</a></li>
<li><a href="/en/blog/funasr-speaker-diarization.html">Speaker Diarization: Who Spoke When</a></li>
<li><a href="/en/blog/sensevoice-emotion-language-detection.html">Emotion & Language Detection</a></li>
<li><a href="/en/blog/funasr-realtime-streaming-asr.html">Real-Time Streaming Speech-to-Text</a></li>
<li><a href="/en/blog/funasr-transcribe-long-audio.html">Transcribe Long Audio (Hours in One Call)</a></li>
<li><a href="/en/blog/funasr-cli-transcribe-command-line.html">Transcribe from the Command Line</a></li>
<li><a href="/en/blog/self-hosted-openai-whisper-api-alternative.html">Self-Hosted OpenAI Whisper API Alternative</a></li>
<li><a href="/en/blog/generate-subtitles-srt-vtt-from-audio-video.html">Auto-Generate Subtitles (SRT / VTT)</a></li>
<li><a href="/en/blog/speech-to-text-python-transcribe-audio.html">Speech to Text in Python</a></li>
<li><a href="/en/blog/funasr-llama-cpp-whisper-cpp-alternative.html">FunASR on llama.cpp (whisper.cpp Alternative)</a></li>
<li><a href="/en/blog/funasr-vs-faster-whisper-chinese.html">FunASR vs faster-whisper (Chinese/Cantonese)</a></li>
<li><a href="/en/blog/lightweight-speech-recognition-cpu.html">Lightweight Speech Recognition on CPU</a></li>
<li><a href="/en/blog/self-hosted-deepgram-assemblyai-alternative.html">Self-Hosted Deepgram/AssemblyAI Alternative</a></li>
<li><a href="/en/blog/which-funasr-model.html">Which FunASR Model?</a></li>
<li><a href="/en/blog/cantonese-speech-recognition.html">Cantonese Speech Recognition (SenseVoice)</a></li>
<li><a href="/en/blog/japanese-speech-recognition.html">Japanese Speech Recognition (SenseVoice)</a></li>
<li><a href="/en/blog/self-hosted-google-aws-azure-speech-to-text.html">Self-Hosted Google/AWS/Azure STT Alternative</a></li>
<li><a href="/en/blog/chinese-speech-recognition.html">Chinese Speech Recognition in Python</a></li>
<li><a href="/en/blog/punctuation-restoration-python.html">Punctuation Restoration in Python</a></li>
<li><a href="/en/blog/speech-to-text-timestamps-python.html">Speech-to-Text with Timestamps in Python</a></li>
</ul>
</div></article>
<footer><div class="container">© 2024-2026 Tongyi Lab, Alibaba Group · <a href="https://github.com/modelscope/FunASR/blob/main/LICENSE">MIT License</a></div></footer>
</body>
</html>