Skip to content

Commit

Permalink
Fixes a new case of issue 353
Browse files Browse the repository at this point in the history
  • Loading branch information
fakufaku committed Jul 19, 2024
1 parent c3c4b79 commit 885fbc9
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pyroomacoustics/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -2283,7 +2283,13 @@ def compute_rir(self):
N = int(math.ceil(t_max * self.fs / hbss) * hbss)

# this is where we will compose the RIR
ir = np.zeros(N + fdl)

# here we create an array of the right length to
# receiver the full RIR
# the +1 is due to some rare cases where numerical
# errors push the last sample over the end of the
# array
ir = np.zeros(N + fdl + 1)

# This is the distance travelled wrt time
distance_rir = np.arange(N) / self.fs * self.c
Expand Down
38 changes: 38 additions & 0 deletions pyroomacoustics/tests/test_issue_353.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,41 @@ def test_issue_353():
room.add_microphone_array(mic_array_in_room)

room.compute_rir()

def test_issue_353_2():
rt60_tgt = 0.451734045124395 # seconds
room_dim = [
2.496315595944846,
2.2147285947364708,
3.749472153652182
] # meters

fs = 16000

e_absorption, max_order = pra.inverse_sabine(rt60_tgt, room_dim)

room = pra.ShoeBox(
room_dim, fs=fs, materials=pra.Material(e_absorption), max_order=max_order
)

room.add_source([
0.24784311631630576,
1.690743273038349,
1.9570721698068267
])

mic_array = np.array([
[
0.46378325918698565,
],
[
1.5657207092343373,
],
[
3.015697444447528,
]
])

room.add_microphone_array(mic_array)

room.compute_rir()

0 comments on commit 885fbc9

Please sign in to comment.