python-soundfile
python-soundfile copied to clipboard
sf.write crash in Windows with Hi-Fi data
I'm working with some high-quality audio data with 10,000,000 samples and a bitrate of 44,100 samples/sec.
When i do sf.write in .ogg format it crashes without an exception.
Specs
SO: Windows 10 RAM: 8 GB CPU: i5-8 gen Python: 3.7.3 Installed with:
conda install cffi numpy
pip install pysoundfile
Reproduce
import numpy as np
import soundfile as sf
wav = np.asarray([
np.random.normal(size=10000000),
np.random.normal(size=10000000)]
)
# normalize from max_to_min to 1_to_-1
wav = wav - np.amin(wav)
wav = wav / np.amax(wav)
wav = wav * 2 -1
wav = np.swapaxes(wav, 0, 1) # shape (9000000, 2)
sf.write('fote.ogg', wav, 44100)
What happens
The program crashes without exception.
Python just closes with errno -1073741571
No .ogg file is exported.
If i lower the samples to 100,000 the export works fine:
import numpy as np
import soundfile as sf
wav = np.asarray([
np.random.normal(size=100000),
np.random.normal(size=100000)]
)
# normalize from max_to_min to 1_to_-1
wav = wav - np.amin(wav)
wav = wav / np.amax(wav)
wav = wav * 2 -1
wav = np.swapaxes(wav, 0, 1) # shape (9000000, 2)
sf.write('fote.ogg', wav, 44100)
print('success')
# this works successfully
Expectation
I expect the function exports the data as an .ogg format because is light.
Note that with .wav and .flac files works fine, but the file size is too big for the scale i'm working.
Any ideas?
PD: I've been trying to export as .mp3 too without success.
This sounds very similar to #233.
Another open issue (probably unrelated) with OGG files is described in #130.