LCAV / pyroomacoustics

Pyroomacoustics is a package for audio signal processing for indoor applications. It was developed as a fast prototyping platform for beamforming algorithms in indoor scenarios.
https://pyroomacoustics.readthedocs.io
MIT License
1.33k stars 417 forks source link

[Question] Why ray-tracing results are inconsistent? #299

Closed z-wony closed 1 year ago

z-wony commented 1 year ago

Hi.

First of all, I'd like to make sure that it is not a complain, I just want to get an advice about it.

When I tested room simulation with hybrid approach (ISM + ray tracing), I got different result every time although every parameters and source files are same.

I tested below example. https://pyroomacoustics.readthedocs.io/en/pypi-release/pyroomacoustics.room.html#hybrid-ism-ray-tracing-simulator

room = pra.ShoeBox(
    room_dim,
    fs=16000,
    materials=pra.Material(e_absorption),
    max_order=3,
    ray_tracing=True,
    air_absorption=True,
)

If I use ISM simulator, every results are perfectly same. (It is good) But I wonder why 'ray tracing' makes inconsistent result. Could you let me advice which feature or code affects consistency? (or any hint is welcome) If I can find reason and if it is bug, I will try to fix it.

Thanks.

fakufaku commented 1 year ago

Hello @z-wony , what you are observing is actually expected! The ray-tracing is a stochastic method. If you need to have deterministic or reproducible results, you should set the seed of the random number generator.

z-wony commented 1 year ago

Thank you for answer! I understand the reason, and also tested with static seed.