okay... so re-reading the numpy array documentation I get that it actually has a field for the data type which in this case is int16.. so 16bit signed integer.
I was a bit hung up on this:
Okay... so now that I have an actual idea of how the data is represented I can think about altering the way I want to.
First I wanted to have it converted to mono... so generally you take the left and right samples and average them:
The shape of the new array is this:
And secondly what is the best way to convert the datatype into float? So that I can work with a range of values from -1 to 1.
I was a bit hung up on this:
Output:[[-1 -2]
[ 1 1]
[-4 -3]
...,
[ 4 -2]
[-4 2]
[ 4 -1]]
(44100, array([[-1, -2],
[ 1, 1],
[-4, -3],
...,
[ 4, -2],
[-4, 2],
[ 4, -1]], dtype=int16))
first one is printing out "audio" and the other is printing out "original" from the code of the original post... one is with a lot of commas... (the way I expected it to be after reading the manual) and the other isn't... just drops one in the middle where it doesn't really belong.Okay... so now that I have an actual idea of how the data is represented I can think about altering the way I want to.
First I wanted to have it converted to mono... so generally you take the left and right samples and average them:
length = audio.shape[0] mono = (audio[0:length:1, 0]+audio[0:length:1, 1])/2Now there are two things I am wondering about:
The shape of the new array is this:
Output:(210331,)
This means it's still a n by 2 array, right?And secondly what is the best way to convert the datatype into float? So that I can work with a range of values from -1 to 1.