title: LAME -- decoding and encoding audio file
body: <p>I used lame for decoding from mp3 file to raw pcm file or encoding into mp3 from from raw pcm. </p>
  
  <p>The question is When I use one test.0.pcm file, doing encoding and decoding over and over again(generating 0.mp3, 1.mp3,2.mp3, ... and test.1.pcm, test.2.pcm ....), although the size of for all .pcm files or all .mp3 files remain the same, but the contents are different. I tried to listen these audio files and found that 99.mp3's volume is much less than 1.mp3.</p>
  
  <p>The script I use is like following:</p>
  
  <pre><code> #!/bin/bash
   num=$1
   last=0
   now=1
   for((i=0;i&lt;num;i++));do
       lame -r -b 64 -s 16000 -m m test.$last.pcm $last.mp3 
       lame --decode --mp3input -t -m m -s 16000 $last.mp3 test.$now.pcm 
       last=$now
       now=$[now+1]
   done
  </code></pre>
  
  <p>The original test.0.pcm has only 1 channel and sampling freq is 16k.</p>
  
  <p>Some logs are like following, they are all same except for Replay Gain:</p>
  
  <pre><code>input:  97.mp3  (16 kHz, 1 channel, MPEG-2 Layer III)
  output: test.98.pcm  (16 bit, Microsoft WAVE)
  skipping initial 1105 samples (encoder+decoder delay)
  skipping final 47 samples (encoder padding-decoder delay)
  Frame#    49/49      64 kbps
  
  Assuming raw pcm input file
  LAME 3.100 64bits (http://lame.sf.net)
  polyphase lowpass filter disabled
  Encoding test.98.pcm to 98.mp3
  Encoding as 16 kHz single-ch MPEG-2 Layer III (4x)  64 kbps qval=3
      Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA
      49/49    (100%)|    0:00/    0:00|    0:00/    0:00|   88.200x|    0:00
  ----------------------------------------------------------------------------------------------------------
     kbps       mono %     long  %
     64.0      100.0       100.0
  Writing LAME Tag...done
  ReplayGain: +46.1dB
  </code></pre>
  
  <p>Noticing ReplayGain is increasing constantly but I have no knowledge about mp3 encoding method, so I am not sure if this is the reason.</p>