mirror of
https://github.com/YuzuZensai/spleeter.git
synced 2026-01-31 14:58:23 +00:00
fix: load method
This commit is contained in:
@@ -60,7 +60,7 @@ class FFMPEGProcessAudioAdapter(AudioAdapter):
|
|||||||
raise IOError('No stream was found with ffprobe')
|
raise IOError('No stream was found with ffprobe')
|
||||||
metadata = next(
|
metadata = next(
|
||||||
stream
|
stream
|
||||||
for stream in probe['stream']
|
for stream in probe['streams']
|
||||||
if stream['codec_type'] == 'audio')
|
if stream['codec_type'] == 'audio')
|
||||||
n_channels = metadata['channels']
|
n_channels = metadata['channels']
|
||||||
if sample_rate is None:
|
if sample_rate is None:
|
||||||
@@ -75,7 +75,7 @@ class FFMPEGProcessAudioAdapter(AudioAdapter):
|
|||||||
.input(path, **input_kwargs)
|
.input(path, **input_kwargs)
|
||||||
.output('-', format='f32le')
|
.output('-', format='f32le')
|
||||||
.overwrite_output()
|
.overwrite_output()
|
||||||
.run(quiet=True))
|
.run(capture_stdout=True, capture_stderr=True))
|
||||||
waveform = np.frombuffer(buffer, dtype='<f4').reshape(-1, n_channels)
|
waveform = np.frombuffer(buffer, dtype='<f4').reshape(-1, n_channels)
|
||||||
if not waveform.dtype == np.dtype(dtype):
|
if not waveform.dtype == np.dtype(dtype):
|
||||||
waveform = waveform.astype(dtype)
|
waveform = waveform.astype(dtype)
|
||||||
@@ -112,8 +112,7 @@ class FFMPEGProcessAudioAdapter(AudioAdapter):
|
|||||||
.output(path, format='f32le', **output_kwargs)
|
.output(path, format='f32le', **output_kwargs)
|
||||||
.run_async(pipe_stdin=True))
|
.run_async(pipe_stdin=True))
|
||||||
try:
|
try:
|
||||||
process.stdin.write(
|
process.stdin.write(data.astype('<f4').tostring())
|
||||||
data.astype('<f4').tostring())
|
|
||||||
process.stdin.close()
|
process.stdin.close()
|
||||||
process.wait()
|
process.wait()
|
||||||
except IOError:
|
except IOError:
|
||||||
|
|||||||
Reference in New Issue
Block a user