Loading scripts/batch_comp_audio.py +16 −7 Original line number Diff line number Diff line Loading @@ -33,12 +33,15 @@ import argparse import concurrent.futures import os import pathlib import re import shutil import subprocess import sys import threading from itertools import repeat from pyaudio3dtools.audiofile import readfile from pyaudio3dtools.audioarray import compare FILES_EQUAL = "File A = File B" SNR_EXPR = r"SNR\s+=(.+)dB\s*\(File B Gain = (.+)\)" Loading Loading @@ -126,14 +129,20 @@ def compare_files(f, fol1, fol2, outputs_dict, tool): """ f1 = os.path.join(fol1, f) f2 = os.path.join(fol2, f) if tool == "CompAudio": cmd = f"{tool} {f1} {f2}" try: output = subprocess.check_output(cmd.split(" ")) except subprocess.CalledProcessError: print(f"{tool} returned a non-zero exit status. Check your files.") sys.exit(-1) tool_output = PARSE_FUNC[tool](output) tool_output = _parse_comp_audio(output) elif tool == "mld": s1, fs1 = readfile(f1) s2, fs2 = readfile(f2) cmp_result = compare(s1, s2, fs1, per_frame=False, get_mld=True) tool_output = cmp_result["MLD"] with threading.Lock(): outputs_dict.update({f: tool_output}) Loading Loading
scripts/batch_comp_audio.py +16 −7 Original line number Diff line number Diff line Loading @@ -33,12 +33,15 @@ import argparse import concurrent.futures import os import pathlib import re import shutil import subprocess import sys import threading from itertools import repeat from pyaudio3dtools.audiofile import readfile from pyaudio3dtools.audioarray import compare FILES_EQUAL = "File A = File B" SNR_EXPR = r"SNR\s+=(.+)dB\s*\(File B Gain = (.+)\)" Loading Loading @@ -126,14 +129,20 @@ def compare_files(f, fol1, fol2, outputs_dict, tool): """ f1 = os.path.join(fol1, f) f2 = os.path.join(fol2, f) if tool == "CompAudio": cmd = f"{tool} {f1} {f2}" try: output = subprocess.check_output(cmd.split(" ")) except subprocess.CalledProcessError: print(f"{tool} returned a non-zero exit status. Check your files.") sys.exit(-1) tool_output = PARSE_FUNC[tool](output) tool_output = _parse_comp_audio(output) elif tool == "mld": s1, fs1 = readfile(f1) s2, fs2 = readfile(f2) cmp_result = compare(s1, s2, fs1, per_frame=False, get_mld=True) tool_output = cmp_result["MLD"] with threading.Lock(): outputs_dict.update({f: tool_output}) Loading