diff --git a/ivas_processing_scripts/audiotools/__init__.py b/ivas_processing_scripts/audiotools/__init__.py index f3b599d19f836086ae2674d02198017d8850fc67..a191140fa22e856277200a9028abddd95cec53a6 100755 --- a/ivas_processing_scripts/audiotools/__init__.py +++ b/ivas_processing_scripts/audiotools/__init__.py @@ -195,8 +195,8 @@ def get_argparser(): output_parser.add_argument( "-bl", "--bin_lfe_gain", - type=float, - help="Render LFE to binaural output with the specified gain (only valid for channel-based input, default = %(default)s)", + type=parse_gain, + help="Render LFE to binaural output with the specified gain (suffix with dB to use nonlinear, e.g. '10 dB', only valid for channel-based input, default = %(default)s)", default=BINAURAL_LFE_GAIN, ) output_parser.add_argument( diff --git a/ivas_processing_scripts/audiotools/convert/channelbased.py b/ivas_processing_scripts/audiotools/convert/channelbased.py index dbb8b160ed46b26f3800d6c411402323f718e012..1499759da3fa5f46c47751a2f4effc46416fd394 100755 --- a/ivas_processing_scripts/audiotools/convert/channelbased.py +++ b/ivas_processing_scripts/audiotools/convert/channelbased.py @@ -128,10 +128,9 @@ def render_cba_to_binaural( IR, _, latency_smp = load_ir(cba.name, bin.name, bin_dataset) # render LFE - if bin_lfe_gain is not None: - bin_lfe, lfe_delay_ns = render_lfe_to_binaural( - cba.audio, cba.fs, cba.lfe_index, bin_lfe_gain - ) + bin_lfe, lfe_delay_ns = render_lfe_to_binaural( + cba.audio, cba.fs, cba.lfe_index, bin_lfe_gain + ) # render rest of the signal bin.audio = binaural_fftconv(cba.audio, IR, cba.num_channels, cba.lfe_index) @@ -139,8 +138,7 @@ def render_cba_to_binaural( bin.audio = delay(bin.audio, bin.fs, -latency_smp, samples=True) # add LFE and rest - if bin_lfe_gain is not None: - bin.audio += bin_lfe + bin.audio += bin_lfe bin.audio = resample_itu(bin, old_fs) bin.fs = old_fs @@ -354,12 +352,14 @@ def render_lfe_to_binaural( x: np.ndarray, fs: Optional[int] = 48000, lfe_index: Optional[list] = None, - LFE_gain: Optional[float] = BINAURAL_LFE_GAIN, + LFE_gain: Optional[float] = None, ) -> Tuple[np.ndarray, int]: """ Extract LFE from the given input and render it binaurally, accounting for delay """ + if LFE_gain is None: + LFE_gain = BINAURAL_LFE_GAIN lfe = x[:, lfe_index].copy() diff --git a/ivas_processing_scripts/processing/chains.py b/ivas_processing_scripts/processing/chains.py index 21b20a0e4dbdcf33fccc738d159290f0dd6a1605..19b5e760c8c7448ccb3a4cd95356daa36b71d352 100755 --- a/ivas_processing_scripts/processing/chains.py +++ b/ivas_processing_scripts/processing/chains.py @@ -577,7 +577,7 @@ def get_processing_chain( "out_fmt": post_fmt, "out_cutoff": tmp_lp_cutoff, "bin_dataset": post_cfg.get("bin_dataset"), - "bin_lfe_gain": post_cfg.get("bin_lfe_gain"), + "bin_lfe_gain": parse_gain(post_cfg.get("bin_lfe_gain")), "limit": post_cfg.get("limit", True), "trajectory": get_abs_path(post_cfg.get("trajectory", None)), "multiprocessing": cfg.multiprocessing,