You can calculate log10(val) by log(val)/log(10). Since log is relatively slow, you might want to store the log(10) value.

You could store k = 20.0 / log(10) as your constant and then your function would just return k * log(val).

I hope that helps.

Cheers,
  Malcolm

On Jun 5, 2006, at 10:05 AM, Aleksi Strandberg wrote:

Hi,

I'm working with FMOD sound engine.
I would need to convert spectrum data to dB.

In the FMOD docs there is this formula:
Decibels = 10.0f * (float)log10(val) * 2.0f

Do you know how this can be done in REALbasic?



Regards,
Aleksi
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to