Initial commit

This commit is contained in:
Paillat
2023-05-15 10:11:04 +02:00
commit 5410752853
24 changed files with 742 additions and 0 deletions

23
generators/speak.py Normal file
View File

@@ -0,0 +1,23 @@
from TTS.api import TTS
import os
# Running a multi-speaker and multi-lingual model
# List available 🐸TTS models and choose the first one
model_best_multi = "tts_models/en/vctk/vits"
fakenames = {
"Alexander": "p230",
"Benjamin": "p240",
"Amelia": "p270",
"Katherine": "p273"
}
voices = ["Alexander", "Benjamin", "Amelia", "Katherine"]
# Init TTS
def generate_voice(path, text, speaker="Alexander"):
tts = TTS(model_best_multi, gpu=True)
speaker = fakenames[speaker] if speaker in fakenames else speaker
tts.tts_to_file(text=text, file_path=path, speaker=speaker, speed=1)