Commit 52708e75 authored by Jan Kiene's avatar Jan Kiene
Browse files

add background dummy noise, in cfg still commented due to bug

parent 25cfc0f1
Loading
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -33,6 +33,15 @@ preprocessing_2:
    # concatenation_order: []
    preamble: 10000
    preamble_noise: true
    ### Additive background noise
    # TODO: enable after bug with bg noise addition is fixed
    #background_noise:
        #### REQUIRED: SNR for background noise in dB
        #snr: 15
        #### REQUIRED: Path to background noise, must have same format and sampling rate as input signal(s)
        #background_noise_path: "experiments/selection/P800-2/proc_input/background_noise.wav"
        #### Seed for delay offest; default = 0
        #seed_delay: 10

#################################################
### Bitstream processing
+8 −0
Original line number Diff line number Diff line
@@ -34,6 +34,14 @@ preprocessing_2:
    # concatenation_order: []
    preamble: 10000
    preamble_noise: true
    # TODO: enable after bug with bg noise addition is fixed
    #background_noise:
        #### REQUIRED: SNR for background noise in dB
        #snr: 15
        #### REQUIRED: Path to background noise, must have same format and sampling rate as input signal(s)
        #background_noise_path: "experiments/selection/P800-5/proc_input/background_noise.wav"
        #### Seed for delay offest; default = 0
        #seed_delay: 10

#################################################
### Bitstream processing
+133 B

File added.

No diff preview for this file type.

+133 B

File added.

No diff preview for this file type.

+12 −4
Original line number Diff line number Diff line
@@ -41,6 +41,12 @@ from tests.constants import INPUT_EXPERIMENT_NAMES, EXPERIMENTS_DIR, TESTS_DIR,
from ivas_processing_scripts.audiotools import audio


BG_NOISE_FOR_EXPERIMENT = {
    "P800-2": Path(TESTS_DIR).joinpath("data").joinpath("p800-2_background_noise.wav"),
    "P800-5": Path(TESTS_DIR).joinpath("data").joinpath("p800-5_background_noise.wav"),
        }
BG_NOISE_NAME = "background_noise.wav"

class Arguments:
    def __init__(self, config):
        self.config = config
@@ -75,16 +81,18 @@ def test_generate_test_items(exp_name):
    # get dummy metadata files
    dummy_md_files = FORMAT_TO_METADATA_FILES.get(input_fmt, list())

    # copy input files
    for f in dummy_input_files:
        print(f)
        f_out = input_path.joinpath(f.name).resolve().absolute()
        print(f_out)
        shutil.copy(f, f_out)
        for i, md_f in enumerate(dummy_md_files):
            print(md_f)
            suffix = f"{i}.csv"
            md_f_out = ".".join([str(f_out), suffix])
            print(md_f_out)
            shutil.copy(md_f, md_f_out)

    # copy background noise if needed
    if (bg_noise := BG_NOISE_FOR_EXPERIMENT.get(exp_name)) is not None:
        bg_noise_out = input_path.joinpath(BG_NOISE_NAME)
        shutil.copy(bg_noise, bg_noise_out)

    generate_test(args)