SoproTTSEngine wraps SoproTTS. It is a local reference-audio engine with a
native streaming API, making it one of the more practical low-latency cloning
paths in the Zaphod notes.
pip install "realtimetts[sopro]"For CUDA, install a matching PyTorch and torchaudio build before or after the
Sopro package, then run pip check.
from RealtimeTTS import TextToAudioStream, SoproTTSEngine, SoproTTSVoice
if __name__ == "__main__":
voice = SoproTTSVoice(ref_audio_path="reference.wav")
engine = SoproTTSEngine(device="cuda", voice=voice)
stream = TextToAudioStream(engine)
stream.feed("Hello from SoproTTS.")
stream.play()
engine.shutdown()SoproTTSVoiceacceptsref_audio_path,ref_audio, orprompt_wav_path. The source ignoresref_textandlanguage.- Defaults include
model_name="samuel-vitorino/sopro",device="cuda",max_frames=400,top_p=0.9,temperature=1.05,anti_loop=True,ref_seconds=12.0, andchunk_frames=6. - Passing
cache_dirsets bothHF_HOMEandHF_HUB_CACHEbefore model load, because the Sopro Mimi codec uses Hugging Face environment cache settings. - Reference audio is prepared and cached by path, mtime, and
ref_seconds. - Output is mono 16-bit PCM at Sopro's
TARGET_SR.
- Working install used
sopro==1.5.0,torch==2.11.0+cu128,torchaudio==2.11.0+cu128,transformers==5.8.0,huggingface_hub==1.14.0, andsoundfile==0.13.1. - A sandboxed first load failed when Hugging Face was unreachable; retry with approved network passed.
- NLTK
punkt_tabneeded to be copied into the Sopro venv for local smoke tests. - Default
chunk_frames=6gave good TTFA/abort balance in the benchmark notes;chunk_frames=3improved TTFA but worsened RTF and abort jitter. - Official notes and Zaphod listening notes both warn that cloning quality can be inconsistent; listen to samples before making it a default.
- If offline runs still call Hugging Face, set both
HF_HOMEandHF_HUB_CACHEor passcache_dir. - If startup reports missing NLTK
punkt_tab, install or copy that tokenizer data into the active venv.