G.711 Audio Compression for Telephony
AIR 3 includes support for the G.711
codec for audio. G.711
is actually rather old – actually formally standardized in 1972 as “Pulse Code Modulation (PCM) of voice frequencies”. There are two compression algorithm variants of G.711
, both of which can be used in AIR.
SoundCodec.PCMA Specifies the G.711 A-law codec (used in Europe and the rest of the world).
SoundCodec.PCMU Specifies the G.711 µ-law codec (used in North America and Japan).
Note
G.711
is primarily used in telephony and SIP
(Session Initiation Protocol) based applications. It is tailored specifically for voice communications and supported on innumerable systems.
We can accomplish this through use of the flash.media.SoundCodec
class within our audio project. Upon configuration of our Microphone
object, we can assign the codec property to the SoundCodec.PCMU
or SoundCodec.PCMA
constant. This will ensure that any audio from that source is processed as G.711
.
package {
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.events.SampleDataEvent;
import flash.filters.BlurFilter;
import flash.geom.Point;
import flash.media.Microphone;
import flash.media.SoundCodec; import flash.text.TextField; import flash.text.TextFormat; import flash.utils.ByteArray; [SWF(width="600", height="500", backgroundColor="#CCCCCC")] public class G711Telephony extends Sprite { private const SPECTRUM_COLOR:uint = 0x24ff00; private var traceField:TextField; private ...
Get What's New in Adobe AIR 3 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.