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"