Code: Select all
import numpy as np
SAMPLE_RATE=48000
DURATION=10.0
audio_out = []
# a simple ramp over the entire duration
for t in range(int(SAMPLE_RATE * DURATION)):
audio_out.append(t / (SAMPLE_RATE * DURATION))
raw_out = np.array(audio_out, dtype=np.float32)
data.astype('float32').tofile("result10.raw")Also, if I convert the raw file to a wav using sox, it also loads the resulting wav correctly:
Code: Select all
$ sox -r 48000 -e float -b 32 -c 1 result10.raw result10.wavI have checked the obvious - endianness - yes, my raw files are in little-endian, and I'm selecting this when importing. I tried big-endian too, just to make sure it wasn't something simple like that. I also checked that my python code isn't producing values too small to represent with a float32, it's not.
This seems like a definite bug to me, because if I keep my files small (about a tenth of the size I actually need to use) then it imports correctly. It's only for files above a size somewhere between 192kB and 1.92MB that things break.