Loading tests/codec_be_on_mr_nonselection/test_param_file.py +1 −3 Original line number Diff line number Diff line Loading @@ -439,9 +439,7 @@ def pre_proc_input(testv_file, fs): elif "stv3OA" in testv_file: num_channel = "16" cut_file = testv_file.replace(".wav", num_channel + "chn_" + cut_gain + ".wav") cut_samples( testv_file, cut_file, num_channel, cut_from, cut_len, cut_gain ) cut_samples(testv_file, cut_file, num_channel, cut_from, cut_len, cut_gain) return cut_file Loading tests/create_short_testvectors.py +17 −4 Original line number Diff line number Diff line Loading @@ -34,8 +34,8 @@ __doc__ = """ Create short (5sec) testvectors. """ import sys import argparse import sys from pathlib import Path from cut_pcm import cut_samples Loading @@ -46,14 +46,28 @@ TEST_VECTOR_DIR = HERE.joinpath("../scripts/testv").resolve() NUM_CHANNELS = "4" # currently only FOA CUT_FROM = "0.0" FILE_IDS = ["stvFOA", "stv2OA", "stv3OA", "stv51MC", "stv71MC", "stv512MC", "stv514MC", "stv714MC", "ISM", "MASA"] FILE_IDS = [ "stvFOA", "stv2OA", "stv3OA", "stv51MC", "stv71MC", "stv512MC", "stv514MC", "stv714MC", "ISM", "MASA", ] GAINS = ["1.0", "16.0", ".004"] def collect_files(file_ids): files = [ f.absolute() for f in TEST_VECTOR_DIR.iterdir() if f.suffix == ".wav" and any([id in f.name for id in file_ids]) and not "_cut" in f.name if f.suffix == ".wav" and any([id in f.name for id in file_ids]) and not "_cut" in f.name ] return files Loading Loading @@ -93,4 +107,3 @@ if __name__ == "__main__": which = args.which cut_len = args.cut_len sys.exit(create_short_testvectors(which=args.which, cut_len=cut_len)) tests/cut_pcm.py +3 −1 Original line number Diff line number Diff line Loading @@ -86,7 +86,9 @@ def cut_samples( num_samples_to_skip = int(start_sec * fs) dur_samples = int(dur_sec * fs) if num_samples_to_skip > dur_samples: raise ValueError(f"Requested to skip {num_samples_to_skip}, but file only has {dur_samples} samples") raise ValueError( f"Requested to skip {num_samples_to_skip}, but file only has {dur_samples} samples" ) s_out = s[num_samples_to_skip : num_samples_to_skip + dur_samples, :] * gain_f Loading tests/hrtf_binary_loading/test_codec_ROM_vs_file.py +7 −2 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import pytest from tests.hrtf_binary_loading.utils import * from .constants import HRTF_FILES """ Binary file """ Loading Loading @@ -197,7 +198,9 @@ def test_masa_binaural_static(test_info, in_tc, in_dir, fs, out_fmt, hrtf_file): @pytest.mark.parametrize("in_dir", INPUT_FORMATS_MASA["dir"]) @pytest.mark.parametrize("in_tc", INPUT_FORMATS_MASA["tc"]) @pytest.mark.parametrize("hrtf_file", HRTF_FILES) def test_masa_binaural_headrotation(test_info, in_tc, in_dir, fs, out_fmt, trj_file, hrtf_file): def test_masa_binaural_headrotation( test_info, in_tc, in_dir, fs, out_fmt, trj_file, hrtf_file ): # -masa Ch File : MASA format # where Ch specifies the number of MASA input/transport channels (1 or 2) # and File specifies input file containing parametric MASA metadata Loading Loading @@ -263,7 +266,9 @@ def test_ism_binaural_static(test_info, in_fmt, out_fs, out_fmt, hrtf_file): @pytest.mark.parametrize("out_fs", SAMPLE_RATE) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) @pytest.mark.parametrize("hrtf_file", HRTF_FILES) def test_ism_binaural_headrotation(test_info, in_fmt, out_fs, out_fmt, trj_file, hrtf_file): def test_ism_binaural_headrotation( test_info, in_fmt, out_fs, out_fmt, trj_file, hrtf_file ): # -ism [+]Ch Files : ISM format # where Ch specifies the number of ISMs (1-4) # and Files specify input files containing metadata, one file per object Loading tests/hrtf_binary_loading/test_renderer_ROM_vs_file.py +13 −3 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 Loading @@ -123,14 +124,21 @@ def test_multichannel_binaural_headrotation_with_binary_hrir( @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_static_with_binary_hrir(test_info, in_fmt, out_fmt, frame_size, hrtf_file): 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, hrtf_file, 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 Loading @@ -165,7 +173,9 @@ def test_ism_binaural_headrotation_with_binary_hrir( @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_static_with_binary_hrir(test_info, in_fmt, out_fmt, frame_size, hrtf_file): 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 Loading
tests/codec_be_on_mr_nonselection/test_param_file.py +1 −3 Original line number Diff line number Diff line Loading @@ -439,9 +439,7 @@ def pre_proc_input(testv_file, fs): elif "stv3OA" in testv_file: num_channel = "16" cut_file = testv_file.replace(".wav", num_channel + "chn_" + cut_gain + ".wav") cut_samples( testv_file, cut_file, num_channel, cut_from, cut_len, cut_gain ) cut_samples(testv_file, cut_file, num_channel, cut_from, cut_len, cut_gain) return cut_file Loading
tests/create_short_testvectors.py +17 −4 Original line number Diff line number Diff line Loading @@ -34,8 +34,8 @@ __doc__ = """ Create short (5sec) testvectors. """ import sys import argparse import sys from pathlib import Path from cut_pcm import cut_samples Loading @@ -46,14 +46,28 @@ TEST_VECTOR_DIR = HERE.joinpath("../scripts/testv").resolve() NUM_CHANNELS = "4" # currently only FOA CUT_FROM = "0.0" FILE_IDS = ["stvFOA", "stv2OA", "stv3OA", "stv51MC", "stv71MC", "stv512MC", "stv514MC", "stv714MC", "ISM", "MASA"] FILE_IDS = [ "stvFOA", "stv2OA", "stv3OA", "stv51MC", "stv71MC", "stv512MC", "stv514MC", "stv714MC", "ISM", "MASA", ] GAINS = ["1.0", "16.0", ".004"] def collect_files(file_ids): files = [ f.absolute() for f in TEST_VECTOR_DIR.iterdir() if f.suffix == ".wav" and any([id in f.name for id in file_ids]) and not "_cut" in f.name if f.suffix == ".wav" and any([id in f.name for id in file_ids]) and not "_cut" in f.name ] return files Loading Loading @@ -93,4 +107,3 @@ if __name__ == "__main__": which = args.which cut_len = args.cut_len sys.exit(create_short_testvectors(which=args.which, cut_len=cut_len))
tests/cut_pcm.py +3 −1 Original line number Diff line number Diff line Loading @@ -86,7 +86,9 @@ def cut_samples( num_samples_to_skip = int(start_sec * fs) dur_samples = int(dur_sec * fs) if num_samples_to_skip > dur_samples: raise ValueError(f"Requested to skip {num_samples_to_skip}, but file only has {dur_samples} samples") raise ValueError( f"Requested to skip {num_samples_to_skip}, but file only has {dur_samples} samples" ) s_out = s[num_samples_to_skip : num_samples_to_skip + dur_samples, :] * gain_f Loading
tests/hrtf_binary_loading/test_codec_ROM_vs_file.py +7 −2 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import pytest from tests.hrtf_binary_loading.utils import * from .constants import HRTF_FILES """ Binary file """ Loading Loading @@ -197,7 +198,9 @@ def test_masa_binaural_static(test_info, in_tc, in_dir, fs, out_fmt, hrtf_file): @pytest.mark.parametrize("in_dir", INPUT_FORMATS_MASA["dir"]) @pytest.mark.parametrize("in_tc", INPUT_FORMATS_MASA["tc"]) @pytest.mark.parametrize("hrtf_file", HRTF_FILES) def test_masa_binaural_headrotation(test_info, in_tc, in_dir, fs, out_fmt, trj_file, hrtf_file): def test_masa_binaural_headrotation( test_info, in_tc, in_dir, fs, out_fmt, trj_file, hrtf_file ): # -masa Ch File : MASA format # where Ch specifies the number of MASA input/transport channels (1 or 2) # and File specifies input file containing parametric MASA metadata Loading Loading @@ -263,7 +266,9 @@ def test_ism_binaural_static(test_info, in_fmt, out_fs, out_fmt, hrtf_file): @pytest.mark.parametrize("out_fs", SAMPLE_RATE) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) @pytest.mark.parametrize("hrtf_file", HRTF_FILES) def test_ism_binaural_headrotation(test_info, in_fmt, out_fs, out_fmt, trj_file, hrtf_file): def test_ism_binaural_headrotation( test_info, in_fmt, out_fs, out_fmt, trj_file, hrtf_file ): # -ism [+]Ch Files : ISM format # where Ch specifies the number of ISMs (1-4) # and Files specify input files containing metadata, one file per object Loading
tests/hrtf_binary_loading/test_renderer_ROM_vs_file.py +13 −3 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 Loading @@ -123,14 +124,21 @@ def test_multichannel_binaural_headrotation_with_binary_hrir( @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_static_with_binary_hrir(test_info, in_fmt, out_fmt, frame_size, hrtf_file): 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, hrtf_file, 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 Loading @@ -165,7 +173,9 @@ def test_ism_binaural_headrotation_with_binary_hrir( @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_static_with_binary_hrir(test_info, in_fmt, out_fmt, frame_size, hrtf_file): 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