Skip to content

Instantly share code, notes, and snippets.

@janvarev
Created November 9, 2025 11:28
Show Gist options
  • Select an option

  • Save janvarev/f39d09f1e067143148fbd5765d117a63 to your computer and use it in GitHub Desktop.

Select an option

Save janvarev/f39d09f1e067143148fbd5765d117a63 to your computer and use it in GitHub Desktop.
# Плагин TTS для голосового помощника Ирины https://github.com/janvarev/Irene-Voice-Assistant с клонированием голоса по образцу.
# (Версия получена путем копии из телеграм-канала, не тестировалась, и обновляться не будет. Приведена для референса)
# От автора: Уже пробно подключил плагином мультиязыковую tts_models/multilingual/multi-dataset/xtts_v2
# pip install tts
import os
from vacore import VACore
def start(core:VACore):
manifest = {
"name": "TTS xtts",
"version": "0.1",
"require_online": True,
"default_options": {
"speaker_wav": "kuzia.wav"
},
"tts": {
"xtts": (init,None,towavfile)
}
}
return manifest
def start_with_options(core:VACore, manifest:dict):
pass
modname = os.path.basename(__file__)[:-3]
def init(core:VACore):
options = core.plugin_options(modname)
import torch
from TTS.api import TTS
device = "cuda" if torch.cuda.is_available() else "cpu"
core.tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)
def towavfile(core:VACore, text_to_speech:str, wavfile:str):
text_to_speech = text_to_speech.replace("…","...")
text_to_speech = core.all_num_to_text(text_to_speech)
options = core.plugin_options(modname)
speaker_wav = options["speaker_wav"]
# Text to speech to a file
path = core.tts.tts_to_file(text=text_to_speech, speaker_wav=speaker_wav, language="ru", file_path=wavfile)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment