Practical AI audio utilities for dataset preparation and lightweight audio processing workflows, with both CLI tools and Python APIs.
- trim — cut a WAV file by time range
- stats — compute duration and RMS for a WAV file
- batch-stats — compute statistics for all WAV files in a directory
trim_wav(...)audio_stats(...)
examples/— runnable example scriptstests/— unit tests for core functionality and CLI
# Create virtual environment (optional but recommended)
python -m venv .venv
source .venv/bin/activate
# Install package with development dependencies
pip install -e ".[dev]"
# Show CLI help
python -m labo_ai_audio_tools --helpGenerate example audio:
python examples/generate_sine.pyTrim a WAV file:
python -m labo_ai_audio_tools trim \
examples/sine_1khz.wav \
--start 0.0 \
--end 1.0 \
-o examples/sine_1khz_trimmed.wavCompute basic audio statistics:
python -m labo_ai_audio_tools stats examples/sine_1khz.wavCompute statistics for all WAV files in a directory:
python -m labo_ai_audio_tools batch-stats examples/assets --outdir examples/outThe batch-stats command scans all .wav files directly under the input directory and computes:
duration_secondsrms
The results are exported to:
summary.csvsummary.json
Example command:
python -m labo_ai_audio_tools batch-stats examples/assets --outdir examples/outCSV format:
filename,duration_seconds,rms
from labo_ai_audio_tools import trim_wav, audio_stats
trim_wav("input.wav", "output.wav", start_sec=0.0, end_sec=1.0)
stats = audio_stats("output.wav")
print(stats)Run the included demos:
python examples/demo_trim.py
python examples/demo_stats.py
python examples/demo_batch_stats.pyExample output:
filename,duration_seconds,rms
tone_a.wav,0.5,0.3535
tone_b.wav,1.0,0.1767Install development dependencies:
pip install -e ".[dev]"Run linting:
ruff check .Run type checking:
mypy labo_ai_audio_toolsRun tests:
pytestShort term
- Add batch dataset preprocessing CLI
- Add SNR and peak-level statistics
Mid term
- Add simple denoise and enhancement baselines
- Add dataset visualization tools
Long term
- Add dataset preparation pipelines for ML workflows
- Add optional backend support for additional audio formats
Apache License 2.0. See the LICENSE file for details.