Supress "PySoundFile failed. Trying audioread instead." warning
See original GitHub issueI’m trying to load an mp3 file with librosa.load(path) and it returns the following warning:
>>> import librosa
>>> librosa.load('mysong.mp3')
/data/anaconda3/envs/aidio/lib/python3.7/site-packages/librosa/core/audio.py:146: UserWarning: PySoundFile failed. Trying audioread instead.
warnings.warn('PySoundFile failed. Trying audioread instead.')
(array([-0.00183699, -0.00195219, 0.00391953, ..., -0.00337326,
0.00295902, 0.00624093], dtype=float32), 22050)
As I’m doing this multiple times it floods the stdout. So I have some questions:
- Why is this a warning? Does it imply something bad?
- Can I hide this warning text? As it floods my stdout in my batch operations.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:20
- Comments:17 (8 by maintainers)
Top Results From Across the Web
PySoundFile failed. Trying audioread instead. - Google Groups
This warning is easy enough to ignore, but I'm trying to understand why it exists in the first place. From my perspective the...
Read more >Can´t use librosa with python 3 - Stack Overflow
/home/henistein/librosa/librosa/core/audio.py:144: UserWarning: PySoundFile failed. Trying audioread instead. warnings.warn('PySoundFile ...
Read more >Troubleshooting — librosa 0.10.0.dev0 documentation
UserWarning: PySoundFile failed. Trying audioread instead. Do not worry. This is a warning, not an error. Odds are that your code is working...
Read more >VGAF-finetune | Kaggle
Trying audioread instead. return f(*args, ... UserWarning: PySoundFile failed. ... instead, or set `no_deprecation_warning=True` to disable this warning ...
Read more >Librosa.load() takes too long to load(sample) mp3 files
I am trying to sample (convert analog to digital) mp3 files via the following Python code ... UserWarning: "PySoundFile failed. Trying audioread instead."....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s a warning, not an error. This warning will always occur when loading mp3 because libsndfile does not (yet/currently) support the mp3 format. Librosa tries to use libsndfile first, and if that fails, it will fall back on the audioread package, which is a bit slower and more brittle, but supports more formats.
Yes, you can always filter warnings. https://docs.python.org/3/library/warnings.html
Any idea how to avoid getting this warnings printed on STDOUT?
I tried launching script with
python -W ignore <script>
and adding:At the beginning of the scripts and this User Warnings keep poping out.
Edit: Nevermind it was my issue.