Loading .gitlab-ci.yml +6 −4 Original line number Diff line number Diff line Loading @@ -67,11 +67,13 @@ format: script: - mkdir $ARTIFACT_FOLDER - isort --profile black . || ret_val_isort=$? - black . || ret_val_black=$? - git diff > "${ARTIFACT_FOLDER}/${ARTIFACT_BASE_NAME}.patch" - isort --profile black . - black . - if [[ $ret_val_isort != 0 || $ret_val_black != 0 ]]; then exit 1; fi - patch_file="${ARTIFACT_FOLDER}/${ARTIFACT_BASE_NAME}.patch" - git diff > $patch_file - if [ -s $patch_file ]; then exit 1; fi artifacts: paths: - "$ARTIFACT_FOLDER" Loading ivas_processing_scripts/audiotools/audioarray.py +6 −6 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ logger = logging.getLogger("__main__") logger.setLevel(logging.DEBUG) ### Functions used in this module # Functions used in this module def trim( x: np.ndarray, fs: Optional[int] = 48000, Loading Loading @@ -183,13 +183,13 @@ def delay_compensation( """ # Get the delay in number of samples if flt_type == "SHQ2" and up == True: if flt_type == "SHQ2" and up: d_samples = DELAY_COMPENSATION_FOR_FILTERING["SHQ2"]["up"] elif flt_type == "SHQ2" and down == True: elif flt_type == "SHQ2" and down: d_samples = DELAY_COMPENSATION_FOR_FILTERING["SHQ2"]["down"] elif flt_type == "SHQ3" and up == True: elif flt_type == "SHQ3" and up: d_samples = DELAY_COMPENSATION_FOR_FILTERING["SHQ3"]["up"] elif flt_type == "SHQ3" and down == True: elif flt_type == "SHQ3" and down: d_samples = DELAY_COMPENSATION_FOR_FILTERING["SHQ3"]["down"] else: d_samples = DELAY_COMPENSATION_FOR_FILTERING[flt_type] Loading Loading @@ -405,7 +405,7 @@ def framewise_io( ) ### Deprecated functions (partly replaced by ITU binaries) # Deprecated functions (partly replaced by ITU binaries) def resample( x: np.ndarray, in_freq: int, Loading ivas_processing_scripts/audiotools/binaural_datasets/binaural_dataset.py +12 −5 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ # the United Nations Convention on Contracts on the International Sales of Goods. # import logging import warnings from pathlib import Path from typing import Optional, Tuple, Union Loading Loading @@ -142,15 +141,23 @@ def load_ir( if in_fmt == "SBA1" or in_fmt == "FOA": dataset_suffix = "SBA1" # Use truncated SBA3 dataset if no SBA1 or 2 dataset exists if not (Path(__file__).parent.joinpath(f"{dataset_prefix}_{dataset}_{dataset_suffix}.mat")).is_file(): if not ( Path(__file__).parent.joinpath( f"{dataset_prefix}_{dataset}_{dataset_suffix}.mat" ) ).is_file(): dataset_suffix = "SBA3" warnings.warn(f"No SBA1 dataset found -> use truncated SBA3 dataset") warnings.warn("No SBA1 dataset found -> use truncated SBA3 dataset") elif in_fmt.endswith("2"): dataset_suffix = "SBA2" # Use truncated SBA3 dataset if no SBA1 or 2 dataset exists if not (Path(__file__).parent.joinpath(f"{dataset_prefix}_{dataset}_{dataset_suffix}.mat")).is_file(): if not ( Path(__file__).parent.joinpath( f"{dataset_prefix}_{dataset}_{dataset_suffix}.mat" ) ).is_file(): dataset_suffix = "SBA3" warnings.warn(f"No SBA2 dataset found -> use truncated SBA3 dataset") warnings.warn("No SBA2 dataset found -> use truncated SBA3 dataset") else: dataset_suffix = "SBA3" Loading ivas_processing_scripts/audiotools/convert/__init__.py +8 −6 Original line number Diff line number Diff line Loading @@ -41,12 +41,12 @@ from ivas_processing_scripts.audiotools.convert.masa import convert_masa from ivas_processing_scripts.audiotools.convert.objectbased import convert_objectbased from ivas_processing_scripts.audiotools.convert.scenebased import convert_scenebased from ivas_processing_scripts.audiotools.wrappers.bs1770 import loudness_norm from ivas_processing_scripts.audiotools.wrappers.esdru import esdru from ivas_processing_scripts.audiotools.wrappers.filter import ( hp50filter_itu, lpfilter_itu, resample_itu, ) from ivas_processing_scripts.audiotools.wrappers.esdru import esdru from ivas_processing_scripts.audiotools.wrappers.p50fbmnru import p50fbmnru from ..metadata import write_ISM_metadata_in_file Loading Loading @@ -258,13 +258,13 @@ def process_audio( """MNRU""" if mnru_q is not None: if logger: logger.debug(f"Applying P.50 Fullband MNRU") logger.debug("Applying P.50 Fullband MNRU") x.audio = p50fbmnru(x, mnru_q) """ESDRU""" if esdru_alpha is not None: if logger: logger.debug(f"Applying ESDRU Recommendation ITU-T P.811") logger.debug("Applying ESDRU Recommendation ITU-T P.811") x.audio = esdru(x, esdru_alpha) """limiting""" Loading @@ -284,17 +284,19 @@ def format_conversion( # validation if isinstance(output, audio.MetadataAssistedSpatialAudio): raise NotImplementedError(f"MASA is not supported as an output for rendering!") raise NotImplementedError("MASA is not supported as an output for rendering!") if isinstance(output, audio.ObjectBasedAudio) and input.name != output.name: raise NotImplementedError( f"ISM is not supported as an output for rendering! Only usable as pass-through" "ISM is not supported as an output for rendering! Only usable as pass-through" ) if logger: logger.debug(f"Format conversion: {input.name} -> {output.name}") if input.name == output.name or (input.name.startswith("BINAURAL") and output.name.startswith("BINAURAL")): if input.name == output.name or ( input.name.startswith("BINAURAL") and output.name.startswith("BINAURAL") ): output.audio = input.audio else: if isinstance(input, audio.BinauralAudio): Loading ivas_processing_scripts/audiotools/convert/channelbased.py +0 −2 Original line number Diff line number Diff line Loading @@ -208,7 +208,6 @@ 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]]) Loading Loading @@ -244,7 +243,6 @@ 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.") Loading Loading
.gitlab-ci.yml +6 −4 Original line number Diff line number Diff line Loading @@ -67,11 +67,13 @@ format: script: - mkdir $ARTIFACT_FOLDER - isort --profile black . || ret_val_isort=$? - black . || ret_val_black=$? - git diff > "${ARTIFACT_FOLDER}/${ARTIFACT_BASE_NAME}.patch" - isort --profile black . - black . - if [[ $ret_val_isort != 0 || $ret_val_black != 0 ]]; then exit 1; fi - patch_file="${ARTIFACT_FOLDER}/${ARTIFACT_BASE_NAME}.patch" - git diff > $patch_file - if [ -s $patch_file ]; then exit 1; fi artifacts: paths: - "$ARTIFACT_FOLDER" Loading
ivas_processing_scripts/audiotools/audioarray.py +6 −6 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ logger = logging.getLogger("__main__") logger.setLevel(logging.DEBUG) ### Functions used in this module # Functions used in this module def trim( x: np.ndarray, fs: Optional[int] = 48000, Loading Loading @@ -183,13 +183,13 @@ def delay_compensation( """ # Get the delay in number of samples if flt_type == "SHQ2" and up == True: if flt_type == "SHQ2" and up: d_samples = DELAY_COMPENSATION_FOR_FILTERING["SHQ2"]["up"] elif flt_type == "SHQ2" and down == True: elif flt_type == "SHQ2" and down: d_samples = DELAY_COMPENSATION_FOR_FILTERING["SHQ2"]["down"] elif flt_type == "SHQ3" and up == True: elif flt_type == "SHQ3" and up: d_samples = DELAY_COMPENSATION_FOR_FILTERING["SHQ3"]["up"] elif flt_type == "SHQ3" and down == True: elif flt_type == "SHQ3" and down: d_samples = DELAY_COMPENSATION_FOR_FILTERING["SHQ3"]["down"] else: d_samples = DELAY_COMPENSATION_FOR_FILTERING[flt_type] Loading Loading @@ -405,7 +405,7 @@ def framewise_io( ) ### Deprecated functions (partly replaced by ITU binaries) # Deprecated functions (partly replaced by ITU binaries) def resample( x: np.ndarray, in_freq: int, Loading
ivas_processing_scripts/audiotools/binaural_datasets/binaural_dataset.py +12 −5 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ # the United Nations Convention on Contracts on the International Sales of Goods. # import logging import warnings from pathlib import Path from typing import Optional, Tuple, Union Loading Loading @@ -142,15 +141,23 @@ def load_ir( if in_fmt == "SBA1" or in_fmt == "FOA": dataset_suffix = "SBA1" # Use truncated SBA3 dataset if no SBA1 or 2 dataset exists if not (Path(__file__).parent.joinpath(f"{dataset_prefix}_{dataset}_{dataset_suffix}.mat")).is_file(): if not ( Path(__file__).parent.joinpath( f"{dataset_prefix}_{dataset}_{dataset_suffix}.mat" ) ).is_file(): dataset_suffix = "SBA3" warnings.warn(f"No SBA1 dataset found -> use truncated SBA3 dataset") warnings.warn("No SBA1 dataset found -> use truncated SBA3 dataset") elif in_fmt.endswith("2"): dataset_suffix = "SBA2" # Use truncated SBA3 dataset if no SBA1 or 2 dataset exists if not (Path(__file__).parent.joinpath(f"{dataset_prefix}_{dataset}_{dataset_suffix}.mat")).is_file(): if not ( Path(__file__).parent.joinpath( f"{dataset_prefix}_{dataset}_{dataset_suffix}.mat" ) ).is_file(): dataset_suffix = "SBA3" warnings.warn(f"No SBA2 dataset found -> use truncated SBA3 dataset") warnings.warn("No SBA2 dataset found -> use truncated SBA3 dataset") else: dataset_suffix = "SBA3" Loading
ivas_processing_scripts/audiotools/convert/__init__.py +8 −6 Original line number Diff line number Diff line Loading @@ -41,12 +41,12 @@ from ivas_processing_scripts.audiotools.convert.masa import convert_masa from ivas_processing_scripts.audiotools.convert.objectbased import convert_objectbased from ivas_processing_scripts.audiotools.convert.scenebased import convert_scenebased from ivas_processing_scripts.audiotools.wrappers.bs1770 import loudness_norm from ivas_processing_scripts.audiotools.wrappers.esdru import esdru from ivas_processing_scripts.audiotools.wrappers.filter import ( hp50filter_itu, lpfilter_itu, resample_itu, ) from ivas_processing_scripts.audiotools.wrappers.esdru import esdru from ivas_processing_scripts.audiotools.wrappers.p50fbmnru import p50fbmnru from ..metadata import write_ISM_metadata_in_file Loading Loading @@ -258,13 +258,13 @@ def process_audio( """MNRU""" if mnru_q is not None: if logger: logger.debug(f"Applying P.50 Fullband MNRU") logger.debug("Applying P.50 Fullband MNRU") x.audio = p50fbmnru(x, mnru_q) """ESDRU""" if esdru_alpha is not None: if logger: logger.debug(f"Applying ESDRU Recommendation ITU-T P.811") logger.debug("Applying ESDRU Recommendation ITU-T P.811") x.audio = esdru(x, esdru_alpha) """limiting""" Loading @@ -284,17 +284,19 @@ def format_conversion( # validation if isinstance(output, audio.MetadataAssistedSpatialAudio): raise NotImplementedError(f"MASA is not supported as an output for rendering!") raise NotImplementedError("MASA is not supported as an output for rendering!") if isinstance(output, audio.ObjectBasedAudio) and input.name != output.name: raise NotImplementedError( f"ISM is not supported as an output for rendering! Only usable as pass-through" "ISM is not supported as an output for rendering! Only usable as pass-through" ) if logger: logger.debug(f"Format conversion: {input.name} -> {output.name}") if input.name == output.name or (input.name.startswith("BINAURAL") and output.name.startswith("BINAURAL")): if input.name == output.name or ( input.name.startswith("BINAURAL") and output.name.startswith("BINAURAL") ): output.audio = input.audio else: if isinstance(input, audio.BinauralAudio): Loading
ivas_processing_scripts/audiotools/convert/channelbased.py +0 −2 Original line number Diff line number Diff line Loading @@ -208,7 +208,6 @@ 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]]) Loading Loading @@ -244,7 +243,6 @@ 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.") Loading