This project has moved and is read-only. For the latest updates, please go here.

MIC stop working of USB headphone when capture speaker audio.

Dec 26, 2013 at 4:59 PM
Hi
I have Logitech USB headset H340 and I capture speaker audio coming to this device with the help of WasapiLoopbackCapture. But problem occur its MIC stop working after some time when we start capturing speaker audio. its sample rate is 44100 but the older usb headphone have 32000 which is working fine with same code.
Any help..
Thanks
Dec 31, 2013 at 2:18 PM
Loopback capture must be at the sample rate the system is using, not the device.
Jan 2, 2014 at 10:10 AM
Hi Mark

Loopback capture is at same sample rate with device but still its stop , I check it with diff settings but no success in final file audio is loopback . what should I do .

Thanks
Jan 3, 2014 at 7:15 PM
It may be a driver issue. Normally there should not be a problem with recording while you also capture with loopback. Can you post a short snippet of code that reproduces the issue?
Jan 6, 2014 at 7:03 AM
Hi mark
Here is my code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using NAudio.CoreAudioApi;
using NAudio.Lame;
using NAudio.Wave;
using System.IO;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            wavtomp3();

        }
        static LameMP3FileWriter wri;
        static bool stopped = false;
        private WaveFileWriter writer;
        public void wavtomp3()
        {


            // Start recording from loopback
            IWaveIn waveIn = new WasapiLoopbackCapture();
            //  int bitrate = System.Convert.ToInt32(textBox2.Text);
            
            MessageBox.Show("BitsPerSample=" + waveIn.WaveFormat.ToString());
            MessageBox.Show("Sample Rtae=" + waveIn.WaveFormat.SampleRate.ToString());
            MessageBox.Show("Channels=" + waveIn.WaveFormat.Channels.ToString());
            MessageBox.Show("BitsPerSample=" + waveIn.WaveFormat.BitsPerSample.ToString());
           
           wri = new LameMP3FileWriter(@"E:\128bits.mp3", waveIn.WaveFormat,LAMEPreset.ABR_128);
             


                      waveIn.DataAvailable += waveIn_DataAvailable;
            waveIn.RecordingStopped += waveIn_RecordingStopped;
            waveIn.StartRecording();
           // stopped = false;



            
                    }

        static void waveIn_RecordingStopped(object sender, StoppedEventArgs e)
        {
            stopped = true;
        }

        static void waveIn_DataAvailable(object sender, WaveInEventArgs e)
        {
            if (wri != null)
                          wri.Write(e.Buffer, 0, e.BytesRecorded);
         }



       
        }


            }
}
Jan 9, 2014 at 11:55 AM
in what way does the mic stop working? You are not recording from the microphone in this code sample.
Jan 9, 2014 at 12:22 PM
Hi mark
yes I am not recording MIC , but headphone mic stop working on other application like if you use MIC on skypee then its stop working.