Loading ivas_processing_scripts/generation/process_ism1_items.py +23 −19 Original line number Diff line number Diff line Loading @@ -267,9 +267,10 @@ def generate_ism1_scene( N_frames = int(len(y.audio) / y.fs * 50) # read azimuth information and create array # read azimuth information and convert to an array if isinstance(source_azi, str): if ":" in source_azi: # start with the initial azimuth value and apply step N_frames times source_azi = source_azi.split(":") azi = np.linspace( float(eval(source_azi[0])), Loading @@ -277,46 +278,49 @@ def generate_ism1_scene( N_frames ) else: azi = np.array(float(eval(source_azi)), ndmin=1) # replicate static azimuth value N_frames times azi = np.repeat(float(eval(source_azi)), N_frames) else: azi = np.array(source_azi, ndmin=1)[:N_frames] if len(azi) < N_frames: # replicate the last elevation azi = np.append(azi, np.full(N_frames - len(azi), azi[-1])) # replicate static azimuth value N_frames times azi = np.repeat(float(source_azi), N_frames) # convert azimuth from 0 .. 360 to -180 .. +180 azi = (azi + 180) % 360 - 180 # check if azimuth is from -180 .. +180 # check, if azimuth is from -180 .. +180 if any(azi > 180) or any(azi < -180): logger.error( f"Incorrect value(s) of azimuth: {azi[(azi > 180) | (azi < -180)]}" ) # read elevation information and create array # read elevation information and convert to an array if isinstance(source_ele, str): if ":" in source_ele: # convert into array (initial_value:step:stop_value) # note: the stop_value value is +-90 degrees depending on the sign of the step source_ele = source_ele.split(":") ele = np.linspace( ele = np.arange( float(eval(source_ele[0])), float(eval(source_ele[2])), N_frames ) else: ele = np.array(float(eval(source_ele)), ndmin=1) else: ele = np.array(source_ele, ndmin=1)[:N_frames] np.sign(float(eval(source_ele[1]))) * 90, float(eval(source_ele[1])) )[:N_frames] # repeat the last elevation value, if array is shorter than N_frames if len(ele) < N_frames: # replicate the last elevation ele = np.append(ele, np.full(N_frames - len(ele), ele[-1])) else: # replicate static elevation value N_frames times ele = np.repeat(float(eval(source_ele)), N_frames) else: # replicate static elevation value N_frames times ele = np.repeat(float(source_ele), N_frames) # check if elevation is from -90 .. +90 if any(ele > 90) or any(ele < -90): logger.error( f"Incorrect value(s) of elevation: {ele[(ele > 90) | (ele < -90)]}" ) # arrange all metadata fields column-wise into a matrix y_meta = np.column_stack((azi, ele)) Loading ivas_processing_scripts/generation/process_ism2_items.py +21 −18 Original line number Diff line number Diff line Loading @@ -302,9 +302,10 @@ def generate_ism2_scene( N_frames = int(len(y.audio) / y.fs * 50) # read azimuth information and create array # read azimuth information and convert to an array if isinstance(source_azi, str): if ":" in source_azi: # start with the initial azimuth value and apply step N_frames times source_azi = source_azi.split(":") azi = np.linspace( float(eval(source_azi[0])), Loading @@ -312,13 +313,11 @@ def generate_ism2_scene( N_frames ) else: azi = np.array(float(eval(source_azi)), ndmin=1) # replicate static azimuth value N_frames times azi = np.repeat(float(eval(source_azi)), N_frames) else: azi = np.array(source_azi, ndmin=1)[:N_frames] if len(azi) < N_frames: # replicate the last elevation azi = np.append(azi, np.full(N_frames - len(azi), azi[-1])) # replicate static azimuth value N_frames times azi = np.repeat(float(source_azi), N_frames) # convert azimuth from 0 .. 360 to -180 .. +180 azi = (azi + 180) % 360 - 180 Loading @@ -329,23 +328,27 @@ def generate_ism2_scene( f"Incorrect value(s) of azimuth: {azi[(azi > 180) | (azi < -180)]}" ) # read elevation information and create array # read elevation information and convert to an array if isinstance(source_ele, str): if ":" in source_ele: # convert into array (initial_value:step:stop_value) # note: the stop_value value is +-90 degrees depending on the sign of the step source_ele = source_ele.split(":") ele = np.linspace( ele = np.arange( float(eval(source_ele[0])), float(eval(source_ele[2])), N_frames ) else: ele = np.array(float(eval(source_ele)), ndmin=1) else: ele = np.array(source_ele, ndmin=1)[:N_frames] np.sign(float(eval(source_ele[1]))) * 90, float(eval(source_ele[1])) )[:N_frames] # repeat the last elevation value, if array is shorter than N_frames if len(ele) < N_frames: # replicate the last elevation ele = np.append(ele, np.full(N_frames - len(ele), ele[-1])) else: # replicate static elevation value N_frames times ele = np.repeat(float(eval(source_ele)), N_frames) else: # replicate static elevation value N_frames times ele = np.repeat(float(source_ele), N_frames) # check if elevation is from -90 .. +90 if any(ele > 90) or any(ele < -90): Loading Loading
ivas_processing_scripts/generation/process_ism1_items.py +23 −19 Original line number Diff line number Diff line Loading @@ -267,9 +267,10 @@ def generate_ism1_scene( N_frames = int(len(y.audio) / y.fs * 50) # read azimuth information and create array # read azimuth information and convert to an array if isinstance(source_azi, str): if ":" in source_azi: # start with the initial azimuth value and apply step N_frames times source_azi = source_azi.split(":") azi = np.linspace( float(eval(source_azi[0])), Loading @@ -277,46 +278,49 @@ def generate_ism1_scene( N_frames ) else: azi = np.array(float(eval(source_azi)), ndmin=1) # replicate static azimuth value N_frames times azi = np.repeat(float(eval(source_azi)), N_frames) else: azi = np.array(source_azi, ndmin=1)[:N_frames] if len(azi) < N_frames: # replicate the last elevation azi = np.append(azi, np.full(N_frames - len(azi), azi[-1])) # replicate static azimuth value N_frames times azi = np.repeat(float(source_azi), N_frames) # convert azimuth from 0 .. 360 to -180 .. +180 azi = (azi + 180) % 360 - 180 # check if azimuth is from -180 .. +180 # check, if azimuth is from -180 .. +180 if any(azi > 180) or any(azi < -180): logger.error( f"Incorrect value(s) of azimuth: {azi[(azi > 180) | (azi < -180)]}" ) # read elevation information and create array # read elevation information and convert to an array if isinstance(source_ele, str): if ":" in source_ele: # convert into array (initial_value:step:stop_value) # note: the stop_value value is +-90 degrees depending on the sign of the step source_ele = source_ele.split(":") ele = np.linspace( ele = np.arange( float(eval(source_ele[0])), float(eval(source_ele[2])), N_frames ) else: ele = np.array(float(eval(source_ele)), ndmin=1) else: ele = np.array(source_ele, ndmin=1)[:N_frames] np.sign(float(eval(source_ele[1]))) * 90, float(eval(source_ele[1])) )[:N_frames] # repeat the last elevation value, if array is shorter than N_frames if len(ele) < N_frames: # replicate the last elevation ele = np.append(ele, np.full(N_frames - len(ele), ele[-1])) else: # replicate static elevation value N_frames times ele = np.repeat(float(eval(source_ele)), N_frames) else: # replicate static elevation value N_frames times ele = np.repeat(float(source_ele), N_frames) # check if elevation is from -90 .. +90 if any(ele > 90) or any(ele < -90): logger.error( f"Incorrect value(s) of elevation: {ele[(ele > 90) | (ele < -90)]}" ) # arrange all metadata fields column-wise into a matrix y_meta = np.column_stack((azi, ele)) Loading
ivas_processing_scripts/generation/process_ism2_items.py +21 −18 Original line number Diff line number Diff line Loading @@ -302,9 +302,10 @@ def generate_ism2_scene( N_frames = int(len(y.audio) / y.fs * 50) # read azimuth information and create array # read azimuth information and convert to an array if isinstance(source_azi, str): if ":" in source_azi: # start with the initial azimuth value and apply step N_frames times source_azi = source_azi.split(":") azi = np.linspace( float(eval(source_azi[0])), Loading @@ -312,13 +313,11 @@ def generate_ism2_scene( N_frames ) else: azi = np.array(float(eval(source_azi)), ndmin=1) # replicate static azimuth value N_frames times azi = np.repeat(float(eval(source_azi)), N_frames) else: azi = np.array(source_azi, ndmin=1)[:N_frames] if len(azi) < N_frames: # replicate the last elevation azi = np.append(azi, np.full(N_frames - len(azi), azi[-1])) # replicate static azimuth value N_frames times azi = np.repeat(float(source_azi), N_frames) # convert azimuth from 0 .. 360 to -180 .. +180 azi = (azi + 180) % 360 - 180 Loading @@ -329,23 +328,27 @@ def generate_ism2_scene( f"Incorrect value(s) of azimuth: {azi[(azi > 180) | (azi < -180)]}" ) # read elevation information and create array # read elevation information and convert to an array if isinstance(source_ele, str): if ":" in source_ele: # convert into array (initial_value:step:stop_value) # note: the stop_value value is +-90 degrees depending on the sign of the step source_ele = source_ele.split(":") ele = np.linspace( ele = np.arange( float(eval(source_ele[0])), float(eval(source_ele[2])), N_frames ) else: ele = np.array(float(eval(source_ele)), ndmin=1) else: ele = np.array(source_ele, ndmin=1)[:N_frames] np.sign(float(eval(source_ele[1]))) * 90, float(eval(source_ele[1])) )[:N_frames] # repeat the last elevation value, if array is shorter than N_frames if len(ele) < N_frames: # replicate the last elevation ele = np.append(ele, np.full(N_frames - len(ele), ele[-1])) else: # replicate static elevation value N_frames times ele = np.repeat(float(eval(source_ele)), N_frames) else: # replicate static elevation value N_frames times ele = np.repeat(float(source_ele), N_frames) # check if elevation is from -90 .. +90 if any(ele > 90) or any(ele < -90): Loading