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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to save audio file #413

Closed
haveyouwantto opened this issue Nov 29, 2022 · 10 comments
Closed

Unable to save audio file #413

haveyouwantto opened this issue Nov 29, 2022 · 10 comments
Labels
bug Something isn't working

Comments

@haveyouwantto
Copy link

haveyouwantto commented Nov 29, 2022

馃悰 Bug Report

Error while saving the audio file.

To Reproduce

Run command demucs out.m4a --two-stems vocals -n htdemucs_ft

Expected behavior

The audio file appears in output folder.

Actual Behavior

The program throws an error and the audio file is truncated.
20221129-230853

Your Environment

  • Python and PyTorch version: Python 3.9.13 Pytorch 1.12.0+cu116
  • Operating system and version (desktop or mobile): Windows 10 22H2
  • Hardware (gpu or cpu, amount of RAM etc.): GTX 1660 super 16GB RAM
@haveyouwantto haveyouwantto added the bug Something isn't working label Nov 29, 2022
@CarlGao4
Copy link
Contributor

CarlGao4 commented Nov 30, 2022

Please run python -c "import soundfile;print(soundfile.__version__);print(soundfile.__libsndfile_version__)" and paste the outputs here.

@haveyouwantto
Copy link
Author

>>> soundfile.__version__
'0.11.0'
>>> soundfile.__libsndfile_version__
'1.1.0'

@CarlGao4
Copy link
Contributor

CarlGao4 commented Dec 1, 2022

I think that the soundfile you are using has been modified, because line 316 is f.write(data) in your screenshot, but the original repository is comment subtype : str, optional.
I suggest reinstalling soundfile using the package manager you installed them.

@haveyouwantto
Copy link
Author

I reinstalled soundfile from pypi, and now it throws another execption.

Traceback (most recent call last):
  File "D:\Python\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "D:\Python\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "D:\Python\Scripts\demucs.exe\__main__.py", line 7, in <module>
  File "D:\Python\lib\site-packages\demucs\separate.py", line 192, in main
    save_audio(sources.pop(model.sources.index(args.stem)), str(stem), **kwargs)
  File "D:\Python\lib\site-packages\demucs\audio.py", line 254, in save_audio
    ta.save(str(path), wav, sample_rate=samplerate,
  File "D:\Python\lib\site-packages\torchaudio\backend\soundfile_backend.py", line 435, in save
    soundfile.write(file=filepath, data=src, samplerate=sample_rate, subtype=subtype, format=format)
  File "D:\Python\lib\site-packages\soundfile.py", line 342, in write
    f.write(data)
  File "D:\Python\lib\site-packages\soundfile.py", line 1017, in write
    written = self._array_io('write', data, len(data))
  File "D:\Python\lib\site-packages\soundfile.py", line 1341, in _array_io
    return self._cdata_io(action, cdata, ctype, frames)
  File "D:\Python\lib\site-packages\soundfile.py", line 1351, in _cdata_io
    _error_check(self._errorcode)
  File "D:\Python\lib\site-packages\soundfile.py", line 1404, in _error_check
    raise LibsndfileError(err, prefix=prefix)
soundfile.LibsndfileError: System error.

@CarlGao4
Copy link
Contributor

CarlGao4 commented Dec 1, 2022

Things become difficult. It's an error occured in libsndfile - the core of soundfile, but it can't print out the error. What I can do is just opening an issue under soundfile repository.

@haveyouwantto
Copy link
Author

haveyouwantto commented Dec 1, 2022

PS: It only happens with demucs v4, the v3 branch is fine.

@CarlGao4
Copy link
Contributor

CarlGao4 commented Dec 1, 2022

It's becoming more interesting. I'll do some experience on my computer.

@CarlGao4
Copy link
Contributor

CarlGao4 commented Dec 1, 2022

Please help me test one thing:
Add ;print(str(stem), sources[model.sources.index(args.stem)].shape) to the end of the file D:\Python\lib\site-packages\demucs\separate.py line 191
then run your command again
paste the outputs here

@haveyouwantto
Copy link
Author

I found out it will only happen when the input audio is long ( > 20 minutes )

@haveyouwantto
Copy link
Author

Oh, I found out the problem, my disk is almost full.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants