Reputation: 427
I'm working on a python project I'm strangled in converting a ByteArray having audio data to int16 in python.
Can someone give a heads-up?
I have used libraries such as jep (python).
Can someone shed some light on this?
Upvotes: 1
Views: 1630
Reputation: 4432
If you need to go forward to deal with int16 dtype for something custom, I guess you'll need to use something like numpy.array like this (not checked):
import numpy as np
# read file or stream in binary mode into a bin_array list
...
# convert binary input values to numpy array with container type int16
np.array([v for v in bin_array], dtype=np.int16)
Upvotes: 2