Hi,
Why are you using a lookup table and not just a log10(x) and 10^(x) for the gain <-> dB conversions? That's how it should be done I think like 10x corresponding to 20dB (assuming signal gain). In your tests it is just: 2000*log10(gain) - 9630 for going to that dB-like scale.
Regards, Roderick
Roderick Colenbrander wrote:
Hi,
Why are you using a lookup table and not just a log10(x) and 10^(x) for the gain <-> dB conversions? That's how it should be done I think like 10x corresponding to 20dB (assuming signal gain). In your tests it is just: 2000*log10(gain) - 9630 for going to that dB-like scale.
Regards, Roderick
That was the only way to get the exact same results as a native dll. For whatever reason Microsoft decided not to use the standard equations like the rest of the world. I assume it was to eliminate the need for floating point calculations. Actually you could use the same equation that the generated the table to go from dB to amp but you can't use an equation to go the other way around because of the weird roundoff errors that result from using a lookup table.
Robert Reif reif@earthlink.net writes:
For whatever reason Microsoft decided not to use the standard equations like the rest of the world. I assume it was to eliminate the need for floating point calculations. Actually you could use the same equation that the generated the table to go from dB to amp but you can't use an equation to go the other way around because of the weird roundoff errors that result from using a lookup table.
Yes, but does that really make a difference for real apps? Do we really need to duplicate the roundoff errors?