# dsh-voice-studio

> **Language:** [English](README.md) · [Česky](README.cs.md)

DeepSeek Harness plugin for local text-to-speech, voice cloning and
best-effort dubbing, with a settings GUI and a model-callable `dsh_voice` tool.

## Features

- **TTS** — local via **XTTS v2** (quality + cloning) or **Piper** (fast), or
  the **ElevenLabs** API.
- **Voice cloning** — clone a voice from a short or long sample and synthesize
  new speech.
- **Voice combination** — experimental mixing (currently clones from the primary
  sample; full mixing is a roadmap item).
- **Dubbing** — transcribe media with **faster-whisper** and re-synthesize the
  transcript locally.
- **Settings section "Voice Studio"** — backend, engine, language, API key,
  sample path.
- Cooperates with `dsh-resource-guard` (reserves memory before local synthesis).

## Requirements (local backend)

- `python3` on PATH (creates `~/.dsh/voice-studio-venv` automatically).
- First run downloads XTTS v2 and faster-whisper models.
- `ffmpeg` on PATH for dubbing video files.
- For the Piper engine, a Piper voice model in `~/.local/share/piper/`.

## Install

```sh
dsh plugin --profile web add dsh-voice-studio
```

Then add `dsh-voice-studio` to `dsh.profile.bundles` and `dependencies` in
`~/.dsh/profiles/web/package.json`, and run `dsh plugin --profile web install`.

## Usage

Ask the agent:

- `dsh_voice action=tts text="Ahoj světe"` — synthesize.
- `dsh_voice action=clone text="Hello" sample=/abs/voice.wav` — clone + synthesize.
- `dsh_voice action=dub media=/abs/video.mp4` — transcribe + re-synthesize.

Outputs are written to `~/.dsh/voice-studio-outputs/`.

## Settings

| Field | Default | Meaning |
| --- | --- | --- |
| `backend` | `local` | `local` or `api` (ElevenLabs). |
| `ttsEngine` | `xtts` | `xtts` (quality + cloning) or `piper` (fast). |
| `language` | `cs` | `cs` or `en`. |
| `apiKey` | `` | ElevenLabs `xi-api-key`. |
| `voiceId` | `` | ElevenLabs voice id (backend `api`). |
| `samplePath` | `` | Default sample for cloning. |

## Architecture

- **Host** (`lib/index.js`) — spawns `worker/voice_worker.py` (stdlib HTTP
  server on `127.0.0.1:7862`) into `~/.dsh/voice-studio-venv`, calls its
  `/tts`, `/clone` and `/dub` endpoints, and implements the ElevenLabs path.
- **Client** (`lib/client.js`) — `settings.section` with configuration, text
  input, and Synthesize / Clone / Dub buttons.

## License

MIT
