Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gpuRIR.beta_SabineEstimation is not consistent with RIR-Generator #18

Closed
quancs opened this issue May 5, 2021 · 4 comments
Closed

gpuRIR.beta_SabineEstimation is not consistent with RIR-Generator #18

quancs opened this issue May 5, 2021 · 4 comments

Comments

@quancs
Copy link

quancs commented May 5, 2021

For room_sz = [6.98986182, 7.65234006, 3.58826744], RT60 = 0.14357507, RIR-Generator returns

"Error: The reflection coefficients cannot be calculated using the current room parameters, i.e. room size and reverberation time.
Please specify the reflection coefficients or change the room parameters."

While, gpuRIR.beta_SabineEstimation(room_sz, RT60) returns [0., 0., 0., 0., 0., 0.].

I don't know if gpuRIR.beta_SabineEstimation gave the right results, or [0., 0., 0., 0., 0., 0.] is a sign of error.

Code of matlab for testing RIR-Generator:

c = 340;                    % Sound velocity (m/s)
fs = 16000;                 % Sample frequency (samples/s)
r = [5.30233645, 3.80691334, 1.7705954];              % Receiver position [x y z] (m)
s = [2.93155193, 6.25306989, 0.86049909];              % Source position [x y z] (m)
L = [6.98986182, 7.65234006, 3.58826744];                % Room dimensions [x y z] (m)

beta = 0.14357507;                 % Reverberation time (s)
n = 4096;                   % Number of samples

h = rir_generator(c, fs, r, s, L, beta, n);
@DavidDiazGuerra
Copy link
Owner

DavidDiazGuerra commented May 5, 2021

Hello,

The issue is due to the Sabine formula that both gpuRIR and RIR-Generator use to predict the RT60 from the room sizes and its reflection coefficients. According to this equation, the lowest RT60 that a room with room_sz = [6.98986182, 7.65234006, 3.58826744] can have would be 0.14571999028149607 seconds (with fully absorbent walls). That's obviously not true since a room with fully absorbent walls would be an anechoic chamber no matter its size, but the Sabine formula is not really accurate for so absorbent walls.

Since you're asking an RT60 lower than that minimum, RIR-Generator answers you that the reflection coefficients cannot be computed and gpuRIR returns the closest solution according to the Sabine formula, which is having fully absorbent walls.

I would suggest you decrease your room size or increase the RT60 since it is probably not a very realistic scenario, but if you really need to simulate such a room, you could use gpuRIR using custom reflection coefficients (instead of using gpuRIR.beta_SabineEstimation(room_sz, RT60)) and try to find those that approximate your desired RT60, which I guess would be quite low but not just 0.

Best regards,
David

@quancs
Copy link
Author

quancs commented May 5, 2021

David

Thank you David.

May you give a criteria to check if I'm asking an RT60 lower than the minimum?

Like when beta_SabineEstimation returns an array containing more than one zero?

@quancs
Copy link
Author

quancs commented May 5, 2021

Maybe it would be better to raise an exception than giving the closest solution in this situation?

@DavidDiazGuerra
Copy link
Owner

May you give a criteria to check if I'm asking an RT60 lower than the minimum?

As explained in the paper, the Sabine formula is:

where $V$ is the volume of the room and $S_i$ and $\alpha_i=1-\beta_i^2$ are the surface area and the absorption coefficient of each wall.

You could use $\alpha_i=1$ to check what is the RT60 that the Sabine formula estimates for an anechoic chamber with that size.

Like when beta_SabineEstimation returns an array containing more than one zero?

I would say that, when the requested RT60 is under that minimum, all the elements in the array will be 0, but I'm not 100% sure of that.

Maybe it would be better to raise an exception than giving the closest solution in this situation?

I'm not sure of this since it might suggest that being slightly under that minimum is much less accurate than being slightly over it, when it is not. The function beta_SabineEstimation is an estimation and should be used carefully (that's why I named it like that instead of just get_beta).

@quancs quancs closed this as completed Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants