According to this, PCM_FORMAT_S16_LE
is Signed 16 bit samples for each channel (Little Endian byte order). When you use numpy.fromstring
without the dtype
argument, it defaults to float
, which is mapped to float64
. So your 1000 samples of 16 bits get converted into only 250 samples of 64 bits.
What I think you should do is:
aaa = numpy.fromstring(data, dtype='<i2')
In the data type, <
states the little endianess, i
the signed integer type, and 2
the 16 bit, or 2 bytes, length.