A fast, multithreaded audio silence remover and chunk slicer.
Project description
Audio Splitter VAD 🎙️✂️
A lightning-fast, production-ready Python library for audio silence removal and multithreaded chunking.
Built on top of Google's robust WebRTC Voice Activity Detection (VAD) engine, this tool allows you to strip silence from audio files and slice pure speech into manageable chunks. It is fully optimized for scale, featuring both I/O-bound multithreading for single massive files and CPU-bound multiprocessing for directories with thousands of files.
Features
- Silence Stripping: Automatically detect and remove non-speech frames using WebRTC VAD.
- Smart Slicing: Yield continuous chunks of pure speech at any desired duration.
- Universal Input: Natively accepts
.mp3and.wavfiles and automatically converts them into the 16-bit mono PCM format required by WebRTC. - Multithreaded Export: Bypass the GIL by saving hundreds of chunks to disk concurrently.
- Batch Processing: Utilize all CPU cores via multiprocessing to process thousands of audio files at maximum speed.
Installation
Install the package via pip (or uv):
pip install audio-splitter-vad
⚠️ System Requirement
This library uses
pydubunder the hood to decode.mp3files. You must have FFmpeg installed on your system and available in yourPATH.
Install FFmpeg
macOS
brew install ffmpeg
Linux
sudo apt install ffmpeg
Windows
Download FFmpeg from gyan.dev or install it with:
winget install ffmpeg
Quick Start
1. Memory-Efficient Generator (Streaming)
Ideal for streaming chunks directly to transcription APIs like Whisper or Google Cloud without saving them to disk.
from audio_splitter_vad.splitter import Splitter
audio_splitter = Splitter()
# Yield 5-second chunks of pure speech (silence removed)
for chunk in audio_splitter.split(
"podcast.mp3",
slice_duration=5,
strip_silence=True,
):
print(f"Received {len(chunk)} bytes of pure speech!")
# Send chunk to your API...
2. High-Speed Multithreaded Slicing (Single File)
Quickly split a single massive audio file into hundreds of .wav chunks on your hard drive.
from audio_splitter_vad.splitter import Splitter
audio_splitter = Splitter()
# Save chunks concurrently using background threads
saved_files = audio_splitter.split_multithreaded(
audio_path="massive_interview.wav",
save_path="./clean_chunks",
slice_duration=5,
max_workers=8,
strip_silence=True,
)
print(f"Successfully exported {len(saved_files)} chunks.")
3. Core-Max Batch Processing (Directories)
If you have a folder containing thousands of audio files, use multiprocessing instead of multithreading. This assigns an isolated VAD engine to every CPU core for maximum throughput.
from audio_splitter_vad.batch_split import batch_process_directory
batch_process_directory(
input_folder="./raw_podcasts",
output_folder="./processed_datasets",
strip_silence=True,
)
Advanced Configuration
You can pass a custom WebRTC VAD engine when initializing Splitter to control how aggressively silence is removed.
| Mode | Description |
|---|---|
0 |
Least aggressive (retains more background noise). |
1 |
Light filtering. |
2 |
Moderate filtering. |
3 |
Most aggressive (removes nearly everything that is not speech). |
Example:
import webrtcvad
from audio_splitter_vad.splitter import Splitter
# Less aggressive filtering
custom_vad = webrtcvad.Vad(1)
splitter = Splitter(vad_engine=custom_vad)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file audio_splitter_vad-0.1.2.tar.gz.
File metadata
- Download URL: audio_splitter_vad-0.1.2.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
624e3a9e3bb4eb632f726f36578a1cb895dd3e90958a08f0ef2009a6918dfb9a
|
|
| MD5 |
4fca62168717c9e7822d9a5316c3dbfc
|
|
| BLAKE2b-256 |
dd4b92c9635cf32dde10152660890a770b3981745d95a4233506ff61f60ed69f
|
File details
Details for the file audio_splitter_vad-0.1.2-py3-none-any.whl.
File metadata
- Download URL: audio_splitter_vad-0.1.2-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88473787c32ed42f0db3e1d588081f923618aaa7240aecabf469da2db384a445
|
|
| MD5 |
28084b6e838de9852c56e13ddec5a13a
|
|
| BLAKE2b-256 |
f6c35e4a181b3b93e72b50a1c44174a0d3db93c74a78cd879109f5d6318661e6
|