Quick comparison of our zcant.conversion.read_wav() routine versus scipy.io.wavfile.read(). Shows that the latter is ~100 times faster, and can sometimes be ~600 times faster when using mmap. The difference isn't quite as great with smaller .WAV files, but amounts to a 0.5sec loadtime difference for a 10mb .WAV file.
Our implementation uses Struct.unpack_from(), which yields a Python list, and is in turn converted to an np.ndarray. Their implementation uses np.fromstring() or np.memmap() so the extraction is performed entirely in C.
Either switch to using scipy.io.wavfile.read() or utilize the more efficient C-based functions for loading wav data.
Quick comparison of our
zcant.conversion.read_wav()
routine versusscipy.io.wavfile.read()
. Shows that the latter is ~100 times faster, and can sometimes be ~600 times faster when using mmap. The difference isn't quite as great with smaller .WAV files, but amounts to a 0.5sec loadtime difference for a 10mb .WAV file.Our implementation uses
Struct.unpack_from()
, which yields a Python list, and is in turn converted to annp.ndarray
. Their implementation usesnp.fromstring()
ornp.memmap()
so the extraction is performed entirely in C.Either switch to using
scipy.io.wavfile.read()
or utilize the more efficient C-based functions for loading wav data.