diff --git a/ivas_processing_scripts/processing/chains.py b/ivas_processing_scripts/processing/chains.py index 84f125a1bc767a4536963cea41c7e4e9f754bb80..6ee222dc5a9bfe31fdd8cae9ac14d5ab4495506c 100755 --- a/ivas_processing_scripts/processing/chains.py +++ b/ivas_processing_scripts/processing/chains.py @@ -575,12 +575,15 @@ def validate_input_files(cfg: TestConfig): # always throw an error for ISM (and MASA) input if input_format.startswith("ISM") or input_format.startswith("MASA"): frame_alignment = "error" + # NOTE: to override this warning for local testing, simply uncomment the below line + # this will override the above variable and enable padding for non-aligned files + # frame_alignment = "padding" if frame_alignment == "padding": # Create new input directory for padded files - output_dir = cfg.output_path / "20ms_aligned_files" + aligned_output_dir = cfg.output_path / "20ms_aligned_files" try: - output_dir.mkdir(exist_ok=False, parents=True) + aligned_output_dir.mkdir(exist_ok=False, parents=True) except FileExistsError: raise ValueError( "Folder for 20ms aligned files already exists. Please move or delete folder" @@ -639,24 +642,29 @@ def validate_input_files(cfg: TestConfig): samples=True, ) # Write padded data to output directory - write(output_dir / item.name, padded_data, fs) + write(aligned_output_dir / item.name, padded_data, fs) # Update audio file path in list - cfg.items_list[i] = output_dir / item.name + cfg.items_list[i] = aligned_output_dir / item.name else: raise ValueError( f"Value of key frame_alignment does not match possible options. Value: {frame_alignment}. Options: 'padding', 'ignore', 'warning', 'error'" ) else: if frame_alignment == "padding": - copyfile(item, output_dir / item.name) + copyfile(item, aligned_output_dir / item.name) # Update audio file path in list - cfg.items_list[i] = output_dir / item.name - else: - pass + cfg.items_list[i] = aligned_output_dir / item.name if frame_alignment == "padding": + # copy over any metadata files + [ + copyfile(f, aligned_output_dir / f.name) + for f in list(cfg.input_path.glob("*.csv")) + + list(cfg.input_path.glob("*.met")) + ] + # Make the output path as the new input path - cfg.input_path = output_dir + cfg.input_path = aligned_output_dir def clean_outputs(cfg: TestConfig) -> None: