diff options
| author | historia <historiavg@proton.me> | 2026-08-24 01:57:13 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-24 01:58:17 -0400 |
| commit | c02d66b2d3221c0c5f5e8f2cb2ae218f1e325a0a (patch) | |
| tree | e9ec4f35c18102d4624d3cd59358d192be7bbfcb /README.md | |
| parent | 194c63e4d11e6de9792a736a7b99788f1db78741 (diff) | |
| download | tts-audiobook-generator-c02d66b2d3221c0c5f5e8f2cb2ae218f1e325a0a.tar.gz | |
feat: manage venv for all backends
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 124 |
1 files changed, 24 insertions, 100 deletions
@@ -15,19 +15,31 @@ The converter sends text extracted from your books to a locally running TTS serv ## Prerequisites -- Python 3.12 +- Python 3.12+ - ffmpeg ## Installation -Create a python 3.12 environment, clone the repo, and install the requirements. +Clone the repo. No manual environment setup is needed — `audiobook.py` +creates and manages its own virtual environment (`envs/tts`) the first time +it runs, installing its requirements and any backend TTS packages into it. ```bash -conda create -n audiobook python=3.12 -y -conda activate audiobook git clone https://git.historia.vg/git/tts-audiobook-generator cd tts-audiobook-generator -pip install -r requirements.txt +python audiobook.py +``` + +On first launch `audiobook.py` creates `envs/tts` (via `python -m venv`), +installs `requirements.txt` into it, and re-launches itself inside that +environment. Backend packages (`qwen-tts`, `faster-qwen3-tts[demo]`) are +pip-installed into the same venv by their setup wizards. + +To add extras manually (e.g. FlashAttention), pip-install into the managed +venv directly: + +```bash +envs/tts/bin/python -m pip install flash-attn ``` Put your book files (epub, etc.) in the `input/` directory. The output goes to `output/`. @@ -42,11 +54,12 @@ python audiobook.py A full-screen TUI opens and shows each backend's status in a table — **unavailable** (red, name dimmed: not installed and no server running), **installed** (orange), or **running** (green, when an external server is already accepting connections on its configured port). From the menu you can: -- **Convert books…** — process the `input/` directory with a ready/running backend (it reads the backend's `server.json` / `voices.json` so you pick the model and voice from menus), or +- **Convert books…** — process the `input/` directory with a ready/running backend (it reads the backend's `server.json` / `voices.json` so you pick the model and voice from menus). If the server isn't running you're offered to start it automatically; after the conversion you're asked whether to stop it, or - **Set up a backend…** — clone, build, and configure a backend end-to-end (audio.cpp, qwen, faster), or -- **Configure a backend…** — regenerate its config (a new `server.json`, rebuild `voices.json`, change ports/speaker). +- **Configure a backend…** — regenerate its config (a new `server.json`, rebuild `voices.json`, change ports/speaker), or +- **Server…** — manually start or stop a configured backend's server (the hub spawns it in the managed venv and polls until it accepts connections). -**Convert books…** and **Configure a backend…** only appear once at least one backend is installed or running. +**Configure a backend…** and **Server…** only appear once at least one backend is installed or running. Everything the TUI does can also be scripted with flags: `python audiobook.py --backend audiocpp --model higgs --voice narrator`, or `python -m backends.audiocpp --families higgs_audio_tts --clone --build-backend cuda`. @@ -79,100 +92,11 @@ You need one of the following backends (the TUI sets them up for you; manual ste Other options including backend server URLs/ports are configured in `converter/config.py` -## Backend Option 1: audio.cpp - -`audiocpp` is an easy to use server that hosts numerous TTS model families. - -### Download and build audiocpp_server - -Download and build `audiocpp_server` for your platform and backend `(cuda, vulkan, hip, cpu)`. Check [audio.cpp's readme](https://github.com/0xShug0/audio.cpp) for details. I'm using one of the helper scripts: - -```bash -git clone https://github.com/0xShug0/audio.cpp -cd audio.cpp -scripts/build_linux.sh --backend cuda --target audiocpp_server -``` - -### Install models - -Download model packages with the python model manager script from the audio.cpp checkout. Each installs to `./models`. Here are two examples, Higgs Audio and Qwen3-TTS: - -```bash -python tools/model_manager_v2.py install higgs_audio_tts_4b_q8_0 -python tools/model_manager_v2.py install qwen3_tts_1_7b_base_q8_0 -python tools/model_manager_v2.py install qwen3_tts_1_7b_customvoice_q8_0 -``` - -You can run `python tools/model_manager_v2.py list` to see all available models. - -### Create server.json - -Create a `server.json` config file. One server can host multiple models and multiple cloned voices. The `id:` fields are the model names you will set for `tts-audiobook-generator` with `--model`. - -The easiest way is the TUI: run `python audiobook.py`, choose **Set up a backend… → audio.cpp**, and it clones `audio.cpp` into `./audio.cpp` (or reuses an existing checkout), builds `audiocpp_server`, lets you pick model families/packages from an expandable checkbox tree (reading the checkout's `model_specs/`), transcribes `.wav` voices with `whisper`, writes `server.json` into the checkout, syncs `converter/config.py`, and prints the launch command. Run it directly with `python -m backends.audiocpp` (flags like `--wavs`, `--families`, `--build-backend`, `--clone` skip the corresponding screens for scripting). Make sure you're in a Python environment that has `whisper` (i.e. `conda activate audiobook` before running). The Qwen3-TTS model tree also offers hosting the VoiceDesign package as a `vdes` entry (see [Voice design](#voice-design) below). - -```json -{ - "host": "127.0.0.1", - "port": 8080, - "backend": "cuda", - "lazy_load": true, - "voice_dir": "/path/to/clone/wavs", - "models": [ - { - "id": "higgs", - "family": "higgs_audio_tts", - "path": "models/Higgs-Audio-v3-TTS-4B-GGUF", - "task": "tts", - "mode": "offline" - }, - { - "id": "qwen", - "family": "qwen3_tts", - "path": "models/Qwen3-TTS-12Hz-1.7B-CustomVoice-GGUF", - "task": "tts", - "mode": "offline" - }, - { - "id": "qwen-clone", - "family": "qwen3_tts", - "path": "models/Qwen3-TTS-12Hz-1.7B-Base-GGUF", - "task": "tts", - "mode": "offline" - } - ] -} -``` - -### Run audio.cpp and the audiobook script - -Run the server with this config file. The `audiocpp_server` path will be slightly different depending on your platform and build options: - -```bash -./build/linux-cuda-release/bin/audiocpp_server --config server.json -``` - -In a different terminal, run `audiobook.py`. Pick the TTS `--model` and `--voice` from server.json: - -```bash -# Higgs Audio (clone-only) -python audiobook.py --backend audiocpp --model higgs --voice narrator - -# Qwen3-TTS built-in speaker -python audiobook.py --backend audiocpp --model qwen - -# Qwen3-TTS voice cloning -python audiobook.py --backend audiocpp --model qwen-clone --voice narrator - -# Qwen-TTS voice design -python audiobook.py --backend audiocpp --model qwen-design \ - --instructions "A warm adult female narrator with a British accent" -``` - -## Other TTS Backends +## TTS Backend Setup -Installation and usage documentation for other supported TTS backends is in the `docs/` directory: +Installation and usage documentation for each supported TTS backend is in the `docs/` directory: +- [audio.cpp instructions](docs/backend-audiocpp.md) - [qwen-tts instructions](docs/backend-qwen.md) - [faster-qwen-tts instructions](docs/backend-faster.md) |
