I have some data that I assume is wav
data. If I use:
soundfile.write(filepath, my_data, samplerate)
, then it correctly writes a wav
file. But I want to somehow convert that wav data to int16
as currently it's some sort of float
:
[0.0018415 0.00730521 0.01155283 ... 0.10048427 0.09344029 0.08903081]
with
max 0.3002103
min -0.33075073
It came from a process in https://github.com/santi-pdp/segan_pytorch
Is there some way for me to convert to int16
this without having to save and then read a file?
Answer was simple enough:
my_data = (my_data * 32767).astype(np.int16)