You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Despite instructions to install ffmpeg in README.md (#414), people still skip it and get audioread's NoBackendError whenever trying to load mp3s. The exception is confusing to the end user and we get a lot of questions about it.
Catch the NoBackendError exception (this will require you to import NoBackendError from audioread.exceptions)
Print a helpful error message instructing the user to install ffmpeg for mp3 support.
Option 2: Test for mp3 support as toolbox is loaded
This is a little more advanced, but I think this is preferred.
As the toolbox is opened, or when demo_cli.py is started, we either use librosa.load() or audioread.audio_open() on a sample mp3 file to test the capability.
If we catch NoBackendError we nag the user and tell them to either install ffmpeg, or rerun the toolbox with --no_mp3_support
The --no_mp3_support flag disallows loading of mp3s when one is selected, preventing NoBackendError from being encountered.
Option 3: Check for ffmpeg backend as toolbox is loaded
Although other backends are able to open mp3, we can force a check for Windows users to see if they followed the instructions and installed ffmpeg. Then do the same nag as option 2 if not detected.
audioread.ffdec.available() can test for ffmpeg availability: audioread/ffdec.py
Take a look at audioread/__init__.py and see how it raises NoBackendError. The code is extremely simple.
Option 4: Contribute to audioread to make the error message more descriptive
Despite instructions to install ffmpeg in README.md (#414), people still skip it and get audioread's NoBackendError whenever trying to load mp3s. The exception is confusing to the end user and we get a lot of questions about it.
Here are some options for dealing with it, sorted in ascending order of preference.
Option 1: Catch it when it occurs
This would make a nice starter issue for someone who is just getting started with python:
In demo_cli.py and demo_toolbox.py,
Option 2: Test for mp3 support as toolbox is loaded
This is a little more advanced, but I think this is preferred.
--no_mp3_support
--no_mp3_support
flag disallows loading of mp3s when one is selected, preventing NoBackendError from being encountered.Option 3: Check for ffmpeg backend as toolbox is loaded
Although other backends are able to open mp3, we can force a check for Windows users to see if they followed the instructions and installed ffmpeg. Then do the same nag as option 2 if not detected.
audioread.ffdec.available() can test for ffmpeg availability: audioread/ffdec.py
Take a look at audioread/__init__.py and see how it raises NoBackendError. The code is extremely simple.
Option 4: Contribute to audioread to make the error message more descriptive
beetbox/audioread#104
The text was updated successfully, but these errors were encountered: