Commit ae45f6fa authored by Jan Kiene's avatar Jan Kiene
Browse files

implement conversion from HOA2 to MASA

parent be539c68
Loading
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -79,9 +79,7 @@ def convert_scenebased(

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

    else:
@@ -196,8 +194,10 @@ def render_sba_to_masa(
    sba_in: audio.SceneBasedAudio,
    masa_out: audio.MetadataAssistedSpatialAudio,
) -> None:
    # two dir only possible from HOA2, which is not yet implemented as conversion
    num_dirs = 1
    if sba_in.name == "HOA2":
        num_dirs = 2
    
    num_tcs = masa_out.audio.shape[1]
    md_out_path = masa_out.metadata_file

+3 −0
Original line number Diff line number Diff line
@@ -77,6 +77,9 @@ def masaAnalyzer(
    if sba.name not in ["PLANARFOA", "FOA", "HOA2"]:
        raise ValueError(f"Only FOA or HOA2 suported, but {sba.name} was given.")

    if num_dirs == 2 and sba.name != "HOA2":
        raise ValueError(f"2-dir MASA needs HOA2, but {sba.name} was given.")

    cmd = [
        str(binary),
        "-mono" if num_tcs == 1 else "-stereo",