Hi, all, According to the following paper, the h = r * powf (10.0f, C) / p should be correct, where p = P_s/P_{s0}, the relative pressure.
Benjamin Bernfeld, "Absorption of sound by air: a personal calculator program," J. AES, vo. 28, 1980. If anyone could share the PDF of ISO 9613-1, it will be greatly appreciated. Cheers, Junfeng On Sun, Nov 27, 2011 at 3:07 AM, Fons Adriaensen <f...@linuxaudio.org>wrote: > Hello all, > > A few days ago I posted a simple C function to calculate > sound absorption in air (reproduced below), adding that > the origin of this code was not clear. > > Joern reported that it could have been [1]. That is not > the case, in fact it was the Javascript code at [2]. > > But comparing the two, and also [3], I'm now convinced > that both [2] and my code are wrong, and that the line > > h = r * powf (10.0f, C) * p; > > should be > > h = r * powf (10.0f, C) / p; > > Which is also logical as 'h' is a concentration (in %), > so it should be the ratio of two pressures, not their > product (the factor powf(...) is a pressure), r is > a ratio in %). > > Both [1] and [3] use this form. > > [1] <http://www.sengpielaudio.com/AirdampingFormula.htm> > [2] <http://www.csgnetwork.com/atmossndabsorbcalc.html> > [3] <http://resource.npl.co.uk/acoustics/techguides/absorption/> > > If anyone has ISO 9613-1, please check ! > > Ciao, > > > > ***** WARNING: this is probably wrong, see above ***** > > // Compute air absorbtion in dB/m > // > // p pressure in Pa > // t temperature in centigrades > // r relative humidity in percent > // f frequency in Hz > // > float airabs (float p, float t, float r, float f) > { > float C, h, tr, f2, frO, frN; > > p /= 101325.0f; > t += 273.15f; > C = 4.6151f - 6.8346f * powf ((273.16f / t), 1.261f); > h = r * powf (10.0f, C) / p; > tr = t / 293.15f; > f2 = f * f; > frO = p * (24 + 4.04e4f * h * (0.02f + h)/(0.391f + h)); > frN = p * powf (tr, -0.5f) * (9 + 280 * h * exp (-4.17f * (powf (tr, > -1/3.0f) - 1))); > return 8.686f * f2 * (1.84e-11f * sqrt (tr) / p > + powf (tr, -2.5f) * ( 0.01275f * (expf (-2239.1f / t) / (frO + > f2 / frO)) > + 0.10680f * (expf (-3352.0f / t) / (frN + > f2 / frN)))); > } > > -- > FA > > Vor uns liegt ein weites Tal, die Sonne scheint - ein Glitzerstrahl. > > _______________________________________________ > Sursound mailing list > Sursound@music.vt.edu > https://mail.music.vt.edu/mailman/listinfo/sursound > -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://mail.music.vt.edu/mailman/private/sursound/attachments/20111127/6c96db1d/attachment.html> _______________________________________________ Sursound mailing list Sursound@music.vt.edu https://mail.music.vt.edu/mailman/listinfo/sursound