From IEEE32 float to 32bit integer numpy array (example : audio .wav files)
问题 I read some data which is stored as IEEE32 float in the interval [-1, +1] with A = numpy.fromstring(data, dtype = numpy.float32) But then I don't want to keep the array as float32 , but rather, as 32-bit integers (in [-2^31, +2^31-1] ). I tried by doing simply : A = numpy.fromstring(data, dtype = numpy.int32) # that's wrong! but it provides a bad result. (wrong probably by a multiplicative constant, or another reason?) How to read an array of IEEE32 float in [-1,1] into a 32bits-integer array