From ae45f6fa91df70aeb4b36f1951503dc7c0fbf7df Mon Sep 17 00:00:00 2001 From: knj Date: Tue, 30 May 2023 16:10:04 +0200 Subject: [PATCH 1/3] implement conversion from HOA2 to MASA --- ivas_processing_scripts/audiotools/convert/scenebased.py | 8 ++++---- .../audiotools/wrappers/masaAnalyzer.py | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ivas_processing_scripts/audiotools/convert/scenebased.py b/ivas_processing_scripts/audiotools/convert/scenebased.py index 7c44897d..252380cb 100755 --- a/ivas_processing_scripts/audiotools/convert/scenebased.py +++ b/ivas_processing_scripts/audiotools/convert/scenebased.py @@ -79,9 +79,7 @@ def convert_scenebased( # SBA -> MASA # NOTE: only allowed for 1st order ambisonics ("FOA" + "PLANARFOA") - elif isinstance(out, audio.MetadataAssistedSpatialAudio) and sba.name.endswith( - "FOA" - ): + elif isinstance(out, audio.MetadataAssistedSpatialAudio) and (sba.name.endswith("FOA") or sba.name == "HOA2"): render_sba_to_masa(sba, out) else: @@ -196,8 +194,10 @@ def render_sba_to_masa( sba_in: audio.SceneBasedAudio, masa_out: audio.MetadataAssistedSpatialAudio, ) -> None: - # two dir only possible from HOA2, which is not yet implemented as conversion num_dirs = 1 + if sba_in.name == "HOA2": + num_dirs = 2 + num_tcs = masa_out.audio.shape[1] md_out_path = masa_out.metadata_file diff --git a/ivas_processing_scripts/audiotools/wrappers/masaAnalyzer.py b/ivas_processing_scripts/audiotools/wrappers/masaAnalyzer.py index 961c987f..0ded643d 100644 --- a/ivas_processing_scripts/audiotools/wrappers/masaAnalyzer.py +++ b/ivas_processing_scripts/audiotools/wrappers/masaAnalyzer.py @@ -77,6 +77,9 @@ def masaAnalyzer( if sba.name not in ["PLANARFOA", "FOA", "HOA2"]: raise ValueError(f"Only FOA or HOA2 suported, but {sba.name} was given.") + if num_dirs == 2 and sba.name != "HOA2": + raise ValueError(f"2-dir MASA needs HOA2, but {sba.name} was given.") + cmd = [ str(binary), "-mono" if num_tcs == 1 else "-stereo", -- GitLab From 445a61fe5714eb0b72649a9dde4e6f48a28ba823 Mon Sep 17 00:00:00 2001 From: knj Date: Thu, 1 Jun 2023 11:43:56 +0200 Subject: [PATCH 2/3] add repeat_signal key to P800-9 configs --- experiments/selection/P800-9/config/P800-9-cat1.yml | 1 + experiments/selection/P800-9/config/P800-9-cat2.yml | 1 + experiments/selection/P800-9/config/P800-9-cat3.yml | 1 + experiments/selection/P800-9/config/P800-9-cat4.yml | 1 + experiments/selection/P800-9/config/P800-9-cat5.yml | 1 + experiments/selection/P800-9/config/P800-9-cat6.yml | 1 + 6 files changed, 6 insertions(+) diff --git a/experiments/selection/P800-9/config/P800-9-cat1.yml b/experiments/selection/P800-9/config/P800-9-cat1.yml index 6c1e483a..14e85e8c 100644 --- a/experiments/selection/P800-9/config/P800-9-cat1.yml +++ b/experiments/selection/P800-9/config/P800-9-cat1.yml @@ -40,6 +40,7 @@ preprocessing_2: snr: 10 ### REQUIRED: Path to background noise, must have same format and sampling rate as input signal(s) background_noise_path: "experiments/selection/P800-9/background_noise/background_noise_cat1.wav" + repeat_signal: true ################################################# ### Bitstream processing diff --git a/experiments/selection/P800-9/config/P800-9-cat2.yml b/experiments/selection/P800-9/config/P800-9-cat2.yml index f18ca640..37fefcee 100644 --- a/experiments/selection/P800-9/config/P800-9-cat2.yml +++ b/experiments/selection/P800-9/config/P800-9-cat2.yml @@ -40,6 +40,7 @@ preprocessing_2: snr: 10 ### REQUIRED: Path to background noise, must have same format and sampling rate as input signal(s) background_noise_path: "experiments/selection/P800-9/background_noise/background_noise_cat2.wav" + repeat_signal: true ################################################# ### Bitstream processing diff --git a/experiments/selection/P800-9/config/P800-9-cat3.yml b/experiments/selection/P800-9/config/P800-9-cat3.yml index 5df21adc..ebd7e193 100644 --- a/experiments/selection/P800-9/config/P800-9-cat3.yml +++ b/experiments/selection/P800-9/config/P800-9-cat3.yml @@ -40,6 +40,7 @@ preprocessing_2: snr: 15 ### REQUIRED: Path to background noise, must have same format and sampling rate as input signal(s) background_noise_path: "experiments/selection/P800-9/background_noise/background_noise_cat3.wav" + repeat_signal: true ################################################# ### Bitstream processing diff --git a/experiments/selection/P800-9/config/P800-9-cat4.yml b/experiments/selection/P800-9/config/P800-9-cat4.yml index eebf2f4e..c7579d70 100644 --- a/experiments/selection/P800-9/config/P800-9-cat4.yml +++ b/experiments/selection/P800-9/config/P800-9-cat4.yml @@ -40,6 +40,7 @@ preprocessing_2: snr: 15 ### REQUIRED: Path to background noise, must have same format and sampling rate as input signal(s) background_noise_path: "experiments/selection/P800-9/background_noise/background_noise_cat4.wav" + repeat_signal: true ################################################# ### Bitstream processing diff --git a/experiments/selection/P800-9/config/P800-9-cat5.yml b/experiments/selection/P800-9/config/P800-9-cat5.yml index b5b9e6c3..77e54cab 100644 --- a/experiments/selection/P800-9/config/P800-9-cat5.yml +++ b/experiments/selection/P800-9/config/P800-9-cat5.yml @@ -40,6 +40,7 @@ preprocessing_2: snr: 15 ### REQUIRED: Path to background noise, must have same format and sampling rate as input signal(s) background_noise_path: "experiments/selection/P800-9/background_noise/background_noise_cat5.wav" + repeat_signal: true ################################################# ### Bitstream processing diff --git a/experiments/selection/P800-9/config/P800-9-cat6.yml b/experiments/selection/P800-9/config/P800-9-cat6.yml index 94be0bbd..11c317df 100644 --- a/experiments/selection/P800-9/config/P800-9-cat6.yml +++ b/experiments/selection/P800-9/config/P800-9-cat6.yml @@ -40,6 +40,7 @@ preprocessing_2: snr: 15 ### REQUIRED: Path to background noise, must have same format and sampling rate as input signal(s) background_noise_path: "experiments/selection/P800-9/background_noise/background_noise_cat6.wav" + repeat_signal: true ################################################# ### Bitstream processing -- GitLab From 0ee1213a0560fd649548b0c29f0369aff5f7b327 Mon Sep 17 00:00:00 2001 From: knj Date: Thu, 1 Jun 2023 11:46:09 +0200 Subject: [PATCH 3/3] fix formatting --- ivas_processing_scripts/audiotools/convert/scenebased.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ivas_processing_scripts/audiotools/convert/scenebased.py b/ivas_processing_scripts/audiotools/convert/scenebased.py index 252380cb..9a5f2729 100755 --- a/ivas_processing_scripts/audiotools/convert/scenebased.py +++ b/ivas_processing_scripts/audiotools/convert/scenebased.py @@ -79,7 +79,9 @@ def convert_scenebased( # SBA -> MASA # NOTE: only allowed for 1st order ambisonics ("FOA" + "PLANARFOA") - elif isinstance(out, audio.MetadataAssistedSpatialAudio) and (sba.name.endswith("FOA") or sba.name == "HOA2"): + elif isinstance(out, audio.MetadataAssistedSpatialAudio) and ( + sba.name.endswith("FOA") or sba.name == "HOA2" + ): render_sba_to_masa(sba, out) else: @@ -197,7 +199,7 @@ def render_sba_to_masa( num_dirs = 1 if sba_in.name == "HOA2": num_dirs = 2 - + num_tcs = masa_out.audio.shape[1] md_out_path = masa_out.metadata_file -- GitLab