Log energy calculation
First of all, the amplitude of a signal is expressed in arbitrary units, so there is no "right" answer. It's unlikely you'll be able to compute an absolute acoustic energy value - this depends on the gains of the recording chain, and the characteristics of the transducers.

Some audio analysis/feature extraction software consider that the full scale of the input audio signal is [-32768, 32767] (due to the predominance of the 16-bit format), some other implementation expect their input to be in the [-1.0, 1.0] range. Matlab's wavread function can return both formats when reading data, with the 'double' or 'native' argument.

I suspect the multiplication by 32767 in your code is simply there to keep the output consistent with a reference implementation of the algorithm which expected data to be in the [-32768, 32767] range, or maybe to keep the results consistent with a previous version of the software that used an input signal with the 'native' instead of 'double' scale.