00001 /* ==================================================================== 00002 * Copyright (c) 2006 Carnegie Mellon University. All rights 00003 * reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions 00007 * are met: 00008 * 00009 * 1. Redistributions of source code must retain the above copyright 00010 * notice, this list of conditions and the following disclaimer. 00011 * 00012 * 2. Redistributions in binary form must reproduce the above copyright 00013 * notice, this list of conditions and the following disclaimer in 00014 * the documentation and/or other materials provided with the 00015 * distribution. 00016 * 00017 * This work was supported in part by funding from the Defense Advanced 00018 * Research Projects Agency and the National Science Foundation of the 00019 * United States of America, and the CMU Sphinx Speech Consortium. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 00022 * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 00023 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00024 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY 00025 * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00026 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00027 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00028 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00029 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00030 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00031 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00032 * 00033 * ==================================================================== 00034 * 00035 */ 00036 00037 #ifndef FE_WARP_H 00038 #define FE_WARP_H 00039 00040 #include "fe_internal.h" 00041 00042 #ifdef __cplusplus 00043 extern "C" { 00044 #endif 00045 #if 0 00046 /* Fool Emacs. */ 00047 } 00048 #endif 00049 00050 #define FE_WARP_ID_INVERSE_LINEAR 0 00051 #define FE_WARP_ID_AFFINE 1 00052 #define FE_WARP_ID_PIECEWISE_LINEAR 2 00053 #define FE_WARP_ID_EIDE_GISH 3 00054 #define FE_WARP_ID_MAX 2 00055 #define FE_WARP_ID_NONE 0xffffffff 00056 00057 typedef struct { 00058 void (*set_parameters)(char const *param_str, float sampling_rate); 00059 const char * (*doc)(void); 00060 uint32 (*id)(void); 00061 uint32 (*n_param)(void); 00062 float (*warped_to_unwarped)(float nonlinear); 00063 float (*unwarped_to_warped)(float linear); 00064 void (*print)(const char *label); 00065 } fe_warp_conf_t; 00066 00067 int fe_warp_set(melfb_t *mel, const char *id_name); 00068 00069 uint32 fe_warp_id(melfb_t *mel); 00070 00071 const char * fe_warp_doc(melfb_t *mel); 00072 00073 void fe_warp_set_parameters(melfb_t *mel, char const *param_str, float sampling_rate); 00074 00075 uint32 fe_warp_n_param(melfb_t *mel); 00076 00077 float fe_warp_warped_to_unwarped(melfb_t *mel, float nonlinear); 00078 00079 float fe_warp_unwarped_to_warped(melfb_t *mel, float linear); 00080 00081 void fe_warp_print(melfb_t *mel, const char *label); 00082 00083 #define FE_WARP_NO_SIZE 0xffffffff 00084 00085 #ifdef __cplusplus 00086 } 00087 #endif 00088 00089 00090 #endif /* FE_WARP_H */ 00091 00092 /* 00093 * Log record. Maintained by RCS. 00094 * 00095 * $Log: fe_warp.h,v $ 00096 * Revision 1.2 2006/02/17 00:31:34 egouvea 00097 * Removed switch -melwarp. Changed the default for window length to 00098 * 0.025625 from 0.256 (so that a window at 16kHz sampling rate has 00099 * exactly 410 samples). Cleaned up include's. Replaced some E_FATAL() 00100 * with E_WARN() and return. 00101 * 00102 * Revision 1.1 2006/02/16 00:18:26 egouvea 00103 * Implemented flexible warping function. The user can specify at run 00104 * time which of several shapes they want to use. Currently implemented 00105 * are an affine function (y = ax + b), an inverse linear (y = a/x) and a 00106 * piecewise linear (y = ax, up to a frequency F, and then it "breaks" so 00107 * Nyquist frequency matches in both scales. 00108 * 00109 * Added two switches, -warp_type and -warp_params. The first specifies 00110 * the type, which valid values: 00111 * 00112 * -inverse or inverse_linear 00113 * -linear or affine 00114 * -piecewise or piecewise_linear 00115 * 00116 * The inverse_linear is the same as implemented by EHT. The -mel_warp 00117 * switch was kept for compatibility (maybe remove it in the 00118 * future?). The code is compatible with EHT's changes: cepstra created 00119 * from code after his changes should be the same as now. Scripts that 00120 * worked with his changes should work now without changes. Tested a few 00121 * cases, same results. 00122 * 00123 */