diff --git a/ivas_processing_scripts/audiotools/binaural_datasets/binaural_dataset.py b/ivas_processing_scripts/audiotools/binaural_datasets/binaural_dataset.py index 8b3b84de189727f3ffb605a0e16d497ae7bf56da..8198b27f6488076d86708ee1baf640c8893f5ece 100755 --- a/ivas_processing_scripts/audiotools/binaural_datasets/binaural_dataset.py +++ b/ivas_processing_scripts/audiotools/binaural_datasets/binaural_dataset.py @@ -73,6 +73,7 @@ def load_hrtf( ) mat_contents = loadmat(filename) + #mat_contents = h5py.File(filename, 'r') try: IR = mat_contents["IR"] @@ -129,8 +130,8 @@ def load_ir( if in_fmt.startswith("MOZART"): dataset_suffix = "FULL" - elif in_fmt in CHANNEL_BASED_AUDIO_FORMATS.keys(): - dataset_suffix = "LS" + elif in_fmt in CHANNEL_BASED_AUDIO_FORMATS.keys(): ##This is triggered when -if HOA3 is passed from the command line. dataset suffix is being set to LS, and "FULL" mode cannot be used - in_format being used is 7_1_4. + dataset_suffix = "FULL" elif out_fmt.startswith("BINAURAL"): dataset_prefix = "HRIR" @@ -192,7 +193,9 @@ def load_ir( in_fmt = fromtype(in_fmt) tmp_fmt = fromtype("LS") - IR_tmp = IR.copy() + #IR_tmp = IR.copy() # Bug: deprecated function, no longer works + IR_tmp = np.array(IR, copy=True) + #IR_tmp = copy.deepcopy(IR) # -> error - h5py lists cannot be pickled IR = np.zeros([IR_tmp.shape[0], IR_tmp.shape[1], in_fmt.num_channels]) ir_index = 0 diff --git a/ivas_processing_scripts/audiotools/convert/channelbased.py b/ivas_processing_scripts/audiotools/convert/channelbased.py index dbb8b160ed46b26f3800d6c411402323f718e012..89ddc63140d5eb016b9177c6de0998c6662dbd7f 100755 --- a/ivas_processing_scripts/audiotools/convert/channelbased.py +++ b/ivas_processing_scripts/audiotools/convert/channelbased.py @@ -125,7 +125,7 @@ def render_cba_to_binaural( if trajectory is not None: cba.audio = rotate_cba(cba, trajectory) - IR, _, latency_smp = load_ir(cba.name, bin.name, bin_dataset) + IR, _, latency_smp = load_ir(cba.name, bin.name, bin_dataset) ##cba.name passed to this function is 7_1_4 -> this caused the renderer to attach suffix LS to the binaural dataset name in the next step # render LFE if bin_lfe_gain is not None: @@ -133,6 +133,7 @@ def render_cba_to_binaural( cba.audio, cba.fs, cba.lfe_index, bin_lfe_gain ) + ##The following two operations must be stateful for frame-wise, TCP enabled rendering # render rest of the signal bin.audio = binaural_fftconv(cba.audio, IR, cba.num_channels, cba.lfe_index) # compensate delay from binaural dataset diff --git a/ivas_processing_scripts/audiotools/convert/objectbased.py b/ivas_processing_scripts/audiotools/convert/objectbased.py index 94c3f79285b2b8eac73d3cadce4643d79e2d4843..2bfc1c0c660bb938becb25a3b9a2aaac9b6897cf 100755 --- a/ivas_processing_scripts/audiotools/convert/objectbased.py +++ b/ivas_processing_scripts/audiotools/convert/objectbased.py @@ -113,7 +113,7 @@ def render_oba_to_binaural( render_oba_to_cba(oba, cba_tmp) - render_cba_to_binaural(cba_tmp, bin, trajectory) + render_cba_to_binaural(cba_tmp, bin, trajectory, bin_dataset, **kwargs) else: IR, SourcePosition, latency_smp = load_ir(oba.name, bin.name, bin_dataset) diff --git a/ivas_processing_scripts/audiotools/convert/scenebased.py b/ivas_processing_scripts/audiotools/convert/scenebased.py index b633f6e73052379661ce47eb4bb00ff160b730df..e65539100d39a2a07a851c93b6a9c70ba0561efd 100755 --- a/ivas_processing_scripts/audiotools/convert/scenebased.py +++ b/ivas_processing_scripts/audiotools/convert/scenebased.py @@ -89,6 +89,7 @@ def convert_scenebased( f"Conversion from {sba.name} to {out.name} is unsupported!" ) +#Rendered Audio is returned here return out @@ -114,16 +115,23 @@ def render_sba_to_binaural( Name of binaural dataset without prefix or suffix """ - if trajectory is not None: + if trajectory is not None: ##Trajectory option for pre-coded head rotations?? sba.audio = rotate_sba(sba, trajectory) - if "ROOM" in bin.name: + if "ROOM" in bin.name: #this is triggered for BINAURAL_ROOM option + ##Does this have be changed based on the new angles mode in SOFA? Or based on input format? cba_tmp = audio.fromtype("7_1_4") + ##Temporary change to 5_1 + ##cba_tmp = audio.fromtype("5_1") cba_tmp.fs = sba.fs render_sba_to_cba(sba, cba_tmp) - channelbased.render_cba_to_binaural(cba_tmp, bin, trajectory) + ##connect cba_tmp to ivas python renderer + + #Binaural dataset name is not being passeed here + channelbased.render_cba_to_binaural(cba_tmp, bin, trajectory, bin_dataset, **kwargs) + #channelbased.render_cba_to_binaural(cba_tmp, bin, **kwargs) - does not work if **kwargs is passed as an argument else: IR, _, latency_smp = load_ir(sba.name, bin.name, bin_dataset) @@ -156,6 +164,7 @@ def render_sba_to_cba( Channel-based output audio """ + ##recreate render_mtx = get_allrad_mtx(sba.ambi_order, cba) cba.audio = sba.audio @ render_mtx.T @@ -409,7 +418,7 @@ def get_allrad_mtx( ALLRAD matrix """ - n_harm = nchan_from_ambi_order(ambi_order) + n_harm = nchan_from_ambi_order(ambi_order) ## (ambi_order + 1)`** 2` if cba.name == "MONO": hoa_dec = np.zeros([1, n_harm])