Commit 8cfdaa57 authored by janssontoftg's avatar janssontoftg
Browse files

Correction of preamble for P800-1 and P800-2.

Moved 20 ms block alignment after addition of source signals, to ensure the overlap period is maintained as specified.
parent ce1d51a8
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ output_path: "experiments/selection/P800-1/proc_input"
loudness: -26

### Pre-amble and Post-amble length in seconds (default = 0.0)
preamble: 1.0
preamble: 0.5
postamble: 1.0

### Flag for adding low-level random background noise (amplitude +-4) instead of silence; default = false (silence)
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ output_path: "experiments/selection/P800-2/proc_input"
loudness: -26

### Pre-amble and Post-amble length in seconds (default = 0.0)
preamble: 1.0
preamble: 0.5
postamble: 1.0

### Flag for adding low-level random background noise (amplitude +-4) instead of silence; default = false (silence)
+9 −9
Original line number Diff line number Diff line
@@ -151,15 +151,6 @@ def generate_stereo_scene(
            pre = np.zeros((N_delay, x.audio.shape[1]))
            x.audio = np.concatenate([pre, x.audio])

        # pad with zeros to ensure that the signal length is a multiple of 20ms
        N_frame = x.fs / 50
        if len(x.audio) % N_frame != 0:
            N_pad = int(N_frame - len(x.audio) % N_frame)

            # insert all-zero preamble
            pre = np.zeros((N_pad, x.audio.shape[1]))
            x.audio = np.concatenate([pre, x.audio])

        # add source signal to the array of source signals
        y.fs = x.fs
        if y.audio is None:
@@ -211,6 +202,15 @@ def generate_stereo_scene(
        post = np.zeros((N_post, y.audio.shape[1]))
        y.audio = np.concatenate([y.audio, post])

    # pad with zeros to ensure that the signal length is a multiple of 20ms
    N_frame = y.fs / 50
    if y.audio.shape[0] % N_frame != 0:
        N_pad = int(N_frame - y.audio.shape[0] % N_frame)

        # insert all-zero postamble
        post = np.zeros((N_pad, y.audio.shape[1]))
        y.audio = np.concatenate([y.audio, post])

    # add random noise
    if cfg.add_low_level_random_noise:
        # create uniformly distributed noise between -4 and 4