none
Echo cancellation in C# and Waveform Audio Interface RRS feed

  • Question

  • Hi,

    First of all I apologyze if it si not the correct forum to ask this.

    I've developed a VoIP application in C# .NET 3.5 that captures microphone audio using Waveform Audio Interface (http://msdn.microsoft.com/en-us/library/aa446573.aspx) and sends it over UDP. At the same time, the applications recevieces UDP packages and plays them.

    It works fine when the peer are using earphones, but when they use PC speakers, the audio feedback appears (http://msdn.microsoft.com/en-us/library/aa446573.aspx).

    I am looking for a solution and afeter a couple hours and I feel very lost. I've readed about AEC filters and some driver-related KSCATEGORY_ACOUSTIC_ECHO_CANCEL (http://msdn.microsoft.com/en-us/library/ff548253(VS.85).aspxhttp://msdn.microsoft.com/en-us/library/ff536379(VS.85).aspx) that should do the trick, but I am unable to understand how to implement it.

    I leave here some code in order to help you understand how I have implemented the audio-related code:

     

     

    WaveIn Recorder = new WaveIn(recorder, 8000, 16, 1, 400);
    Recorder.BufferFull += Recorder_BufferFull;
    [...]
     public delegate void SoundRecordedEventHandler(byte[] voice_chunk);
     public event SoundRecordedEventHandler SoundRecorded;
    
     private void Recorder_BufferFull(byte[] data)
     {
      // The playable data
      byte[] result = new byte[0];
      result = new byte[data.Length];
      data.CopyTo(result, 0);
    
      // Notify recorded sound
      if (SoundRecorded != null) SoundRecorded(result);
     }
    
    [...]
    
    WaveOut Player = new WaveOut(speaker, 8000, 16, 1);
    [...]
     public void Play(byte[] data)
     {
      // The playable data
      byte[] result = new byte[0];
      result = new byte[data.Length];
      data.CopyTo(result, 0);
    
      // Play data
      Player.Play(result, 0, result.Length);
     }
    
    

     

    I dont know if it is possble to do it with Waveform Audio Interface, any help, suggestion or idea will be appreciated.

     

    Thanks.

     

    Wednesday, December 15, 2010 4:23 PM

All replies