mirror of
https://github.com/fumiama/Retrieval-based-Voice-Conversion-WebUI.git
synced 2026-06-06 01:30:24 +08:00
fix(audio): remove downsample_audio from mdxnet.py
it is no longer needed, since it's imported from infer.lib.audio
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user