/* ==================================================================== * Copyright (c) 1999-2001 Carnegie Mellon University. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ==================================================================== * */ #ifndef _NEW_FE_H_ #define _NEW_FE_H_ typedef struct{ float32 SAMPLING_RATE; int32 FRAME_RATE; float32 WINDOW_LENGTH; int32 FB_TYPE; int32 NUM_CEPSTRA; int32 NUM_FILTERS; int32 FFT_SIZE; float32 LOWER_FILT_FREQ; float32 UPPER_FILT_FREQ; float32 PRE_EMPHASIS_ALPHA; } param_t; typedef struct{ float32 sampling_rate; int32 num_cepstra; int32 num_filters; int32 fft_size; float32 lower_filt_freq; float32 upper_filt_freq; float32 **filter_coeffs; float32 **mel_cosine; float32 *left_apex; int32 *width; }melfb_t; typedef struct{ float32 SAMPLING_RATE; int32 FRAME_RATE; int32 FRAME_SHIFT; float32 WINDOW_LENGTH; int32 FRAME_SIZE; int32 FFT_SIZE; int32 FB_TYPE; int32 NUM_CEPSTRA; float32 PRE_EMPHASIS_ALPHA; int16 *OVERFLOW_SAMPS; int32 NUM_OVERFLOW_SAMPS; melfb_t *MEL_FB; int32 START_FLAG; int16 PRIOR; float64 *HAMMING_WINDOW; } fe_t; #define MEL_SCALE 1 #define LOG_LINEAR 2 /* Default values */ #define DEFAULT_SAMPLING_RATE 16000.0 #define DEFAULT_FRAME_RATE 100 #define DEFAULT_WINDOW_LENGTH 0.025625 #define DEFAULT_FFT_SIZE 512 #define DEFAULT_FB_TYPE MEL_SCALE #define DEFAULT_NUM_CEPSTRA 13 #define DEFAULT_PRE_EMPHASIS_ALPHA 0.97 #define DEFAULT_START_FLAG 0 #define BB_SAMPLING_RATE 16000 #define DEFAULT_BB_FRAME_SHIFT 160 #define DEFAULT_BB_NUM_FILTERS 40 #define DEFAULT_BB_LOWER_FILT_FREQ 133.33334 #define DEFAULT_BB_UPPER_FILT_FREQ 6855.4976 #define NB_SAMPLING_RATE 8000 #define DEFAULT_NB_FRAME_SHIFT 80 #define DEFAULT_NB_NUM_FILTERS 31 #define DEFAULT_NB_LOWER_FILT_FREQ 200 #define DEFAULT_NB_UPPER_FILT_FREQ 3500 /* Interface */ fe_t *fe_init(param_t const *P); int32 fe_start_utt(fe_t *FE); int32 fe_process_utt(fe_t *FE, int16 const *spch, int32 nsamps, float32 **cep); int32 fe_end_utt(fe_t *FE, float32 *cepvector); int32 fe_close(fe_t *FE); int32 fe_process(fe_t *FE, int16 const *spch, int32 nsamps, float32 **cep ); #endif /* _NEW_FE_H_ */