Metadata-Version: 2.4
Name: twat-audio
Version: 2.7.9
Summary: Audio processing plugin for TWAT
Project-URL: Documentation, https://github.com/twardoch/twat-audio#readme
Project-URL: Issues, https://github.com/twardoch/twat-audio/issues
Project-URL: Source, https://github.com/twardoch/twat-audio
Author-email: Adam Twardoch <adam+github@twardoch.com>
License-Expression: MIT
License-File: LICENSE
Keywords: audio,processing,twat-plugin
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.10
Requires-Dist: pedalboard>=0.8.6
Requires-Dist: twat>=1.8.1
Provides-Extra: all
Requires-Dist: twat-mp[all]>=2.6.4; extra == 'all'
Requires-Dist: twat>=1.8.1; extra == 'all'
Provides-Extra: dev
Requires-Dist: absolufy-imports>=0.3.1; extra == 'dev'
Requires-Dist: mypy>=1.15.0; extra == 'dev'
Requires-Dist: pre-commit>=4.1.0; extra == 'dev'
Requires-Dist: pyproject-pyupgrade>=0.1.1; extra == 'dev'
Requires-Dist: pyupgrade-directories>=0.3.0; extra == 'dev'
Requires-Dist: pyupgrade>=3.19.1; extra == 'dev'
Requires-Dist: ruff>=0.9.7; extra == 'dev'
Provides-Extra: docs
Requires-Dist: myst-parser>=3.0.0; extra == 'docs'
Requires-Dist: sphinx-autodoc-typehints>=2.0.0; extra == 'docs'
Requires-Dist: sphinx-rtd-theme>=2.0.0; extra == 'docs'
Requires-Dist: sphinx>=7.2.6; extra == 'docs'
Provides-Extra: parallel
Requires-Dist: twat-mp[all]>=2.6.4; extra == 'parallel'
Provides-Extra: test
Requires-Dist: coverage[toml]>=7.6.12; extra == 'test'
Requires-Dist: pytest-asyncio>=0.25.3; extra == 'test'
Requires-Dist: pytest-benchmark[histogram]>=5.1.0; extra == 'test'
Requires-Dist: pytest-cov>=6.0.0; extra == 'test'
Requires-Dist: pytest-xdist>=3.6.1; extra == 'test'
Requires-Dist: pytest>=8.3.4; extra == 'test'
Description-Content-Type: text/markdown

# twat-audio

`twat-audio` is the audio-file domain package for the `twat` ecosystem. It preserves the existing Pedalboard resampling API and adds deterministic ffmpeg-backed helpers for common audio-file workflows.

## Requirements

- Python 3.10+
- `pedalboard` for resampling
- `ffmpeg`/`ffprobe` for metadata, trimming, extraction, normalization, and muxing helpers

## Python API

```python
from twat_audio import AudioProcessConfig, resample_audio, normalize_audio, trim_audio

resample_audio(AudioProcessConfig("input.wav", "speech-16k.wav", target_samplerate=16000.0))
normalize_audio("input.wav", "normal.wav")
trim_audio("input.wav", "intro.wav", start=0, duration=5)
```

Implemented helpers:

- `resample_audio`: existing Pedalboard resampling behavior.
- `audio_metadata`: ffprobe metadata.
- `normalize_audio`, `trim_audio`, `extract_audio`.
- `replace_audio`: import/replace media audio tracks.
- `simple_effect`: explicit ffmpeg audio filter helper for deterministic effects.
- `generate_audio`: optional thin adapter to `twat_genai` audio providers.

Speech-specific STT, TTS, and dubbing orchestration belong in `twat_speech`; this package stays focused on audio files and signals.

## CLI

```bash
python -m twat_audio --help
python -m twat_audio resample input.wav speech.wav --samplerate 16000
python -m twat_audio normalize input.wav normal.wav --dry-run
python -m twat_audio trim input.wav clip.wav --start 2 --duration 5 --dry-run
python -m twat_audio extract movie.mp4 voice.wav --dry-run
python -m twat_audio replace silent.mp4 voice.wav dubbed.mp4 --dry-run
```

## Reference scripts

The audio portions of `vidimportaudio`, `vidpredub.py`, `viddub-*`, and `vidreverb.py` are represented here only where they are deterministic audio-file operations. Dubbing plans, speech provider calls, transcript handling, and subtitle work live in `twat_speech`.
