Forums > MaxMSP

Formula integration

May 04 2011 | 9:50 am

Hallo together,

I want to integrate this formula in Max:

Δ L in dB = 20 × log (Distanc r2 / Distanc r1)

which object can I use to achieve the result of this calculation.

Thank you very much for your answers

May 04 2011 | 6:26 pm

I would say look into the [expr] object. Something like this probably: [expr 20 * log($f1 / $f2)]

and if you still need to calculate the distance r2 and r1: [expr sqrt((pow(($f1 – $f3),2) + pow(($f2 – $f4) ,2)))] where $f1 and $f3 are r1.x and r2.x and $f2, $f4 = r1.y and r2.y

I think that should work (none of those are tested in max), but then again, my math skills aren’t all that polished ;)

May 04 2011 | 6:34 pm

Expr will do it, but you need to use log10 instead of log (log is natural log).

Might as well use vexpr, though since if you ever need to process lists of distances, you can do all your calculations in one place…

vexpr 20.*(log10(abs($f1/$f2))) @scalarmode 1

May 05 2011 | 8:58 am

That works great, I am happy! Thank you very much.

Viewing 4 posts - 1 through 4 (of 4 total)

Forums > MaxMSP