edu.cmu.sphinx.frontend.frequencywarp
Class MelFilter
java.lang.Object
edu.cmu.sphinx.frontend.frequencywarp.MelFilter
public class MelFilter
- extends java.lang.Object
Defines a triangular mel-filter. The MelFrequencyFilterBank
creates
mel-filters and filters spectrum data using the method filterOutput
.
A mel-filter is a triangular shaped bandpass filter. When a mel-filter is constructed, the parameters
leftEdge
, rightEdge
, centerFreq
, initialFreq
, and
deltaFreq
are given to the Constructor
. The first three arguments to the constructor,
i.e. leftEdge
, rightEdge
, and centerFreq
, specify the filter's slopes. The
total area under the filter is 1. The filter is shaped as a triangle. Knowing the distance between the center
frequency and each of the edges, it is easy to compute the slopes of the two sides in the triangle - the third side
being the frequency axis. The last two arguments, initialFreq
and deltaFreq
, identify the
first frequency bin that falls inside this filter and the spacing between successive frequency bins. All frequencies
here are considered in a linear scale.
Figure 1 below shows pictorially what the other parameters mean.
Figure 1: A triangular mel-filter.
- See Also:
MelFrequencyFilterBank
Constructor Summary |
MelFilter(double leftEdge,
double centerFreq,
double rightEdge,
double initialFreq,
double deltaFreq)
Constructs a filter from the parameters. |
Method Summary |
double |
filterOutput(double[] spectrum)
Compute the output of a filter. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MelFilter
public MelFilter(double leftEdge,
double centerFreq,
double rightEdge,
double initialFreq,
double deltaFreq)
throws java.lang.IllegalArgumentException
- Constructs a filter from the parameters.
In the current implementation, the filter is a bandpass filter with a triangular shape. We're given the left and
right edges and the center frequency, so we can determine the right and left slopes, which could be not only
assymmetric but completely different. We're also given the initial frequency, which may or may not coincide with
the left edge, and the frequency step.
- Parameters:
leftEdge
- the filter's lowest passing frequencycenterFreq
- the filter's center frequencyrightEdge
- the filter's highest passing frequencyinitialFreq
- the first frequency bin in the pass banddeltaFreq
- the step in the frequency axis between frequency bins
- Throws:
java.lang.IllegalArgumentException
filterOutput
public double filterOutput(double[] spectrum)
- Compute the output of a filter. We're given a power spectrum, to which we apply the appropriate weights.
- Parameters:
spectrum
- the input power spectrum to be filtered
- Returns:
- the filtered value, in fact a weighted average of power in the frequency range of the filter pass band