diff --git a/example_generation.py b/example_generation.py index 723b48b..86de883 100644 --- a/example_generation.py +++ b/example_generation.py @@ -9,7 +9,7 @@ "datasets/rir_datasets" # Directory containing Room Impulse Response (RIR) files ) ROOM = "bomb_shelter" # Initial room setting, change according to available rooms listed below -FORMAT = "mic" # Output format specifier +FORMAT = "foa" # Output format specifier: could be 'mic' or 'foa' N_EVENTS_MEAN = 15 # Mean number of foreground events in a soundscape N_EVENTS_STD = 6 # Standard deviation of the number of foreground events DURATION = 60.0 # Duration in seconds of each soundscape, customizable by the user diff --git a/spatialscaper/core.py b/spatialscaper/core.py index 046288a..d60fc96 100644 --- a/spatialscaper/core.py +++ b/spatialscaper/core.py @@ -69,15 +69,15 @@ __ROOM_RIR_FILE__ = { "metu": "metu_sparg_em32.sofa", "arni": "arni_mic.sofa", - "bomb_shelter": "bomb_shelter_mic.sofa", - "gym": "gym_mic.sofa", - "pb132": "pb132_mic.sofa", - "pc226": "pc226_mic.sofa", - "sa203": "sa203_mic.sofa", - "sc203": "sc203_mic.sofa", - "se203": "se203_mic.sofa", - "tb103": "tb103_mic.sofa", - "tc352": "tc352_mic.sofa", + "bomb_shelter": "bomb_shelter_{fmt}.sofa", + "gym": "gym_{fmt}.sofa", + "pb132": "pb132_{fmt}.sofa", + "pc226": "pc226_{fmt}.sofa", + "sa203": "sa203_{fmt}.sofa", + "sc203": "sc203_{fmt}.sofa", + "se203": "se203_{fmt}.sofa", + "tb103": "tb103_{fmt}.sofa", + "tc352": "tc352_{fmt}.sofa", } @@ -547,8 +547,10 @@ def get_room_irs_xyz(self): Returns: numpy.ndarray: An array of XYZ coordinates for the impulse response positions. """ + if self.format == 'foa' and self.room in ['metu','arni']: + raise ValueError('"metu" and "arni" rooms are currently only supported in mic (tetrahedral) format. please check again soon.') room_sofa_path = os.path.join( - self.rir_dir, __SPATIAL_SCAPER_RIRS_DIR__, __ROOM_RIR_FILE__[self.room] + self.rir_dir, __SPATIAL_SCAPER_RIRS_DIR__, __ROOM_RIR_FILE__[self.room].format(fmt=self.format) ) return load_pos(room_sofa_path, doas=False) @@ -563,8 +565,10 @@ def get_room_irs_wav_xyz(self, wav=True, pos=True): Returns: tuple: A tuple containing the impulse responses, their sampling rate, and their XYZ positions. """ + if self.format == 'foa' and self.room in ['metu','arni']: + raise ValueError('"metu" and "arni" rooms are currently only supported in mic (tetrahedral) format. please check again soon.') room_sofa_path = os.path.join( - self.rir_dir, __SPATIAL_SCAPER_RIRS_DIR__, __ROOM_RIR_FILE__[self.room] + self.rir_dir, __SPATIAL_SCAPER_RIRS_DIR__, __ROOM_RIR_FILE__[self.room].format(fmt=self.format) ) all_irs, ir_sr, all_ir_xyzs = load_rir_pos(room_sofa_path, doas=False) ir_sr = ir_sr.data[0] diff --git a/spatialscaper/version.py b/spatialscaper/version.py index 29651ab..661a32c 100644 --- a/spatialscaper/version.py +++ b/spatialscaper/version.py @@ -3,4 +3,4 @@ """Version info""" short_version = "0.1" -version = "0.1.1" +version = "0.1.2"