Skip to content

Commit

Permalink
Changes required to enable FOA on TAU rooms (iranroman#55)
Browse files Browse the repository at this point in the history
* changes required to enable FOA

* version bump

* SELDnet23 can be trained and replicates cross-validation results on STARSS23 Fold4 using the data generated with this commit.
  • Loading branch information
iranroman authored Apr 8, 2024
1 parent 0979976 commit 507054e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion example_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 15 additions & 11 deletions spatialscaper/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}


Expand Down Expand Up @@ -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)

Expand All @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion spatialscaper/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"""Version info"""

short_version = "0.1"
version = "0.1.1"
version = "0.1.2"

0 comments on commit 507054e

Please sign in to comment.