Slices audio clips into chunks of a specific number of seconds at the closest moment of silence (decided by silero-vad). Uses onnx which avoids the pytorch dependency.
Project description
vadslice
Slices audio clips of speech into chunks of certain length in seconds at silence points so it doesn't cut in the middle of someone speaking. It uses VAD (voice activity detection from silero-vad) to determine these points of silence within the clip.
Uses ONNX runtime instead of PyTorch, avoiding the heavy PyTorch dependency while maintaining the same VAD accuracy.
It's extremely fast.
Installation
Requires Python 3.12+.
uv add vadslice
or pip:
pip install vadslice
Usage
CLI
vadslice <size> <input_file> <output_dir> [--format wav|mp3|ogg|m4a]
Example:
vadslice 30 audio.mp3 ./chunks --format mp3
Chunks are saved to output_dir/input_file_stem/chunk_XXXX_offset_XX.XXs.ext.
Python API
from vadslice import slicer
parts = slicer("audio.mp3", slice_length_s=30.0)
for i, part in enumerate(parts):
print(f"Part {i}: Offset: {part.offset_s}s, Size: {len(part.part)} bytes")
The function slicer returns a list of AudioPart objects, each containing:
part: WAV bytes (16 kHz mono) for that sliceoffset_s: Start time offset in seconds from the original audio
Supports any audio format that PyAV can decode (MP3, WAV, OGG, M4A, FLAC, etc.).
Project details
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 vadslice-1.0.0.tar.gz.
File metadata
- Download URL: vadslice-1.0.0.tar.gz
- Upload date:
- Size: 2.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.24
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
386120738386fe7fd5c30deaa346b0d4756a7416ce47006d041ea9d67616bdcc
|
|
| MD5 |
85aa32ccf79c4a22a45e602b6ecae9fb
|
|
| BLAKE2b-256 |
4aa0b45ca00f075cdba8b7461b6491d8de21628cfa4341cb31260fec6d0914a3
|
File details
Details for the file vadslice-1.0.0-py3-none-any.whl.
File metadata
- Download URL: vadslice-1.0.0-py3-none-any.whl
- Upload date:
- Size: 2.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.24
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70ddaeddf8147e6cae2d817088f5a68a24ccc289b5f363e5063bd29b57b63355
|
|
| MD5 |
c758bd97975a56fcc0afff3e0bb6a355
|
|
| BLAKE2b-256 |
df5b1559371b735ca3a588d41afc74ed62e9263703b6d8b1f0a56c443f9339eb
|