Skip to content

Commit

Permalink
add v2 integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
tomjnixon committed Nov 7, 2023
1 parent 6eb2136 commit b591609
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ear/test/data/test_v2_meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "version 2 structure and defaults"
version: "ITU-R_BS.2076-2"
items:
- type: "Objects"
channels: [1]
blocks:
- rtime: 0.0
duration: 1/4
position:
azimuth: 0.0
elevation: 0.0
distance: 1.0
objectDivergence:
value: 1.0

22 changes: 22 additions & 0 deletions ear/test/test_integrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,28 @@ def test_render_adapt(tmpdir):
npt.assert_allclose(samples, expected, atol=1e-6)


def test_render_v2(tmpdir):
"""check that a v2 ADM is parsed correctly and has the correct default divergence applied"""
meta_file = os.path.join(files_dir, "test_v2_meta.yaml")
bwf_file = str(tmpdir / "test_v2_bwf.wav")

args = ["ear-utils", "make_test_bwf", "-m", meta_file, "-i", wav_file, bwf_file]
assert subprocess.call(args) == 0

rendered_file = str(tmpdir / "test_v2_render.wav")
args = ["ear-render", "-s", "0+5+0", bwf_file, rendered_file]
assert subprocess.call(args) == 0

samples, sr = soundfile.read(rendered_file)

expected_in = generate_samples()[:, 0]

expected = np.zeros((len(expected_in), 6))
expected[:, 2] = expected_in

npt.assert_allclose(samples, expected, atol=1e-6)


@pytest.mark.parametrize("order", [1, 2])
@pytest.mark.parametrize("chna_only", [False, True])
def test_hoa(tmpdir, order, chna_only):
Expand Down

0 comments on commit b591609

Please sign in to comment.