ComfyUI-kaola-IndexTTS2
3
stars
0
commits
Python
primary language
Feb 2, 2026
updated
ComfyUI custom nodes for IndexTTS-2, a state-of-the-art zero-shot text-to-speech system with advanced emotion control capabilities.
✨ Zero-Shot Voice Cloning - Clone any voice with just a few seconds of reference audio
🎭 Advanced Emotion Control - Control emotions through multiple modalities:
🎯 Speaker-Emotion Disentanglement - Independent control over timbre and emotion
⚡ RTX 5090 Optimized - Support for Blackwell architecture with Blackwell-specific Flash-Attention compilation and cu128 alignment
Clone this repository into your ComfyUI custom nodes directory:
cd ComfyUI/custom_nodes
git clone https://github.com/YOUR_USERNAME/ComfyUI-kaola-IndexTTS2.git
cd ComfyUI-kaola-IndexTTS2
Install the required Python packages:
pip install -r requirements.txt
[!IMPORTANT] External Core Library: The core IndexTTS-2 library is required. You must install it separately and ensure it's in your Python path.
Download the IndexTTS-2 model to your ComfyUI models directory:
# Using huggingface-cli
uv tool install "huggingface-hub[cli,hf_xet]"
hf download IndexTeam/IndexTTS-2 --local-dir=ComfyUI/models/IndexTTS-2
# Or using modelscope
uv tool install "modelscope"
modelscope download --model IndexTeam/IndexTTS-2 --local_dir ComfyUI/models/IndexTTS-2
Loads the IndexTTS-2 model with configurable optimization settings.
Inputs:
model_dir - Path to model directory (default: IndexTTS-2)use_fp16 - Enable FP16 for lower VRAM usageuse_cuda_kernel - Enable compiled CUDA kernelsuse_deepspeed - Enable DeepSpeed accelerationOutputs:
model - Loaded IndexTTS2 model instanceBasic voice cloning using standard ComfyUI AUDIO inputs.
Inputs:
model - IndexTTS2 model from loadertext - Text to synthesizespk_audio_prompt - Reference audio (Connect to LoadAudio output)temperature - Randomness control (0.1-2.0, default 1.0)top_k / top_p - Sampling filters for better naturalnessuse_random - Enable randomness in generationOutputs:
audio - Generated audio (Standard ComfyUI format)Voice synthesis with separate emotion reference audio.
Inputs:
model - IndexTTS2 modeltext - Text to synthesizespk_audio_prompt - Speaker reference audioemo_audio_prompt - Emotion reference audioemo_alpha - Emotion strength (0.0-1.0)use_random - Enable randomnessOutputs:
audio - Generated audioControl emotions via 8-dimensional vector.
Inputs:
model - IndexTTS2 modeltext - Text to synthesizespk_audio_prompt - Speaker reference audiohappy, angry, sad, afraid, disgusted, melancholic, surprised, calm - Emotion intensities (0.0-1.0)use_random - Enable randomnessOutputs:
audio - Generated audioEmotion Vector Format:
[happy, angry, sad, afraid, disgusted, melancholic, surprised, calm]
Control emotions via natural language description.
Inputs:
model - IndexTTS2 modeltext - Text to synthesizespk_audio_prompt - Speaker reference audiouse_emo_text - Auto-extract emotion from main textemo_text - Optional separate emotion descriptionemo_alpha - Emotion strength (0.0-1.0, recommended: 0.6)use_random - Enable randomnessOutputs:
audio - Generated audioMulti-character script dubbing driven by SRT subtitles. Parses an SRT script with character names, matches each line to a voice reference, and assembles the synthesized audio onto the SRT timeline.
Required Inputs:
model - IndexTTS2 modelscript_srt - SRT format script (multiline, see format below)emo_alpha - Emotion strength (0.0-2.0, default 1.0)temperature - Randomness control (0.1-2.0, default 1.0)top_k - Top-K sampling (0-100, default 0)top_p - Top-P sampling (0.0-1.0, default 1.0)use_random - Enable randomness (default False)save_segments - Save individual emotion clips and synthesized clips as downloadable files (default False)segments_prefix - Filename prefix for saved segments (default "dubbing")Optional Inputs:
emo_audio_prompt - Emotion reference audio (auto-sliced by SRT timestamps)voice_1 ~ voice_7 - Up to 7 character voice reference audiosvoice_1_name ~ voice_7_name - Character names corresponding to each voice (e.g., "唐僧")Outputs:
audio - Full assembled dubbed audioSRT Script Format:
Supports standard multi-line SRT format:
1
00:00:01,000 --> 00:00:03,000
唐僧:悟空,你又调皮了。
2
00:00:04,000 --> 00:00:06,500
孙悟空:师父,俺老孙冤枉啊!
Also supports compact single-line SRT:
1 00:00:01,000 --> 00:00:03,000 唐僧:悟空,你又调皮了。
2 00:00:04,000 --> 00:00:06,500 孙悟空:师父,俺老孙冤枉啊!
Character name uses Chinese colon : or English colon : as separator.
Emotion text in parentheses — add emotion descriptions after the character name:
1
00:00:01,000 --> 00:00:03,000
唐僧(高兴的说):悟空,快来看。
2
00:00:04,000 --> 00:00:06,000
孙悟空(愤怒):俺老孙不服!
Both half-width () and full-width () parentheses are supported.
Emotion Priority:
| Priority | Condition | Behavior |
|---|---|---|
| 1 (highest) | Parentheses emotion in script, e.g. 唐僧(高兴的说): | Forced emo_text mode, ignores audio emotion |
| 2 | emo_audio_prompt connected, no parentheses | Slices emotion audio by SRT timestamp |
| 3 (lowest) | Neither | Voice-only synthesis, no emotion control |
Segment Saving:
When save_segments is enabled, individual files are saved to {output}/{segments_prefix}_segments/:
{index}_emo_{character}_{time}.wav — Emotion audio slice for each line{index}_tts_{character}_{time}.wav — Synthesized audio for each lineThese files appear in the ComfyUI output panel for download.
[!NOTE] Core Node Compatibility: We have removed the custom Save/Load nodes to ensure 100% compatibility with ComfyUI core. Use standard LoadAudio for inputs and SaveAudio or PreviewAudio for outputs.
emo_alpha to control emotion strengthsurprised: 0.45, others: 0)use_emo_text to extract emotion from textemo_text for explicit emotion descriptionemo_alpha around 0.6 for natural resultsvoice_1, voice_2, etc.voice_1_name, voice_2_name etc. to match character names in the SRT script (e.g., "唐僧", "孙悟空")emo_audio_promptscript_srt, using 角色名:台词 format唐僧(高兴的说):悟空,快来看。save_segments to export individual audio clips for review[!TIP] An example workflow is available at
examples/05_script_dubbing.json. Import it directly into ComfyUI to get started quickly.
💡 FP16 Mode: Highly recommended for faster inference and lower VRAM usage with minimal quality loss
💡 Emotion Alpha: When using text-based emotion control, use lower emo_alpha values (0.6 or less) for more natural speech
💡 Random Sampling: Enabling use_random adds variety but may reduce voice cloning fidelity
💡 Audio Format: Reference audio should be clear, with minimal background noise
💡 Voice Cloning Accuracy: For best results, use 5-15 seconds of clean, single-speaker reference audio. Avoid background music or noise. Consistent speaking style in the reference yields more stable cloning.
💡 Script Dubbing Timeline: If a synthesized clip is longer than the gap before the next SRT timestamp, the next clip is automatically pushed forward (no truncation). The output may be longer than the original SRT timeline.
Make sure the model is downloaded to the correct location:
ComfyUI/models/IndexTTS-2/config.yaml
ComfyUI/models/IndexTTS-2/[model files]
builder ErrorIf you see ImportError: cannot import name 'builder' from 'google.protobuf.internal', your environment has a Protobuf version mismatch. Fix it with:
pip install protobuf==3.20.3
For the best performance on RTX 5090, ensure your Torch environment is aligned with CUDA 12.8 or higher:
pip install --force-reinstall torch==2.8.0 torchaudio==2.8.0 torchvision==0.23.0 --index-url https://download.pytorch.org/whl/cu128
If flash-attn fails on your 5090, perform a local source compilation:
pip install ninja
pip install flash-attn --no-build-isolation --no-cache-dir
Set mirror endpoint (for users in China):
export HF_ENDPOINT="https://hf-mirror.com"
If you use IndexTTS-2 in your work, please cite:
@article{zhou2025indextts2,
title={IndexTTS2: A Breakthrough in Emotionally Expressive and Duration-Controlled Auto-Regressive Zero-Shot Text-to-Speech},
author={Siyi Zhou, Yiquan Zhou, Yi He, Xun Zhou, Jinchao Wang, Wei Deng, Jingchen Shu},
journal={arXiv preprint arXiv:2506.21619},
year={2025}
}
The official IndexTTS-2 requires internet access to download the wav2vec2bert model from HuggingFace. If you want to use a fully offline setup with local models, you can use the fork version:
# Clone the fork instead of the official repo
git clone https://github.com/kana112233/index-tts.git
cd index-tts
# Install dependencies
GIT_LFS_SKIP_SMUDGE=1 git checkout -f
pip install -e .
# Download to a local directory
huggingface-cli download facebook/w2v-bert-2.0 \
--local-dir /path/to/models/w2v-bert-2.0
Before starting ComfyUI, set the local model path:
export W2V_BERT_PATH="/path/to/models/w2v-bert-2.0"
The fork modifies indextts/utils/maskgct_utils.py to:
W2V_BERT_PATH environment variableThis allows completely offline usage without internet access.
This project follows the license of the original IndexTTS-2 project. For commercial usage, please contact: indexspeech@bilibili.com
Python
98.4%
ComfyUI-kaola-IndexTTS2
3
stars
0
commits
Python
primary language
Feb 2, 2026
updated
ComfyUI custom nodes for IndexTTS-2, a state-of-the-art zero-shot text-to-speech system with advanced emotion control capabilities.
✨ Zero-Shot Voice Cloning - Clone any voice with just a few seconds of reference audio
🎭 Advanced Emotion Control - Control emotions through multiple modalities:
🎯 Speaker-Emotion Disentanglement - Independent control over timbre and emotion
⚡ RTX 5090 Optimized - Support for Blackwell architecture with Blackwell-specific Flash-Attention compilation and cu128 alignment
Clone this repository into your ComfyUI custom nodes directory:
cd ComfyUI/custom_nodes
git clone https://github.com/YOUR_USERNAME/ComfyUI-kaola-IndexTTS2.git
cd ComfyUI-kaola-IndexTTS2
Install the required Python packages:
pip install -r requirements.txt
[!IMPORTANT] External Core Library: The core IndexTTS-2 library is required. You must install it separately and ensure it's in your Python path.
Download the IndexTTS-2 model to your ComfyUI models directory:
# Using huggingface-cli
uv tool install "huggingface-hub[cli,hf_xet]"
hf download IndexTeam/IndexTTS-2 --local-dir=ComfyUI/models/IndexTTS-2
# Or using modelscope
uv tool install "modelscope"
modelscope download --model IndexTeam/IndexTTS-2 --local_dir ComfyUI/models/IndexTTS-2
Loads the IndexTTS-2 model with configurable optimization settings.
Inputs:
model_dir - Path to model directory (default: IndexTTS-2)use_fp16 - Enable FP16 for lower VRAM usageuse_cuda_kernel - Enable compiled CUDA kernelsuse_deepspeed - Enable DeepSpeed accelerationOutputs:
model - Loaded IndexTTS2 model instanceBasic voice cloning using standard ComfyUI AUDIO inputs.
Inputs:
model - IndexTTS2 model from loadertext - Text to synthesizespk_audio_prompt - Reference audio (Connect to LoadAudio output)temperature - Randomness control (0.1-2.0, default 1.0)top_k / top_p - Sampling filters for better naturalnessuse_random - Enable randomness in generationOutputs:
audio - Generated audio (Standard ComfyUI format)Voice synthesis with separate emotion reference audio.
Inputs:
model - IndexTTS2 modeltext - Text to synthesizespk_audio_prompt - Speaker reference audioemo_audio_prompt - Emotion reference audioemo_alpha - Emotion strength (0.0-1.0)use_random - Enable randomnessOutputs:
audio - Generated audioControl emotions via 8-dimensional vector.
Inputs:
model - IndexTTS2 modeltext - Text to synthesizespk_audio_prompt - Speaker reference audiohappy, angry, sad, afraid, disgusted, melancholic, surprised, calm - Emotion intensities (0.0-1.0)use_random - Enable randomnessOutputs:
audio - Generated audioEmotion Vector Format:
[happy, angry, sad, afraid, disgusted, melancholic, surprised, calm]
Control emotions via natural language description.
Inputs:
model - IndexTTS2 modeltext - Text to synthesizespk_audio_prompt - Speaker reference audiouse_emo_text - Auto-extract emotion from main textemo_text - Optional separate emotion descriptionemo_alpha - Emotion strength (0.0-1.0, recommended: 0.6)use_random - Enable randomnessOutputs:
audio - Generated audioMulti-character script dubbing driven by SRT subtitles. Parses an SRT script with character names, matches each line to a voice reference, and assembles the synthesized audio onto the SRT timeline.
Required Inputs:
model - IndexTTS2 modelscript_srt - SRT format script (multiline, see format below)emo_alpha - Emotion strength (0.0-2.0, default 1.0)temperature - Randomness control (0.1-2.0, default 1.0)top_k - Top-K sampling (0-100, default 0)top_p - Top-P sampling (0.0-1.0, default 1.0)use_random - Enable randomness (default False)save_segments - Save individual emotion clips and synthesized clips as downloadable files (default False)segments_prefix - Filename prefix for saved segments (default "dubbing")Optional Inputs:
emo_audio_prompt - Emotion reference audio (auto-sliced by SRT timestamps)voice_1 ~ voice_7 - Up to 7 character voice reference audiosvoice_1_name ~ voice_7_name - Character names corresponding to each voice (e.g., "唐僧")Outputs:
audio - Full assembled dubbed audioSRT Script Format:
Supports standard multi-line SRT format:
1
00:00:01,000 --> 00:00:03,000
唐僧:悟空,你又调皮了。
2
00:00:04,000 --> 00:00:06,500
孙悟空:师父,俺老孙冤枉啊!
Also supports compact single-line SRT:
1 00:00:01,000 --> 00:00:03,000 唐僧:悟空,你又调皮了。
2 00:00:04,000 --> 00:00:06,500 孙悟空:师父,俺老孙冤枉啊!
Character name uses Chinese colon : or English colon : as separator.
Emotion text in parentheses — add emotion descriptions after the character name:
1
00:00:01,000 --> 00:00:03,000
唐僧(高兴的说):悟空,快来看。
2
00:00:04,000 --> 00:00:06,000
孙悟空(愤怒):俺老孙不服!
Both half-width () and full-width () parentheses are supported.
Emotion Priority:
| Priority | Condition | Behavior |
|---|---|---|
| 1 (highest) | Parentheses emotion in script, e.g. 唐僧(高兴的说): | Forced emo_text mode, ignores audio emotion |
| 2 | emo_audio_prompt connected, no parentheses | Slices emotion audio by SRT timestamp |
| 3 (lowest) | Neither | Voice-only synthesis, no emotion control |
Segment Saving:
When save_segments is enabled, individual files are saved to {output}/{segments_prefix}_segments/:
{index}_emo_{character}_{time}.wav — Emotion audio slice for each line{index}_tts_{character}_{time}.wav — Synthesized audio for each lineThese files appear in the ComfyUI output panel for download.
[!NOTE] Core Node Compatibility: We have removed the custom Save/Load nodes to ensure 100% compatibility with ComfyUI core. Use standard LoadAudio for inputs and SaveAudio or PreviewAudio for outputs.
emo_alpha to control emotion strengthsurprised: 0.45, others: 0)use_emo_text to extract emotion from textemo_text for explicit emotion descriptionemo_alpha around 0.6 for natural resultsvoice_1, voice_2, etc.voice_1_name, voice_2_name etc. to match character names in the SRT script (e.g., "唐僧", "孙悟空")emo_audio_promptscript_srt, using 角色名:台词 format唐僧(高兴的说):悟空,快来看。save_segments to export individual audio clips for review[!TIP] An example workflow is available at
examples/05_script_dubbing.json. Import it directly into ComfyUI to get started quickly.
💡 FP16 Mode: Highly recommended for faster inference and lower VRAM usage with minimal quality loss
💡 Emotion Alpha: When using text-based emotion control, use lower emo_alpha values (0.6 or less) for more natural speech
💡 Random Sampling: Enabling use_random adds variety but may reduce voice cloning fidelity
💡 Audio Format: Reference audio should be clear, with minimal background noise
💡 Voice Cloning Accuracy: For best results, use 5-15 seconds of clean, single-speaker reference audio. Avoid background music or noise. Consistent speaking style in the reference yields more stable cloning.
💡 Script Dubbing Timeline: If a synthesized clip is longer than the gap before the next SRT timestamp, the next clip is automatically pushed forward (no truncation). The output may be longer than the original SRT timeline.
Make sure the model is downloaded to the correct location:
ComfyUI/models/IndexTTS-2/config.yaml
ComfyUI/models/IndexTTS-2/[model files]
builder ErrorIf you see ImportError: cannot import name 'builder' from 'google.protobuf.internal', your environment has a Protobuf version mismatch. Fix it with:
pip install protobuf==3.20.3
For the best performance on RTX 5090, ensure your Torch environment is aligned with CUDA 12.8 or higher:
pip install --force-reinstall torch==2.8.0 torchaudio==2.8.0 torchvision==0.23.0 --index-url https://download.pytorch.org/whl/cu128
If flash-attn fails on your 5090, perform a local source compilation:
pip install ninja
pip install flash-attn --no-build-isolation --no-cache-dir
Set mirror endpoint (for users in China):
export HF_ENDPOINT="https://hf-mirror.com"
If you use IndexTTS-2 in your work, please cite:
@article{zhou2025indextts2,
title={IndexTTS2: A Breakthrough in Emotionally Expressive and Duration-Controlled Auto-Regressive Zero-Shot Text-to-Speech},
author={Siyi Zhou, Yiquan Zhou, Yi He, Xun Zhou, Jinchao Wang, Wei Deng, Jingchen Shu},
journal={arXiv preprint arXiv:2506.21619},
year={2025}
}
The official IndexTTS-2 requires internet access to download the wav2vec2bert model from HuggingFace. If you want to use a fully offline setup with local models, you can use the fork version:
# Clone the fork instead of the official repo
git clone https://github.com/kana112233/index-tts.git
cd index-tts
# Install dependencies
GIT_LFS_SKIP_SMUDGE=1 git checkout -f
pip install -e .
# Download to a local directory
huggingface-cli download facebook/w2v-bert-2.0 \
--local-dir /path/to/models/w2v-bert-2.0
Before starting ComfyUI, set the local model path:
export W2V_BERT_PATH="/path/to/models/w2v-bert-2.0"
The fork modifies indextts/utils/maskgct_utils.py to:
W2V_BERT_PATH environment variableThis allows completely offline usage without internet access.
This project follows the license of the original IndexTTS-2 project. For commercial usage, please contact: indexspeech@bilibili.com
Python
98.4%