1. For use in an audio encoder, a method of bit allocation comprising: incrementally adjusting a global gain according to a gradient, wherein the gradient is adjusted each time the number of bits used to represent a quantized value is counted.