Decibels are an interesting beast. Decibels are not really a measure of volume, in and of themselves - they are an indicator of gain or attention, as described in http://en.wikipedia.org/wiki/Decibel . The number of decibels is ten times the logarithm to the base 10 of the ratio of the two power values.
You can get decibels from one critical place in the web audio API - RealtimeAnalyser getFloatFrequencyData returns a floating-point array of decay per decibel. This is not a technical volume, but it is a damping from unity (1), which would be a sine wave at this frequency at full volume (from -1 to 1).
Gain controls, of course, are usually expressed in decibels, because they are a measure of the relationship between the unit and any of your volume controls. Think of unity (0 dB, gain = 1) as "loud as your speakers will go."
To express the gain in decibels, remember that a gain of 1 (without attenuation, without gain) will be 0 decibels - because 10 ^ 0 = 1. (In fact, this is because 10 ^ (0/10) = 1. Obviously that zero divided by anything is still zero, but remember that these are DECI-bels, there are ten factors there.) In the aforementioned Wikipedia article, this is explained with a large proportion.
To convert between two - for example, set the gain value. If you have decibels and get the decibel gain from gain.value - you just need to use the formula
decibel_level = 20 * log10( gain.value );
aka
gain.value = Math.pow(10, (decibel_level / 20));
Please note that the 10 log base is a bit more complicated in Javascript due to access only to the natural logarithm and not to the base 10 logarithm, but you can get it through
function log10(x) { return Math.log(x)/Math.LN10; }
(There is a Math.log10 () method there, but it is experimental and not implemented in all browsers.)