mirror of
https://github.com/YuzuZensai/spleeter.git
synced 2026-01-31 14:58:23 +00:00
fix: update writing process
This commit is contained in:
@@ -129,7 +129,6 @@ def process_audio(
|
|||||||
yield_single_examples=False)
|
yield_single_examples=False)
|
||||||
# initialize pool for audio export
|
# initialize pool for audio export
|
||||||
pool = Pool(16)
|
pool = Pool(16)
|
||||||
tasks = []
|
|
||||||
for sample in prediction:
|
for sample in prediction:
|
||||||
sample_filename = sample.pop('audio_id', 'unknown_filename').decode()
|
sample_filename = sample.pop('audio_id', 'unknown_filename').decode()
|
||||||
input_directory, input_filename = split(sample_filename)
|
input_directory, input_filename = split(sample_filename)
|
||||||
@@ -144,13 +143,12 @@ def process_audio(
|
|||||||
output_path,
|
output_path,
|
||||||
output_dirname,
|
output_dirname,
|
||||||
f'{instrument}.{codec}')
|
f'{instrument}.{codec}')
|
||||||
tasks.append(
|
pool.apply_async(
|
||||||
pool.apply_async(
|
audio_adapter.save,
|
||||||
audio_adapter.save,
|
(filename, waveform, sample_rate, codec))
|
||||||
(filename, waveform, sample_rate, codec)))
|
|
||||||
# Wait for everything to be written
|
# Wait for everything to be written
|
||||||
for task in tasks:
|
pool.join()
|
||||||
task.wait(timeout=20)
|
pool.close()
|
||||||
|
|
||||||
|
|
||||||
def entrypoint(arguments, params):
|
def entrypoint(arguments, params):
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ class FFMPEGProcessAudioAdapter(AudioAdapter):
|
|||||||
.output(path, format='f32le', **output_kwargs)
|
.output(path, format='f32le', **output_kwargs)
|
||||||
.run_async(pipe_stdin=True, quiet=True))
|
.run_async(pipe_stdin=True, quiet=True))
|
||||||
try:
|
try:
|
||||||
process.stdin.write(data.astype('<f4').tostring())
|
process.stdin.write(data.astype('<f4').tobytes())
|
||||||
process.stdin.close()
|
process.stdin.close()
|
||||||
process.wait()
|
process.wait()
|
||||||
except IOError:
|
except IOError:
|
||||||
|
|||||||
Reference in New Issue
Block a user