ComfyUI Node

MegaTTS3

ByteDance's voice-cloning TTS, local and bilingual

By 1038lab·Created about a year ago·Updated about a year ago· 51
MegaTTS3
    • generated_audio
    â—„input_textâ–º
    â—„languageenâ–º
    â—„generation_quality32â–º
    â—„pronunciation_strength1.4â–º
    â—„voice_similarity3.0â–º
    â—„reference_voiceâ–º

    Text in, a cloned voice reads it out - no API key in sight

    MegaTTS3 wraps ByteDance's zero-shot TTS model of the same name as a ComfyUI node, and it's one of the few options that genuinely pulls off bilingual voice cloning: English, Chinese, and code-switching between the two mid-sentence. No cloud, no key, everything runs on your GPU. In the ComfyUI TTS scene the popular kids are IndexTTS and Zonos, while MegaTTS3 is the quiet option people test and then quietly keep around as the backup - partly because its two similarity dials give you real control over whose accent comes through. Want an English speaker to read Mandarin in a specific person's voice? This is the node that makes that weirdly easy.

    How it actually works

    Under the hood are five models running a relay. A g2p frontend turns your text into phonemes and tones; the aligner_lm (a Whisper-based model) analyzes the reference clip so the output can match its rhythm; a duration model predicts per-phoneme timing; then a latent diffusion transformer - the big checkpoint that dominates that diffusion_transformer/ folder - generates the speech latent conditioned on both your text and the reference voice's latent. Finally a WaveVAE decoder turns the latent back into 24 kHz audio, loudness-matched to your reference clip.

    Two of the dials are really classifier-free-guidance weights on that diffusion transformer:

    • pronunciation_strength (p_w) - low keeps the speaker's accent, high forces standard pronunciation. This is the one you raise for cross-lingual cloning.
    • voice_similarity (t_w) - how hard the output hugs the reference voice. Crank it for expressiveness, drop it if the result gets uncanny.

    generation_quality isn't a quality slider in the usual sense - it's the number of diffusion steps. Use 1–5 to iterate fast, 15–32 for finals. The default is 32, which is fine; you mostly turn it down to speed things up.

    The catch that trips everyone up

    ByteDance never released the WaveVAE encoder. So the model can't extract a reference voice's latent from audio alone - every voice needs a pre-extracted .npy feature file sitting next to its .wav in the pack's voices/ folder. If the .npy is missing, you'll get "Voice feature file not found." That's the #1 thing people hit, and it's not your fault.

    Install

    Through ComfyUI Manager, search "ComfyUI-MegaTTS" - or the manual way:

    cd ComfyUI/custom_nodes
    git clone https://github.com/1038lab/ComfyUI-MegaTTS
    cd ComfyUI-MegaTTS
    pip install -r requirements.txt
    

    Restart ComfyUI. The first run automatically downloads the model files from ByteDance's Hugging Face repo into ComfyUI/models/TTS/MegaTTS3/ - a few gigabytes, with the diffusion transformer the heavy one, so don't mistake a slow first run for a hang. It runs in fp16; the README says 4 GB VRAM minimum, 8 GB+ recommended, and I'd want the 8 GB. The node tears the model down and frees VRAM after every run, which helps on low-memory machines at the cost of a reload each generation.

    Wiring and troubleshooting

    The single output, generated_audio (AUDIO), plugs straight into ComfyUI's core Preview Audio node to listen, or into Save Audio / a VHS node to write a file. The language dropdown takes en or zh; long text is auto-chunked (~60 chars for Chinese, ~130 for English).

    • Dropdown is empty → drop .wav + .npy pairs into ComfyUI/custom_nodes/ComfyUI-MegaTTS/voices/ and refresh.
    • "Voice feature file not found" → the .npy is missing. Grab a pre-extracted one (ByteDance's Google Drive, or their GitHub) or use the pack's Voice Maker to prep audio.
    • First run slow → it's downloading models, not frozen.
    • OOM on low VRAM → restart ComfyUI between long generations; the auto model-download + cleanup is already doing what it can.
    Category🧪AILab/🔊Audio

    Inputs (6)

    NameTypeDefaultDescription
    input_textSTRINGEnter the text you want to convert to speech
    languageCOMBOenSelect the language of your input text
    generation_qualityINT32Higher number = better quality but slower generation
    pronunciation_strengthFLOAT1.4How closely to follow the text pronunciation
    voice_similarityFLOAT3.0How similar to the reference voice
    reference_voiceCOMBOSelect a reference voice

    Outputs (1)

    NameTypeDescription
    generated_audioAUDIO—