This project has moved. For the latest updates, please go here.

Record to mp3?

May 11 at 8:28 PM
Hello

I'm new to naudio and I want to use it for recording audio as mp3 but so far I found only examples with wav files.

So far I have:
m_WaveSource = new WaveIn();
            m_WaveSource.WaveFormat = new WaveFormat(44100, 1);

            m_WaveSource.DataAvailable += new EventHandler<WaveInEventArgs>(DataAvailable);
            m_WaveSource.RecordingStopped += new EventHandler<StoppedEventArgs>(RecordingStopped);

            m_WaveFile = new WaveFileWriter(strFile, m_WaveSource.WaveFormat);

            m_WaveSource.StartRecording();
 void DataAvailable(object sender, WaveInEventArgs e)
        {
            if (m_WaveFile != null)
            {
                m_WaveFile.Write(e.Buffer, 0, e.BytesRecorded);
                m_WaveFile.Flush();
            }
        }
What do I have to change for getting a mp3 file?
May 12 at 5:58 PM
Dude, how about asking google before posting?? As answered 1000 ppl before NAudio does NOT include an MP3 encoder.

You can try the NAudio MediafoundationEncoder class, which depends on your OS, or Lame.