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

❓ How to rename saved wav files upon saving? #261

Closed ProjCRys closed 10 months ago

ProjCRys commented 10 months ago

❓ Questions and Help

We have a wiki available for our users. Please make sure you have checked it out first.

Okay when I try to run this example it always create a 'test.wav' file. I wanted to have a custom name or file path where it could be saved because I'm working on a project that uses this through multithreading. The 'test.wav' file can only exist once in a folder. There is also no mention of renaming the saved wav file in the documentation, (unless I missed it and please tell me where).

V3 EN

import os import torch

device = torch.device('cpu') torch.set_num_threads(4) local_file = 'model.pt'

if not os.path.isfile(local_file): torch.hub.download_url_to_file('https://models.silero.ai/models/tts/en/v3_en.pt', local_file)

model = torch.package.PackageImporter(local_file).load_pickle("tts_models", "model") model.to(device)

example_text = 'Hello there.' sample_rate = 48000 speaker='en_11'

audio_paths = model.save_wav(text=example_text, speaker=speaker, sample_rate=sample_rate)

image