Commit 26e47a1c authored by Jan Kiene's avatar Jan Kiene
Browse files

fix PLANARFOA to MASA and FOA conversions

parent 00049882
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -78,7 +78,8 @@ def convert_scenebased(
        render_sba_to_sba(sba, out)

    # SBA -> MASA
    elif isinstance(out, audio.MetadataAssistedSpatialAudio) and sba.name == "FOA":
    # NOTE: only allowed for 1st order ambisonics ("FOA" + "PLANARFOA")
    elif isinstance(out, audio.MetadataAssistedSpatialAudio) and sba.name.endswith("FOA"):
        render_sba_to_masa(sba, out)

    else:
@@ -176,7 +177,7 @@ def render_sba_to_sba(
        sba_out.audio = np.pad(
            sba_in.audio, [[0, 0], [0, sba_out.num_channels - sba_in.num_channels]]
        )
    elif sba_out.ambi_order < sba_in.ambi_order:
    elif sba_out.ambi_order <= sba_in.ambi_order:
        sba_out.audio = sba_in.audio[:, : sba_out.num_channels]

    if sba_out.is_planar:
@@ -187,9 +188,8 @@ def render_sba_to_masa(
    sba_in: audio.SceneBasedAudio,
    masa_out: audio.MetadataAssistedSpatialAudio,
) -> None:
    assert sba_in.name == "FOA"

    # two dir only possible from HOA2
    # two dir only possible from HOA2, which is not yet implemented as conversion
    num_dirs = 1
    num_tcs = masa_out.audio.shape[1]
    md_out_path = masa_out.metadata_file
+2 −2
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ def masaAnalyzer(
    if num_dirs not in [1, 2]:
        raise ValueError(f"Only 1 or 2 directions supported, but {num_dirs} was given.")

    if sba.name not in ["FOA", "HOA2"]:
    if sba.name not in [ "PLANARFOA", "FOA", "HOA2"]:
       raise ValueError(f"Only FOA or HOA2 suported, but {sba.name} was given.")

    cmd = [