Loading tests/create_short_testvectors.py +18 −12 Original line number Diff line number Diff line Loading @@ -41,25 +41,31 @@ from pathlib import Path from cut_pcm import cut_samples HERE = Path(__file__).parent.resolve() TEST_VECTOR_DIR = str(HERE.joinpath("../scripts/testv").resolve()) TEST_VECTOR_DIR = HERE.joinpath("../scripts/testv").resolve() NUM_CHANNELS = "4" # currently only FOA CUT_FROM = "0.0" CUT_LEN = "5.0" FILE_IDS = ["stvFOA"] GAINS = ["1.0", "16.0", ".004"] def collect_files(): files = [f.absolute() for f in TEST_VECTOR_DIR.iterdir() if f.suffix == ".wav" and any([f.name.startswith(id) for id in FILE_IDS])] return files def create_short_testvectors(): for f in collect_files(): for fs in ['48', '32', '16']: in_file = f"{TEST_VECTOR_DIR}/stvFOA{fs}c.wav" cut_gain = "1.0" cut_file = f"{TEST_VECTOR_DIR}/stvFOA{fs}c_cut.wav" cut_samples(in_file, cut_file, NUM_CHANNELS, fs + "000", CUT_FROM, CUT_LEN, cut_gain) cut_gain = "16.0" cut_file = f"{TEST_VECTOR_DIR}/stvFOA{fs}c_cut_{cut_gain}.wav" cut_samples(in_file, cut_file, NUM_CHANNELS, fs + "000", CUT_FROM, CUT_LEN, cut_gain) cut_gain = ".004" cut_file = f"{TEST_VECTOR_DIR}/stvFOA{fs}c_cut_{cut_gain}.wav" cut_samples(in_file, cut_file, NUM_CHANNELS, fs + "000", CUT_FROM, CUT_LEN, cut_gain) for g in GAINS: suffix = "_cut" if g != "1.0": suffix += f"_{g}" out_file = f.parent.joinpath(f.stem + suffix + f.suffix) cut_samples(f, out_file, NUM_CHANNELS, fs + "000", CUT_FROM, CUT_LEN, g) if __name__ == "__main__": Loading Loading
tests/create_short_testvectors.py +18 −12 Original line number Diff line number Diff line Loading @@ -41,25 +41,31 @@ from pathlib import Path from cut_pcm import cut_samples HERE = Path(__file__).parent.resolve() TEST_VECTOR_DIR = str(HERE.joinpath("../scripts/testv").resolve()) TEST_VECTOR_DIR = HERE.joinpath("../scripts/testv").resolve() NUM_CHANNELS = "4" # currently only FOA CUT_FROM = "0.0" CUT_LEN = "5.0" FILE_IDS = ["stvFOA"] GAINS = ["1.0", "16.0", ".004"] def collect_files(): files = [f.absolute() for f in TEST_VECTOR_DIR.iterdir() if f.suffix == ".wav" and any([f.name.startswith(id) for id in FILE_IDS])] return files def create_short_testvectors(): for f in collect_files(): for fs in ['48', '32', '16']: in_file = f"{TEST_VECTOR_DIR}/stvFOA{fs}c.wav" cut_gain = "1.0" cut_file = f"{TEST_VECTOR_DIR}/stvFOA{fs}c_cut.wav" cut_samples(in_file, cut_file, NUM_CHANNELS, fs + "000", CUT_FROM, CUT_LEN, cut_gain) cut_gain = "16.0" cut_file = f"{TEST_VECTOR_DIR}/stvFOA{fs}c_cut_{cut_gain}.wav" cut_samples(in_file, cut_file, NUM_CHANNELS, fs + "000", CUT_FROM, CUT_LEN, cut_gain) cut_gain = ".004" cut_file = f"{TEST_VECTOR_DIR}/stvFOA{fs}c_cut_{cut_gain}.wav" cut_samples(in_file, cut_file, NUM_CHANNELS, fs + "000", CUT_FROM, CUT_LEN, cut_gain) for g in GAINS: suffix = "_cut" if g != "1.0": suffix += f"_{g}" out_file = f.parent.joinpath(f.stem + suffix + f.suffix) cut_samples(f, out_file, NUM_CHANNELS, fs + "000", CUT_FROM, CUT_LEN, g) if __name__ == "__main__": Loading