bastibe / python-soundfile

SoundFile is an audio library based on libsndfile, CFFI, and NumPy
BSD 3-Clause "New" or "Revised" License
713 stars 111 forks source link

unknown error in flac decoder #434

Open autumn-2-net opened 6 months ago

autumn-2-net commented 6 months ago

Original Traceback (most recent call last): File "C:\Users\autumn.conda\envs\py10\lib\site-packages\torch\utils\data_utils\worker.py", line 308, in _worker_loop data = fetcher.fetch(index) File "C:\Users\autumn.conda\envs\py10\lib\site-packages\torch\utils\data_utils\fetch.py", line 51, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "C:\Users\autumn.conda\envs\py10\lib\site-packages\torch\utils\data_utils\fetch.py", line 51, in data = [self.dataset[idx] for idx in possibly_batched_index] File "D:\propj\AudioFixer\dataSET\AF_dataset.py", line 92, in getitem wavs,sr=torchaudio.load(data_path) File "C:\Users\autumn.conda\envs\py10\lib\site-packages\torchaudio_backend\utils.py", line 203, in load return backend.load(uri, frame_offset, num_frames, normalize, channels_first, format, buffer_size) File "C:\Users\autumn.conda\envs\py10\lib\site-packages\torchaudio_backend\soundfile.py", line 26, in load return soundfile_backend.load(uri, frame_offset, num_frames, normalize, channels_first, format) File "C:\Users\autumn.conda\envs\py10\lib\site-packages\torchaudio_backend\soundfilebackend.py", line 230, in load waveform = file.read(frames, dtype, always_2d=True) File "C:\Users\autumn.conda\envs\py10\lib\site-packages\soundfile.py", line 867, in read frames = self._array_io('read', out, frames) File "C:\Users\autumn.conda\envs\py10\lib\site-packages\soundfile.py", line 1312, in _array_io return self._cdata_io(action, cdata, ctype, frames) File "C:\Users\autumn.conda\envs\py10\lib\site-packages\soundfile.py", line 1322, in _cdata_io _error_check(self._errorcode) File "C:\Users\autumn.conda\envs\py10\lib\site-packages\soundfile.py", line 1357, in _error_check raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace')) RuntimeError: Error : unknown error in flac decoder.

The problem seems to occur randomly, reading the same audio file will sometimes occur and sometimes not.

autumn-2-net commented 6 months ago

RuntimeError: Caught RuntimeError in DataLoader worker process 5. Original Traceback (most recent call last): File "C:\Users\autumn.conda\envs\py10\lib\site-packages\torch\utils\data_utils\worker.py", line 308, in _worker_loop data = fetcher.fetch(index) File "C:\Users\autumn.conda\envs\py10\lib\site-packages\torch\utils\data_utils\fetch.py", line 51, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "C:\Users\autumn.conda\envs\py10\lib\site-packages\torch\utils\data_utils\fetch.py", line 51, in data = [self.dataset[idx] for idx in possibly_batched_index] File "D:\propj\AudioFixer\dataSET\AF_dataset.py", line 80, in getitem wavs,sr=torchaudio.load(data_path) File "C:\Users\autumn.conda\envs\py10\lib\site-packages\torchaudio_backend\utils.py", line 203, in load return backend.load(uri, frame_offset, num_frames, normalize, channels_first, format, buffer_size) File "C:\Users\autumn.conda\envs\py10\lib\site-packages\torchaudio_backend\soundfile.py", line 26, in load return soundfile_backend.load(uri, frame_offset, num_frames, normalize, channels_first, format) File "C:\Users\autumn.conda\envs\py10\lib\site-packages\torchaudio_backend\soundfilebackend.py", line 230, in load waveform = file.read(frames, dtype, always_2d=True) File "C:\Users\autumn.conda\envs\py10\lib\site-packages\soundfile.py", line 867, in read frames = self._array_io('read', out, frames) File "C:\Users\autumn.conda\envs\py10\lib\site-packages\soundfile.py", line 1312, in _array_io return self._cdata_io(action, cdata, ctype, frames) File "C:\Users\autumn.conda\envs\py10\lib\site-packages\soundfile.py", line 1322, in _cdata_io _error_check(self._errorcode) File "C:\Users\autumn.conda\envs\py10\lib\site-packages\soundfile.py", line 1357, in _error_check raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace')) RuntimeError: Error : flac decoder lost sync.

bastibe commented 6 months ago

please reopen this issue with libsndfile, and provide the audio file as an example.