April 29, 2009 | 1:35 pm

hello,

I am trying to implement an equation that calculates the sound pressure level in my patch, using the js object.

The problem is that it is not working, it doesn’t look like it is receiving correctly the information.

here is the code:

inlets = 5;

function calculate(D, rho, c, N, r){

var dbs = Math.round(20 * Math.LOG10E * Math.log(Math.pow((D * rho * c * N / (4 * Math.PI * r * r)),0.5)/0.00002));

outlet(0, dbs);

}

function msg_float(v)

{

if (jsarguments.length>5){

var D = jsarguments[0];

var rho = jsarguments[1];

var c = jsarguments[2];

var N = jsarguments[3];

var r = jsarguments[4];

}

calculate(D, rho, c, N, r);

}

It receives 5 variables:

rho – air density (kg/m3)

c – sound velocity (m/s)

N – sound power (W)

r – distance from source (m)

D – directivity coefficient

and gives me the SPL in dB as a result.

Thank you