Skip to main content

A cli tool for cutting a long audio into segments by silence.

Project description

voicecut

PyPI version License: MIT

A cli utility for splitting a long audio file into shorter chunks based on moments of silence. It is useful for preprocessing audio before performing speech-to-text on it.

Installation

Through uv (recomended)

uv tool install voicecut

Through pip

pip install voicecut

Usage

Split audio files from the command line:

voicecut audio.mp3 [OPTIONS]

Options:

  • --segment-length FLOAT: Target segment length in seconds (default: 600)
  • --segment-delta FLOAT: Allowed deviation from segment length in seconds (default: 30)
  • --silence-thresh-mode {mean, max, auto}: Mode to determine the silence threshold. 'mean' uses the audio's average dBFS, 'max' uses the audio's peak dBFS, and 'abs' treats --silence-thresh-delta as an absolute dBFS value. For 'mean' and 'max', the computed value is adjusted by --silence-thresh-delta; for 'abs' the delta is used directly as the threshold.
  • --silence-thresh-delta FLOAT: Silence threshold delta in dB (default: -4)
  • --min-silence-len FLOAT: Minimum silence length in seconds (default: 0.5)
  • --output-dir PATH: Output directory for split segments (default: current directory)

Example:

voicecut audio.mp3 --segment-length 600 --output-dir ./segments

Development

It is recomended to use uv toolset for development.

Testing

There are unittests available in the tests/ directory.

uv run pytest

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

voicecut-0.2.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

voicecut-0.2.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file voicecut-0.2.0.tar.gz.

File metadata

  • Download URL: voicecut-0.2.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for voicecut-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c5cf90b7d52a03cfdda27508986d640a82f5035f3d8b28dcef1502ffaff79e40
MD5 90688eea70102478e2152649454a2a72
BLAKE2b-256 7d0792c49cd9517d1d08b7840e3e4f911b91959a6dd0f0969ba549f3ba496ab6

See more details on using hashes here.

File details

Details for the file voicecut-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: voicecut-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for voicecut-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ac365b7e43696d1b9282b37fc73fdc9bd0d31b24dd56148d6f2a2df041dfeeb8
MD5 6c80010d827d0682570294faa9f8b061
BLAKE2b-256 c040da3d9542a5c31bbd63c2c43d10e0a9714e6853d3b441863b1027a020fca7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page