wav file manupalation
I want get the details of the wave such as its frames into a array of integers. Using fname.getframes we can ge the properties of the frame and save in list or anything for writing into another wav or anything,but fname.getframes gives information not in integers some thing like a "/xt/x4/0w' etc..
But i want t开发者_开发知识库hem in integer so that would be helpful for manupation and smoothening join of 2 wav files
I don't know what library you're using, but it looks like it's probably returning a string of bytes. To get it into a list of integers, you could do something like this:
data = [ord(character) for character in data]
To convert it back, you could do something like this:
data = ''.join(chr(character) for character in data)
If you need to convert the frame data into integers, you can create an array.array('h')
(array of signed 16-bit words) and load it from the frame data using its .fromstring
or .fromfile
methods.
However, I'm almost sure that you can keep the frame data as they are, and manipulate them using functions in the audioop
module.
NumPy can load the data into arrays for easy manipulation. Or SciPy. I forget which.
精彩评论