I need to send some audio I use a torch based text to speech to generate as a JSON. I cannot find a way to turn it into a base64 without the following awful code:
torchaudio.save('C:/Work/test_images/temp.wav', wav_array, sampling_rate)
wav_file = open('C:/Work/test_images/temp.wav', 'rb')

any ideas how to clean this up? there doesn’t appear to be any built-in functions with torch to do this, but I’m fairly new so would appreciate any help.