how to save clone voice ?
#101
by
ruibin001
- opened
outputs = model.synthesize(
"It took me quite a long time to develop a voice and now that I have it I am not going to be silent.",
config,
speaker_wav="/data/TTS-public/_refclips/3.wav",
gpt_cond_len=3,
language="en",
)
how to deal outputs to save it as wav file ?
@ruibin001 you can use the following code to achieve it:
import numpy as np
import scipy.io.wavfile as wavfile
def save_wav(wav: np.ndarray, sample_rate: int = 24000, filename='output.wav') -> None:
wav_norm = wav * (32767 / max(0.01, np.max(np.abs(wav))))
wav_norm = wav_norm.astype(np.int16)
wavfile.write(filename=filename, rate=sample_rate, data=wav_norm)
save_wav(outputs["wav"])