Skip to content

Possible bugs in roomsim.c #3

Description

@kaimex

Hi, I have a question regarding code in roomsim.c :

		for (j=0; j<Nout; j++)
		{
			r = sqrt(1.0 - alpha[j]);
			/* r = 1.0 - alpha[j]; */
			pSimulation->logreflection        [i*Nout + j] = LOGDOMAIN(r);
			LOGLIMIT(pSimulation->logreflection        [i*Nout + j]);

			pSimulation->logabsorption        [i*Nout + j] = LOGDOMAIN(1.0 - r);
			LOGLIMIT(pSimulation->logabsorption        [i*Nout + j]);

			pSimulation->logdiffusion         [i*Nout + j] = LOGDOMAIN(d[j]);
			LOGLIMIT(pSimulation->logdiffusion         [i*Nout + j]);

			pSimulation->logspecularreflection[i*Nout + j] = LOGDOMAIN((1.0 - d[j]) * r);
			LOGLIMIT(pSimulation->logspecularreflection[i*Nout + j]);

			pSimulation->logdiffusereflection [i*Nout + j] = LOGDOMAIN(d[j] * r);
			LOGLIMIT(pSimulation->logdiffusereflection [i*Nout + j]);

			pSimulation->diffusioncoefficient [i*Nout + j] = d[j];
		}

I wonder, whether the line ending with "LOGDOMAIN(1.0-r);" is correct.
Before the initial change from r=1.0-alpha[j] to r=sqrt(1.0-alpha[j]) this was the same as LOGDOMAIN(alpha[j]).
After the change "1-r" is no longer equal to absorption, neither intensity/power-absorption nor wave-amplitude absorption.
My understanding is, that, depending on what logabsorption is meant to be (absorption of power or wave-amplitude) the right hand side should be LOGDOMAIN(alpha[j]) (for power-absorption) or 0.5*LOGDOMAIN(alpha[j]) (for wave-amplitude absorption).

2nd question: The absorption values in sampleroomsetup.m are understood as values of intensity absorption. I have not found a statement about the diffusion values. One would assume, that they describe diffusion of intensity. In the above code excerpt they are, however, used as factors for wave-amplitude reflection ((1.0-d[j]*r) and d[j]*r). So there they should be diffusion values for wave-amplitudes, not intensities. What is intended/correct ?

3rd issue: Some manufacturers of sound absorption materials specify NRC values >1. If such values are entered in the absorption specs of roomsetup.m sqrt(1-alpha) produces NaN results.

4th question: I wonder why nobody considers negative reflection values.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions