Loading tests/renderer/compare_audio.py +0 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,6 @@ from pyaudio3dtools.audioarray import getdelay def compare_audio_arrays( left: np.ndarray, left_fs: int, right: np.ndarray, right_fs: int ) -> Tuple[float, float]: if left_fs != right_fs: return ValueError(f"Differing samplerates: {left_fs} vs {right_fs}!") Loading tests/renderer/test_renderer.py +15 −34 Original line number Diff line number Diff line Loading @@ -403,15 +403,6 @@ def test_ism_binaural_static(test_info, in_fmt, out_fmt, framing_5ms): except: in_meta_files = None if out_fmt == "BINAURAL": run_renderer( in_fmt, out_fmt, test_case_name=test_info.node.name, in_meta_files=in_meta_files, framing_5ms=(framing_5ms == "5ms"), ) else: run_renderer( in_fmt, out_fmt, Loading @@ -434,16 +425,6 @@ def test_ism_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file, framing except: in_meta_files = None if out_fmt == "BINAURAL": run_renderer( in_fmt, out_fmt, test_case_name=test_info.node.name, trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), in_meta_files=in_meta_files, framing_5ms=(framing_5ms == "5ms"), ) else: run_renderer( in_fmt, out_fmt, Loading tests/renderer/test_renderer_be_comparison.py +62 −19 Original line number Diff line number Diff line Loading @@ -28,8 +28,8 @@ import pytest from .utils import * from .utils import * """ Ambisonics """ Loading @@ -49,12 +49,16 @@ def test_ambisonics_binaural_static(test_info, in_fmt, out_fmt): @pytest.mark.parametrize("trj_file", HR_TRAJECTORIES_TO_TEST) @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) def test_ambisonics_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file): @pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST) def test_ambisonics_binaural_headrotation( test_info, in_fmt, out_fmt, trj_file, framing_5ms ): compare_renderer_vs_mergetarget( test_info, in_fmt, out_fmt, trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), framing_5ms=(framing_5ms == "5ms"), is_comparetest=True, ) Loading @@ -80,7 +84,10 @@ def test_multichannel_binaural_static(test_info, in_fmt, out_fmt): @pytest.mark.parametrize("trj_file", HR_TRAJECTORIES_TO_TEST) @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC) def test_multichannel_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file): @pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST) def test_multichannel_binaural_headrotation( test_info, in_fmt, out_fmt, trj_file, framing_5ms ): if in_fmt in ["MONO", "STEREO"]: pytest.skip("MONO or STEREO to Binaural rendering unsupported") Loading @@ -89,6 +96,7 @@ def test_multichannel_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file in_fmt, out_fmt, trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), framing_5ms=(framing_5ms == "5ms"), is_comparetest=True, ) Loading @@ -106,21 +114,31 @@ def test_ism(test_info, in_fmt, out_fmt): @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) def test_ism_binaural_static(test_info, in_fmt, out_fmt): @pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST) def test_ism_binaural_static(test_info, in_fmt, out_fmt, framing_5ms): if not framing_5ms: pytest.xfail("Binaural output currently only supported with 5ms framing") try: in_meta_files = FORMAT_TO_METADATA_FILES[in_fmt] except: in_meta_files = None compare_renderer_vs_mergetarget( test_info, in_fmt, out_fmt, in_meta_files=in_meta_files, is_comparetest=True test_info, in_fmt, out_fmt, in_meta_files=in_meta_files, framing_5ms=(framing_5ms == "5ms"), is_comparetest=True, ) @pytest.mark.parametrize("trj_file", HR_TRAJECTORIES_TO_TEST) @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) def test_ism_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file): @pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST) def test_ism_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file, framing_5ms): try: in_meta_files = FORMAT_TO_METADATA_FILES[in_fmt] except: Loading @@ -132,12 +150,14 @@ def test_ism_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file): out_fmt, trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), in_meta_files=in_meta_files, framing_5ms=(framing_5ms == "5ms"), is_comparetest=True, ) """ MASA """ @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA) def test_masa(test_info, in_fmt, out_fmt): Loading @@ -145,22 +165,28 @@ def test_masa(test_info, in_fmt, out_fmt): test_info, in_fmt, out_fmt, in_meta_files=FORMAT_TO_METADATA_FILES[in_fmt] ) @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA) def test_masa_binaural_static(test_info, in_fmt, out_fmt): @pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST) def test_masa_binaural_static(test_info, in_fmt, out_fmt, framing_5ms): if out_fmt in ["BINAURAL_ROOM_IR", "BINAURAL_ROOM_REVERB"]: pytest.skip("Skipping binaural room outputs for MASA as unimplemented.") compare_renderer_vs_mergetarget( test_info, in_fmt, out_fmt, in_meta_files=FORMAT_TO_METADATA_FILES[in_fmt] test_info, in_fmt, out_fmt, in_meta_files=FORMAT_TO_METADATA_FILES[in_fmt], framing_5ms=(framing_5ms == "5ms"), ) @pytest.mark.parametrize("trj_file", HR_TRAJECTORIES_TO_TEST) @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA) def test_masa_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file): @pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST) def test_masa_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file, framing_5ms): if out_fmt in ["BINAURAL_ROOM_IR", "BINAURAL_ROOM_REVERB"]: pytest.skip("Skipping binaural room outputs for MASA as unimplemented.") Loading @@ -169,9 +195,11 @@ def test_masa_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file): in_fmt, out_fmt, trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), in_meta_files=FORMAT_TO_METADATA_FILES[in_fmt] in_meta_files=FORMAT_TO_METADATA_FILES[in_fmt], framing_5ms=(framing_5ms == "5ms"), ) """ Custom loudspeaker layouts """ Loading @@ -179,7 +207,10 @@ def test_masa_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file): @pytest.mark.parametrize("in_layout", CUSTOM_LS_TO_TEST) def test_custom_ls_input(test_info, in_layout, out_fmt): compare_renderer_vs_mergetarget( test_info, CUSTOM_LAYOUT_DIR.joinpath(f"{in_layout}.txt"), out_fmt, is_comparetest=True test_info, CUSTOM_LAYOUT_DIR.joinpath(f"{in_layout}.txt"), out_fmt, is_comparetest=True, ) Loading @@ -187,7 +218,10 @@ def test_custom_ls_input(test_info, in_layout, out_fmt): @pytest.mark.parametrize("in_fmt", OUTPUT_FORMATS) def test_custom_ls_output(test_info, in_fmt, out_fmt): compare_renderer_vs_mergetarget( test_info, in_fmt, CUSTOM_LAYOUT_DIR.joinpath(f"{out_fmt}.txt"), is_comparetest=True test_info, in_fmt, CUSTOM_LAYOUT_DIR.joinpath(f"{out_fmt}.txt"), is_comparetest=True, ) Loading @@ -204,21 +238,30 @@ def test_custom_ls_input_output(test_info, in_fmt, out_fmt): @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_layout", CUSTOM_LS_TO_TEST) def test_custom_ls_input_binaural(test_info, in_layout, out_fmt): @pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST) def test_custom_ls_input_binaural(test_info, in_layout, out_fmt, framing_5ms): compare_renderer_vs_mergetarget( test_info, CUSTOM_LAYOUT_DIR.joinpath(f"{in_layout}.txt"), out_fmt, is_comparetest=True test_info, CUSTOM_LAYOUT_DIR.joinpath(f"{in_layout}.txt"), out_fmt, framing_5ms=(framing_5ms == "5ms"), is_comparetest=True, ) @pytest.mark.parametrize("trj_file", HR_TRAJECTORIES_TO_TEST) @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_layout", CUSTOM_LS_TO_TEST) def test_custom_ls_input_binaural_headrotation(test_info, in_layout, out_fmt, trj_file): @pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST) def test_custom_ls_input_binaural_headrotation( test_info, in_layout, out_fmt, trj_file, framing_5ms ): compare_renderer_vs_mergetarget( test_info, CUSTOM_LAYOUT_DIR.joinpath(f"{in_layout}.txt"), out_fmt, trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), framing_5ms=(framing_5ms == "5ms"), is_comparetest=True, ) Loading tests/renderer/utils.py +25 −11 Original line number Diff line number Diff line Loading @@ -27,12 +27,12 @@ """ import logging import os import subprocess as sp import sys import os from pathlib import Path from tempfile import TemporaryDirectory from typing import Optional, Tuple, Dict from typing import Dict, Optional, Tuple import numpy as np import pytest Loading @@ -43,11 +43,13 @@ from .constants import * sys.path.append(SCRIPTS_DIR) import pyaudio3dtools # fixture returns test information, enabling per-testcase SNR @pytest.fixture def test_info(request): return request def run_cmd(cmd, env=None): logging.info(f"\nRunning command\n{' '.join(cmd)}\n") try: Loading @@ -65,7 +67,6 @@ def check_BE( cut: np.ndarray, cut_fs: int, ): if ref is None or np.array_equal(ref, np.zeros_like(ref)): pytest.fail("REF signal does not exist or is zero!") Loading Loading @@ -148,7 +149,6 @@ def run_renderer( else: framing_name = "" if not isinstance(out_fmt, str): out_name = f"{out_fmt.stem}" else: Loading Loading @@ -212,12 +212,15 @@ def run_renderer( # Set env variables for UBSAN env = os.environ.copy() if test_case_name and "UBSAN_OPTIONS" in env.keys(): env["UBSAN_OPTIONS"] = env["UBSAN_OPTIONS"] + f",log_path=usan_log_{test_case_name}" env["UBSAN_OPTIONS"] = ( env["UBSAN_OPTIONS"] + f",log_path=usan_log_{test_case_name}" ) run_cmd(cmd, env) return pyaudio3dtools.audiofile.readfile(out_file) def compare_renderer_vs_mergetarget(test_info, in_fmt, out_fmt, **kwargs): ref, ref_fs = run_renderer( in_fmt, Loading @@ -227,16 +230,27 @@ def compare_renderer_vs_mergetarget(test_info, in_fmt, out_fmt, **kwargs): output_path_base=OUTPUT_PATH_REF, **kwargs, ) cut, cut_fs = run_renderer(in_fmt, out_fmt, test_case_name=test_info.node.name, **kwargs) cut, cut_fs = run_renderer( in_fmt, out_fmt, test_case_name=test_info.node.name, **kwargs ) check_BE(test_info, ref, ref_fs, cut, cut_fs) def compare_renderer_vs_pyscripts(test_info, in_fmt, out_fmt, **kwargs): ref, ref_fs = run_pyscripts(in_fmt, out_fmt, **kwargs) cut, cut_fs = run_renderer(in_fmt, out_fmt, test_case_name=test_info.node.name, **kwargs) cut, cut_fs = run_renderer( in_fmt, out_fmt, test_case_name=test_info.node.name, **kwargs ) check_BE(test_info, ref, ref_fs, cut, cut_fs) def compare_renderer_args(test_info, in_fmt, out_fmt, ref_kwargs: Dict, cut_kwargs: Dict): ref, ref_fs = run_renderer(in_fmt, out_fmt, test_case_name=test_info.node.name, **ref_kwargs) cut, cut_fs = run_renderer(in_fmt, out_fmt, test_case_name=test_info.node.name, **cut_kwargs) def compare_renderer_args( test_info, in_fmt, out_fmt, ref_kwargs: Dict, cut_kwargs: Dict ): ref, ref_fs = run_renderer( in_fmt, out_fmt, test_case_name=test_info.node.name, **ref_kwargs ) cut, cut_fs = run_renderer( in_fmt, out_fmt, test_case_name=test_info.node.name, **cut_kwargs ) check_BE(test_info, ref, ref_fs, cut, cut_fs) tests/split_rendering/constants.py +2 −0 Original line number Diff line number Diff line Loading @@ -172,6 +172,7 @@ SPLIT_PRE_REND_CMD = [ "BINAURAL_SPLIT_CODED", "-tf", "", # 14 -> post-trajectory file "-fr5", ] """ Split-post Renderer commandline template """ Loading @@ -189,4 +190,5 @@ SPLIT_POST_REND_CMD = [ "BINAURAL", "-tf", "", # 12 -> post-trajectory file "-fr5", ] Loading
tests/renderer/compare_audio.py +0 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,6 @@ from pyaudio3dtools.audioarray import getdelay def compare_audio_arrays( left: np.ndarray, left_fs: int, right: np.ndarray, right_fs: int ) -> Tuple[float, float]: if left_fs != right_fs: return ValueError(f"Differing samplerates: {left_fs} vs {right_fs}!") Loading
tests/renderer/test_renderer.py +15 −34 Original line number Diff line number Diff line Loading @@ -403,15 +403,6 @@ def test_ism_binaural_static(test_info, in_fmt, out_fmt, framing_5ms): except: in_meta_files = None if out_fmt == "BINAURAL": run_renderer( in_fmt, out_fmt, test_case_name=test_info.node.name, in_meta_files=in_meta_files, framing_5ms=(framing_5ms == "5ms"), ) else: run_renderer( in_fmt, out_fmt, Loading @@ -434,16 +425,6 @@ def test_ism_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file, framing except: in_meta_files = None if out_fmt == "BINAURAL": run_renderer( in_fmt, out_fmt, test_case_name=test_info.node.name, trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), in_meta_files=in_meta_files, framing_5ms=(framing_5ms == "5ms"), ) else: run_renderer( in_fmt, out_fmt, Loading
tests/renderer/test_renderer_be_comparison.py +62 −19 Original line number Diff line number Diff line Loading @@ -28,8 +28,8 @@ import pytest from .utils import * from .utils import * """ Ambisonics """ Loading @@ -49,12 +49,16 @@ def test_ambisonics_binaural_static(test_info, in_fmt, out_fmt): @pytest.mark.parametrize("trj_file", HR_TRAJECTORIES_TO_TEST) @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) def test_ambisonics_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file): @pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST) def test_ambisonics_binaural_headrotation( test_info, in_fmt, out_fmt, trj_file, framing_5ms ): compare_renderer_vs_mergetarget( test_info, in_fmt, out_fmt, trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), framing_5ms=(framing_5ms == "5ms"), is_comparetest=True, ) Loading @@ -80,7 +84,10 @@ def test_multichannel_binaural_static(test_info, in_fmt, out_fmt): @pytest.mark.parametrize("trj_file", HR_TRAJECTORIES_TO_TEST) @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC) def test_multichannel_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file): @pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST) def test_multichannel_binaural_headrotation( test_info, in_fmt, out_fmt, trj_file, framing_5ms ): if in_fmt in ["MONO", "STEREO"]: pytest.skip("MONO or STEREO to Binaural rendering unsupported") Loading @@ -89,6 +96,7 @@ def test_multichannel_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file in_fmt, out_fmt, trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), framing_5ms=(framing_5ms == "5ms"), is_comparetest=True, ) Loading @@ -106,21 +114,31 @@ def test_ism(test_info, in_fmt, out_fmt): @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) def test_ism_binaural_static(test_info, in_fmt, out_fmt): @pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST) def test_ism_binaural_static(test_info, in_fmt, out_fmt, framing_5ms): if not framing_5ms: pytest.xfail("Binaural output currently only supported with 5ms framing") try: in_meta_files = FORMAT_TO_METADATA_FILES[in_fmt] except: in_meta_files = None compare_renderer_vs_mergetarget( test_info, in_fmt, out_fmt, in_meta_files=in_meta_files, is_comparetest=True test_info, in_fmt, out_fmt, in_meta_files=in_meta_files, framing_5ms=(framing_5ms == "5ms"), is_comparetest=True, ) @pytest.mark.parametrize("trj_file", HR_TRAJECTORIES_TO_TEST) @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) def test_ism_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file): @pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST) def test_ism_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file, framing_5ms): try: in_meta_files = FORMAT_TO_METADATA_FILES[in_fmt] except: Loading @@ -132,12 +150,14 @@ def test_ism_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file): out_fmt, trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), in_meta_files=in_meta_files, framing_5ms=(framing_5ms == "5ms"), is_comparetest=True, ) """ MASA """ @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA) def test_masa(test_info, in_fmt, out_fmt): Loading @@ -145,22 +165,28 @@ def test_masa(test_info, in_fmt, out_fmt): test_info, in_fmt, out_fmt, in_meta_files=FORMAT_TO_METADATA_FILES[in_fmt] ) @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA) def test_masa_binaural_static(test_info, in_fmt, out_fmt): @pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST) def test_masa_binaural_static(test_info, in_fmt, out_fmt, framing_5ms): if out_fmt in ["BINAURAL_ROOM_IR", "BINAURAL_ROOM_REVERB"]: pytest.skip("Skipping binaural room outputs for MASA as unimplemented.") compare_renderer_vs_mergetarget( test_info, in_fmt, out_fmt, in_meta_files=FORMAT_TO_METADATA_FILES[in_fmt] test_info, in_fmt, out_fmt, in_meta_files=FORMAT_TO_METADATA_FILES[in_fmt], framing_5ms=(framing_5ms == "5ms"), ) @pytest.mark.parametrize("trj_file", HR_TRAJECTORIES_TO_TEST) @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA) def test_masa_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file): @pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST) def test_masa_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file, framing_5ms): if out_fmt in ["BINAURAL_ROOM_IR", "BINAURAL_ROOM_REVERB"]: pytest.skip("Skipping binaural room outputs for MASA as unimplemented.") Loading @@ -169,9 +195,11 @@ def test_masa_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file): in_fmt, out_fmt, trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), in_meta_files=FORMAT_TO_METADATA_FILES[in_fmt] in_meta_files=FORMAT_TO_METADATA_FILES[in_fmt], framing_5ms=(framing_5ms == "5ms"), ) """ Custom loudspeaker layouts """ Loading @@ -179,7 +207,10 @@ def test_masa_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file): @pytest.mark.parametrize("in_layout", CUSTOM_LS_TO_TEST) def test_custom_ls_input(test_info, in_layout, out_fmt): compare_renderer_vs_mergetarget( test_info, CUSTOM_LAYOUT_DIR.joinpath(f"{in_layout}.txt"), out_fmt, is_comparetest=True test_info, CUSTOM_LAYOUT_DIR.joinpath(f"{in_layout}.txt"), out_fmt, is_comparetest=True, ) Loading @@ -187,7 +218,10 @@ def test_custom_ls_input(test_info, in_layout, out_fmt): @pytest.mark.parametrize("in_fmt", OUTPUT_FORMATS) def test_custom_ls_output(test_info, in_fmt, out_fmt): compare_renderer_vs_mergetarget( test_info, in_fmt, CUSTOM_LAYOUT_DIR.joinpath(f"{out_fmt}.txt"), is_comparetest=True test_info, in_fmt, CUSTOM_LAYOUT_DIR.joinpath(f"{out_fmt}.txt"), is_comparetest=True, ) Loading @@ -204,21 +238,30 @@ def test_custom_ls_input_output(test_info, in_fmt, out_fmt): @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_layout", CUSTOM_LS_TO_TEST) def test_custom_ls_input_binaural(test_info, in_layout, out_fmt): @pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST) def test_custom_ls_input_binaural(test_info, in_layout, out_fmt, framing_5ms): compare_renderer_vs_mergetarget( test_info, CUSTOM_LAYOUT_DIR.joinpath(f"{in_layout}.txt"), out_fmt, is_comparetest=True test_info, CUSTOM_LAYOUT_DIR.joinpath(f"{in_layout}.txt"), out_fmt, framing_5ms=(framing_5ms == "5ms"), is_comparetest=True, ) @pytest.mark.parametrize("trj_file", HR_TRAJECTORIES_TO_TEST) @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_layout", CUSTOM_LS_TO_TEST) def test_custom_ls_input_binaural_headrotation(test_info, in_layout, out_fmt, trj_file): @pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST) def test_custom_ls_input_binaural_headrotation( test_info, in_layout, out_fmt, trj_file, framing_5ms ): compare_renderer_vs_mergetarget( test_info, CUSTOM_LAYOUT_DIR.joinpath(f"{in_layout}.txt"), out_fmt, trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), framing_5ms=(framing_5ms == "5ms"), is_comparetest=True, ) Loading
tests/renderer/utils.py +25 −11 Original line number Diff line number Diff line Loading @@ -27,12 +27,12 @@ """ import logging import os import subprocess as sp import sys import os from pathlib import Path from tempfile import TemporaryDirectory from typing import Optional, Tuple, Dict from typing import Dict, Optional, Tuple import numpy as np import pytest Loading @@ -43,11 +43,13 @@ from .constants import * sys.path.append(SCRIPTS_DIR) import pyaudio3dtools # fixture returns test information, enabling per-testcase SNR @pytest.fixture def test_info(request): return request def run_cmd(cmd, env=None): logging.info(f"\nRunning command\n{' '.join(cmd)}\n") try: Loading @@ -65,7 +67,6 @@ def check_BE( cut: np.ndarray, cut_fs: int, ): if ref is None or np.array_equal(ref, np.zeros_like(ref)): pytest.fail("REF signal does not exist or is zero!") Loading Loading @@ -148,7 +149,6 @@ def run_renderer( else: framing_name = "" if not isinstance(out_fmt, str): out_name = f"{out_fmt.stem}" else: Loading Loading @@ -212,12 +212,15 @@ def run_renderer( # Set env variables for UBSAN env = os.environ.copy() if test_case_name and "UBSAN_OPTIONS" in env.keys(): env["UBSAN_OPTIONS"] = env["UBSAN_OPTIONS"] + f",log_path=usan_log_{test_case_name}" env["UBSAN_OPTIONS"] = ( env["UBSAN_OPTIONS"] + f",log_path=usan_log_{test_case_name}" ) run_cmd(cmd, env) return pyaudio3dtools.audiofile.readfile(out_file) def compare_renderer_vs_mergetarget(test_info, in_fmt, out_fmt, **kwargs): ref, ref_fs = run_renderer( in_fmt, Loading @@ -227,16 +230,27 @@ def compare_renderer_vs_mergetarget(test_info, in_fmt, out_fmt, **kwargs): output_path_base=OUTPUT_PATH_REF, **kwargs, ) cut, cut_fs = run_renderer(in_fmt, out_fmt, test_case_name=test_info.node.name, **kwargs) cut, cut_fs = run_renderer( in_fmt, out_fmt, test_case_name=test_info.node.name, **kwargs ) check_BE(test_info, ref, ref_fs, cut, cut_fs) def compare_renderer_vs_pyscripts(test_info, in_fmt, out_fmt, **kwargs): ref, ref_fs = run_pyscripts(in_fmt, out_fmt, **kwargs) cut, cut_fs = run_renderer(in_fmt, out_fmt, test_case_name=test_info.node.name, **kwargs) cut, cut_fs = run_renderer( in_fmt, out_fmt, test_case_name=test_info.node.name, **kwargs ) check_BE(test_info, ref, ref_fs, cut, cut_fs) def compare_renderer_args(test_info, in_fmt, out_fmt, ref_kwargs: Dict, cut_kwargs: Dict): ref, ref_fs = run_renderer(in_fmt, out_fmt, test_case_name=test_info.node.name, **ref_kwargs) cut, cut_fs = run_renderer(in_fmt, out_fmt, test_case_name=test_info.node.name, **cut_kwargs) def compare_renderer_args( test_info, in_fmt, out_fmt, ref_kwargs: Dict, cut_kwargs: Dict ): ref, ref_fs = run_renderer( in_fmt, out_fmt, test_case_name=test_info.node.name, **ref_kwargs ) cut, cut_fs = run_renderer( in_fmt, out_fmt, test_case_name=test_info.node.name, **cut_kwargs ) check_BE(test_info, ref, ref_fs, cut, cut_fs)
tests/split_rendering/constants.py +2 −0 Original line number Diff line number Diff line Loading @@ -172,6 +172,7 @@ SPLIT_PRE_REND_CMD = [ "BINAURAL_SPLIT_CODED", "-tf", "", # 14 -> post-trajectory file "-fr5", ] """ Split-post Renderer commandline template """ Loading @@ -189,4 +190,5 @@ SPLIT_POST_REND_CMD = [ "BINAURAL", "-tf", "", # 12 -> post-trajectory file "-fr5", ]