Using Librosa in Python to Interpret Audio: A Guide

In case librosa returns an output that needs scaling, it can be multiplied by a scaling factor and converted to the same data type as the output of scipy wave reader to ensure consistent value ranges. An example code for reading an audio file is causing an error at line 4 and it is unclear what the issue could be. Both librosa and scipy are installed but are not functioning properly.


While attempting to read an
audio file
using Librosa, I encountered an error.

FileNotFoundError: [WinError 2] The system cannot find the file specified

The instructions stated that I must install


, but it proved to be ineffective in resolving the issue. On the other hand,


was successfully installed at

ffmpeg in c:programdataanaconda3libsite-packages (1.4)


This is a code example that I am utilizing to access a sample audio file.

import librosa
filename = librosa.util.example_audio_file()
y, sr = librosa.load(filename)

The error is being thrown on line 4.

FileNotFoundError                         Traceback (most recent call last)
      1 filename = librosa.util.example_audio_file()
      2 print(filename)
----> 3 y, sr = librosa.load(filename) in load(path, sr, mono, offset, duration, dtype, res_type)
    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 in audio_open(path, backends)
    105     """
    106     if backends is None:
--> 107         backends = available_backends()
    109     for BackendClass in backends: in available_backends()
     85     # FFmpeg.
---> 86     if ffdec.available():
     87         result.append(ffdec.FFmpegAudioFile)
     88 in available()
    106         stdout=subprocess.PIPE,
    107         stderr=subprocess.PIPE,
--> 108         creationflags=PROC_FLAGS,
    109     )
    110     proc.wait() in popen_multiple(commands, command_args, *args, **kwargs)
     92         cmd = [command] + command_args
     93         try:
---> 94             return subprocess.Popen(cmd, *args, **kwargs)
     95         except OSError:
     96             if i == len(commands) - 1: in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)
    767                                 c2pread, c2pwrite,
    768                                 errread, errwrite,
--> 769                                 restore_signals, start_new_session)
    770         except:
    771             # Cleanup if the child failed starting. in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
   1170                                          env,
   1171                                          os.fspath(cwd) if cwd is not None else None,
-> 1172                                          startupinfo)
   1173             finally:
   1174                 # Child is launched. Close the parent's copy of those pipe
FileNotFoundError: [WinError 2] The system cannot find the file specified

I’m uncertain about the issue at hand. Despite the installation of both




, neither seem to be functioning. Please inform me if additional information is necessary.


The solution involves opening


with the necessary


permission, followed by executing a specific command.

conda install -c conda-forge librosa

The issue at hand is that

pip install librosa

did not function properly, requiring the installation of



conda install


Hope it will help future visitor.

Frequently Asked Questions