Commit 50ccf621 authored by Anika Treffehn's avatar Anika Treffehn
Browse files

fixed small issues

parent 21c124f1
Loading
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -157,7 +157,7 @@ def concat(
    pad_noise: Optional[bool] = False,
    preamble: Optional[int] = None,
    pad_noise_preamble: Optional[bool] = False,
) -> list:
) -> Tuple[list, int]:
    """
    Horizontally concatenates audio files into one long file

@@ -198,7 +198,7 @@ def concat(

        # pad with very low amplitude noise
        x = trim(
            x, in_fs, (-silence_pre, -silence_post), samples=True, pad_noise=pad_noise
            x, fs, (-silence_pre, -silence_post), samples=True, pad_noise=pad_noise
        )

        # add the length to our splits list
@@ -209,11 +209,11 @@ def concat(

    # add preamble
    if preamble:
        y = trim(y, in_fs, (-preamble, 0), pad_noise_preamble)
        y = trim(y, fs, (-preamble, 0), pad_noise_preamble)

    write(out_file, y, fs=in_fs)
    write(out_file, y, fs=fs)

    return splits[1:]
    return splits[1:], fs


def split(
+4 −1
Original line number Diff line number Diff line
@@ -130,7 +130,7 @@ def concat_setup(cfg: TestConfig, chain, logger: logging.Logger):
    tmp_audio = audio.fromtype(cfg_pre2.in_fmt)
    tmp_num_chans = tmp_audio.num_channels

    cfg.splits = concat(
    cfg.splits, fs = concat(
        cfg.items_list,
        cfg.concat_file,
        in_fs=cfg_pre2.in_fs,
@@ -144,6 +144,9 @@ def concat_setup(cfg: TestConfig, chain, logger: logging.Logger):
    # set input to the concatenated file we have just written to the output dir
    cfg.items_list = [cfg.concat_file]

    # save input sampling rate for splitting at the end
    cfg.pre2.in_fs = fs

    # write out splits
    with open(cfg.concat_file.with_suffix(".splits.log"), "w") as f:
        print(", ".join([str(s) for s in cfg.splits]), file=f)