1

I recently installed librosa (package I've been using for a while on different PC) on my new PC with Windows 10 running. After that I've downloaded latest static version of ffmpeg and copied it to C: and added it to the Path. Tested ffmpeg and it works like a charm! For python I am using Anaconda environment and after starting Jupyter Notebook and running librosa.load(path, sr = None) I've got

<ipython-input-3-1e009e0ae576> in <module>
----> 1 audio = librosa.load(pathToJson)

~\anaconda3\envs\tf_gpu\lib\site-packages\librosa\core\audio.py in load(path, sr, mono, offset, duration, dtype, res_type)
    117 
    118     y = []
--> 119     with audioread.audio_open(os.path.realpath(path)) as input_file:
    120         sr_native = input_file.samplerate
    121         n_channels = input_file.channels

~\anaconda3\envs\tf_gpu\lib\site-packages\audioread\__init__.py in audio_open(path, backends)
    114 
    115     # All backends failed!
--> 116     raise NoBackendError()

NoBackendError:

strange isn't it? Then I went all over the internet, doing whatnot trying to fix it and then I've got an idea to run my line of code inside anaconda command interface and it WORKS?? How is this possible? It is the same environment.

python
Python 3.7.7 (default, Mar 23 2020, 23:19:08) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import librosa
>>> librosa.load('test.wav')
(array([-0.00027   , -0.00039953, -0.0003659 , ..., -0.16393574,
       -0.17814247,  0.        ], dtype=float32), 22050)

I did a lot of testing and I really prefer my Jupyter so any help would be appreciated. I tried the following: I've added C:\ffmpeg\bin and C:\ffmpeg to my Path for both User and System Variables. After that I've made specific variables for ffmpeg and ffmpeg_bin for both User and System Variables. No luck. After that I've tried installing ffmpeg using conda, without success. The last thing I've tested is this:

import audioread
audioread.ffdec.FFmpegAudioFile('test.wav')

and that works. Thanks

slavko
  • 103
  • 1
  • 10

1 Answers1

1

You have this line of code: audio = librosa.load(pathToJson)

It seems to me that you are accidentally trying to load JSON file with librosa. Check that :D

Curious
  • 154
  • 1
  • 8