AudioSlicer
A Python tool for automatically slicing audio files based on silence detection, designed for creating ML datasets and processing large audio collections.
Features
- Automatic silence detection using RMS analysis
- Batch processing of WAV and MP3 files
- Random word generation for unique file naming
- Configurable silence thresholds and segment lengths
- Maintains original sample rate
Installation
You can install audioslicer either via pip or by cloning the repository:
Using pip
pip install lm_audioslicer
From source
git clone https://github.com/LarsMonstad/audioslicer.git
cd audioslicer
pip install -r requirements.txt
PIP usage
lm_audioslicer /path/to/audio/folder [options]
Usage
python -m audioslicer.slicer /path/to/audio/folder [options]
Options
-t, --threshold: Silence threshold in dB (default: -40.0)-l, --min_length: Minimum segment length in ms (default: 5000)-i, --min_interval: Minimum silence interval in ms (default: 300)-s, --hop_size: Analysis window size in ms (default: 10)-m, --max_silence: Maximum silence to keep in ms (default: 1000)
Example
python audioslicer.slicer -m ./my_audio -t -35 -l 3000
PIP example
lm_audioslicer ./my_audio -t -35 -l 3000
How It Works
- Analyzes audio using RMS (root mean square) to detect silence
- Identifies silence regions below the threshold
- Splits audio at optimal points within silence regions
- Generates unique filenames using random pronounceable words
- Saves segments in a new 'sliced_audio' directory
Output
- Creates 'sliced_audio' folder in the input directory
- Naming format:
originalname_randomword_number.wav - Preserves original audio quality and sample rate
Technical Notes
- Minimum segment length prevents creation of tiny clips
- Hop size affects precision vs processing speed
- Maximum silence parameter trims long silence periods
- Uses librosa for robust audio processing
Acknowledgments
- Inspired by GUI Audio Slicer
License
MIT License
Made by Lars Monstad
Metadata
Release files for lm-audioslicer 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lm_audioslicer-0.1.8.tar.gz | 7.4 kB | Without provenance | Details for lm_audioslicer-0.1.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lm_audioslicer-0.1.8-py3-none-any.whl | Python 3 | none | any | Details for lm_audioslicer-0.1.8-py3-none-any.whl |
Total release size: 14.6 kB
Release files / lm_audioslicer-0.1.8.tar.gz
| Download URL | lm_audioslicer-0.1.8.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d0f5f55f45de6ab61628b6e35cd9b7571e9f764542943306f4880356694aca0d
|
|
BLAKE2b-256 checksum How to use checksums |
7bd2fba89732212ddc813b3beddb2ff9e658ef899a97b3e3f1528050e64e643a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.8.18
|
Release files / lm_audioslicer-0.1.8-py3-none-any.whl
| Download URL | lm_audioslicer-0.1.8-py3-none-any.whl |
|---|---|
| Size | 7.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3d6a49e98ab63cd6dfc4685d0eac8352f29cc726101533637a89d7870fe2a633
|
|
BLAKE2b-256 checksum How to use checksums |
5d79afad93718161e20ade7f69a1353fed303343e08ee6ad6acbfcca3044300d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.8.18
|
Security for lm-audioslicer 0.1.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.