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