title: LameMP3FileWriter: Unsupported encoding format MuLaw Parameter name: format
body: <p>Trying to convert a 12 year old wav file to mp3,</p>
  
  <p>8K, 8bit, Mono-channel, Mu-Law format, WAV</p>
  
  <p>and I am getting this error in LameMP3FileWriter line:</p>
  
  <p><strong>LameMP3FileWriter: Unsupported encoding format MuLaw Parameter name: format</strong></p>
  
  <pre><code>static void Main(string[] args)
  {
      string wavFilePath = @"C:\temp\Message.wav";
      string mp3FilePath = @"C:\temp\Message.mp3";
      if (!File.Exists(mp3FilePath))
      {
          byte[] bytearrwav = File.ReadAllBytes(wavFilePath);
          byte[] bytearrmp3 = ConvertWavToMp3(bytearrwav);
          File.WriteAllBytes(mp3FilePath, bytearrmp3);
      }
  }
  
  public static byte[] ConvertWavToMp3(byte[] wavFile)
  {
      try
      {
          using (var retMs = new MemoryStream())
          using (var ms = new MemoryStream(wavFile))
          using (var rdr = new WaveFileReader(ms))
          using (var wtr = new LameMP3FileWriter(retMs, rdr.WaveFormat, 128))
          {
              rdr.CopyTo(wtr);
              return retMs.ToArray();
          }
      }
      catch (Exception ex)
      {
          Console.WriteLine(ex.Message);
          return null;
      }
  }
  </code></pre>
  
  <p>Could anyone show me how to convert this type of wav to mp3?</p>