Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The format of the wav file is unknown. #2

Open
tkeshun opened this issue May 5, 2021 · 5 comments
Open

The format of the wav file is unknown. #2

tkeshun opened this issue May 5, 2021 · 5 comments

Comments

@tkeshun
Copy link

tkeshun commented May 5, 2021

I get a RuntimeError when I run the fourth Try out random prediction codebase present in test.py. in Setup.
I found that the format of the wav file in data/test was unknown.
I opened this wav file in audacity, but it showed up as a file of unknown format.
Is this wav file the correct one?
Sorry if this is my mistake.
The full text of the error is below.

> python3 test.py
Mixture file is present at following location: /home/shun/aicrowd/music-demixing-challenge-starter-kit/data/test/Mu - Too Bright/mixture.wav
Traceback (most recent call last):
  File "/home/shun/aicrowd/music-demixing-challenge-starter-kit/evaluator/music_demixing.py", line 142, in run
    self.evaluation()
  File "/home/shun/aicrowd/music-demixing-challenge-starter-kit/evaluator/music_demixing.py", line 129, in evaluation
    self.prediction(mixture_file_path=self.get_music_file_location(music_name),
  File "test.py", line 52, in prediction
    x, rate = sf.read(mixture_file_path)  # mixture is stereo with sample rate of 44.1kHz
  File "/home/shun/.local/share/virtualenvs/music-demixing-challenge-starter-kit-dMCFg2FA/lib/python3.8/site-packages/soundfile.py", line 256, in read
    with SoundFile(file, 'r', samplerate, channels,
  File "/home/shun/.local/share/virtualenvs/music-demixing-challenge-starter-kit-dMCFg2FA/lib/python3.8/site-packages/soundfile.py", line 629, in __init__
    self._file = self._open(file, mode_int, closefd)
  File "/home/shun/.local/share/virtualenvs/music-demixing-challenge-starter-kit-dMCFg2FA/lib/python3.8/site-packages/soundfile.py", line 1183, in _open
    _error_check(_snd.sf_error(file_ptr),
  File "/home/shun/.local/share/virtualenvs/music-demixing-challenge-starter-kit-dMCFg2FA/lib/python3.8/site-packages/soundfile.py", line 1357, in _error_check
    raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace'))
RuntimeError: Error opening '/home/shun/aicrowd/music-demixing-challenge-starter-kit/data/test/Mu - Too Bright/mixture.wav': File contains data in an unknown format.

Traceback (most recent call last):
  File "test.py", line 64, in <module>
    submission.run()
  File "/home/shun/aicrowd/music-demixing-challenge-starter-kit/evaluator/music_demixing.py", line 148, in run
    raise e
  File "/home/shun/aicrowd/music-demixing-challenge-starter-kit/evaluator/music_demixing.py", line 142, in run
    self.evaluation()
  File "/home/shun/aicrowd/music-demixing-challenge-starter-kit/evaluator/music_demixing.py", line 129, in evaluation
    self.prediction(mixture_file_path=self.get_music_file_location(music_name),
  File "test.py", line 52, in prediction
    x, rate = sf.read(mixture_file_path)  # mixture is stereo with sample rate of 44.1kHz
  File "/home/shun/.local/share/virtualenvs/music-demixing-challenge-starter-kit-dMCFg2FA/lib/python3.8/site-packages/soundfile.py", line 256, in read
    with SoundFile(file, 'r', samplerate, channels,
  File "/home/shun/.local/share/virtualenvs/music-demixing-challenge-starter-kit-dMCFg2FA/lib/python3.8/site-packages/soundfile.py", line 629, in __init__
    self._file = self._open(file, mode_int, closefd)
  File "/home/shun/.local/share/virtualenvs/music-demixing-challenge-starter-kit-dMCFg2FA/lib/python3.8/site-packages/soundfile.py", line 1183, in _open
    _error_check(_snd.sf_error(file_ptr),
  File "/home/shun/.local/share/virtualenvs/music-demixing-challenge-starter-kit-dMCFg2FA/lib/python3.8/site-packages/soundfile.py", line 1357, in _error_check
    raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace'))
RuntimeError: Error opening '/home/shun/aicrowd/music-demixing-challenge-starter-kit/data/test/Mu - Too Bright/mixture.wav': File contains data in an unknown format.
@faroit
Copy link
Collaborator

faroit commented May 5, 2021

i guess this is a git-lfs error (do you really have valid files on your disk - did you check the filesize?)

Python 3.9.1 (default, Dec 10 2020, 10:36:41)
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import soundfile as sf
>>> sf.read("data/test/Mu - Too Bright/mixture.wav")
(array([[-0.09933472, -0.09863281],
       [-0.11071777, -0.08987427],
       [-0.12136841, -0.08178711],
       ...,
       [-0.04922485, -0.08898926],
       [-0.04959106, -0.08755493],
       [-0.04937744, -0.08685303]]), 44100)

@skbly7
Copy link
Collaborator

skbly7 commented May 5, 2021

@tkeshun, adding to above comment.

In your repository please try out the following:

git lfs pull

In case this command fails, you need to install git-lfs in your system or upgrade your git version.

Please let us know in case you continue facing the issue.

@tkeshun
Copy link
Author

tkeshun commented May 5, 2021

@skbly7
I got the git-lfs error as you suggested.
Here is what I did.
I checked the file size.

> ls -l * | awk '{print $5}'
132
132
132
132
132

The file size was 132 bytes, which is very small.
I installed git lfs and ran git lfs pull on data/test/Mu - Too Bright.

> ls -l * | awk '{print $5}'
1234844
1234844
1234844
1234844
1234844

> python3 test.py May 06, 2021 02:45:35 PM
Mixture file is present at the following location: /home/shun/aicrowd/music-demixing-challenge-starter-kit/data/test/Mu - Too Bright/mixture.wav
/home/shun/aicrowd/music-demixing-challenge-starter-kit/data/test/Mu - Too Bright/mixture.wav: prediction completed.
Successfully generated predictions!

The file was successfully executed.
Thank you for your help!

@skbly7
Copy link
Collaborator

skbly7 commented May 5, 2021

Glad to hear it!

Closing this issue and waiting to see you on the leaderboard soon. 🚀

@skbly7 skbly7 closed this as completed May 5, 2021
@faroit
Copy link
Collaborator

faroit commented May 8, 2021

@skbly7 should we add more docs on git lfs installation requirement?

@skbly7 skbly7 reopened this May 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants