Loading scripts/pyaudio3dtools/audioarray.py +11 −2 Original line number Diff line number Diff line Loading @@ -398,8 +398,17 @@ def compare( with tempfile.TemporaryDirectory() as tmpdir: tmpfile_ref = Path(tmpdir).joinpath("ref.wav") tmpfile_test = Path(tmpdir).joinpath("test.wav") wavfile.write(str(tmpfile_ref), fs, ref.astype(np.int16)) wavfile.write(str(tmpfile_test), fs, test.astype(np.int16)) ### 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) else: ref_tmp = ref.copy() test_tmp = test.copy() 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)] if ref_jbm_tf and test_jbm_tf: Loading Loading
scripts/pyaudio3dtools/audioarray.py +11 −2 Original line number Diff line number Diff line Loading @@ -398,8 +398,17 @@ def compare( with tempfile.TemporaryDirectory() as tmpdir: tmpfile_ref = Path(tmpdir).joinpath("ref.wav") tmpfile_test = Path(tmpdir).joinpath("test.wav") wavfile.write(str(tmpfile_ref), fs, ref.astype(np.int16)) wavfile.write(str(tmpfile_test), fs, test.astype(np.int16)) ### 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) else: ref_tmp = ref.copy() test_tmp = test.copy() 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)] if ref_jbm_tf and test_jbm_tf: Loading