Loading examples/TEMPLATE.yml +23 −22 Original line number Diff line number Diff line Loading @@ -87,6 +87,7 @@ input: ################################################ ### Pre-processing on whole signal(s) ################################################ # preprocessing_2: ### Options for processing of the concatenated item (concatenate_input: true) or ### the individual items (concatenate_input: false) after previous pre-processing step ### Horizontally concatenate input items into one long file; default = false Loading @@ -96,9 +97,9 @@ input: ### Should only be used if concatenate_input = true # concatenation_order: [] ### Specify preamble duration in ms; default = 0 # preamble: 40 # preamble: 10000 ### Flag wheter to use noise (amplitude +-4) for the preamble or silence; default = false (silence) # pad_noise_preamble: true # preamble_noise: true ### Additive background noise # background_noise: ### REQUIRED: SNR for background noise in dB Loading Loading @@ -257,8 +258,8 @@ conditions_to_generate: postprocessing: ### REQUIRED: Target format for output fmt: "BINAURAL" ### Target sampling rate in Hz for resampling; default = null (no resampling) # fs: 16000 ### REQUIRED: Target sampling rate in Hz for resampling fs: 48000 ### Low-pass cut-off frequency in Hz; default = null (no filtering) # lp_cutoff: 24000 ### Target loudness in LKFS; default = null (no loudness change applied) Loading ivas_processing_scripts/__init__.py +6 −14 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ from ivas_processing_scripts.processing.processing import ( preprocess_2, process_item, reorder_items_list, reverse_process_2 ) from ivas_processing_scripts.utils import DirManager, apply_func_parallel Loading Loading @@ -97,7 +98,7 @@ def main(args): # Re-ordering items based on concatenation order if hasattr(cfg, "preprocessing_2"): if cfg.preprocessing_2["concatenate_input"] and cfg.preprocessing_2.get("concatenation_order", None) is not None: if cfg.preprocessing_2.get("concatenate_input") and cfg.preprocessing_2.get("concatenation_order", None) is not None: cfg.items_list = reorder_items_list(cfg.items_list, cfg.preprocessing_2["concatenation_order"]) # check for ISM metadata Loading Loading @@ -128,6 +129,8 @@ def main(args): # preprocessing on whole signal(s) if hasattr(cfg, "preprocessing_2"): # save process info to revert it later cfg.pre2 = cfg.proc_chains[0]["processes"][0] preprocess_2(cfg, logger) # run conditions Loading @@ -152,19 +155,8 @@ def main(args): "mp" if cfg.multiprocessing else None, ) if cfg.concatenate_input: # write out the splits, optionally remove file out_paths_splits, out_meta_splits = concat_teardown(cfg, logger) # scale individual files if cfg.postprocessing.get("loudness", False): # TODO: take care of samplingrate scale_files( out_paths_splits, cfg.postprocessing["fmt"], cfg.postprocessing["loudness"], cfg.postprocessing.get("fs", None), out_meta_splits, ) if hasattr(cfg, "preprocessing_2"): reverse_process_2(cfg, logger) # copy configuration to output directory with open(cfg.output_path.joinpath(f"{cfg.name}.yml"), "w") as f: Loading ivas_processing_scripts/audiotools/audiofile.py +19 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ import numpy as np import scipy.io.wavfile as wav from .audioarray import trim, window from ivas_processing_scripts.audiotools import audio logger = logging.getLogger("__main__") logger.setLevel(logging.DEBUG) Loading Loading @@ -431,3 +432,21 @@ def parse_wave_header( "ext_param_size": ext_param_size, "ext_param": ext_param, } def remove_preamble(cfg): # get number of channels from output format num_channels = audio.fromtype(cfg.postprocessing["fmt"]).num_channels for odir in cfg.out_dirs: for item in cfg.items_list: path_input = odir / item.name # read file x, fs = read(path_input, nchannels=num_channels, fs=cfg.postprocessing["fs"]) # remove preamble x = trim(x, fs, (cfg.pre2.preamble, 0)) # write file write(path_input, x, fs) return ivas_processing_scripts/constants.py +1 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,7 @@ REQUIRED_KEYS = [ "input_path", "output_path", ("postprocessing", {"fmt"}), ("postprocessing", {"fs"}), "conditions_to_generate", ] REQUIRED_KEYS_EVS = {"bitrates"} Loading ivas_processing_scripts/processing/chains.py +5 −5 Original line number Diff line number Diff line Loading @@ -155,7 +155,7 @@ def get_preprocessing_2(cfg: TestConfig) -> dict: "concatenate_input": pre2_cfg.get("concatenate_input", False), "concatenation_order": pre2_cfg.get("concatenation_order", None), "preamble": pre2_cfg.get("preamble", 0), "pad_noise_preamble": pre2_cfg.get("pad_noise_preamble", False), "pad_noise_preamble": pre2_cfg.get("preamble_noise", False), "background_noise": background, "in_hp50": pre2_cfg.get("hp50", False), "multiprocessing": cfg.multiprocessing, Loading Loading @@ -246,7 +246,7 @@ def get_processing_chain( "error_pattern": cfg.tx.get("error_pattern", None), "error_rate": cfg.tx.get("error_rate", None), "master_seed": cfg.master_seed, "prerun_seed": cfg.prerun_seed, "prerun_seed": cfg.tx.get("prerun_seed", 0), } elif cfg.tx.get("type", None) == "JBM": tx_cfg = { Loading @@ -262,7 +262,7 @@ def get_processing_chain( else: tx_cfg = None if hasattr(cfg, "preprocessing_2"): # TODO: not nice if hasattr(cfg, "preprocessing_2"): preamble = cfg.preprocessing_2.get("preamble", 0) else: preamble = 0 Loading Loading @@ -301,7 +301,7 @@ def get_processing_chain( "error_pattern": cfg.tx.get("error_pattern", None), "error_rate": cfg.tx.get("error_rate", None), "master_seed": cfg.master_seed, "prerun_seed": cfg.prerun_seed, "prerun_seed": cfg.tx.get("prerun_seed", 0), } elif cfg.tx.get("type", None) == "JBM": tx_cfg = { Loading @@ -317,7 +317,7 @@ def get_processing_chain( else: tx_cfg = None if hasattr(cfg, "preprocessing_2"): # TODO: not nice if hasattr(cfg, "preprocessing_2"): preamble = cfg.preprocessing_2.get("preamble", 0) else: preamble = 0 Loading Loading
examples/TEMPLATE.yml +23 −22 Original line number Diff line number Diff line Loading @@ -87,6 +87,7 @@ input: ################################################ ### Pre-processing on whole signal(s) ################################################ # preprocessing_2: ### Options for processing of the concatenated item (concatenate_input: true) or ### the individual items (concatenate_input: false) after previous pre-processing step ### Horizontally concatenate input items into one long file; default = false Loading @@ -96,9 +97,9 @@ input: ### Should only be used if concatenate_input = true # concatenation_order: [] ### Specify preamble duration in ms; default = 0 # preamble: 40 # preamble: 10000 ### Flag wheter to use noise (amplitude +-4) for the preamble or silence; default = false (silence) # pad_noise_preamble: true # preamble_noise: true ### Additive background noise # background_noise: ### REQUIRED: SNR for background noise in dB Loading Loading @@ -257,8 +258,8 @@ conditions_to_generate: postprocessing: ### REQUIRED: Target format for output fmt: "BINAURAL" ### Target sampling rate in Hz for resampling; default = null (no resampling) # fs: 16000 ### REQUIRED: Target sampling rate in Hz for resampling fs: 48000 ### Low-pass cut-off frequency in Hz; default = null (no filtering) # lp_cutoff: 24000 ### Target loudness in LKFS; default = null (no loudness change applied) Loading
ivas_processing_scripts/__init__.py +6 −14 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ from ivas_processing_scripts.processing.processing import ( preprocess_2, process_item, reorder_items_list, reverse_process_2 ) from ivas_processing_scripts.utils import DirManager, apply_func_parallel Loading Loading @@ -97,7 +98,7 @@ def main(args): # Re-ordering items based on concatenation order if hasattr(cfg, "preprocessing_2"): if cfg.preprocessing_2["concatenate_input"] and cfg.preprocessing_2.get("concatenation_order", None) is not None: if cfg.preprocessing_2.get("concatenate_input") and cfg.preprocessing_2.get("concatenation_order", None) is not None: cfg.items_list = reorder_items_list(cfg.items_list, cfg.preprocessing_2["concatenation_order"]) # check for ISM metadata Loading Loading @@ -128,6 +129,8 @@ def main(args): # preprocessing on whole signal(s) if hasattr(cfg, "preprocessing_2"): # save process info to revert it later cfg.pre2 = cfg.proc_chains[0]["processes"][0] preprocess_2(cfg, logger) # run conditions Loading @@ -152,19 +155,8 @@ def main(args): "mp" if cfg.multiprocessing else None, ) if cfg.concatenate_input: # write out the splits, optionally remove file out_paths_splits, out_meta_splits = concat_teardown(cfg, logger) # scale individual files if cfg.postprocessing.get("loudness", False): # TODO: take care of samplingrate scale_files( out_paths_splits, cfg.postprocessing["fmt"], cfg.postprocessing["loudness"], cfg.postprocessing.get("fs", None), out_meta_splits, ) if hasattr(cfg, "preprocessing_2"): reverse_process_2(cfg, logger) # copy configuration to output directory with open(cfg.output_path.joinpath(f"{cfg.name}.yml"), "w") as f: Loading
ivas_processing_scripts/audiotools/audiofile.py +19 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ import numpy as np import scipy.io.wavfile as wav from .audioarray import trim, window from ivas_processing_scripts.audiotools import audio logger = logging.getLogger("__main__") logger.setLevel(logging.DEBUG) Loading Loading @@ -431,3 +432,21 @@ def parse_wave_header( "ext_param_size": ext_param_size, "ext_param": ext_param, } def remove_preamble(cfg): # get number of channels from output format num_channels = audio.fromtype(cfg.postprocessing["fmt"]).num_channels for odir in cfg.out_dirs: for item in cfg.items_list: path_input = odir / item.name # read file x, fs = read(path_input, nchannels=num_channels, fs=cfg.postprocessing["fs"]) # remove preamble x = trim(x, fs, (cfg.pre2.preamble, 0)) # write file write(path_input, x, fs) return
ivas_processing_scripts/constants.py +1 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,7 @@ REQUIRED_KEYS = [ "input_path", "output_path", ("postprocessing", {"fmt"}), ("postprocessing", {"fs"}), "conditions_to_generate", ] REQUIRED_KEYS_EVS = {"bitrates"} Loading
ivas_processing_scripts/processing/chains.py +5 −5 Original line number Diff line number Diff line Loading @@ -155,7 +155,7 @@ def get_preprocessing_2(cfg: TestConfig) -> dict: "concatenate_input": pre2_cfg.get("concatenate_input", False), "concatenation_order": pre2_cfg.get("concatenation_order", None), "preamble": pre2_cfg.get("preamble", 0), "pad_noise_preamble": pre2_cfg.get("pad_noise_preamble", False), "pad_noise_preamble": pre2_cfg.get("preamble_noise", False), "background_noise": background, "in_hp50": pre2_cfg.get("hp50", False), "multiprocessing": cfg.multiprocessing, Loading Loading @@ -246,7 +246,7 @@ def get_processing_chain( "error_pattern": cfg.tx.get("error_pattern", None), "error_rate": cfg.tx.get("error_rate", None), "master_seed": cfg.master_seed, "prerun_seed": cfg.prerun_seed, "prerun_seed": cfg.tx.get("prerun_seed", 0), } elif cfg.tx.get("type", None) == "JBM": tx_cfg = { Loading @@ -262,7 +262,7 @@ def get_processing_chain( else: tx_cfg = None if hasattr(cfg, "preprocessing_2"): # TODO: not nice if hasattr(cfg, "preprocessing_2"): preamble = cfg.preprocessing_2.get("preamble", 0) else: preamble = 0 Loading Loading @@ -301,7 +301,7 @@ def get_processing_chain( "error_pattern": cfg.tx.get("error_pattern", None), "error_rate": cfg.tx.get("error_rate", None), "master_seed": cfg.master_seed, "prerun_seed": cfg.prerun_seed, "prerun_seed": cfg.tx.get("prerun_seed", 0), } elif cfg.tx.get("type", None) == "JBM": tx_cfg = { Loading @@ -317,7 +317,7 @@ def get_processing_chain( else: tx_cfg = None if hasattr(cfg, "preprocessing_2"): # TODO: not nice if hasattr(cfg, "preprocessing_2"): preamble = cfg.preprocessing_2.get("preamble", 0) else: preamble = 0 Loading