Loading scripts/pyaudio3dtools/audioarray.py +11 −12 Original line number Diff line number Diff line Loading @@ -308,9 +308,6 @@ def compare( lengths_differ = ref.shape[0] != test.shape[0] test_orig = test.copy() ref_orig = ref.copy() if lengths_differ: if handle_differing_lengths == "fail": raise RuntimeError( Loading Loading @@ -442,19 +439,21 @@ def compare( tmpfile_test = Path(tmpdir).joinpath("test.wav") ### need to resample to 48kHz for MLD computation to be correct ### write out and delete tmp variables to reduce memory usage if fs != 48000: ref_tmp = np.clip( resample(ref_orig.astype(float), fs, 48000), -32768, 32767 ) resample(ref.astype(float), fs, 48000), -32768, 32767 ).astype(np.int16) wavfile.write(str(tmpfile_ref), 48000, ref_tmp) del ref_tmp test_tmp = np.clip( resample(test_orig.astype(float), fs, 48000), -32768, 32767 ) resample(test.astype(float), fs, 48000), -32768, 32767 ).astype(np.int16) wavfile.write(str(tmpfile_test), 48000, test_tmp) del test_tmp else: ref_tmp = ref_orig.copy() test_tmp = test_orig.copy() wavfile.write(str(tmpfile_ref), 48000, ref_tmp.astype(np.int16)) wavfile.write(str(tmpfile_test), 48000, test_tmp.astype(np.int16)) wavfile.write(str(tmpfile_ref), 48000, ref) wavfile.write(str(tmpfile_test), 48000, test) cmd = [ str(wdiff), Loading Loading
scripts/pyaudio3dtools/audioarray.py +11 −12 Original line number Diff line number Diff line Loading @@ -308,9 +308,6 @@ def compare( lengths_differ = ref.shape[0] != test.shape[0] test_orig = test.copy() ref_orig = ref.copy() if lengths_differ: if handle_differing_lengths == "fail": raise RuntimeError( Loading Loading @@ -442,19 +439,21 @@ def compare( tmpfile_test = Path(tmpdir).joinpath("test.wav") ### need to resample to 48kHz for MLD computation to be correct ### write out and delete tmp variables to reduce memory usage if fs != 48000: ref_tmp = np.clip( resample(ref_orig.astype(float), fs, 48000), -32768, 32767 ) resample(ref.astype(float), fs, 48000), -32768, 32767 ).astype(np.int16) wavfile.write(str(tmpfile_ref), 48000, ref_tmp) del ref_tmp test_tmp = np.clip( resample(test_orig.astype(float), fs, 48000), -32768, 32767 ) resample(test.astype(float), fs, 48000), -32768, 32767 ).astype(np.int16) wavfile.write(str(tmpfile_test), 48000, test_tmp) del test_tmp else: ref_tmp = ref_orig.copy() test_tmp = test_orig.copy() wavfile.write(str(tmpfile_ref), 48000, ref_tmp.astype(np.int16)) wavfile.write(str(tmpfile_test), 48000, test_tmp.astype(np.int16)) wavfile.write(str(tmpfile_ref), 48000, ref) wavfile.write(str(tmpfile_test), 48000, test) cmd = [ str(wdiff), Loading