From 57e6fea877ac9979e315fc611251745354303433 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 12 May 2025 16:12:57 +0200 Subject: [PATCH 1/3] remove condition around rendering LFE to binaural - if not supplied the default gain value is used and LFE is always rendered --- .../audiotools/convert/channelbased.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ivas_processing_scripts/audiotools/convert/channelbased.py b/ivas_processing_scripts/audiotools/convert/channelbased.py index dbb8b160..565c87de 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 -- GitLab From f8e5f63169a5b125704b143934e89d6ff00d8746 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 12 May 2025 16:17:07 +0200 Subject: [PATCH 2/3] update audiotools CLI to accept dB gain values as well for LFE --- ivas_processing_scripts/audiotools/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ivas_processing_scripts/audiotools/__init__.py b/ivas_processing_scripts/audiotools/__init__.py index f3b599d1..a191140f 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( -- GitLab From 451d015c004772214cb5fb78595f4dc67fbf5a6b Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 12 May 2025 16:45:26 +0200 Subject: [PATCH 3/3] fix test failures due to None value being passed --- ivas_processing_scripts/audiotools/convert/channelbased.py | 4 +++- ivas_processing_scripts/processing/chains.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ivas_processing_scripts/audiotools/convert/channelbased.py b/ivas_processing_scripts/audiotools/convert/channelbased.py index 565c87de..1499759d 100755 --- a/ivas_processing_scripts/audiotools/convert/channelbased.py +++ b/ivas_processing_scripts/audiotools/convert/channelbased.py @@ -352,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 21b20a0e..19b5e760 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, -- GitLab