Thanks for opening my eyes to the fact that MASTER_GAIN works on decibels (dB).
After reading your post I looked more into depth on this control and found the Java Class Specification for the class FloatControl.Type (http://java.sun.com/j2se/1.4.2/docs/api/javax/sound/sampled/FloatControl.Type.html) where it describes what each of the controls mean.
Besides the fact that the GAIN is in dB, it also states that it follows a logarithmic curve.
It gives a conversion function, from a linear value [0, 2] to the GAIN range [-80, 6].
This two ranges are rounded to natural numbers. The real GAIN range is [-80, 6.0206] and the conversion function is:
linearValue = pow(10.0, gainDB/20.0) ..(I)
and if I inverted I get:
gainDB = 20*Log(linearValue) ..(II)
So, to make this more easy for us I created a conversion method, where as input I give the percentage value, that is, from [0, 100] and the value should an integer, then I also set the min and max values of the Gain control (see III) and with some magic (scale equivalence and applying the conversion function I) I get a value in dB.
The method is something like this:
private static float getVolumeIndB(int linearValue, float minGainValue, float maxGainValue) .. (III)
So if I set 100 as the linear value I will get the value 6.0206 which will be the loudest sound and if I set 0 I will get no sound at all and the dB value from the method III will be -80.
ESSAY
I've read the document you sent me, mostly it is ok although seems that some parts should be not in the introduction but somewhere else; I will reserve my comments for now, but I would like to read your new version and if possible also send me the editable files so if I need to change something I can do so.
Thanks
ps. I will make sure by tomorrow we get the SVN working from the Internet and not only in the internal LAN. Sorry for that delay.
CORPUS
I will now continue with the corpus, will send it or uploaded to the SVN as soon as I am done.
;)
No comments:
Post a Comment