Loading tests/hrtf_binary_loading/test_renderer_ROM_vs_file.py +31 −13 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ from tests.renderer.constants import ( INPUT_FORMATS_ISM, INPUT_FORMATS_MC, ) from .constants import HRTF_FILES """ Ambisonics """ Loading @@ -49,11 +50,12 @@ from tests.renderer.constants import ( @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) @pytest.mark.parametrize("hrtf_file", HRTF_FILES) def test_ambisonics_binaural_static_with_binary_hrir( test_info, in_fmt, out_fmt, frame_size test_info, in_fmt, out_fmt, frame_size, hrtf_file ): compare_renderer_vs_renderer_with_binary_hrir( test_info, in_fmt, out_fmt, frame_size=frame_size test_info, in_fmt, out_fmt, hrtf_file, frame_size=frame_size ) Loading @@ -61,13 +63,15 @@ def test_ambisonics_binaural_static_with_binary_hrir( @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) @pytest.mark.parametrize("hrtf_file", HRTF_FILES) def test_ambisonics_binaural_headrotation_with_binary_hrir( test_info, in_fmt, out_fmt, trj_file, frame_size test_info, in_fmt, out_fmt, trj_file, frame_size, hrtf_file ): compare_renderer_vs_renderer_with_binary_hrir( test_info, in_fmt, out_fmt, hrtf_file, trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), frame_size=frame_size, ) Loading @@ -79,14 +83,15 @@ def test_ambisonics_binaural_headrotation_with_binary_hrir( @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) @pytest.mark.parametrize("hrtf_file", HRTF_FILES) def test_multichannel_binaural_static_with_binary_hrir( test_info, in_fmt, out_fmt, frame_size test_info, in_fmt, out_fmt, frame_size, hrtf_file ): if in_fmt in ["MONO", "STEREO"]: pytest.skip("MONO or STEREO to Binaural rendering unsupported") compare_renderer_vs_renderer_with_binary_hrir( test_info, in_fmt, out_fmt, frame_size=frame_size test_info, in_fmt, out_fmt, hrtf_file, frame_size=frame_size ) Loading @@ -94,8 +99,9 @@ def test_multichannel_binaural_static_with_binary_hrir( @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) @pytest.mark.parametrize("hrtf_file", HRTF_FILES) def test_multichannel_binaural_headrotation_with_binary_hrir( test_info, in_fmt, out_fmt, trj_file, frame_size test_info, in_fmt, out_fmt, trj_file, frame_size, hrtf_file ): if in_fmt in ["MONO", "STEREO"]: pytest.skip("MONO or STEREO to Binaural rendering unsupported") Loading @@ -104,6 +110,7 @@ def test_multichannel_binaural_headrotation_with_binary_hrir( test_info, in_fmt, out_fmt, hrtf_file, trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), frame_size=frame_size, ) Loading @@ -115,14 +122,15 @@ def test_multichannel_binaural_headrotation_with_binary_hrir( @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) def test_ism_binaural_static_with_binary_hrir(test_info, in_fmt, out_fmt, frame_size): @pytest.mark.parametrize("hrtf_file", HRTF_FILES) def test_ism_binaural_static_with_binary_hrir(test_info, in_fmt, out_fmt, frame_size, hrtf_file): try: in_meta_files = FORMAT_TO_METADATA_FILES_RENDERER[in_fmt] except: in_meta_files = None compare_renderer_vs_renderer_with_binary_hrir( test_info, in_fmt, out_fmt, in_meta_files=in_meta_files, frame_size=frame_size test_info, in_fmt, out_fmt, hrtf_file, in_meta_files=in_meta_files, frame_size=frame_size ) Loading @@ -130,8 +138,9 @@ def test_ism_binaural_static_with_binary_hrir(test_info, in_fmt, out_fmt, frame_ @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) @pytest.mark.parametrize("hrtf_file", HRTF_FILES) def test_ism_binaural_headrotation_with_binary_hrir( test_info, in_fmt, out_fmt, trj_file, frame_size test_info, in_fmt, out_fmt, trj_file, frame_size, hrtf_file ): try: in_meta_files = FORMAT_TO_METADATA_FILES_RENDERER[in_fmt] Loading @@ -142,6 +151,7 @@ def test_ism_binaural_headrotation_with_binary_hrir( test_info, in_fmt, out_fmt, hrtf_file, trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), in_meta_files=in_meta_files, frame_size=frame_size, Loading @@ -154,7 +164,8 @@ def test_ism_binaural_headrotation_with_binary_hrir( @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA_RENDERER) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) def test_masa_binaural_static_with_binary_hrir(test_info, in_fmt, out_fmt, frame_size): @pytest.mark.parametrize("hrtf_file", HRTF_FILES) def test_masa_binaural_static_with_binary_hrir(test_info, in_fmt, out_fmt, frame_size, hrtf_file): if out_fmt in ["BINAURAL_ROOM_IR", "BINAURAL_ROOM_REVERB"]: pytest.skip("Skipping binaural room outputs for MASA as unimplemented.") Loading @@ -162,6 +173,7 @@ def test_masa_binaural_static_with_binary_hrir(test_info, in_fmt, out_fmt, frame test_info, in_fmt, out_fmt, hrtf_file, in_meta_files=FORMAT_TO_METADATA_FILES_RENDERER[in_fmt], ) Loading @@ -170,8 +182,9 @@ def test_masa_binaural_static_with_binary_hrir(test_info, in_fmt, out_fmt, frame @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA_RENDERER) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) @pytest.mark.parametrize("hrtf_file", HRTF_FILES) def test_masa_binaural_headrotation_with_binary_hrir( test_info, in_fmt, out_fmt, trj_file, frame_size test_info, in_fmt, out_fmt, trj_file, frame_size, hrtf_file ): if out_fmt in ["BINAURAL_ROOM_IR", "BINAURAL_ROOM_REVERB"]: pytest.skip("Skipping binaural room outputs for MASA as unimplemented.") Loading @@ -180,6 +193,7 @@ def test_masa_binaural_headrotation_with_binary_hrir( test_info, in_fmt, out_fmt, hrtf_file, trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), in_meta_files=FORMAT_TO_METADATA_FILES_RENDERER[in_fmt], ) Loading @@ -191,13 +205,15 @@ def test_masa_binaural_headrotation_with_binary_hrir( @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_layout", CUSTOM_LS_TO_TEST) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) @pytest.mark.parametrize("hrtf_file", HRTF_FILES) def test_custom_ls_input_binaural_with_binary_hrir( test_info, in_layout, out_fmt, frame_size test_info, in_layout, out_fmt, frame_size, hrtf_file ): compare_renderer_vs_renderer_with_binary_hrir( test_info, CUSTOM_LAYOUT_DIR.joinpath(f"{in_layout}.txt"), out_fmt, hrtf_file, frame_size=frame_size, ) Loading @@ -206,13 +222,15 @@ def test_custom_ls_input_binaural_with_binary_hrir( @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_layout", CUSTOM_LS_TO_TEST) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) @pytest.mark.parametrize("hrtf_file", HRTF_FILES) def test_custom_ls_input_binaural_headrotation_with_binary_hrir( test_info, in_layout, out_fmt, trj_file, frame_size test_info, in_layout, out_fmt, trj_file, frame_size, hrtf_file ): compare_renderer_vs_renderer_with_binary_hrir( test_info, CUSTOM_LAYOUT_DIR.joinpath(f"{in_layout}.txt"), out_fmt, hrtf_file, trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), frame_size=frame_size, ) tests/hrtf_binary_loading/utils.py +6 −11 Original line number Diff line number Diff line Loading @@ -322,14 +322,7 @@ def compare_rom_vs_binary( ) out_bin, out_bin_fs = pyaudio3dtools.audiofile.readfile(out_bin_path) check_BE( test_info, out_rom, out_rom_fs, out_bin, out_bin_fs, xfail=xfail, ) check_BE(test_info, out_rom, out_rom_fs, out_bin, out_bin_fs, xfail) if keep_file == False: os.remove(bitstream_path) os.remove(out_rom_path) Loading @@ -340,6 +333,7 @@ def compare_renderer_vs_renderer_with_binary_hrir( test_info, in_fmt, out_fmt, hrtf_file, metadata_input: Optional[str] = None, in_meta_files: Optional[list] = None, trj_file: Optional[str] = None, Loading @@ -350,13 +344,14 @@ def compare_renderer_vs_renderer_with_binary_hrir( refveclev_file: Optional[str] = None, config_file: Optional[str] = None, frame_size: Optional[str] = "20ms", hrir_name="ivas_binaural_48kHz.bin", keep_file=False, ): xfail = hrtf_file == HRTF_BINARY_FILE_DIFF_FROM_ROM hrtf_file_dir = SCRIPTS_DIR.joinpath( "binauralRenderer_interface/binaural_renderers_hrtf_data" ) hrtf_file_path = hrtf_file_dir.joinpath(hrir_name) hrtf_file_path = hrtf_file_dir.joinpath(hrtf_file.format(48)) ref_out = run_renderer( None, test_info, Loading Loading @@ -394,7 +389,7 @@ def compare_renderer_vs_renderer_with_binary_hrir( ref, ref_fs = pyaudio3dtools.audiofile.readfile(ref_out) cut, cut_fs = pyaudio3dtools.audiofile.readfile(cut_out) check_BE(test_info, ref, ref_fs, cut, cut_fs) check_BE(test_info, ref, ref_fs, cut, cut_fs, xfail) if keep_file == False: os.remove(ref_out) os.remove(cut_out) Loading
tests/hrtf_binary_loading/test_renderer_ROM_vs_file.py +31 −13 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ from tests.renderer.constants import ( INPUT_FORMATS_ISM, INPUT_FORMATS_MC, ) from .constants import HRTF_FILES """ Ambisonics """ Loading @@ -49,11 +50,12 @@ from tests.renderer.constants import ( @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) @pytest.mark.parametrize("hrtf_file", HRTF_FILES) def test_ambisonics_binaural_static_with_binary_hrir( test_info, in_fmt, out_fmt, frame_size test_info, in_fmt, out_fmt, frame_size, hrtf_file ): compare_renderer_vs_renderer_with_binary_hrir( test_info, in_fmt, out_fmt, frame_size=frame_size test_info, in_fmt, out_fmt, hrtf_file, frame_size=frame_size ) Loading @@ -61,13 +63,15 @@ def test_ambisonics_binaural_static_with_binary_hrir( @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) @pytest.mark.parametrize("hrtf_file", HRTF_FILES) def test_ambisonics_binaural_headrotation_with_binary_hrir( test_info, in_fmt, out_fmt, trj_file, frame_size test_info, in_fmt, out_fmt, trj_file, frame_size, hrtf_file ): compare_renderer_vs_renderer_with_binary_hrir( test_info, in_fmt, out_fmt, hrtf_file, trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), frame_size=frame_size, ) Loading @@ -79,14 +83,15 @@ def test_ambisonics_binaural_headrotation_with_binary_hrir( @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) @pytest.mark.parametrize("hrtf_file", HRTF_FILES) def test_multichannel_binaural_static_with_binary_hrir( test_info, in_fmt, out_fmt, frame_size test_info, in_fmt, out_fmt, frame_size, hrtf_file ): if in_fmt in ["MONO", "STEREO"]: pytest.skip("MONO or STEREO to Binaural rendering unsupported") compare_renderer_vs_renderer_with_binary_hrir( test_info, in_fmt, out_fmt, frame_size=frame_size test_info, in_fmt, out_fmt, hrtf_file, frame_size=frame_size ) Loading @@ -94,8 +99,9 @@ def test_multichannel_binaural_static_with_binary_hrir( @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) @pytest.mark.parametrize("hrtf_file", HRTF_FILES) def test_multichannel_binaural_headrotation_with_binary_hrir( test_info, in_fmt, out_fmt, trj_file, frame_size test_info, in_fmt, out_fmt, trj_file, frame_size, hrtf_file ): if in_fmt in ["MONO", "STEREO"]: pytest.skip("MONO or STEREO to Binaural rendering unsupported") Loading @@ -104,6 +110,7 @@ def test_multichannel_binaural_headrotation_with_binary_hrir( test_info, in_fmt, out_fmt, hrtf_file, trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), frame_size=frame_size, ) Loading @@ -115,14 +122,15 @@ def test_multichannel_binaural_headrotation_with_binary_hrir( @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) def test_ism_binaural_static_with_binary_hrir(test_info, in_fmt, out_fmt, frame_size): @pytest.mark.parametrize("hrtf_file", HRTF_FILES) def test_ism_binaural_static_with_binary_hrir(test_info, in_fmt, out_fmt, frame_size, hrtf_file): try: in_meta_files = FORMAT_TO_METADATA_FILES_RENDERER[in_fmt] except: in_meta_files = None compare_renderer_vs_renderer_with_binary_hrir( test_info, in_fmt, out_fmt, in_meta_files=in_meta_files, frame_size=frame_size test_info, in_fmt, out_fmt, hrtf_file, in_meta_files=in_meta_files, frame_size=frame_size ) Loading @@ -130,8 +138,9 @@ def test_ism_binaural_static_with_binary_hrir(test_info, in_fmt, out_fmt, frame_ @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) @pytest.mark.parametrize("hrtf_file", HRTF_FILES) def test_ism_binaural_headrotation_with_binary_hrir( test_info, in_fmt, out_fmt, trj_file, frame_size test_info, in_fmt, out_fmt, trj_file, frame_size, hrtf_file ): try: in_meta_files = FORMAT_TO_METADATA_FILES_RENDERER[in_fmt] Loading @@ -142,6 +151,7 @@ def test_ism_binaural_headrotation_with_binary_hrir( test_info, in_fmt, out_fmt, hrtf_file, trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), in_meta_files=in_meta_files, frame_size=frame_size, Loading @@ -154,7 +164,8 @@ def test_ism_binaural_headrotation_with_binary_hrir( @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA_RENDERER) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) def test_masa_binaural_static_with_binary_hrir(test_info, in_fmt, out_fmt, frame_size): @pytest.mark.parametrize("hrtf_file", HRTF_FILES) def test_masa_binaural_static_with_binary_hrir(test_info, in_fmt, out_fmt, frame_size, hrtf_file): if out_fmt in ["BINAURAL_ROOM_IR", "BINAURAL_ROOM_REVERB"]: pytest.skip("Skipping binaural room outputs for MASA as unimplemented.") Loading @@ -162,6 +173,7 @@ def test_masa_binaural_static_with_binary_hrir(test_info, in_fmt, out_fmt, frame test_info, in_fmt, out_fmt, hrtf_file, in_meta_files=FORMAT_TO_METADATA_FILES_RENDERER[in_fmt], ) Loading @@ -170,8 +182,9 @@ def test_masa_binaural_static_with_binary_hrir(test_info, in_fmt, out_fmt, frame @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA_RENDERER) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) @pytest.mark.parametrize("hrtf_file", HRTF_FILES) def test_masa_binaural_headrotation_with_binary_hrir( test_info, in_fmt, out_fmt, trj_file, frame_size test_info, in_fmt, out_fmt, trj_file, frame_size, hrtf_file ): if out_fmt in ["BINAURAL_ROOM_IR", "BINAURAL_ROOM_REVERB"]: pytest.skip("Skipping binaural room outputs for MASA as unimplemented.") Loading @@ -180,6 +193,7 @@ def test_masa_binaural_headrotation_with_binary_hrir( test_info, in_fmt, out_fmt, hrtf_file, trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), in_meta_files=FORMAT_TO_METADATA_FILES_RENDERER[in_fmt], ) Loading @@ -191,13 +205,15 @@ def test_masa_binaural_headrotation_with_binary_hrir( @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_layout", CUSTOM_LS_TO_TEST) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) @pytest.mark.parametrize("hrtf_file", HRTF_FILES) def test_custom_ls_input_binaural_with_binary_hrir( test_info, in_layout, out_fmt, frame_size test_info, in_layout, out_fmt, frame_size, hrtf_file ): compare_renderer_vs_renderer_with_binary_hrir( test_info, CUSTOM_LAYOUT_DIR.joinpath(f"{in_layout}.txt"), out_fmt, hrtf_file, frame_size=frame_size, ) Loading @@ -206,13 +222,15 @@ def test_custom_ls_input_binaural_with_binary_hrir( @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_layout", CUSTOM_LS_TO_TEST) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) @pytest.mark.parametrize("hrtf_file", HRTF_FILES) def test_custom_ls_input_binaural_headrotation_with_binary_hrir( test_info, in_layout, out_fmt, trj_file, frame_size test_info, in_layout, out_fmt, trj_file, frame_size, hrtf_file ): compare_renderer_vs_renderer_with_binary_hrir( test_info, CUSTOM_LAYOUT_DIR.joinpath(f"{in_layout}.txt"), out_fmt, hrtf_file, trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), frame_size=frame_size, )
tests/hrtf_binary_loading/utils.py +6 −11 Original line number Diff line number Diff line Loading @@ -322,14 +322,7 @@ def compare_rom_vs_binary( ) out_bin, out_bin_fs = pyaudio3dtools.audiofile.readfile(out_bin_path) check_BE( test_info, out_rom, out_rom_fs, out_bin, out_bin_fs, xfail=xfail, ) check_BE(test_info, out_rom, out_rom_fs, out_bin, out_bin_fs, xfail) if keep_file == False: os.remove(bitstream_path) os.remove(out_rom_path) Loading @@ -340,6 +333,7 @@ def compare_renderer_vs_renderer_with_binary_hrir( test_info, in_fmt, out_fmt, hrtf_file, metadata_input: Optional[str] = None, in_meta_files: Optional[list] = None, trj_file: Optional[str] = None, Loading @@ -350,13 +344,14 @@ def compare_renderer_vs_renderer_with_binary_hrir( refveclev_file: Optional[str] = None, config_file: Optional[str] = None, frame_size: Optional[str] = "20ms", hrir_name="ivas_binaural_48kHz.bin", keep_file=False, ): xfail = hrtf_file == HRTF_BINARY_FILE_DIFF_FROM_ROM hrtf_file_dir = SCRIPTS_DIR.joinpath( "binauralRenderer_interface/binaural_renderers_hrtf_data" ) hrtf_file_path = hrtf_file_dir.joinpath(hrir_name) hrtf_file_path = hrtf_file_dir.joinpath(hrtf_file.format(48)) ref_out = run_renderer( None, test_info, Loading Loading @@ -394,7 +389,7 @@ def compare_renderer_vs_renderer_with_binary_hrir( ref, ref_fs = pyaudio3dtools.audiofile.readfile(ref_out) cut, cut_fs = pyaudio3dtools.audiofile.readfile(cut_out) check_BE(test_info, ref, ref_fs, cut, cut_fs) check_BE(test_info, ref, ref_fs, cut, cut_fs, xfail) if keep_file == False: os.remove(ref_out) os.remove(cut_out)