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

WasapiLoopbackCapture on window XP

Nov 7, 2013 at 12:55 PM
I am capture audio data with the help of WasapiLoopbackCapture (naudio) and writing it to mp3 file . its working fine on window 7 and window 8. but on window XP its showing error . I read WasapiLoopbackCapture not working on window XP . could you pls help me how do I capture audio on window XP with the help of WasapiLoopbackCapture.

Here is my code:-
 static LameMP3FileWriter wri;
    static bool stopped = false;
    public void wavtomp3()

        // Start recording from loopback
        IWaveIn waveIn = new WasapiLoopbackCapture();
        MessageBox.Show("Sample Rate="+waveIn.WaveFormat.SampleRate.ToString());

           wri = new LameMP3FileWriter(@"e:\test.mp3", waveIn.WaveFormat, 44);

        waveIn.DataAvailable += waveIn_DataAvailable;
        waveIn.RecordingStopped += waveIn_RecordingStopped;

static void waveIn_DataAvailable(object sender, WaveInEventArgs e)
        if (wri != null)

            if (e.BytesRecorded == 0)
                wri.Write(e.Buffer, 0,12800);
                Debug.WriteLine("Adding Silence To File No Sound is playing");
            else if(e.BytesRecorded > 0)
                wri.Write(e.Buffer, 0, e.BytesRecorded);
                Debug.WriteLine("Sound Playing From Sound Card and recording");

        Debug.WriteLine("bytes record="+e.BytesRecorded);        
Nov 7, 2013 at 9:22 PM
WASAPI is a new audio API introduced in Windows Vista. It is not possible to make it work in Windows XP unfortunately.
Nov 8, 2013 at 3:32 AM
Hi markheath
is there any way to capture speaker audio in XP.
Nov 8, 2013 at 7:25 AM
Not easily. Some soundcards offer a "What you hear" input, although it can be very tricky with the mixer api to find and that input.
The other option is to go with a virtual sound card driver