Lost_Edge/VoiceGenerator/GenerateDialogue.py
Oleg Petruny 644083344e Voice generator module
Reviewed-on: #5
Co-authored-by: Oleg Petruny <oleg.petruny@gmail.com>
Co-committed-by: Oleg Petruny <oleg.petruny@gmail.com>
2024-12-13 17:41:14 +01:00

12 lines
534 B
Python

import torch
from TTS.api import TTS
# Get device
device = "cuda" if torch.cuda.is_available() else "cpu"
tts = TTS("tts_models/multilingual/multi-dataset/bark").to(device)
tts.tts_to_file(text="Greetings Martin. This is a synthesized speech for future dialogues. \
As you can see [cough] I mean hear... Yes, hear with your own ears, the speech trained from 2min audio is indeed impressive.",
voice_dir=".\\voices\\",
speaker="Test",
file_path=".\\output\\Test.wav")