spleeter icon indicating copy to clipboard operation
spleeter copied to clipboard

Flac files cause exception indicating wrong data shape for librosa stft

Open cbhower opened this issue 3 years ago • 1 comments

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/ |

cbhower avatar Nov 20 '21 02:11 cbhower

Hi @cbhower, it is quite strange that the tests fail only with flac files. All audio files are loaded with ffmpeg that is supposed to output the same format whatever the input file. Can you double check that your flac file does load properly with ffmpeg?

romi1502 avatar Dec 05 '21 18:12 romi1502