Flac files cause exception indicating wrong data shape for librosa stft
- Dominant language
- Python
- Stars
- 28.4k
- Forks
- 3.1k
- PR merge metrics
- No merged PRs in 30d
Description
## Description
Installed using pip install spleeter. Python version 3.9.9, tf version 2.5.0, spleeter 2.3.0. I pass a numpy array into an instantiation of a Separator class object to get the stem predictions. My unit tests pass with WAV, AIF and AIFF files but not with FLAC. I get the error below.
Error
Traceback (most recent call last):
File "C:\\\\\\\src\handlers\scheduler\scheduler.py", line 198, in run_job
stems = separator.separate(audio_signal.signal.T)
File "C:\\\\\\\venv\lib\site-packages\spleeter\separator.py", line 321, in separate
return self._separate_librosa(waveform, audio_descriptor)
File "C:\Users\Christian\Documents\cbhower\OriginAudio\SoundSeparatorApp\venv\lib\site-packages\spleeter\separator.py", line 260, in _separate_librosa
stft = self._stft(waveform)
File "C:\\\\\\\venv\lib\site-packages\spleeter\separator.py", line 204, in _stft
np.concatenate((np.zeros((N,)), data[:, c], np.zeros((N,))))
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\\\\\\\src\handlers\scheduler\scheduler.py", line 239, in run_job
CosmosDBService.log_message(json.dumps({
File "C:\\\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
File "C:\\\AppData\Local\Programs\Python\Python39\lib\json\encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "C:\\\AppData\Local\Programs\Python\Python39\lib\json\encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "C:\\\AppData\Local\Programs\Python\Python39\lib\json\encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type IndexError is not JSON serializable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\\\\\\\venv\lib\site-packages\parameterized\parameterized.py", line 533, in standalone_func
return func(*(a + p.args), **p.kwargs)
File "C:\\\\\\\src\handlers\scheduler\test_scheduler.py", line 71, in test_schedule_jobs
JobScheduler.run_job()
File "C:\\\\\\\src\handlers\scheduler\scheduler.py", line 276, in run_job
CosmosDBService.log_message(json.dumps({
File "C:\\\\\Programs\Python\Python39\lib\json\__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
File "C:\\\\\Programs\Python\Python39\lib\json\encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "C:\\\\\Programs\Python\Python39\lib\json\encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "C:\\\\\Programs\Python\Python39\lib\json\encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type TypeError is not JSON serializable
## Environment
| OS | Windows |
| Installation type | pip |
| Hardware spec | GPU=RTX2070 / CPU=i7-10750H/ |
Contributor guide
Research direction
Reproduce the failure with the FLAC-derived NumPy array and inspect spleeter/separator.py around _stft, especially the failing data[:, c] access. Compare the array shape produced for FLAC with the working WAV, AIF, and AIFF inputs. Done means FLAC input reaches stem separation without the IndexError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python, tensorflow
- Domain
- audio-video-rtc, machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100