From 6a28ec9925d343e48e0e642eceb373785e3492db Mon Sep 17 00:00:00 2001 From: Alex Murkoff <79400603+alexlnkp@users.noreply.github.com> Date: Tue, 11 Jun 2024 12:41:59 +0700 Subject: [PATCH] fix(audio): remove downsample_audio from mdxnet.py it is no longer needed, since it's imported from infer.lib.audio --- infer/modules/uvr5/mdxnet.py | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/infer/modules/uvr5/mdxnet.py b/infer/modules/uvr5/mdxnet.py index 3e6d652..150f92f 100644 --- a/infer/modules/uvr5/mdxnet.py +++ b/infer/modules/uvr5/mdxnet.py @@ -224,37 +224,6 @@ class Predictor: downsample_audio(path_vocal, opt_path_vocal, format) downsample_audio(path_other, opt_path_other, format) -def downsample_audio(input_path: str, output_path: str, format: str) -> None: - if not os.path.exists(input_path): return - - input_container = av.open(input_path) - output_container = av.open(output_path, 'w') - - # Create a stream in the output container - input_stream = input_container.streams.audio[0] - output_stream = output_container.add_stream(format) - - output_stream.bit_rate = 128_000 # 128kb/s (equivalent to -q:a 2) - - # Copy packets from the input file to the output file - for packet in input_container.demux(input_stream): - for frame in packet.decode(): - for out_packet in output_stream.encode(frame): - output_container.mux(out_packet) - - for packet in output_stream.encode(): - output_container.mux(packet) - - # Close the containers - input_container.close() - output_container.close() - - try: # Remove the original file - os.remove(input_path) - except Exception as e: - print(f"Failed to remove the original file: {e}") - - class MDXNetDereverb: def __init__(self, chunks, device): self.onnx = "assets/uvr5_weights/onnx_dereverb_By_FoxJoy"