|
| 1 | +""" |
| 2 | +# Test for Issue 353 |
| 3 | +
|
| 4 | +[issue #353](https://github.com/LCAV/pyroomacoustics/issues/353) |
| 5 | +
|
| 6 | +The cause of the issue was that the time of the maximum delay |
| 7 | +in the RIR is used to determine the necessary size of the array. |
| 8 | +
|
| 9 | +The float64 value of the delay was used to determine the size and construct the array. |
| 10 | +However, the `rir_build` routine takes float32. |
| 11 | +After conversion, the array size would evaluate to one delay more due to rounding |
| 12 | +offset and an array size check would fail. |
| 13 | +
|
| 14 | +Converting the delay time array to float32 before creating the rir array |
| 15 | +solved the issue. |
| 16 | +""" |
| 17 | + |
| 18 | +import numpy as np |
| 19 | + |
| 20 | +import pyroomacoustics as pra |
| 21 | + |
| 22 | + |
| 23 | +def test_issue_353(): |
| 24 | + room_dims = np.array([10.0, 10.0, 10.0]) |
| 25 | + room = pra.ShoeBox( |
| 26 | + room_dims, fs=24000, materials=None, max_order=22, use_rand_ism=False |
| 27 | + ) |
| 28 | + |
| 29 | + source = np.array([[6.35551912], [4.33308523], [3.69586303]]) |
| 30 | + room.add_source(source) |
| 31 | + |
| 32 | + mic_array_in_room = np.array( |
| 33 | + [ |
| 34 | + [1.5205189, 1.49366285, 1.73302404, 1.67847898], |
| 35 | + [4.68430529, 4.76250254, 4.67956424, 4.60702604], |
| 36 | + [2.68214263, 2.7980202, 2.55341851, 2.72701718], |
| 37 | + ] |
| 38 | + ) |
| 39 | + room.add_microphone_array(mic_array_in_room) |
| 40 | + |
| 41 | + room.compute_rir() |
0 commit comments