Loading ivas_processing_scripts/audiotools/wrappers/bs1770.py +23 −2 Original line number Diff line number Diff line Loading @@ -134,8 +134,12 @@ def bs1770demo( result = run(cmd, logger=logger) # parse output measured_loudness = float(result.stdout.splitlines()[3].split(":")[1]) scale_factor = float(result.stdout.splitlines()[-3].split(":")[1]) measured_loudness = check_for_nan_and_inf( result.stdout.splitlines()[3].split(":")[1] ) scale_factor = check_for_nan_and_inf( result.stdout.splitlines()[-3].split(":")[1] ) return measured_loudness, scale_factor Loading Loading @@ -289,3 +293,20 @@ def scale_files( # write into file write(file, scaled_audio, audio_obj.fs) def check_for_nan_and_inf(input_string: str): """ Checks the input string for nan and inf Parameters ---------- input_string: str Input string """ if "nan" in input_string.lower(): raise ValueError("Too quiet.") elif "inf" in input_string.lower(): raise ValueError("All zeros.") else: return float(input_string) Loading
ivas_processing_scripts/audiotools/wrappers/bs1770.py +23 −2 Original line number Diff line number Diff line Loading @@ -134,8 +134,12 @@ def bs1770demo( result = run(cmd, logger=logger) # parse output measured_loudness = float(result.stdout.splitlines()[3].split(":")[1]) scale_factor = float(result.stdout.splitlines()[-3].split(":")[1]) measured_loudness = check_for_nan_and_inf( result.stdout.splitlines()[3].split(":")[1] ) scale_factor = check_for_nan_and_inf( result.stdout.splitlines()[-3].split(":")[1] ) return measured_loudness, scale_factor Loading Loading @@ -289,3 +293,20 @@ def scale_files( # write into file write(file, scaled_audio, audio_obj.fs) def check_for_nan_and_inf(input_string: str): """ Checks the input string for nan and inf Parameters ---------- input_string: str Input string """ if "nan" in input_string.lower(): raise ValueError("Too quiet.") elif "inf" in input_string.lower(): raise ValueError("All zeros.") else: return float(input_string)