When a source was too close to the microphone, the time-of-flight might be smaller than the delay due to the fractionnal delay filter used to create the impulse response. It is then necessary to add this delay to the rir filter to ensure no runtime error.
()
| 4 | |
| 5 | |
| 6 | def test_issue_115_ism_breaking(): |
| 7 | """ |
| 8 | When a source was too close to the microphone, the time-of-flight |
| 9 | might be smaller than the delay due to the fractionnal delay filter |
| 10 | used to create the impulse response. |
| 11 | It is then necessary to add this delay to the rir filter to ensure |
| 12 | no runtime error. |
| 13 | """ |
| 14 | print("Test with source close to microphone.") |
| 15 | shoebox = pra.ShoeBox( |
| 16 | [9.29447785567344, 6.529510207957697, 4.4677460263160995], |
| 17 | materials=pra.Material(energy_absorption=0.1675976883006225), |
| 18 | fs=16000, |
| 19 | max_order=17, |
| 20 | ) |
| 21 | source_loc = [5.167674641605016, 4.379726875714017, 2.9190423403507504] |
| 22 | shoebox.add_source(source_loc) |
| 23 | noise_loc = [8.47420884677372, 5.675261722911696, 1.2040578622058364] |
| 24 | shoebox.add_source(noise_loc) |
| 25 | R = np.array([[8.571318246865648], [5.799718630723678], [1.3702254938278977]]) |
| 26 | print( |
| 27 | "mic - source distance : {} m".format( |
| 28 | np.sqrt(sum((np.array(source_loc) - np.squeeze(R)) ** 2)) |
| 29 | ) |
| 30 | ) |
| 31 | print( |
| 32 | "mic - noise distance : {} m".format( |
| 33 | np.sqrt(sum((np.array(noise_loc) - np.squeeze(R)) ** 2)) |
| 34 | ) |
| 35 | ) |
| 36 | shoebox.add_microphone_array(pra.MicrophoneArray(R, shoebox.fs)) |
| 37 | shoebox.compute_rir() |
| 38 | |
| 39 | |
| 40 | def test_issue_115_rt_breaking(): |
no test coverage detected