Saving the Audio Files
#6
by
TalhaNisarMughal
- opened
So I was using this model to perform TTS-hindi but while saving the audio files I faced some errors. So I have resolved the error. If anyone is also facing any error while saving the audio file then you can try this function. It worked for me.
def save_audio_file(output, file):
audio_array = output.numpy().squeeze()
audio_array /=1.414
audio_array *= 32767
audio_array = audio_array.astype(np.int16)
sampling_rate = model.config.sampling_rate
scipy.io.wavfile.write(f"/root/{file}", rate=sampling_rate, data=audio_array)