Audio::MFCC - Perl module for computing mel-frequency cepstral coefficients
use Audio::MFCC; my $fe = Audio::MFCC->init(\%params) $fe->start_utt; my @ceps = $fe->process_utt($rawdata, $nsamps); my $leftover = $fe->end_utt;
This module provides an interface to the Sphinx-II feature extraction library which can be used to extract mel-frequency cepstral coefficients from data. These coefficients can then be passed to the
You might find this useful if, for example, you wish to do the actual recognition on a different machine from the audio capture, and don't have the bandwidth to send a full stream of audio data over the network.
Currently, Sphinx-II also uses delta and double-delta cepstral vectors as input to its vector quantization module, but the calculation of these values is done inside the recognizer's utterance processing module.. In the future it may be possible to move the extraction of these features into the feature extraction library, or to use entirely different features as input (for example, LPC coefficients, though currently, mel-scale cepstra give the best recognition performance).
my $fe = Audio::MFCC->init(\%params);
Initializes parameters for feature extraction, and return an object which encapsulates the state of the extraction process.
The parameters are passed as a reference to a hash of parameter names keyed to parameter values. Available parameters include:
Sampling rate at which the audio data to be processed was captured, specified in samples per second.
Number of frames of data to be processed per second of sampled audio.
Size of the FFT window, in number of samples.
Number of cepstral coefficients to compute.
Number of filters to use for creating the mel-scale.
Frame size for FFT analysis (must be a power of 2).
Low end of filter band.
High end of filter band.
Scaling factor for pre-emphasis of input audio data.
This is documented for completeness, but you should never use it. It specifies the type of filter band to use in extraction - the options are (exportable constants) MEL_SCALE and LOG_LINEAR, but only MEL_SCALE is supported.
$fe->start_utt or die "start_utt failed";
$feobject for cepstral extraction. If it fails (though I don't know why it would), it will return
my @cepvectors = $fe->process_utt($rawdata, $nsamps);
Performs cepstral extraction on
$nsampssamples of audio data from
$rawdata. If any data is left over (under one frame), it will be carried over to the next call to
process_utt, or analyzed and returned by
Note that the audio data is currently always represented as a vector of 16-bit signed integers in native byte order.
Returns a list of array references, each of which points to the vector of cepstral coefficients extracted from one frame of data.
my $leftover = $fe->end_utt;
Finishes the processing of utterance data. If there is any extra data remaining to be processed, it will be padded with zeroes to a single frame and cepstral extraction will be done, with the resulting vector returned (as an array reference). Otherwise, a false value is returned.
David Huggins-Daines <firstname.lastname@example.org>