snakers4 / silero-models

Silero Models: pre-trained speech-to-text, text-to-speech and text-enhancement models made embarrassingly simple
Other
4.86k stars 303 forks source link

hi i have one question about tts #207

Closed GGuPP-git closed 1 year ago

GGuPP-git commented 1 year ago

when i run my code it hangs and just closes.


import time
import torch

language = 'ru'
model_id = 'ru_v3'
sample_rate = 48000
speaker = 'baya'
put_accent = True
put_yo = True
device = torch.device('cpu')
text = "Приветствую дорогой друг"

model, _= torch.hub.load(repo_or_dir='snakers4/silero-models',
                                       model='silero_tts',
                                       language=language,
                                       speaker=model_id)
model.to(device)

audio = model.apply_tts(text=text,
                        speaker=speaker,
                        sample_rate=sample_rate,
                        put_accent=put_accent,
                        put_yo=put_yo)

print(text)

sd.play(audio, sample_rate)
time.sleep( len(audio) / sample_rate +50)
![image](https://user-images.githubusercontent.com/86510219/222802168-69002f7e-6b06-480e-907a-6a4811ee5d1c.png)

sd.stop()```
GGuPP-git commented 1 year ago

image

snakers4 commented 1 year ago

Looks like you have found a solution?

GGuPP-git commented 1 year ago

yes, thx

GGuPP-git commented 1 year ago

should have been replaced model_id = 'ru_v3' on model_id = 'v3_1_ru'