title: Reading samples directly from a converted MP3 file using NAudio
body: <p>I am trying to read PCM samples from a (converted) MP3 file using NAudio, but failing as the <code>Read</code> method returns zero (indicating EOF) every time.</p>
  
  <p>Example: this piece of code, which attempts to read a single 16-bit sample, always prints "0":</p>
  
  <pre><code>using System;
  using NAudio.Wave;
  
  namespace NAudioMp3Test
  {
      class Program
      {
          static void Main(string[] args)
          {
              using (Mp3FileReader fr = new Mp3FileReader("MySong.mp3"))
              {
                  byte[] buffer = new byte[2];
                  using (WaveStream pcm = WaveFormatConversionStream.CreatePcmStream(fr))
                  {
                      using (WaveStream aligned = new BlockAlignReductionStream(pcm))
                      {
                          Console.WriteLine(aligned.WaveFormat);
                          Console.WriteLine(aligned.Read(buffer, 0, 2));
                      }
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>16 bit PCM: 44kHz 2 channels
  0
  </code></pre>
  
  <p>But this version which reads from a WAV file works fine (I used iTunes to convert the MP3 to a WAV so they should contain similar samples):</p>
  
  <pre><code>static void Main(string[] args)
  {
      using (WaveFileReader pcm = new WaveFileReader("MySong.wav"))
      {
          byte[] buffer = new byte[2];
          using (WaveStream aligned = new BlockAlignReductionStream(pcm))
          {
              Console.WriteLine(aligned.WaveFormat);
              Console.WriteLine(aligned.Read(buffer, 0, 2));
          }
      }
  }
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>16 bit PCM: 44kHz 2 channels
  2
  </code></pre>
  
  <p>What is going on here?  Both streams have the same wave formats so I would expect to be able to use the same API to read samples.  Setting the <code>Position</code> property doesn't help either.</p>