It would be nice if librosa.load(path, sr) would support a format-kwarg.
See original GitHub issueIs your feature request related to a problem? Please describe.
I am currently dealing with python inmemory file objects (io.BytesIO
etc.). They don’t have a file extension which is why librosa.load()
cannot recognise them properly as paths and I get: RuntimeError: Error opening <_io.BytesIO object at 0x7f1ed40ff090>: Format not recognised.
Describe the solution you’d like
librosa.load()
uses a SoundFile
object internally which in fact already supports format as a kwarg
. Please propagate that kwarg
to the function call so that a user can define the extension of the file manually (=> librosa.load(path, sr, format)
)
Describe alternatives you’ve considered
At the moment, I am using pydub.AudioSegments
for that. But it is not as clean as that one librosa
call would be.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (5 by maintainers)
Top GitHub Comments
@Lavair thanks for checking back, and sorry that it’s taken so long to get to this one. But I’m glad you were able to work around it.
To put it simply, the (in progress) PR and proposed resolution would have resulted in something like the following for you:
Not quite as slick as promoting all soundfile parameters up to the librosa API, but much easier to maintain and not too much more difficult to use. It does sound to me like your original issue was a bit subtler than just specifying format, but I think the proposed solution should otherwise sufficiently resolve things.
Hmm, sorry that I didn’t respond earlier. You must know that I finished the project where I used librosa somewhere around July and don’t have access to it anymore 😅
As you can image, I forgot the exact situation I had here and I cannot reasonably comment on it, sorry 😬 …but apparently, you already made a pr anyway. 👍 😄