views:

642

answers:

4

I just tried the below code, and it works fine to reduce the echo on head phones. But the problem of echo remains as it is in case of speakers.

  public var intCountMilliSec:int = 0;
  public var intLastActivityLevel:int = 0;

  public var intLastLowestActivityLevel:int = 100;//07-Dec-09

  private function CancelEcho(e:TimerEvent):void
  {
      intCountMilliSec = intCountMilliSec + 50;
      if (Red5OutgoingMic.activityLevel > intLastActivityLevel)
      {
          intLastActivityLevel = Red5OutgoingMic.activityLevel;
      }

      if (Red5OutgoingMic.activityLevel < intLastLowestActivityLevel)
      {
          intLastLowestActivityLevel = Red5OutgoingMic.activityLevel;
      }

      if (intCountMilliSec >= 1500)
      {
          if (intLastActivityLevel > 20)
          {
              Red5OutgoingMic.gain *= 0.8; 
          }
          if (intLastLowestActivityLevel < 20)
          {
              if (Red5OutgoingMic.gain <= 30)
              {
                  Red5OutgoingMic.gain = Red5OutgoingMic.gain/0.8;
              }
          }

          intCountMilliSec = 0;
          intLastActivityLevel = 0;

          intLastLowestActivityLevel = 0;
      }
  }

Any immediate help is appreciated.

A: 

what your experiencing is called feedback, its a hardware issue, the microphone picks up the sound emmitting from the speakers and plays it back again through the speakers.

Typically it comes out as a squeal but with the delay of over ip it can just recycle the sound. This is a common problem.

Headphones are a common solution. Another solution is to move your audio output away from your audio input: i.e. move the speakers away from the microphone.

See: http://en.wikipedia.org/wiki/Audio%5Ffeedback

JERiv
Hi JERiv,Thanks for your immediate response.Actually, I tried by moving the speakers away from the microphone. But the problem still remains. I just want to be sure if any code modification will be helpful or it is just resolvable at hardware level?Thanks,Amit.
Amit
A: 

I just want to be sure if any code modification will be helpful or it is just resolvable at hardware level?

Thanks,

Amit.

Amit
A: 

The solution you're looking for is called echo cancellation. Unfortunately today there are only two options:

1) do the echo cancelling in Flash. Adobe has the ability to do this embedded in flash, but unfortunately they only allow it to be used when running against Adobe Connect's conferencing server. Lame, but true.

2) your other option is to decode the audio from all participants in a server, mix the audio there, and remove echo using an echo cancelling library. An example of a C library that does this is spandsp, but this requires a lot of extra code, and a media server that can decode from Flash. The Red5 open-source server can receive audio and video from Flash, and you can use the Xuggle library to decode the audio into raw audio. Removing the echo though would require integration with the right echo canelling library.

In short, unless Adobe decides to actually enable echo-canelling in Flash for non-Adobe-proprietary apps, you're left with a hard road to fix the issue (i.e. there is no way to fix this from ActionScript today).

Hope that helps.

  • Art
Xuggle
Similar question here: http://stackoverflow.com/questions/592058/voice-echo-problem/592161#592161
Mondain
A: 

Art,

So looking at your suggestion #1. Does this mean the the flash based echo cancellation will work for Flash Media Server? FMS is not Adobe Connect, but it is an Adobe product. Thanks.

rash
As far as I know, it'll only work with Adobe Connect.
Xuggle