56 #pragma warning (disable: 4996)
63 #include "fe_warp_inverse_linear.h"
72 static float params[N_PARAM] = { 1.0f };
73 static int32 is_neutral = YES;
74 static char p_str[256] =
"";
75 static float nyquist_frequency = 0.0f;
79 fe_warp_inverse_linear_doc()
81 return "inverse_linear :== < w' = x / a >";
85 fe_warp_inverse_linear_id()
87 return FE_WARP_ID_INVERSE_LINEAR;
91 fe_warp_inverse_linear_n_param()
97 fe_warp_inverse_linear_set_parameters(
char const *param_str,
float sampling_rate)
101 char temp_param_str[256];
104 nyquist_frequency = sampling_rate / 2;
105 if (param_str == NULL) {
110 if (strcmp(param_str, p_str) == 0) {
114 strcpy(temp_param_str, param_str);
115 memset(params, 0, N_PARAM *
sizeof(
float));
116 strcpy(p_str, param_str);
118 tok = strtok(temp_param_str, seps);
119 while (tok != NULL) {
120 params[param_index++] = (float)
atof_c(tok);
121 tok = strtok(NULL, seps);
122 if (param_index >= N_PARAM) {
128 (
"Inverse linear warping takes only one argument, %s ignored.\n",
131 if (params[0] == 0) {
134 (
"Inverse linear warping cannot have slope zero, warping not applied.\n");
139 fe_warp_inverse_linear_warped_to_unwarped(
float nonlinear)
146 float temp = nonlinear * params[0];
147 if (temp > nyquist_frequency) {
149 (
"Warp factor %g results in frequency (%.1f) higher than Nyquist (%.1f)\n",
150 params[0], temp, nyquist_frequency);
157 fe_warp_inverse_linear_unwarped_to_warped(
float linear)
164 float temp = linear / params[0];
170 fe_warp_inverse_linear_print(
const char *label)
174 for (i = 0; i < N_PARAM; i++) {
175 printf(
"%s[%04u]: %6.3f ", label, i, params[i]);
Miscellaneous useful string functions.
#define E_INFO(...)
Print logging information to standard error stream.
SPHINXBASE_EXPORT double atof_c(char const *str)
Locale independent version of atof().
Implementation of logging routines.
#define E_WARN(...)
Print warning message to error log.