(hpf_enable)
| 7 | |
| 8 | @pytest.mark.parametrize("hpf_enable", [(True,), (False,)]) |
| 9 | def test_rir_hpf(hpf_enable): |
| 10 | pra.constants.set("rir_hpf_enable", hpf_enable) |
| 11 | np.random.seed(0) |
| 12 | |
| 13 | # The desired reverberation time and dimensions of the room |
| 14 | rt60_tgt = 0.3 # seconds |
| 15 | room_dim = [10, 7.5, 3.5] # meters |
| 16 | |
| 17 | # We invert Sabine's formula to obtain the parameters for the ISM simulator |
| 18 | e_absorption, max_order = pra.inverse_sabine(rt60_tgt, room_dim) |
| 19 | |
| 20 | # Create the room |
| 21 | room = pra.ShoeBox( |
| 22 | room_dim, |
| 23 | fs=16_000, |
| 24 | materials=pra.Material(e_absorption), |
| 25 | max_order=max_order, |
| 26 | use_rand_ism=True, |
| 27 | air_absorption=True, |
| 28 | ) |
| 29 | # place the source in the room |
| 30 | room.add_source([2.5, 3.73, 1.76]) |
| 31 | |
| 32 | # finally place the array in the room |
| 33 | room.add_microphone([6.3, 4.87, 1.2]) |
| 34 | |
| 35 | room.compute_rir() |
| 36 | rir = room.rir[0][0] |
| 37 | |
| 38 | mean = np.mean(rir) |
| 39 | |
| 40 | if hpf_enable: |
| 41 | assert abs(mean) < 1e-5 |
| 42 | else: |
| 43 | assert abs(mean) >= 1e-5 |
nothing calls this directly
no test coverage detected