beetbox / audioread

cross-library (GStreamer + Core Audio + MAD + FFmpeg) audio decoding for Python
MIT License
483 stars 108 forks source link

NoBackendError: #102

Closed sharonosahon closed 4 years ago

sharonosahon commented 4 years ago

Hi all,

When I run this code: import os import librosa #for audio processing import IPython.display as ipd import matplotlib.pyplot as plt import numpy as np from scipy.io import wavfile #for audio processing import warnings warnings.filterwarnings("ignore")

train_audio_path = 'train/audio/' samples, sample_rate = librosa.load(train_audio_path+'yes/0a7c2a8d_nohash_0.wav', sr = 16000)

I get these errors:

Error opening 'train/audio/yes/0a7c2a8d_nohash_0.wav': File contains data in an unknown format and NoBackendError:

I've tried downloading ffmpeg and gstreamer to fix the second error but no luck. I'm not sure what to do about the first error as I have imported libraries that should be able to handle .wav files. I've also tried re-installing librosa.

Thank you for your help in advance. Screenshot 2019-11-12 at 15 12 11 Screenshot 2019-11-12 at 15 12 02

sampsyo commented 4 years ago

Hello! Audioread uses the built-in libraries to handle WAV files, so no external dependencies should be necessary. Is there any chance your WAV file is corrupted or otherwise nonstandard? Can you share the file?

sharonosahon commented 4 years ago

@sampsyo thank you for your reply. I tried attaching the wav file and zip folder with all wav files but neither worked. I got the data here: https://www.kaggle.com/c/tensorflow-speech-recognition-challenge/data The wav file is located in the folder train--> audio--> yes--> 0a7c2a8d_nohash_0.wav

Apologies for not being able to attach it directly. Would you mind checking the file out on the link please?

Thank you

sampsyo commented 4 years ago

Have you tried opening the file with other tools? Please try opening them with a few other things, like VLC or whatever, to make sure the files actually work.

sharonosahon commented 4 years ago

There was indeed something wrong with the files. For some reason they were 0 seconds long. Thank you very much for your help!

sampsyo commented 4 years ago

Great.