IndexTTS2 Local Speech Synthesis: Reusing the Pre-Loaded WebUI Model for Voiceover TTS

Preface

When the local IndexTTS2 WebUI is already running, a common approach to let an Agent or script convert text to wav is to import IndexTTS2 again and start a separate inference process. This loads a second copy of the model, often doubling VRAM usage, and inference on Apple Silicon can take a very long time. The Skill introduced below takes a different path: using gradio_client to call the current WebUI backend’s /gen_single, which follows the same chain as clicking “Generate Speech” on the page, without re-occupying VRAM. It is suitable for voiceovers, narration, and cloning preset voiceprints.

What is this

IndexTTS2 Local Text-to-Speech (SkillHub coordinates @user_d0c0b7f4/index-tts2-skills, version 1.0.1, source community, category design-media) is a set of Agent-oriented SKILL.md skills. The publisher is user_d0c0b7f4, tag requires_api_key=false, and installation and use do not require an extra API Key.

The positioning can be summarized as: generating speech on a locally running IndexTTS2 WebUI; invoking /gen_single via gradio_client to reuse the TTS model already loaded in the WebUI process. It is suitable for local synthesis of voiceovers/narration, cloning saved preset voiceprints (e.g., the example named Hai in the documentation), or automating the IndexTTS2 generation workflow locally.

Core Functions

Based on the SkillHub introduction and the skill package SKILL.md documentation, verified capabilities include:

  1. Reuse WebUI Process: Does not load the model a second time, avoiding double VRAM usage.
  2. Preset Voiceprint Driven: Reads reference audio from outputs/presets/{name}/ (includes the default example Hai; in a real environment you can switch to your own preset name).
  3. Scripted Generation: The core script scripts/generate_tts.py dynamically aligns with the /gen_single parameter signature and prints OUTPUT:{absolute_path} upon success, making it easy for Agents or pipelines to parse.
  4. WebUI Lifecycle: Checks 127.0.0.1:7860 by default; if not listening, you can start webui.py in the background in the IndexTTS2 project directory (you can use --no-auto-start to make it fail directly).
  5. Governance Extensions (Skill Package v2 Documentation): Optional --verify-ref to verify reference wav SHA-256, --speed to adjust speed using FFmpeg atempo, pronunciation-lexicon.json to correct proper noun pronunciation, and writes a .manifest.json manifest.

Notes when calling /gen_single (Summary from skill package references/api_reference.md): emo_control_method must pass option text instead of a numeric index; the voiceprint reference must be wrapped in a Gradio FileData; the return value is a gr.update dictionary, and the actual wav is usually located in outputs/spk_{timestamp}.wav.

Installation and Enabling

The SkillHub page requires installing this skill according to SkillHub Installation Instructions. First, confirm the CLI:

command -v skillhub && skillhub --version

If not installed, you can run the full installation (documentation recommends CLI + default Skill):

curl -fsSL https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/install.sh | bash

When installing the skill, you must use --dir to point to the current Agent’s skills directory; otherwise, it defaults to ./skills/ and will not be recognized. Common paths are as follows (excerpted from the installation documentation):

Agent / Environment skills directory
Cursor ~/.cursor/skills/
Claude Code ~/.claude/skills/
Codex ~/.codex/skills/ or .agents/skills/ in the project
WorkBuddy ~/.workbuddy/skills/

Installation command example (replace <skills directory> with the corresponding path from the table above):

skillhub install @user_d0c0b7f4/index-tts2-skills --dir <skills directory>

After installation, the skills directory should contain files like SKILL.md, scripts/generate_tts.py, etc.; the Agent can read SKILL.md to call the workflow.

Typical Usage

Prerequisites

  1. IndexTTS2 is installed locally, and webui.py can be started via uv run (the skill documentation defaults the project path to ~/Documents/index-tts-main, which can be overridden with --project).
  2. The preset directory outputs/presets/{name}/ exists, containing prompt.wav and supporting configuration (example preset name Hai).
  3. gradio_client is installed along with the WebUI dependencies; it is recommended to call the script using uv run python inside the IndexTTS2 project directory.

Workflow Overview

  1. Confirm that the WebUI is listening on 127.0.0.1:7860; if it is not started and auto-start is allowed, you can run it in the project directory:
   nohup uv run webui.py > /tmp/indextts_webui.log 2>&1 &

Loading the model for the first time usually takes 1–2 minutes.
2. Prepare the voiceover copy; for Chinese, you can estimate duration based on approximately 4.5 characters/second (e.g., 20 seconds is about 90 characters).
3. Call the generation script (the skills directory in the path depends on the installation location in the previous section; the example below uses the Cursor default):

   cd ~/Documents/index-tts-main
   uv run python ~/.cursor/skills/index-tts2-skills/scripts/generate_tts.py \
       --text "大家好,今天想跟大伙儿分享一个小习惯……" \
       --preset Hai \
       --output "./hai_tts_demo.wav"
  1. Determine success: if OUTPUT:{absolute_path} appears in the terminal and the target wav file exists; otherwise, check the [index-tts2] log (common causes: WebUI not started, incorrect preset name, invalid emo parameter).

Common parameters: --text (required), --preset (default Hai), --host / --port (default 127.0.0.1:7860), --output, --emo-weight, --emo-mode, --target-seconds, --no-auto-start.

Example of enabling governance options (from skill package documentation):

cd ~/Documents/index-tts-main
uv run python ~/.cursor/skills/index-tts2-skills/scripts/generate_tts.py \
    --text "用 Codex 和扣代克斯都试过" --preset Hai --output ./out.wav \
    --verify-ref --speed 1.12

Applicable Scenarios and Notes

Who is it for: Developers who have already deployed IndexTTS2 locally and want Agents to generate voiceovers without starting another inference process; developers who need fixed preset voiceprints and can hand over the generation path to subsequent editing or publishing workflows.

Limitations and Notes:

  • Relies on the local WebUI and IndexTTS2 environment; it is not cloud-based TTS. If IndexTTS2 is missing, you must complete the installation and model preparation according to the upstream project first.
  • The default port is 7860; if you modified the WebUI port, you must align it using --port.
  • The example preset Hai is for illustration only; your local machine may not have this directory, so you should use your own name under outputs/presets/.
  • SkillHub Statistics (when scraped): Rating 100000, Downloads 913; it is a community source, and you can check the version history and file list on the SkillHub page before use.
  • Apple Silicon (MPS) inference is slower than CUDA, so you need to reserve a longer waiting time; the script will not automatically terminate the WebUI process.

Conclusion

IndexTTS2 Local Text-to-Speech turns “WebUI is running” into a TTS capability callable by Agents: the same /gen_single interface, the same loaded model, bridging automation with OUTPUT: lines and an optional manifest. For installation and details, see SkillHub:

  • Page: https://www.skillhub.cn/skills/user_d0c0b7f4/index-tts2-skills
  • Coordinates: @user_d0c0b7f4/index-tts2-skills
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye