Loading scripts/pyaudio3dtools/audioarray.py +13 −7 Original line number Diff line number Diff line Loading @@ -352,7 +352,9 @@ def compare( ) search_path = toolsdir.joinpath(curr_platform.replace("Windows", "Win32")) wdiff = search_path.joinpath("wav-diff").with_suffix(".exe" if curr_platform == "Windows" else "") wdiff = search_path.joinpath("wav-diff").with_suffix( ".exe" if curr_platform == "Windows" else "" ) if not wdiff.exists(): wdiff = shutil.which("wav-diff") Loading Loading @@ -405,7 +407,6 @@ def compare( result["MLD"] = mld_max # Run remanining tests after checking if the lenght differs lengths_differ = ref.shape[0] != test.shape[0] Loading Loading @@ -678,16 +679,21 @@ def ssnr( """ Calculate Segmental SNR for test_sig to ref_sig as defined in ISO/IEC 14496-4 """ # check if diff of signal is zero already, then SNR is infinite, since no noise signals_equal = (ref_sig == test_sig).all() if signals_equal: return np.asarray([np.inf] * ref_sig.shape[1]) ss = list() # allocation here ref_sig_norm = ref_sig / -np.iinfo(np.int16).min # allocation here test_sig_norm = test_sig / -np.iinfo(np.int16).min # check if diff of signal is zero already, then SNR is infinite, since no noise # allocation here diff_sig_norm = ref_sig_norm - test_sig_norm if np.all(diff_sig_norm == 0): return np.asarray([np.inf] * ref_sig_norm.shape[1]) # allocation here channels_identical_idx = np.sum(np.abs(diff_sig_norm), axis=0) == 0 denom_add = 10**-13 * len_seg Loading Loading
scripts/pyaudio3dtools/audioarray.py +13 −7 Original line number Diff line number Diff line Loading @@ -352,7 +352,9 @@ def compare( ) search_path = toolsdir.joinpath(curr_platform.replace("Windows", "Win32")) wdiff = search_path.joinpath("wav-diff").with_suffix(".exe" if curr_platform == "Windows" else "") wdiff = search_path.joinpath("wav-diff").with_suffix( ".exe" if curr_platform == "Windows" else "" ) if not wdiff.exists(): wdiff = shutil.which("wav-diff") Loading Loading @@ -405,7 +407,6 @@ def compare( result["MLD"] = mld_max # Run remanining tests after checking if the lenght differs lengths_differ = ref.shape[0] != test.shape[0] Loading Loading @@ -678,16 +679,21 @@ def ssnr( """ Calculate Segmental SNR for test_sig to ref_sig as defined in ISO/IEC 14496-4 """ # check if diff of signal is zero already, then SNR is infinite, since no noise signals_equal = (ref_sig == test_sig).all() if signals_equal: return np.asarray([np.inf] * ref_sig.shape[1]) ss = list() # allocation here ref_sig_norm = ref_sig / -np.iinfo(np.int16).min # allocation here test_sig_norm = test_sig / -np.iinfo(np.int16).min # check if diff of signal is zero already, then SNR is infinite, since no noise # allocation here diff_sig_norm = ref_sig_norm - test_sig_norm if np.all(diff_sig_norm == 0): return np.asarray([np.inf] * ref_sig_norm.shape[1]) # allocation here channels_identical_idx = np.sum(np.abs(diff_sig_norm), axis=0) == 0 denom_add = 10**-13 * len_seg Loading