pyroomacoustics
pyroomacoustics copied to clipboard
Assertion Error: pyroomacoustics.build_rir.fast_rir_builder
File "...\Anaconda3\lib\site-packages\pyroomacoustics\soundsource.py", line 254, in get_rir fast_rir_builder(ir, time, alpha, visibility.astype(np.int32), Fs, fdl) File "pyroomacoustics\build_rir.pyx", line 53, in pyroomacoustics.build_rir.fast_rir_builder AssertionError
Hi there, Any idea what might lead to the above error message?
Hi @moonlightSong , thanks for reporting the error. Can you please provide the OS, python version, platform, and how you installed the package ? Thanks!
@fakufaku Thanks for reply. The OS is Windows 10. The python version is python 3.7. The platform is conda 4.9.2. Install is by pip. The error message is given by pyroomacoustics 0.4.2. For some setup it works and for some it prints the error. In the later case, pyroomacoustics 0.3.1 fails quietly. The setup is room_x, room_y, room_z = 8.59, 6.46, 3.20 micL_x, micL_y = 4.36, 3.24 micR_x, micR_y = 4.50, 3.28 mic_z = 0.97 s1_x, s1_y, s1_z = 4.04, 2.48, 1.00 s2_x, s2_y, s2_z = 5.39, 2.44, 1.62 t60 = 0.44
compute_rir is given by: def compute_rir(self):
self.rir = []
self.visibility = None
self.image_source_model()
for m, mic in enumerate(self.mic_array.R.T):
h = []
for s, source in enumerate(self.sources):
h.append(source.get_rir(mic, self.visibility[s][m], self.fs, self.t0)[:self.max_rir_len])
self.rir.append(h)
Thank you very much for providing the extra information. This seems to be an error with the cython code that builds the RIR from the information about the echo delays and amplitudes. I think this may happen if the source and the microphones are too close (which would be a bug of course, since all cases should be covered). Is it possible for you to check if the failing cases have the smallest distance between sources and microphones ?
In https://github.com/LCAV/pyroomacoustics/blob/869ebc38cfe6a04e4f7b0e71a79101ab345dbc54/pyroomacoustics/room.py#L1761 at this line https://github.com/LCAV/pyroomacoustics/blob/869ebc38cfe6a04e4f7b0e71a79101ab345dbc54/pyroomacoustics/room.py#L1848 the time is adjusted. When use room.compute_rir() directly instead of rewrite it like posted above, the code doesn't complain.
In https://github.com/LCAV/pyroomacoustics/blob/5d25cbe15fbcfddb43f16cb7a8ce5b7567f1e922/pyroomacoustics/soundsource.py#L220 time is not adjusted.
so it seems that get_rir() is causing the problem because it didn't adjust the time.
Sorry for coming back so late to this issue. Indeed, the code in soundsource is something left-over from the previous implementation of the Room class. In recent version of pyroomacoustics, the preferred way to get the room impulse response is via the Room class, see the doc here.
No worries. But if there are 2 places where the rir can be obtained, it is better that they are consistent, otherwise it is error-prone.
On Tue, Feb 16, 2021 at 12:58 AM Robin Scheibler [email protected] wrote:
Sorry for coming back so late to this issue. Indeed, the code in soundsource is something left-over from the previous implementation of the Room class. In recent version of pyroomacoustics, the preferred way to get the room impulse response is via the Room class, see the doc here https://pyroomacoustics.readthedocs.io/en/pypi-release/pyroomacoustics.room.html#create-the-room-impulse-response .
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/LCAV/pyroomacoustics/issues/205#issuecomment-779602013, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIZLUVYMVE6ELZLAP23VKYDS7ICOTANCNFSM4V6FA25A .
Thank you so much. You really helped me. I add the same time delay when using get_rir(), and looks like it worked when generating WHAMR! dataset.
In
https://github.com/LCAV/pyroomacoustics/blob/869ebc38cfe6a04e4f7b0e71a79101ab345dbc54/pyroomacoustics/room.py#L1761
at this line https://github.com/LCAV/pyroomacoustics/blob/869ebc38cfe6a04e4f7b0e71a79101ab345dbc54/pyroomacoustics/room.py#L1848
the time is adjusted. When use room.compute_rir() directly instead of rewrite it like posted above, the code doesn't complain. In
https://github.com/LCAV/pyroomacoustics/blob/5d25cbe15fbcfddb43f16cb7a8ce5b7567f1e922/pyroomacoustics/soundsource.py#L220
time is not adjusted. so it seems that get_rir() is causing the problem because it didn't adjust the time.