I am calculating a dBFS value from a 16-bit wave file sample (-32768 to +32767) using c# as follows:
int sampleValue = -32700;
double dBFSvalue = 20 * Math.Log10(Math.Abs(sampleValue) / 32768);
But when I try to print the dBFS value, a sampleValue of 32768 results in "0" as it should, but any other value of sampleValue results in "-infinity".
MessageBox.Show($"Result: {dBFSvalue}dBFS");
Is this something to do with the displaying of type Double? How should I convert the number to display it properly in the form of "-60.5 dBFS"?
Thanks.