Loading ivas_processing_scripts/audiotools/audiofile.py +2 −14 Original line number Diff line number Diff line Loading @@ -157,7 +157,7 @@ def concat( pad_noise: Optional[bool] = False, preamble: Optional[int] = None, pad_noise_preamble: Optional[bool] = False, ) -> Tuple[list, int, int]: ) -> list: """ Horizontally concatenates audio files into one long file Loading @@ -180,10 +180,6 @@ def concat( ------- splits List of sample indices to split the resulting file at num_frames Length of overall signal in frames num_frames_preamble: int Length of preamble in frames """ y = None Loading Loading @@ -217,15 +213,7 @@ def concat( write(out_file, y, fs=in_fs) # compute length of concatenated file and preamble in frames for bitstream processing frame_len = fs_compare * IVAS_FRAME_LEN_MS / 1000 num_frames = int(len(y) / frame_len) if preamble: num_frames_preamble = int(preamble / IVAS_FRAME_LEN_MS) else: num_frames_preamble = 0 return splits[1:], num_frames, num_frames_preamble return splits[1:] def split( Loading ivas_processing_scripts/audiotools/wrappers/eid_xor.py +1 −3 Original line number Diff line number Diff line Loading @@ -120,9 +120,7 @@ def create_and_apply_error_pattern( if error_pattern is None: # create error pattern if error_rate is not None: error_pattern = in_bitstream.parent.joinpath("error_pattern").with_suffix( ".192" ) error_pattern = in_bitstream.parent.joinpath("error_pattern").with_suffix(".192") create_error_pattern(len_sig, error_pattern, error_rate, preamble, master_seed, prerun_seed) else: raise ValueError( Loading ivas_processing_scripts/processing/chains.py +1 −0 Original line number Diff line number Diff line Loading @@ -249,6 +249,7 @@ def get_processing_chain( "dec_opts": dec_cfg.get("opts"), "multiprocessing": cfg.multiprocessing, "tx": tx_cfg, "preamble": cfg.preamble, } ) ) Loading ivas_processing_scripts/processing/ivas.py +9 −5 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ import logging import os.path import platform from copy import deepcopy from pathlib import Path from typing import Optional, Union Loading @@ -47,6 +46,7 @@ from ivas_processing_scripts.audiotools.wrappers.networkSimulator import ( ) from ivas_processing_scripts.processing.processing import Processing from ivas_processing_scripts.utils import run from ivas_processing_scripts.audiotools.constants import IVAS_FRAME_LEN_MS class IVAS(Processing): Loading Loading @@ -233,14 +233,18 @@ class IVAS(Processing): elif self.tx["type"] == "FER": bs, ext = os.path.splitext(bitstream) bitstream_processed = Path(f"{bs}_processed{ext}") signal, _ = read( in_file, fs=self.in_fs ) # TODO: pass down number of frames and preamble from concatenation signal, _ = read(in_file, fs=self.in_fs, nchannels=self.in_fmt.num_channels) frame_number = len(signal) / self.in_fs / IVAS_FRAME_LEN_MS * 1000 if self.preamble: frame_number_preamble = self.preamble / IVAS_FRAME_LEN_MS else: frame_number_preamble = 0 logger.debug(f"Frame loss simulator {bitstream} -> {bitstream_processed}") create_and_apply_error_pattern( in_bitstream=bitstream, out_bitstream=bitstream_processed, len_sig=len(signal), len_sig=frame_number, preamble=frame_number_preamble, error_pattern=self.tx["error_pattern"], error_rate=self.tx["error_rate"], master_seed=self.tx["master_seed"], Loading ivas_processing_scripts/processing/processing.py +64 −77 Original line number Diff line number Diff line Loading @@ -63,7 +63,6 @@ def concat_setup(cfg: TestConfig, logger: logging.Logger): if any([i for i in cfg.items_list if i.suffix == ".txt"]): raise SystemExit("Concatenation for text files is unsupported") if len(cfg.items_list) > 1: logger.info(f"Concatenating input files in directory {cfg.input_path}") # concatenate ISM metadata Loading Loading @@ -94,7 +93,7 @@ def concat_setup(cfg: TestConfig, logger: logging.Logger): f"{cfg.input_path.name}_concatenated.wav" ) cfg.splits, cfg.num_frames, cfg.num_frames_preamble = concat( cfg.splits = concat( cfg.items_list, cfg.concat_file, cfg.concat_silence.get("pre", 0), Loading @@ -121,13 +120,6 @@ def concat_setup(cfg: TestConfig, logger: logging.Logger): f"Splits written to file {cfg.concat_file.with_suffix('.splits.log')}" ) else: warn( "Concatenation specified with a single item this will have no effect. Please use preprocessing if padding is required." ) cfg.splits = [] # TODO: set num frames def concat_teardown(cfg: TestConfig, logger: logging.Logger): try: Loading @@ -140,11 +132,6 @@ def concat_teardown(cfg: TestConfig, logger: logging.Logger): out_files = [] out_meta = [] if num_splits <= 1: logger.info("No splitting of output file necessary since only one signal used.") out_meta = None else: logger.info(f"Splitting output file in directory {cfg.output_path}") for odir in cfg.out_dirs: Loading Loading
ivas_processing_scripts/audiotools/audiofile.py +2 −14 Original line number Diff line number Diff line Loading @@ -157,7 +157,7 @@ def concat( pad_noise: Optional[bool] = False, preamble: Optional[int] = None, pad_noise_preamble: Optional[bool] = False, ) -> Tuple[list, int, int]: ) -> list: """ Horizontally concatenates audio files into one long file Loading @@ -180,10 +180,6 @@ def concat( ------- splits List of sample indices to split the resulting file at num_frames Length of overall signal in frames num_frames_preamble: int Length of preamble in frames """ y = None Loading Loading @@ -217,15 +213,7 @@ def concat( write(out_file, y, fs=in_fs) # compute length of concatenated file and preamble in frames for bitstream processing frame_len = fs_compare * IVAS_FRAME_LEN_MS / 1000 num_frames = int(len(y) / frame_len) if preamble: num_frames_preamble = int(preamble / IVAS_FRAME_LEN_MS) else: num_frames_preamble = 0 return splits[1:], num_frames, num_frames_preamble return splits[1:] def split( Loading
ivas_processing_scripts/audiotools/wrappers/eid_xor.py +1 −3 Original line number Diff line number Diff line Loading @@ -120,9 +120,7 @@ def create_and_apply_error_pattern( if error_pattern is None: # create error pattern if error_rate is not None: error_pattern = in_bitstream.parent.joinpath("error_pattern").with_suffix( ".192" ) error_pattern = in_bitstream.parent.joinpath("error_pattern").with_suffix(".192") create_error_pattern(len_sig, error_pattern, error_rate, preamble, master_seed, prerun_seed) else: raise ValueError( Loading
ivas_processing_scripts/processing/chains.py +1 −0 Original line number Diff line number Diff line Loading @@ -249,6 +249,7 @@ def get_processing_chain( "dec_opts": dec_cfg.get("opts"), "multiprocessing": cfg.multiprocessing, "tx": tx_cfg, "preamble": cfg.preamble, } ) ) Loading
ivas_processing_scripts/processing/ivas.py +9 −5 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ import logging import os.path import platform from copy import deepcopy from pathlib import Path from typing import Optional, Union Loading @@ -47,6 +46,7 @@ from ivas_processing_scripts.audiotools.wrappers.networkSimulator import ( ) from ivas_processing_scripts.processing.processing import Processing from ivas_processing_scripts.utils import run from ivas_processing_scripts.audiotools.constants import IVAS_FRAME_LEN_MS class IVAS(Processing): Loading Loading @@ -233,14 +233,18 @@ class IVAS(Processing): elif self.tx["type"] == "FER": bs, ext = os.path.splitext(bitstream) bitstream_processed = Path(f"{bs}_processed{ext}") signal, _ = read( in_file, fs=self.in_fs ) # TODO: pass down number of frames and preamble from concatenation signal, _ = read(in_file, fs=self.in_fs, nchannels=self.in_fmt.num_channels) frame_number = len(signal) / self.in_fs / IVAS_FRAME_LEN_MS * 1000 if self.preamble: frame_number_preamble = self.preamble / IVAS_FRAME_LEN_MS else: frame_number_preamble = 0 logger.debug(f"Frame loss simulator {bitstream} -> {bitstream_processed}") create_and_apply_error_pattern( in_bitstream=bitstream, out_bitstream=bitstream_processed, len_sig=len(signal), len_sig=frame_number, preamble=frame_number_preamble, error_pattern=self.tx["error_pattern"], error_rate=self.tx["error_rate"], master_seed=self.tx["master_seed"], Loading
ivas_processing_scripts/processing/processing.py +64 −77 Original line number Diff line number Diff line Loading @@ -63,7 +63,6 @@ def concat_setup(cfg: TestConfig, logger: logging.Logger): if any([i for i in cfg.items_list if i.suffix == ".txt"]): raise SystemExit("Concatenation for text files is unsupported") if len(cfg.items_list) > 1: logger.info(f"Concatenating input files in directory {cfg.input_path}") # concatenate ISM metadata Loading Loading @@ -94,7 +93,7 @@ def concat_setup(cfg: TestConfig, logger: logging.Logger): f"{cfg.input_path.name}_concatenated.wav" ) cfg.splits, cfg.num_frames, cfg.num_frames_preamble = concat( cfg.splits = concat( cfg.items_list, cfg.concat_file, cfg.concat_silence.get("pre", 0), Loading @@ -121,13 +120,6 @@ def concat_setup(cfg: TestConfig, logger: logging.Logger): f"Splits written to file {cfg.concat_file.with_suffix('.splits.log')}" ) else: warn( "Concatenation specified with a single item this will have no effect. Please use preprocessing if padding is required." ) cfg.splits = [] # TODO: set num frames def concat_teardown(cfg: TestConfig, logger: logging.Logger): try: Loading @@ -140,11 +132,6 @@ def concat_teardown(cfg: TestConfig, logger: logging.Logger): out_files = [] out_meta = [] if num_splits <= 1: logger.info("No splitting of output file necessary since only one signal used.") out_meta = None else: logger.info(f"Splitting output file in directory {cfg.output_path}") for odir in cfg.out_dirs: Loading