Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a2375e6daf | |||
| 8504126d4a | |||
| 4dc4ffa58c | |||
| 26b38811cc | |||
| 1d63461e35 | |||
| 5f1e2e67a4 | |||
| c23b1d42bf | |||
| b2866d073c | |||
| a889c68e40 |
Executable
+31
@@ -0,0 +1,31 @@
|
||||
import time
|
||||
|
||||
import sounddevice as sd
|
||||
import torch
|
||||
|
||||
language = 'ru'
|
||||
model_id = 'ru_v3'
|
||||
sample_rate = 48000 # 48000
|
||||
speaker = 'aidar' # aidar, baya, kseniya, xenia, random
|
||||
put_accent = True
|
||||
put_yo = True
|
||||
device = torch.device('cpu') # cpu или gpu
|
||||
text = "Хауди Хо, друзья!!!"
|
||||
|
||||
model, _ = torch.hub.load(repo_or_dir='snakers4/silero-models',
|
||||
model='silero_tts',
|
||||
language=language,
|
||||
speaker=model_id)
|
||||
model.to(device)
|
||||
|
||||
|
||||
def va_speak(what: str):
|
||||
audio = model.apply_tts(text=what + "..",
|
||||
speaker=speaker,
|
||||
sample_rate=sample_rate,
|
||||
put_accent=put_accent,
|
||||
put_yo=put_yo)
|
||||
|
||||
sd.play(audio, sample_rate * 1.05)
|
||||
time.sleep((len(audio) / sample_rate) + 0.5)
|
||||
sd.stop()
|
||||
Reference in New Issue
Block a user