If I import a 24 bit AIFF in librosa, no exception is raised, but it is parsed as (I think?) a 16 bit WAV, resulting in an array of modulated white-ish noise.
This should be either an exception, or correctly load the file.
FWIW, I use subprocess calls to sox and ffmpeg to handle all non-WAVs, since audiorate etc seem to also have problems with non-16-bit non-WAV files, and much of my data is in 24 or 32 bit formats.
Since librosa doesn't handle audio decoding directly, I think this is probably an issue in audioread.
Have you tried loading with PySoundFile instead? It will also load into a numpy array, so all of the other librosa functionality ought to work.
Wow, PySoundfile is a find. It does correctly load 24 bit audio. audioread does not.
to quote them:
Each buffer is a buffer or str object containing raw 16-bit little-endian signed integer PCM data. (Currently, these PCM format parameters are not configurable, but this could be added to most of the backends.)
It's a pity they don't throw an exception for non-16 bit audio, but that's not an issue for here.
Of course, libsoundfile doesn't support MP3, and presumably AAC etc for the same reason, so this would still leave a role for audioread. And if you then have a 24-bit MPEG4 audio file, neither library can do it; but once again, implementing universal audio support is not librosa's job.
Yup, lack of mp3 support of the main reason we haven't switched over.
If there anything left to do in this thread, or can we close it out?
Most helpful comment
Since librosa doesn't handle audio decoding directly, I think this is probably an issue in audioread.
Have you tried loading with PySoundFile instead? It will also load into a numpy array, so all of the other librosa functionality ought to work.