diff --git a/ivas_processing_scripts/audiotools/binaural_datasets/binaural_dataset.py b/ivas_processing_scripts/audiotools/binaural_datasets/binaural_dataset.py index 12ee1018044234a23271b555b1443670ac02f603..e2341a8ad593af326be643dabfa9156b3842ccbf 100755 --- a/ivas_processing_scripts/audiotools/binaural_datasets/binaural_dataset.py +++ b/ivas_processing_scripts/audiotools/binaural_datasets/binaural_dataset.py @@ -154,9 +154,7 @@ def load_ir( f"No latency of HRTF dataset specified in .mat file -> computed latency: {latency_smp}" ) - if in_fmt.startswith("MONO"): - IR = IR[:, :, :1] # use omni/W from SBA - elif in_fmt.startswith("STEREO"): + if in_fmt.startswith("STEREO"): IR = IR[:, :, :2] # use L and R channels. elif ( in_fmt in CHANNEL_BASED_AUDIO_FORMATS.keys() diff --git a/ivas_processing_scripts/audiotools/convert/channelbased.py b/ivas_processing_scripts/audiotools/convert/channelbased.py index 94acef8e9dbd985201595cf79fedfc1c58d286ac..b0fadf99bb5b3c128e38343a9b18e34ea93873df 100755 --- a/ivas_processing_scripts/audiotools/convert/channelbased.py +++ b/ivas_processing_scripts/audiotools/convert/channelbased.py @@ -104,6 +104,15 @@ def render_cba_to_binaural( bin_lfe_gain: Optional[float] LFE gain for binaural rendering """ + + if cba.name == "MONO": + # no binauralization possible for mono -> render to stereo and assume binaural signal + cba_stereo = audio.fromtype("STEREO") + cba_stereo.fs = bin.fs + render_cba_to_cba(cba, cba_stereo) + bin.audio = cba_stereo.audio + return + # TODO this will change if we have resampled HRTFs cba.audio = resample_itu(cba, 48000) old_fs = cba.fs @@ -199,6 +208,7 @@ def render_cba_to_binaural( def render_cba_to_cba( cba_in: audio.ChannelBasedAudio, cba_out: audio.ChannelBasedAudio ) -> None: + # Stereo to Mono if cba_in.name == "STEREO" and cba_out.name == "MONO": render_mtx = np.vstack([[0.5], [0.5]]) @@ -234,6 +244,10 @@ def render_cba_to_cba( def render_cba_to_sba(cba: audio.ChannelBasedAudio, sba: audio.SceneBasedAudio) -> None: + + if cba.name == "MONO": + raise ValueError(f"Rendering from MONO to {sba.name} is not supported.") + # SH response for loudspeaker positions render_mtx = np.hstack( [ diff --git a/ivas_processing_scripts/audiotools/convert/masa.py b/ivas_processing_scripts/audiotools/convert/masa.py index 0014ef800c8f119994346c399b74afaa33ae933b..c03977ab6dbfb59046e34e1dc7d6bc3a62ac87ba 100755 --- a/ivas_processing_scripts/audiotools/convert/masa.py +++ b/ivas_processing_scripts/audiotools/convert/masa.py @@ -78,8 +78,6 @@ def render_masa_to_binaural( **kwargs, ): if "ROOM" in bin.name: - # TODO decide between MOZART or 7_1_4 for BRIRs - # cba_tmp = audio.fromtype("MOZART") cba_tmp = audio.fromtype("7_1_4") cba_tmp.fs = masa.fs diff --git a/ivas_processing_scripts/audiotools/convert/objectbased.py b/ivas_processing_scripts/audiotools/convert/objectbased.py index 9c8fcde36f0fe7e2306ced287ae01cb45e2c71ca..4111face8d1ee5c74b2ad66f78aec28737fc2be1 100755 --- a/ivas_processing_scripts/audiotools/convert/objectbased.py +++ b/ivas_processing_scripts/audiotools/convert/objectbased.py @@ -108,8 +108,6 @@ def render_oba_to_binaural( # bin.audio = np.zeros([oba.audio.shape[0], bin.num_channels]) if "ROOM" in bin.name: - # TODO decide between MOZART or 7_1_4 for BRIRs - # cba_tmp = audio.fromtype("MOZART") cba_tmp = audio.fromtype("7_1_4") cba_tmp.fs = oba.fs diff --git a/ivas_processing_scripts/audiotools/convert/scenebased.py b/ivas_processing_scripts/audiotools/convert/scenebased.py index 393f2a321011ecb9a2c7758bf9d9bdfb3926102a..10a91522905603eb4f2726989137d04e1650700e 100755 --- a/ivas_processing_scripts/audiotools/convert/scenebased.py +++ b/ivas_processing_scripts/audiotools/convert/scenebased.py @@ -113,8 +113,6 @@ def render_sba_to_binaural( sba.audio = rotate_sba(sba, trajectory) if "ROOM" in bin.name: - # TODO decide between MOZART or 7_1_4 for BRIRs - # cba_tmp = audio.fromtype("MOZART") cba_tmp = audio.fromtype("7_1_4") cba_tmp.fs = sba.fs diff --git a/ivas_processing_scripts/processing/chains.py b/ivas_processing_scripts/processing/chains.py index 2786bc2054a3610c104d03cdaa912c355f84dad8..e495f5319e469b92370b1718b11dc0c3e3edf53a 100755 --- a/ivas_processing_scripts/processing/chains.py +++ b/ivas_processing_scripts/processing/chains.py @@ -163,8 +163,6 @@ def get_processing_chain( elif cond_cfg["type"] == "esdru": tmp_esdru_alpha = cond_cfg["alpha"] elif cond_cfg["type"] == "mono_dmx": - # TODO: mono dmx - # raise NotImplementedError("Mono downmix support WIP") chain["processes"].append( Postprocessing( { diff --git a/ivas_processing_scripts/processing/evs.py b/ivas_processing_scripts/processing/evs.py index 52133877e303488a2994377e465f1ac82a883949..0e9c3e441e2c48de9769caf6dcfc197014031a75 100755 --- a/ivas_processing_scripts/processing/evs.py +++ b/ivas_processing_scripts/processing/evs.py @@ -35,6 +35,7 @@ from itertools import repeat from pathlib import Path from shutil import copyfile from typing import Optional +import platform from ivas_processing_scripts.audiotools import audio from ivas_processing_scripts.audiotools.audiofile import ( @@ -57,13 +58,19 @@ class EVS(Processing): self, ): if not self.cod_bin or not Path(self.cod_bin).exists(): - raise FileNotFoundError( - "The EVS encoder binary was not found! Please check the configuration." - ) + if platform.system() == "Windows" and (self.cod_bin and Path(self.cod_bin).with_suffix(".exe").exists()): + self.cod_bin = Path(self.cod_bin).with_suffix(".exe") + else: + raise FileNotFoundError( + "The EVS encoder binary was not found! Please check the configuration." + ) if not self.dec_bin or not Path(self.dec_bin).exists(): - raise FileNotFoundError( - "The EVS decoder binary was not found! Please check the configuration." - ) + if platform.system() == "Windows" and (self.dec_bin and Path(self.dec_bin).with_suffix(".exe").exists()): + self.dec_bin = Path(self.dec_bin).with_suffix(".exe") + else: + raise FileNotFoundError( + "The EVS decoder binary was not found! Please check the configuration." + ) # configure per-channel bitrate if specified, otherwise simply repeat if not isinstance(self.bitrate, list): diff --git a/ivas_processing_scripts/processing/ivas.py b/ivas_processing_scripts/processing/ivas.py index 886eb267523cd37580222aaaf19447e46fd4c37a..18199f9be59f4e47422d4d34bf4a706ce6d76143 100755 --- a/ivas_processing_scripts/processing/ivas.py +++ b/ivas_processing_scripts/processing/ivas.py @@ -35,6 +35,7 @@ import os.path from copy import deepcopy from pathlib import Path from typing import Optional +import platform from ivas_processing_scripts.audiotools import audio from ivas_processing_scripts.audiotools.audiofile import parse_wave_header @@ -52,13 +53,19 @@ class IVAS(Processing): def _validate(self): if not self.cod_bin or not Path(self.cod_bin).exists(): - raise FileNotFoundError( - "The IVAS encoder binary was not found! Please check the configuration." - ) + if platform.system() == "Windows" and (self.cod_bin and Path(self.cod_bin).with_suffix(".exe").exists()): + self.cod_bin = Path(self.cod_bin).with_suffix(".exe") + else: + raise FileNotFoundError( + "The IVAS encoder binary was not found! Please check the configuration." + ) if not self.dec_bin or not Path(self.dec_bin).exists(): - raise FileNotFoundError( - "The IVAS decoder binary was not found! Please check the configuration." - ) + if platform.system() == "Windows" and (self.dec_bin and Path(self.dec_bin).with_suffix(".exe").exists()): + self.dec_bin = Path(self.dec_bin).with_suffix(".exe") + else: + raise FileNotFoundError( + "The IVAS decoder binary was not found! Please check the configuration." + ) if self.tx is not None: if not self.tx["bin"] or not Path(self.tx["bin"]).exists(): bin = self.tx["bin"]