Loading scripts/pyaudio3dtools/audioarray.py +19 −12 Original line number Diff line number Diff line Loading @@ -362,15 +362,13 @@ def compare( if get_mld: def parse_wav_diff(proc: subprocess.CompletedProcess) -> int: mld_max = 0 for line in proc.stdout.splitlines(): if line.strip().startswith("MLD:"): start = line.find("max:") + 4 stop = line.find("@") def parse_wav_diff(proc: subprocess.CompletedProcess) -> float: line = proc.stdout.splitlines()[-1].strip() start = line.find(">") + 1 stop = line.rfind("<") mld = float(line[start:stop].strip()) if mld > mld_max: mld_max = mld return mld # TODO probably needs a fix to show up in pytest if proc.returncode: Loading Loading @@ -401,8 +399,12 @@ def compare( ### need to resample to 48kHz for MLD computation to be correct if fs != 48000: ref_tmp = np.clip( resample(ref.astype(float), fs, 48000), -32768, 32767) test_tmp = np.clip( resample(test.astype(float), fs, 48000), -32768, 32767) ref_tmp = np.clip( resample(ref.astype(float), fs, 48000), -32768, 32767 ) test_tmp = np.clip( resample(test.astype(float), fs, 48000), -32768, 32767 ) else: ref_tmp = ref.copy() test_tmp = test.copy() Loading @@ -410,7 +412,12 @@ def compare( wavfile.write(str(tmpfile_ref), fs, ref_tmp.astype(np.int16)) wavfile.write(str(tmpfile_test), fs, test_tmp.astype(np.int16)) cmd = [str(wdiff), str(tmpfile_ref), str(tmpfile_test)] cmd = [ str(wdiff), "--print-ctest-measurement", str(tmpfile_ref), str(tmpfile_test), ] if ref_jbm_tf and test_jbm_tf: cmd.extend( [ Loading Loading
scripts/pyaudio3dtools/audioarray.py +19 −12 Original line number Diff line number Diff line Loading @@ -362,15 +362,13 @@ def compare( if get_mld: def parse_wav_diff(proc: subprocess.CompletedProcess) -> int: mld_max = 0 for line in proc.stdout.splitlines(): if line.strip().startswith("MLD:"): start = line.find("max:") + 4 stop = line.find("@") def parse_wav_diff(proc: subprocess.CompletedProcess) -> float: line = proc.stdout.splitlines()[-1].strip() start = line.find(">") + 1 stop = line.rfind("<") mld = float(line[start:stop].strip()) if mld > mld_max: mld_max = mld return mld # TODO probably needs a fix to show up in pytest if proc.returncode: Loading Loading @@ -401,8 +399,12 @@ def compare( ### need to resample to 48kHz for MLD computation to be correct if fs != 48000: ref_tmp = np.clip( resample(ref.astype(float), fs, 48000), -32768, 32767) test_tmp = np.clip( resample(test.astype(float), fs, 48000), -32768, 32767) ref_tmp = np.clip( resample(ref.astype(float), fs, 48000), -32768, 32767 ) test_tmp = np.clip( resample(test.astype(float), fs, 48000), -32768, 32767 ) else: ref_tmp = ref.copy() test_tmp = test.copy() Loading @@ -410,7 +412,12 @@ def compare( wavfile.write(str(tmpfile_ref), fs, ref_tmp.astype(np.int16)) wavfile.write(str(tmpfile_test), fs, test_tmp.astype(np.int16)) cmd = [str(wdiff), str(tmpfile_ref), str(tmpfile_test)] cmd = [ str(wdiff), "--print-ctest-measurement", str(tmpfile_ref), str(tmpfile_test), ] if ref_jbm_tf and test_jbm_tf: cmd.extend( [ Loading