edu.cmu.sphinx.frontend.window
Class RaisedCosineWindower

java.lang.Object
  extended byedu.cmu.sphinx.frontend.BaseDataProcessor
      extended byedu.cmu.sphinx.frontend.window.RaisedCosineWindower
All Implemented Interfaces:
Configurable, DataProcessor

public class RaisedCosineWindower
extends BaseDataProcessor

Slices up a Data object into a number of overlapping windows (usually refered to as "frames" in the speech world). In order to minimize the signal discontinuities at the boundaries of each frame, we multiply each frame with a raised cosine windowing function. Moreover, the system uses overlapping windows to capture information that may occur at the window boundaries. These events would not be well represented if the windows were juxtaposed.

The number of resulting windows depends on the window size and the window shift (commonly known as frame shift in speech world). Figure 1 shows the relationship between the original data stream, the window size, the window shift, and the windows returned.


Figure 1: Relationship between original data, window size, window shift, and the windows returned.

The raised cosine windowing function will be applied to each such window. Since the getData() method returns a window, and multiple windows are created for each Data object, this is a 1-to-many processor. Also note that the returned windows should have the same number of data points as the windowing function.

The applied windowing function, W(n), of length N (the window size), is given by the following formula:

 W(n) = (1-a) - (a * cos((2 * Math.PI * n)/(N - 1)))
 
where a is commonly known as the "alpha" value. This variable can be set by the user using the property defined by PROP_ALPHA, which has a default value of PROP_ALPHA_DEFAULT. Please follow the links to the see the constant field values. Some values of alpha receive special names, since they are used so often. A value of 0.46 for the alpha results in a window named Hamming window. A value of 0.5 results in the Hanning window. And a value of 0 results in the Rectangular window. The default for this system is the Hamming window, with alpha 0.46 (but check the value in PROP_ALPHA_DEFAULT!). Figure 2 below shows the Hamming window function (a = 0.46), using our default window size of 25.625 ms and assuming a sample rate of 16kHz, thus yielding 410 samples per window.


Figure 2: The Hamming window function.

See Also:
Data

Field Summary
static java.lang.String PROP_ALPHA
          The name of the SphinxProperty for the alpha value of the Window, which has a default value of 0.46 (double), which is the value for the RaisedCosineWindow.
static double PROP_ALPHA_DEFAULT
          The default value for PROP_ALPHA.
static java.lang.String PROP_WINDOW_SHIFT_MS
          The SphinxProperty name for window shift in milliseconds, which has a default value of 10F.
static float PROP_WINDOW_SHIFT_MS_DEFAULT
          The default value for PROP_WINDOW_SHIFT_MS.
static java.lang.String PROP_WINDOW_SIZE_MS
          The SphinxProperty name for window size in milliseconds.
static float PROP_WINDOW_SIZE_MS_DEFAULT
          The default value for PROP_WINDOW_SIZE_MS.
 
Constructor Summary
RaisedCosineWindower()
           
 
Method Summary
 Data getData()
          Returns the next Data object, which is usually a window of the input Data, with the windowing function applied to it.
 void initialize()
          Initializes this DataProcessor.
 void newProperties(PropertySheet ps)
          This method is called when this configurable component has new data.
 void register(java.lang.String name, Registry registry)
          Register my properties.
 
Methods inherited from class edu.cmu.sphinx.frontend.BaseDataProcessor
getName, getPredecessor, getTimer, setPredecessor, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROP_WINDOW_SIZE_MS

public static final java.lang.String PROP_WINDOW_SIZE_MS
The SphinxProperty name for window size in milliseconds.

See Also:
Constant Field Values

PROP_WINDOW_SIZE_MS_DEFAULT

public static final float PROP_WINDOW_SIZE_MS_DEFAULT
The default value for PROP_WINDOW_SIZE_MS.

See Also:
Constant Field Values

PROP_WINDOW_SHIFT_MS

public static final java.lang.String PROP_WINDOW_SHIFT_MS
The SphinxProperty name for window shift in milliseconds, which has a default value of 10F.

See Also:
Constant Field Values

PROP_WINDOW_SHIFT_MS_DEFAULT

public static final float PROP_WINDOW_SHIFT_MS_DEFAULT
The default value for PROP_WINDOW_SHIFT_MS.

See Also:
Constant Field Values

PROP_ALPHA

public static final java.lang.String PROP_ALPHA
The name of the SphinxProperty for the alpha value of the Window, which has a default value of 0.46 (double), which is the value for the RaisedCosineWindow.

See Also:
Constant Field Values

PROP_ALPHA_DEFAULT

public static final double PROP_ALPHA_DEFAULT
The default value for PROP_ALPHA.

See Also:
Constant Field Values
Constructor Detail

RaisedCosineWindower

public RaisedCosineWindower()
Method Detail

register

public void register(java.lang.String name,
                     Registry registry)
              throws PropertyException
Description copied from interface: Configurable
Register my properties. This method is called once early in the time of the component, shortly after the component is constructed. This component should register any configuration properties that it needs to register. If this configurable extends another configurable, super.register should also be called

Specified by:
register in interface Configurable
Overrides:
register in class BaseDataProcessor
Throws:
PropertyException

newProperties

public void newProperties(PropertySheet ps)
                   throws PropertyException
Description copied from interface: Configurable
This method is called when this configurable component has new data. The component should first validate the data. If it is bad the component should return false. If the data is good, the component should record the the data internally and return true.

Specified by:
newProperties in interface Configurable
Overrides:
newProperties in class BaseDataProcessor
Throws:
PropertyException

initialize

public void initialize()
Description copied from class: BaseDataProcessor
Initializes this DataProcessor. This is typically called after the DataProcessor has been configured.

Specified by:
initialize in interface DataProcessor
Overrides:
initialize in class BaseDataProcessor

getData

public Data getData()
             throws DataProcessingException
Returns the next Data object, which is usually a window of the input Data, with the windowing function applied to it.

Specified by:
getData in interface DataProcessor
Specified by:
getData in class BaseDataProcessor
Returns:
the next available Data object, returns null if no Data object is available
Throws:
DataProcessingException - if a data processing error occurred
See Also:
Data