Wednesday, December 15, 2010

Acoustic Echo Cancellation support for Flash Player

If you ever developed a Flash application with live audio/video communication you probably ran into trouble with acoustic echo/feedback.
The flash.media.useEchoSuppression property doesn't solve the problem Flash Player had no AEC support.
Maybe you tried some workarounds but faced the requirement that the user had to use a headset for a good experience.

Please read my latest post about the current implementation of the AEC feature.

Fortunately AEC support will be part of a Flash Player version in 2011.
MicrophoneEnhancedOptions and MicrophoneEnhancedMode are not included in the current beta version of the Flash Player (10.2) but according to this Jira ticket from the Adobe Flash Player Bug and Issue Management System this feature is developed and will be part of an upcoming player version in 2011.

The code, when both speaker and microphone are used simultaneously, might look like this:

...
import flash.media.Microphone;
import flash.media.MicrophoneEnhancedMode;
import flash.media.MicrophoneEnhancedOptions;
import flash.media.SoundCodec;
...
var microphone:Microphone = Microphone.getEnhancedMicrophone(deviceIndex);
microphone.codec = SoundCodec.SPEEX;
var enhancedOptions = new MicrophoneEnhancedOptions();
enhancedOptions.mode = MicrophoneEnhancedMode.FULL_DUPLEX;
microphone.enhancedOptions = enhancedOptions;
...

Example chat room using Red5 and Adobe Cirrus aka Stratus rendezvous service, i created for a small ActionScript 3 VideoChatAPI in February 2009.
I developed it for a collaboration software of Dorian. It's using the direct RTMFP peer to peer connection feature of Flash Player 10, the 10.1 multicast feature is not suitable in this case.

4 comments:

  1. If you need a solution today, you can use the AEC that is currently available form SoliCall. SoliCall offers several producs that you can use with your flash application. For example, you can use (1) SoliCall Pro - an add-on on the client machine or (2) PBXMate/Server SDK - that runs in the network.

    ReplyDelete
  2. Hi John,

    thanks for your comment I'll take a look at this product maybe it's possible to use it with an Adobe Air application. I know that there are some solutions for AEC around. For example Adobe Connect already features server side AEC too.

    In this particular case the AEC support for Flash Player might be the best solution. Native implementation into Flash and Air applications reduces development costs because in an ideal case clients need only a single ActionScript developer - users only the Flash plugin or Air runtime.

    As described client server communication is just used for routing and user management. Once the clients are connected with each other via the Adobe Cirrus rendezvous service, audio, video and message broadcasting happens client to client.
    This takes load of the server and minimises client server traffic. It enables the possibility to run a small server instance with low cpu and memory usage. Personally i run a Java application server on a Linux instance but a simple LAMP instance would do the job too.

    Overall it reduces development and operating costs largely.

    ReplyDelete
  3. Do you know any AEC solution open source?

    ReplyDelete
    Replies
    1. Hi Vincenzo,

      You can use the open source Flex SDK and develop an application that utilizes Adobe Flash Players AEC feature with flash.media.Microphone, flash.media.MicrophoneEnhancedMode and flash.media.MicrophoneEnhancedOptions. If you are looking for a free IDE check out Powerflasher's FDT.

      Kind Regards
      Joachim

      Delete