diff --git a/ivas_processing_scripts/generation/generate_masa_items.py b/ivas_processing_scripts/generation/generate_masa_items.py index 65b29761261af5a609e67713878e0415a4739816..9d71d7c4d2ce6662bb7634fac101cd998e41e23f 100644 --- a/ivas_processing_scripts/generation/generate_masa_items.py +++ b/ivas_processing_scripts/generation/generate_masa_items.py @@ -208,6 +208,7 @@ def generate_MASA_scene( # repeat for all source files offset = 0 + y_int = None for i in range(N_inputs): # parse parameters from the scene description source_file = ( @@ -269,9 +270,10 @@ def generate_MASA_scene( ) sys.exit(-1) - # initialize intermediate SBA object - y_int = audio.SceneBasedAudio(IR_fmt) - y_int.fs = cfg.fs + # initialize intermediate SBA object (based on the format of the IR file) + if y_int is None: + y_int = audio.SceneBasedAudio(IR_fmt) + y_int.fs = cfg.fs # read source file x = audio.fromfile("MONO", input_filename) @@ -325,13 +327,15 @@ def generate_MASA_scene( delta_offset = source_shift - offset if delta_offset > 0: # insert zeros to the output SBA signal to shift it right - audioarray.trim( + y_int.audio = audioarray.trim( y_int.audio, y_int.fs, limits=[-delta_offset, 0], samples=True ) offset = source_shift else: # insert zeros to the new SBA source signal to shift it right - audioarray.trim(x.audio, x.fs, limits=[delta_offset, 0], samples=True) + x.audio = audioarray.trim( + x.audio, x.fs, limits=[delta_offset, 0], samples=True + ) # adjust the length of the audio source signal delta_length = len(x.audio) - len(y_int.audio) diff --git a/ivas_processing_scripts/generation/generate_mc_items.py b/ivas_processing_scripts/generation/generate_mc_items.py index bac49e0c8de1720c46334cb9d576426da279e06b..2b2da206b3b832ca821f6a2bb3ed0bad6729ff23 100644 --- a/ivas_processing_scripts/generation/generate_mc_items.py +++ b/ivas_processing_scripts/generation/generate_mc_items.py @@ -208,6 +208,7 @@ def generate_MC_scene( # repeat for all source files offset = 0 + y_int = None for i in range(N_inputs): # parse parameters from the scene description source_file = ( @@ -270,8 +271,9 @@ def generate_MC_scene( sys.exit(-1) # initialize intermediate SBA object (based on the format of the IR file) - y_int = audio.SceneBasedAudio(IR_fmt) - y_int.fs = cfg.fs + if y_int is None: + y_int = audio.SceneBasedAudio(IR_fmt) + y_int.fs = cfg.fs # read source file x = audio.fromfile("MONO", input_filename) @@ -325,13 +327,15 @@ def generate_MC_scene( delta_offset = source_shift - offset if delta_offset > 0: # insert zeros to the output SBA signal to shift it right - audioarray.trim( + y_int.audio = audioarray.trim( y_int.audio, y_int.fs, limits=[-delta_offset, 0], samples=True ) offset = source_shift else: # insert zeros to the new SBA source signal to shift it right - audioarray.trim(x.audio, x.fs, limits=[delta_offset, 0], samples=True) + x.audio = audioarray.trim( + x.audio, x.fs, limits=[delta_offset, 0], samples=True + ) # adjust the length of the audio source signal delta_length = len(x.audio) - len(y_int.audio)