studio-tts

Community@sunset1896/studio-tts
Community skill — not reviewed. It was shared by 落嵛 and has not been checked by Neta. Read SKILL.md below before letting an agent use it.
Use it in Cohub

Paste this into your agent's chat — it fetches the skill and follows it.

Use the skill: studio-tts. Run `npx -y @neta-art/neta-search-cli@latest skills use @sunset1896/studio-tts --via site` and follow what it prints. Read its complete output, redirecting it to a temporary file first if necessary, and resolve relative paths from the skill directory it prints.
Install from a terminal
npx -y @neta-art/neta-search-cli@latest skills use @sunset1896/studio-tts
Summary

Make your characters and narrators speak aloud in a voice that fits them, or turn recordings into text.

  • Give any line, greeting or narration a spoken voice: design one from traits like gender, age and pitch, or copy a voice from a short sample.
  • It reads your world first, then asks which character or narration to voice, offering your real character, place and event names.
  • Each character's voice is saved back to your world, so later lines come out in the same voice.
  • Results come as audio files with a playable page listing every take, and you can publish the page as a work.
  • It can also turn audio or video into text with word-by-word timing, which is handy for subtitles. Not for music or sound effects.
SKILL.md
# Studio TTS — Speech Generation / Transcription Skill

Makes "text → anyone's voice" and "audio/video → text" one command inside a Studio world.
The skill is a **functional methodology**: it contains no specific world content; the text, voice attributes and reference audio are all passed in
by the caller, so any character, any language and any material goes through the same flow reliably.

Reply in the user's language. Text the user sees in the deliverable (titles, descriptions, lines) follows the user's language.

The runtime is vendored under this skill's `scripts/` (a trimmed copy of upstream tts-skill + a Studio adapter layer),
with its own venv, installed automatically on first use (torch CPU + omnivoice, optionally faster-whisper).

## When to use this skill

- The user wants to **voice a character**: have a character say a line, a passage of narration, a greeting.
- The user wants **voice cloning**: give a 3–10 second reference audio and reproduce that voice saying new text.
- The user wants **voice design**: create a voice from scratch by gender / age / pitch / accent / dialect.
- The user wants **batch exploration**: generate the same text with several seeds, pick the best and note its seed.
- The user wants **speech to text**: turn an audio/video file into text (with word-level timestamps, optionally translated into English).

## When not to use this skill

- Music, score, ambience, sound effects → `neta generate audio` (suno).
- Real-time chat / roleplay with a character → `create-roleplay`.
- Only images / character portraits → the `generate` image flow.
- Restyling an existing speech web page → `create-web-work`.

## Worldview-aware workflow (default inside a Studio world)

Inside a Studio world this skill follows a "worldview-aware" flow by default: **read the world first, then ask which part to voice, and after generating write the
voice back to the world**. The full methodology is in `references/world-voice.md`; use the `world` subcommand for a quick inventory.

1. **Read the world** → read `manifest.json` and all materials (characters / locations / events / lore), extracting full character information,
   environment and tone; run `studio_tts.py world` for the voice inventory.
2. **Sort the story** → order the main and side lines by events / scenes, marking the voiceable segments (character lines, scene narration,
   main-line / side-line narration).
3. **Take stock of voices** → existing speech Works (`works/audio/*/tracks.json`), character binding status, narrator profile.
4. **Ask** → always ask the user: which part / which character / which narration segment; run a `neta questionnaire`
   round of options built from the world's real content (character, location and event names used directly), or ask in the conversation, in the user's language.
5. **Generate** → if the character already has a voice, reuse the binding (engine+mode+instruct/ref+seed); if not,
   design one from the character material (`voice-design.md`) or clone; design the narrator voice to fit the world's tone.
6. **Bind back** → write the character's voice back to the material (the `bind` subcommand writes the `content` key `voice`); store the narrator voice in
   `works/audio/narrator/binding.json`; the next generation reuses the same voice automatically.

## Capability skeleton (unchanging core)

### Main commands

| Command | Input | Output |
|---|---|---|
| `setup [--with_asr]` | none (first run) | the ready main environment (OmniVoice + ASR); the default engine qwen3-tts also needs `models install qwen3-tts` (weights public, no token) |
| `voice --model <ID>` | `--text` required + mode parameters | `works/audio/<slug>/`: wav + mp3 + player page + tracks.json |
| `transcribe` | `--input` audio/video file | `works/audio/transcribe_<timestamp>/`: json + txt |
| `models` | list / status / install <ID> | model list / install status / download and install a model |
| `history / doctor` | none | history / environment diagnosis |
| `world` | none (reads the manifest + materials + existing speech Works) | worldview voice inventory: characters / locations / events + voice binding status (`--json` for structured output) |
| `bind` | `--character`/`--atom` + `--slug` or explicit parameters | writes the voice back to the material's `content` key `voice` (`--dry-run` to preview) |

### Multiple engines (choose your own TTS model)

`voice --model <ID>` supports: `qwen3-tts` (**default**, all public variants, no token), `omnivoice` (installed,
runs directly on CPU), `spark-tts` (CPU friendly, installed), `f5-tts`; `cosyvoice2` / `index-tts2` /
`fish-speech` are manual installs (separate conda/GPU environments). Each engine has its own venv, without polluting the others.

- Install: `python3 studio_tts.py models install <ID>` (creates the venv, installs dependencies and downloads weights automatically);
  in mainland China add `--source modelscope` to download from ModelScope (every model has a mirror repo there)
- Full notes: `references/models.md` (download methods, model comparison, caveats)
- Engine choice follows the "2026 Open-Source TTS Selection Guide": CosyVoice 2 first for Chinese, Qwen3-TTS for low latency,
  IndexTTS2 for emotion control, Spark-TTS for CPU without a GPU

### Three generation modes (voice --mode)

- `auto`: text only, the model picks a voice automatically (fastest check).
- `design`: `--instruct "male, middle-aged, low pitch"` generates from attributes (to create a character's voice).
- `clone`: `--ref_audio ref.wav [--ref_text "reference transcript"]` clones a reference voice (copy a real person / an existing voice).

### Data flow (input → action → output at each step)

1. **Read the world / set parameters** → first read the world, sort the story and ask the user which part to make, following the "worldview-aware workflow";
   then settle the text, mode, **engine (--model)**, seed and batch size; for design mode see
   `references/voice-design.md` for attributes, and `references/models.md` to compare engines.
2. **Generate** → run `voice`; same seed + same parameters = same audio (reproducible); in a batch each gets its own seed.
   External engines (spark/qwen/f5) run in backend runners in their own venvs, without polluting the main environment.
3. **Save** → wav (raw) + mp3 (web playback) are written to `works/audio/<slug>/audio/`;
   the player page `index.html` lists every track (each collapsible section has the reproducible command);
   `tracks.json` is for programmatic use (AVG voice-over, character card voices, etc.), with an engine field.
4. **Publish** (speech) → `neta work init web` + `neta work publish web` (see
   `references/studio-integration.md`).
5. **Deliver** → hand over the Work link or file path with interaction-components; include the reproducible command.
6. **Transcribe** (separate path) → `transcribe` outputs json/txt; deliver the file paths directly.

### Reproducibility (the most important unchanging constraint of this skill)

- Fixed `--seed` + all generation parameters = exactly the same audio.
- Every generation is written to the SQLite history, and the reproducible command is always available (player page / `history --show_cmd`).
- When giving a character a voice, record the `instruct` (or reference audio) + seed in the character material to reuse it reliably.

## Build flow (run by the agent)

```bash
# 0. Read the world (worldview-aware, no TTS environment needed): characters / locations / events / existing voice inventory
python3 /workspace/.agents/skills/studio-tts/scripts/studio_tts.py world

# 0. First time: install the environment (TTS about 10–20 minutes; add --with_asr if transcription is needed)
python3 /workspace/.agents/skills/studio-tts/scripts/studio_tts.py setup --with_asr

# 1. Generate speech (example: voice design mode)
python3 /workspace/.agents/skills/studio-tts/scripts/studio_tts.py voice \
  --text "Hello, welcome." \
  --mode design --instruct "male, middle-aged, low pitch" \
  --seed 42 --slug demo-voice --title "Example · Line"

# 2. Publish as a Studio Work
node /mods/neta/neta work init web works/audio/demo-voice --title "Example · Line"
node /mods/neta/neta work publish web works/audio/demo-voice

# 3. Transcribe material
python3 /workspace/.agents/skills/studio-tts/scripts/studio_tts.py transcribe \
  --input meeting.mp4 --language zh
```

> Parameter details for generation/transcription are in `references/params.md`; voice attribute combinations in
> `references/voice-design.md`; publishing and delivery rules in `references/studio-integration.md`.

## Quality checklist

- [ ] The world was read and inventoried: `world` output includes characters / locations / events and existing voices
- [ ] The user was asked which part / which character / which narration to make; nothing picked on your own
- [ ] When the character already has a voice, the binding was reused (engine+instruct+seed match)
- [ ] A new character voice was written back to the material (`bind` subcommand / `content` key `voice`); the narrator saved to `narrator/binding.json`
- [ ] Generation succeeded: `works/audio/<slug>/` has wav (+ mp3) + index.html + tracks.json
- [ ] The player page opens, every track plays, and the reproducible-command section is there
- [ ] `work init` + `work publish` done, `meta.json` is `ready` with a `preview.url`
- [ ] The reply delivered the Work link or file path, with the reproducible command
- [ ] Transcription: both json (word-level timestamps) + txt exist, and the text preview matches the audio
- [ ] No music / sound-effect request was routed into this skill by mistake
- [ ] It has been run once against a real target (this skill was verified with world characters when it was built)

## Resources

- `references/world-voice.md`: the worldview-aware workflow — full rules for reading the world / sorting the story / inventory / asking / generating / binding back.
- `scripts/studio_tts.py world`: worldview voice inventory (reads the manifest + materials + existing speech Works, no TTS environment needed).
- `scripts/studio_tts.py bind`: writes a character's voice back to the material (content key `voice`; the Chinese key name used by older materials is still read) for automatic reuse later.
- `references/params.md`: every voice/transcribe parameter and default.
- `references/voice-design.md`: design mode attribute categories, options and common combinations.
- `references/models.md`: multi-engine registry, how to download each model, model comparison, caveats.
- `references/studio-integration.md`: folder structure, Work publishing, delivery, error handling, boundaries.
- `scripts/studio_tts.py`: the single entry point (setup/voice/transcribe/models/history/doctor).
- `scripts/backends/`: external engine runners (run_spark/run_qwen/run_f5).
- `scripts/requirements*.txt`: dependency lists per engine (requirements.txt main environment / -spark / -qwen / -f5), installed by `models install`.
- `scripts/tts_skill/`: the vendored upstream package (trimmed, no web service).