Modified from http://replaygain.hydrogenaud.io/proposal/mfiles/index.html to make it compatible with MATLAB 2016
Note: this is the original ReplayGain (1.x). The RG in foobar2000 has been updated to ver. 2.x, which is essentially ITU BS.1770 Recommendation.