Packageefnx.sound
Classpublic class Waveform
InheritanceWaveform Inheritance flash.display.Bitmap

Waveform takes a loaded sound object [mp3] from which it constructs a plottable waveform. The waveform can be analyzed using two methods: Max, which calculates the absolute max value for each window or RMS, which calculates the root mean square of all values in each window. RMS is typically about 4 milliseconds faster per window than Max. Further more Waveform attepts to be as smart as possible, by analyzing the maximum number of windows to calculate per frame. In order to do this correctly, you must tell Waveform what your target framerate is with frameRate or Waveform wil assume it to be 16, which is a good comprimise between speed and functionality [as when flash is chugging on values, you don't get much mouse/keyboard input, but with a higher frame rate less windows are calculated per frame, taking longer to analyze the sound].



Public Properties
 PropertyDefined by
  frameRate : Number
Waveform
  leftChannel : Vector
[read-only] Returns the current block of plottable data from the left channel.
Waveform
  leftSample : uint
Waveform
  numWindows : uint
Waveform
  rightChannel : Vector
[read-only] Returns the current block of plottable data from the right channel.
Waveform
  rightSample : uint
Waveform
  sound : Sound
Waveform
  windowSize : uint
[read-only] The size of each window in samples.
Waveform
Public Methods
 MethodDefined by
  
Creates a new instance of Waveform.
Waveform
  
cancel():void
Stops all analyzation.
Waveform
  
createWaveform(method:String = "rms"):void
Constructs two vectors of analyzed waveforms using the method supplied in "method".
Waveform
Events
 EventSummaryDefined by
   A complete event is dispatched when Waveform has completed analyzing all windows.Waveform
   A progress event is dispatched whenever a chunk of windows has been analyzed [usually each frame].Waveform
Public Constants
 ConstantDefined by
  SAMPLERATE : uint = 44100
[static] Flash's sampling frequency.
Waveform
Property detail
frameRateproperty
frameRate:Number  [read-write]Implementation
    public function get frameRate():Number
    public function set frameRate(value:Number):void
leftChannelproperty 
leftChannel:Vector  [read-only]

Returns the current block of plottable data from the left channel. The size of the returned vector is the number of windows analyzed. Typically this data would be accessed on an "as analyzed" basis through

Implementation
    public function get leftChannel():Vector

See also

which is a vector containing the windows analyzed most recently [last frame].
leftSampleproperty 
leftSample:uint  [read-write]Implementation
    public function get leftSample():uint
    public function set leftSample(value:uint):void
numWindowsproperty 
numWindows:uint  [read-write]Implementation
    public function get numWindows():uint
    public function set numWindows(value:uint):void
rightChannelproperty 
rightChannel:Vector  [read-only]

Returns the current block of plottable data from the right channel. The size of the returned vector is the number of windows analyzed. Typically this data would be accessed on an "as analyzed" basis through

Implementation
    public function get rightChannel():Vector

See also

which is a vector containing the windows analyzed most recently [last frame].
rightSampleproperty 
rightSample:uint  [read-write]Implementation
    public function get rightSample():uint
    public function set rightSample(value:uint):void
soundproperty 
sound:Sound  [read-write]Implementation
    public function get sound():Sound
    public function set sound(value:Sound):void
windowSizeproperty 
windowSize:uint  [read-only]

The size of each window in samples.

Implementation
    public function get windowSize():uint
Constructor detail
Waveform()constructor
public function Waveform()

Creates a new instance of Waveform.

Method detail
cancel()method
public function cancel():void

Stops all analyzation.

createWaveform()method 
public function createWaveform(method:String = "rms"):void

Constructs two vectors of analyzed waveforms using the method supplied in "method". The vectors will consist of plottable points [0 to 1] representing the left and right channels. Every value in each vector represents all sound data in a given window.

Parameters
method:String (default = "rms") — Determines the method of analyzation. Valid methods are max and rms.
Event detail
completeevent 
Event object type: efnx.events.WaveformEvent

A complete event is dispatched when Waveform has completed analyzing all windows.

progressevent  
Event object type: efnx.events.WaveformEvent

A progress event is dispatched whenever a chunk of windows has been analyzed [usually each frame].

Constant detail
SAMPLERATEconstant
public static const SAMPLERATE:uint = 44100

Flash's sampling frequency.