Commit a78ef61d authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

update pyaudio3dtools ISM metadata and headrotation trajectory reading

parent c5d4ca19
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -237,7 +237,7 @@ def rotateHOA(x: np.ndarray, trajectory: str) -> np.ndarray:
        i1 = i_frame * frame_len
        i2 = (i_frame + 1) * frame_len

        q1 = trj_data[i_frame % trj_frames, 1:]
        q1 = trj_data[i_frame % trj_frames, :]
        R_r = Quat2RotMat(q1)
        R[:, :] = SHrotmatgen(R_r, order=int(np.sqrt(sig_dim)) - 1)

+1 −1
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ def rotateISM(
    ele_rot = np.zeros([N_frames])

    for i_frame in range(N_frames):
        q = trj_data[i_frame % trj_frames, 1:]
        q = trj_data[i_frame % trj_frames, :]
        azi_rot[i_frame], ele_rot[i_frame] = rotateAziEle(
            azi[i_frame], ele[i_frame], Quat2RotMat(q)
        )
+1 −1
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ def rotateMC(x: np.ndarray, trajectory: str, layout: spatialaudioformat) -> np.n
        start = i_frame * frame_len
        end = (i_frame + 1) * frame_len

        q = trj_data[i_frame % trj_frames, 1:]
        q = trj_data[i_frame % trj_frames, :]

        rotated_pos = np.array(
            [
+6 −6
Original line number Diff line number Diff line
@@ -315,8 +315,8 @@ def read_ism_input(file_handle: TextIO, dirname: str) -> dict:
                current_values = line.strip().split(",")
                pos = {}
                pos["use_for_frames"] = 1
                pos["azimuth"] = float(current_values[1])
                pos["elevation"] = float(current_values[2])
                pos["azimuth"] = float(current_values[0])
                pos["elevation"] = float(current_values[1])
                ism["positions"].append(pos)
                pos_idx += 1

@@ -429,8 +429,8 @@ def read_ism_ivas_data(metadata_path: str, object_index: int = 0) -> None:
                current_values = line.strip().split(",")
                pos = {}
                pos["use_for_frames"] = 1
                pos["azimuth"] = float(current_values[1])
                pos["elevation"] = float(current_values[2])
                pos["azimuth"] = float(current_values[0])
                pos["elevation"] = float(current_values[1])
                ism["positions"].append(pos)
                pos_idx += 1
    except FileNotFoundError:
@@ -462,12 +462,12 @@ def write_ism_ivas_data(
    gain = 1.0
    pos_idx = 0
    pos_used_times = 0
    for frame_idx in range(num_frames):
    for _ in range(num_frames):
        azimuth = float(positions[pos_idx]["azimuth"])
        elevation = float(positions[pos_idx]["elevation"])

        file_handle.write(
            f"{frame_idx:04d},{azimuth:+07.2f},{elevation:+06.2f},{distance:05.2f},{spread:06.2f},{gain:04.2f}\n"
            f"{azimuth:+07.2f},{elevation:+06.2f},{distance:05.2f},{spread:06.2f},{gain:04.2f}\n"
        )

        pos_used_times += 1