Commit dabab8c0 authored by janssontoftg's avatar janssontoftg
Browse files

Merge branch '56-item-generation-incomplete-convolution-with-irs' into 'main'

Resolve "Item generation: Incomplete convolution with IRs"

See merge request !109
parents d21e76e6 42bf7176
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -89,6 +89,9 @@ def reverb(
            tmp_input.audio = resample_itu(tmp_input, IR.fs)
            tmp_input.fs = IR.fs

        # add trailing zeros
        tmp_input.audio = np.concatenate([tmp_input.audio, np.zeros((IR.audio.shape[0]-1, 1))])

        # write input audio signal to temporary file in .pcm format
        tmp_input_file = tmp_dir.joinpath("tmp_reverbIn.pcm")
        write(tmp_input_file, tmp_input.audio, tmp_input.fs)
+5 −1
Original line number Diff line number Diff line
@@ -203,6 +203,7 @@ def generate_ambi_scene(
    else:
        ambi_format = "FOA"

    len_s1 = 0
    y = audio.SceneBasedAudio(ambi_format)
    for i in range(N_sources):
        # parse parameters from the scene description
@@ -233,6 +234,9 @@ def generate_ambi_scene(
            fs=cfg.IR_fs,
        )

        if i == 0:
            len_s1 = x.audio.shape[0]

        # convolve with the FOA/HOA2 IR
        if ambi_format == "FOA":
            x = reverb_foa(x, IR)
@@ -246,7 +250,7 @@ def generate_ambi_scene(
        # shift the second (and all other) source files (positive shift creates overlap, negative shift creates a gap)
        if i > 0:
            # get the length of the first source file
            N_delay = len(y.audio[:, 0])
            N_delay = len_s1

            # add the shift
            N_delay += int(-source_overlap * x.fs)
+5 −1
Original line number Diff line number Diff line
@@ -193,6 +193,7 @@ def generate_stereo_scene(
    else:
        source_overlap = 0.0

    len_s1 = 0
    y = audio.ChannelBasedAudio("STEREO")
    for i in range(N_sources):
        # parse parameters from the scene description
@@ -223,6 +224,9 @@ def generate_stereo_scene(
            fs=cfg.IR_fs,
        )

        if i == 0:
            len_s1 = x.audio.shape[0]

        # convolve with stereo IR
        x = reverb_stereo(x, IR)

@@ -233,7 +237,7 @@ def generate_stereo_scene(
        # shift the second (and all other) source files (positive shift creates overlap, negative shift creates a gap)
        if i > 0:
            # get the length of the first source file
            N_delay = len(y.audio[:, 0])
            N_delay = len_s1

            # add the shift
            N_delay += int(-source_overlap * x.fs)