SPRAAK
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Data Structures | Modules | Typedefs | Enumerations | Functions | Variables
API_LowLvl::lib::preproc
+ Collaboration diagram for API_LowLvl::lib::preproc:

Data Structures

struct  SprCdFilter
 
struct  SprGHFitGaussian
 
struct  SprGHFitGaussMix
 
struct  SprSspFlist
 
struct  SprSspFinfo
 
struct  SprSspAS
 
struct  SprSspStatus
 
struct  SprSspInfo
 
struct  SprSspDesc
 
struct  SprSspDlist
 
struct  SprSspStoreInfo
 
struct  SprSspRecallInfo
 
struct  spr_t_ssp_types
 

Modules

 API_LowLvl::lib::preproc::mod
 

Typedefs

typedef float(* SprSspFScaleCvt )(float freq)
 
typedef void(* _FuncPtr1_SSP_MASTER_ )(struct spr_t_ssp_info *info, SprSspStatus *action)
 
typedef int(* _FuncPtr2_SSP_MASTER_ )(struct spr_t_ssp_info *info, const void *frame_in, void *frame_out)
 
typedef void(* _FuncPtr3_SSP_MASTER_ )(struct spr_t_ssp_info *info)
 
typedef void *(* _FuncPtr4_SSP_MASTER_ )(SprStream *f, struct spr_t_ssp_desc *d)
 
typedef int(* _FuncPtr5_SSP_MASTER_ )(SprSspInfo *ssp_start, const char **line_array, void *aux_info)
 
typedef int(* _FuncPtr6_SSP_MASTER_ )(SprSspInfo *info, const void *frame_in, void *frame_out)
 
typedef float *(* SprWinF32Func )(float *restrict w, int N)
 
typedef double *(* SprWinF64Func )(double *restrict w, int N)
 

Enumerations

enum  { SPR_CD_LP_FILTER, SPR_CD_HP_FILTER, SPR_CD_BS_FILTER, SPR_CD_BP_FILTER }
 
enum  {
  SPR_FREQSCALE_MEL, SPR_FREQSCALE_BARK, SPR_FREQSCALE_ERB, SPR_FREQSCALE_PLP,
  SPR_FREQSCALE_MELDM, SPR_FREQSCALE_MELHTK, SPR_FREQSCALE_ERBGM, SPR_FREQSCALE_LINEAR,
  SPR_FREQSCALE_NFREQSCALE
}
 auditory frequency scales More...
 
enum  {
  SPR_SSP_FRAME_OUT, SPR_SSP_FRAME_SKP, SPR_SSP_FRAME_END, SPR_SSP_FRAME_ERR,
  SPR_SSP_FRAME_HLD
}
 
enum  {
  SPR_SSP_FLIST_STOP, SPR_SSP_FLIST_CONTINUE, SPR_SSP_FLIST_START, SPR_SSP_FLIST_PAUSE,
  SPR_SSP_FLIST_RESUME
}
 
enum  { SPR_SSP_STATUS_NOI, SPR_SSP_STATUS_RDY, SPR_SSP_STATUS_ERR, SPR_SSP_STATUS_FAT }
 
enum  {
  SPR_SSP_PASTE_STORE, SPR_SSP_PASTE_RECALL, SPR_SSP_PASTE_GET_VLEN, SPR_SSP_PASTE_GET_TYPE,
  SPR_SSP_PASTE_CHK_NAME, SPR_SSP_PASTE_LAST
}
 
enum  { SPR_SSP_MODSTATUS_LOAD, SPR_SSP_MODSTATUS_SAVE, SPR_SSP_MODSTATUS_UPDATE }
 Action ID's. More...
 
enum  { SPR_SSP_MOD_AUX_NULL, SPR_SSP_MOD_AUX_KEYS, SPR_SSP_MOD_AUX_VAR, SPR_SSP_MOD_AUX_DES }
 note: lowest bits reverved for FEVAL_SUBST_... flags More...
 
enum  { SPR_SSP_LT_EMPTY, SPR_SSP_LT_GLOBAL_CMD, SPR_SSP_LT_HEADER, SPR_SSP_LT_LOCAL_CMD }
 
enum  {
  SPR_FBSHAPE_REC, SPR_FBSHAPE_TRI2, SPR_FBSHAPE_SCHROEDER, SPR_FBSHAPE_TRI,
  SPR_FBSHAPE_GAMMA, SPR_FBSHAPE_NFBSHAPE
}
 filterbank shapes More...
 
enum  {
  SPR_WIN_HAMMING, SPR_WIN_RECTANGULAR, SPR_WIN_HANNING, SPR_WIN_BLACKMAN,
  SPR_WIN_TRIANGULAR, SPR_WIN_GAUSSIAN, SPR_WIN_NWINDOWTYPE
}
 The different window types. More...
 

Functions

SprCdFilterspr_cd_free_filter (SprCdFilter *filter, SprMsgId *routine)
 
void spr_cd_print_filter (SprStream *dest, const SprCdFilter *filter)
 
SprCdFilterspr_cd_order_filter (SprCdFilter *filter)
 
SprCdFilterspr_cd_cascade_filter (SprCdFilter *filter1, const SprCdFilter *filter2)
 Put two filters in cascade. More...
 
int spr_cd_is_unstable (const SprCdFilter *filter)
 
int spr_cd_chebyII_design (SprCdFilter **filter, int ftype, int mx_ord, double bp_ripple, double sb_attenuation,...)
 
int spr_cd_gcd (unsigned int i, unsigned int j)
 Calculates the greatest common divider. More...
 
void spr_coding_pitch_filter (float resid[], float ppar[], float s[], int nfsh)
 
void spr_coding_pitch_prediction (float s[], int npwlen, float wi2[], float ppar[], int oset2, int m1, int m2)
 
void spr_coding_residual (float x[], float resid[], float a[], int nwlen, int nfsh, int p, int oset)
 
void spr_coding_pitch_residual (float s[], float ppar[], float resid[], int oset2, int nfsh, int npwlen)
 
void spr_coding_pre_emphasis (short int buf[], float s[], int nfsh, int nwlen, float preem, int oset)
 
void spr_coding_de_emphasis (float x[], int nfsh, float preem, float s[])
 
void spr_coding_synth_flt (float err[], float lpc_par[], int p, int nfsh, float x[])
 
double spr_coding_distortion (float werr[], int vlen)
 
void spr_coding_weight_flt (float lpc_par[], float gamma, float err[], float werr[], int p, int nfsh)
 
void spr_conv_d (float a[], int La, float b[], int Lb, float c[])
 
void spr_fir_d (int n, float x[], float y[], float b[], int Lb)
 
float spr_fscale_melhtk2hz (float mel)
 
float spr_fscale_hz2melhtk (float hz)
 
float spr_fscale_meldm2hz (float mel)
 
float spr_fscale_hz2meldm (float hz)
 
float spr_fscale_mel2hz (float mel)
 Frequency scale conversion from Mel to Hz. More...
 
float spr_fscale_hz2mel (float hz)
 Frequency scale conversion from Hz to Mel. More...
 
float spr_fscale_barkplp2hz (float bark)
 Frequency scale conversion from Bark (PLP) to Hz. More...
 
float spr_fscale_hz2barkplp (float hz)
 Frequency scale conversion from Hz to Bark (PLP). More...
 
float spr_fscale_bark2hz (float bark)
 Frequency scale conversion from Bark to Hz. More...
 
float spr_fscale_hz2bark (float hz)
 Frequency scale conversion from Hz to Bark. More...
 
float spr_fscale_erb2hz (float erb)
 Frequency scale conversion from Erb to Hz. More...
 
float spr_fscale_hz2erb (float hz)
 Frequency scale conversion from Hz to Erb. More...
 
float spr_fscale_erbgm2hz (float erb)
 Frequency scale conversion from Erb (Glasberg & Moore) to Hz. More...
 
float spr_fscale_hz2erbgm (float hz)
 Frequency scale conversion from Hz to Erb (Glasberg & Moore). More...
 
float spr_fscale_lin2hz (float hz)
 Frequency scale conversion from Hz to Erb. More...
 
float spr_fscale_hz2lin (float hz)
 Frequency scale conversion from Hz to Erb. More...
 
int spr_fspec (int Lb, float b[], int La, float a[], int Lfft, float z[], int type)
 
int spr_ghfit_fit (float hist[], float bin[], int nbin, SprGHFitGaussMix *gmix, int niter)
 
float spr_ghfit_eval (SprGHFitGaussMix *gmix, float x)
 
int spr_ghthr (SprGHFitGaussMix *gmix, float thr[], int niter)
 
int spr_iir_d (int n, float x[], float y[], float a[], int La, float b[], int Lb)
 
void spr_lms (int n, float d[], float *x[], float e[], float *w[], int lw, float mu[], int nref, int delta, int norm, int adap)
 
void spr_make_A_filter (float b[], int *Lb, float a[], int *La, float samplefreq)
 
float ** spr_read_obs (int *f0_read, int *nfr_read, SprSspDesc *ssp_des, SprStream *dfptr, const char *fname, double btime, double etime)
 
void spr_rms_ana (float x[], int nfr, int nflength, int nfshift, float rms[], float hist[], int nbin, SprGHFitGaussMix *gmix, float *thr)
 
void spr_rms_histana (float rms[], int nfr, float hist[], int nbin, SprGHFitGaussMix *gmix, float *thr)
 
void spr_rms_bed (int nfr, float lrms[], SprGHFitGaussMix *gmix, float thresh, int min_gaplen, int min_seglen, int extend, int seg1[], int seg2[], int *nseg, float min_snr)
 
void spr_sad_ffsad (int n, float y1[], float y2[], float e1[], float e2[], float u1[], float u2[], float w1[], float w2[], int lw1, int lw2, float mu1, float mu2)
 
void spr_sad_fbsad (int n, float y1[], float y2[], float u1[], float u2[], float w1[], float w2[], int lw1, int lw2, float mu1, float mu2)
 
void spr_sel_list_print_info (SprStream *fd, char *str, short *sel_list, int size)
 
void spr_sel_vec_copy (void *out, const void *in, const short *sel_info, size_t el_size)
 
short * spr_sel_list_make (char *str, int vlen, int *Size, char *name, SprVarlist *varlist)
 
int spr_sel_list_is_triv (short *list)
 Detect whether the selected part is a continuous block. More...
 
short * spr_sel_list_compl (short *list, int vlen, int *len)
 
short * spr_sel_list_pack (short *list)
 
int spr_ssp_line_type (const char *str)
 
const char * spr_ssp_get_line (const char ***line_array, int req_types, int stop_types)
 
const char * spr_ssp_next_line (const char ***line_array)
 
SprSspDescspr_ssp_free (SprSspDesc *ssp_des)
 Free all memory allocated by the signal processing routines. More...
 
void spr_ssp_print_fi (SprStream *fd, SprSspDesc *ssp_des)
 
void spr_ssp_print (SprStream *fd, SprSspDesc *ssp_des)
 
int spr_ssp_reset (SprSspDesc *ssp_des, SprStream *fd, SprKeySet *keys)
 
SprSspDescspr_ssp_setup (const char *script_name, char **line_array)
 
int spr_ssp_modstatus_do (SprSspDesc *ssp_des, SprSspStatus *action, SprMsgId *routine)
 
int spr_ssp_modstatus_load (SprSspDesc *ssp_des, const char *fname)
 
int spr_ssp_modstatus_save (SprSspDesc *ssp_des, const char *fname)
 
int spr_ssp_aux_stream (SprSspDesc *ssp_des, char *name, const SprDT *type, int vlen, void *dest, char *optional_used)
 
int spr_ssp_setup_END (SprSspInfo *Info, const char **descript, void *aux_info)
 
int spr_ssp_process_END (SprSspInfo *Info, const void *frame_in, void *frame_out)
 
int spr_ssp_process (SprSspDesc *ssp_des, void *frame_in)
 
int spr_ssp_flist (SprSspDesc *ssp_des, void ***res_mat, int start)
 
int spr_ssp_fseek (SprSspDesc *ssp_des, int new_pos, int nfr_proc, int mode, int *skip_fseek, int *skip_proc, int modify, SprStream *fd, int reset_pos)
 
void spr_ssp_help (SprStream *fd, int level)
 Print the syntax of all possible commands and routines. More...
 
int spr_ssp_paste (SprMsgId *Routine, SprSspInfo *info, int action, const char *buffer,...)
 
int spr_ssp_new_file (SprSspDesc *ssp_des, const char *obsdir, const char *dfname, const char *suffix)
 
int spr_ssp_process_stream (SprSspDesc *ssp_des, SprStream *fdi, SprStream *fdo, int nfr)
 
char ** spr_ssp_free_txt_block (char **line_array)
 Free a string array (dynamically allocated). More...
 
char ** spr_ssp_append_txt_files (const char **line_array, const char *fnames)
 
char ** spr_ssp_append_line_array (const char **line_array, const char *const *add_array, int free_flag)
 
int spr_ssp_check_keycompat (SprKeySet *keys, int dtype, const SprDT *dformat, int nchan, int nparam, double samplefreq)
 
void * spr_ssp_read_frame (SprStream *fd, SprSspDesc *ssp_des)
 
int spr_ssp_modify_nfr (SprKeySet *keys, const char *fname, int nfr)
 
void spr_ssp_modify_fshift (SprKeySet *keys, const char *fname, double fshift)
 
SprStreamspr_ssp_fileclose (SprStream *fd, SprKeySet *keys, int nfr_new, const char *fname)
 
int spr_ssp_setup_write (SprSspInfo *info, SprCmdBuf *cmdbuf, SprVarlist *varlist)
 
int spr_ssp_setup_read (SprSspInfo *info, SprCmdBuf *cmdbuf, SprVarlist *varlist)
 
int spr_ssp_setup_convert (SprSspInfo *info, SprCmdBuf *cmdbuf, SprVarlist *varlist)
 
int spr_ssp_setup_mix (SprSspInfo *info, SprCmdBuf *cmdbuf, SprVarlist *varlist)
 
int spr_ssp_setup_debug (SprSspInfo *info, SprCmdBuf *cmdbuf, SprVarlist *varlist)
 
SprSspInfospr_ssp_scan_store (SprSspInfo *info, const char *buffer, int *closed)
 
int spr_ssp_setup_store (SprSspInfo *info, SprCmdBuf *cmdbuf, SprVarlist *varlist)
 
float * spr_win_f32_hamming (float *restrict w, int N)
 
float * spr_win_f32_rectangular (float *restrict w, int N)
 
float * spr_win_f32_hanning (float *restrict w, int N)
 
float * spr_win_f32_triangular (float *restrict w, int N)
 
float * spr_win_f32_blackman (float *restrict w, int N)
 
float * spr_win_f32_gaussian (float *restrict w, int N)
 
float * spr_win_f32_create (float *restrict w, int N, int windowtype)
 
double * spr_win_f64_hamming (double *restrict w, int N)
 
double * spr_win_f64_rectangular (double *restrict w, int N)
 
double * spr_win_f64_hanning (double *restrict w, int N)
 
double * spr_win_f64_triangular (double *restrict w, int N)
 
double * spr_win_f64_blackman (double *restrict w, int N)
 
double * spr_win_f64_gaussian (double *restrict w, int N)
 
double * spr_win_f64_create (double *restrict w, int N, int windowtype)
 

Variables

const char *const spr_cd_str_filter []
 
const char *const spr_ssp_str_scaletype [SPR_FREQSCALE_NFREQSCALE+1]
 
SprSspFScaleCvt spr_ssp_fscale_to_hz []
 
SprSspFScaleCvt spr_ssp_fscale_from_hz []
 
char * spr_ssp_str_err []
 
char * spr_ssp_str_err_short []
 
char * spr_ssp_str_status []
 
char * spr_ssp_str_paste []
 
SprSspDesc spr_ssp_empty_desc
 
struct spr_t_ssp_types spr_ssp_types []
 
const char *const spr_ssp_str_banktype [SPR_FBSHAPE_NFBSHAPE+1]
 
const char *const spr_win_type [SPR_WIN_NWINDOWTYPE+1]
 Maps enum window types to strings. More...
 
SprWinF32Func spr_win_f32_func []
 function pointer to the functions to make any of the filters More...
 
SprWinF64Func spr_win_f64_func []
 function pointer to the functions to make any of the filters More...
 

Detailed Description

Typedef Documentation

typedef float(* SprSspFScaleCvt)(float freq)
typedef void(* _FuncPtr1_SSP_MASTER_)(struct spr_t_ssp_info *info,SprSspStatus *action)
typedef int(* _FuncPtr2_SSP_MASTER_)(struct spr_t_ssp_info *info, const void *frame_in,void *frame_out)
typedef void(* _FuncPtr3_SSP_MASTER_)(struct spr_t_ssp_info *info)
typedef void*(* _FuncPtr4_SSP_MASTER_)(SprStream *f,struct spr_t_ssp_desc *d)
typedef int(* _FuncPtr5_SSP_MASTER_)(SprSspInfo *ssp_start, const char **line_array, void *aux_info)
typedef int(* _FuncPtr6_SSP_MASTER_)(SprSspInfo *info, const void *frame_in, void *frame_out)
typedef float*(* SprWinF32Func)(float *restrict w, int N)
typedef double*(* SprWinF64Func)(double *restrict w, int N)

Enumeration Type Documentation

anonymous enum
Enumerator
SPR_CD_LP_FILTER 
SPR_CD_HP_FILTER 
SPR_CD_BS_FILTER 
SPR_CD_BP_FILTER 
anonymous enum

auditory frequency scales

Enumerator
SPR_FREQSCALE_MEL 
SPR_FREQSCALE_BARK 
SPR_FREQSCALE_ERB 
SPR_FREQSCALE_PLP 
SPR_FREQSCALE_MELDM 
SPR_FREQSCALE_MELHTK 
SPR_FREQSCALE_ERBGM 
SPR_FREQSCALE_LINEAR 
SPR_FREQSCALE_NFREQSCALE 
anonymous enum
Enumerator
SPR_SSP_FRAME_OUT 
SPR_SSP_FRAME_SKP 
SPR_SSP_FRAME_END 
SPR_SSP_FRAME_ERR 
SPR_SSP_FRAME_HLD 
anonymous enum
Enumerator
SPR_SSP_FLIST_STOP 
SPR_SSP_FLIST_CONTINUE 
SPR_SSP_FLIST_START 
SPR_SSP_FLIST_PAUSE 
SPR_SSP_FLIST_RESUME 
anonymous enum
Enumerator
SPR_SSP_STATUS_NOI 
SPR_SSP_STATUS_RDY 
SPR_SSP_STATUS_ERR 
SPR_SSP_STATUS_FAT 
anonymous enum
Enumerator
SPR_SSP_PASTE_STORE 
SPR_SSP_PASTE_RECALL 
SPR_SSP_PASTE_GET_VLEN 
SPR_SSP_PASTE_GET_TYPE 
SPR_SSP_PASTE_CHK_NAME 
SPR_SSP_PASTE_LAST 
anonymous enum

Action ID's.

Enumerator
SPR_SSP_MODSTATUS_LOAD 
SPR_SSP_MODSTATUS_SAVE 
SPR_SSP_MODSTATUS_UPDATE 
anonymous enum

note: lowest bits reverved for FEVAL_SUBST_... flags

Enumerator
SPR_SSP_MOD_AUX_NULL 

no extra argument needed, so pass NULL (default action)

SPR_SSP_MOD_AUX_KEYS 

pass the keyset extra argument

SPR_SSP_MOD_AUX_VAR 

pass the variable list as extra argument

SPR_SSP_MOD_AUX_DES 

pass the main ssp_descriptor structure as extra argument

anonymous enum
Enumerator
SPR_SSP_LT_EMPTY 
SPR_SSP_LT_GLOBAL_CMD 
SPR_SSP_LT_HEADER 
SPR_SSP_LT_LOCAL_CMD 
anonymous enum

filterbank shapes

Enumerator
SPR_FBSHAPE_REC 
SPR_FBSHAPE_TRI2 
SPR_FBSHAPE_SCHROEDER 
SPR_FBSHAPE_TRI 
SPR_FBSHAPE_GAMMA 
SPR_FBSHAPE_NFBSHAPE 
anonymous enum

The different window types.

Enumerator
SPR_WIN_HAMMING 
SPR_WIN_RECTANGULAR 
SPR_WIN_HANNING 
SPR_WIN_BLACKMAN 
SPR_WIN_TRIANGULAR 
SPR_WIN_GAUSSIAN 
SPR_WIN_NWINDOWTYPE 

Function Documentation

SprCdFilter* spr_cd_free_filter ( SprCdFilter filter,
SprMsgId routine 
)
void spr_cd_print_filter ( SprStream dest,
const SprCdFilter filter 
)
SprCdFilter* spr_cd_order_filter ( SprCdFilter filter)

Order the filter so that the MA parts are in front of the AR parts.

SprCdFilter* spr_cd_cascade_filter ( SprCdFilter filter1,
const SprCdFilter filter2 
)

Put two filters in cascade.

int spr_cd_is_unstable ( const SprCdFilter filter)

Check if a filter is unstable by tracking the impulse response of the AR parts. This version uses float calculations.

int spr_cd_chebyII_design ( SprCdFilter **  filter,
int  ftype,
int  mx_ord,
double  bp_ripple,
double  sb_attenuation,
  ... 
)

Design of a type II Chebyshev filter (equiripple in the stopband). Returns the lowest order digital Chebyshev type II filter that meets the specified design specifications. If the filter result pointer is NULL, only the order is calculated.

The numerator (zeros) and denominator (poles) is splitted in parts (cascading of filters) so that the order of each partial filter is less or equal to the specified upper limit mx_ord. This ensures that both the zeros and poles do not shift too much (both are used by the Chebychev filter). A value of (-1) prevents the splitting, Values of 0 and 1 are illegal.

Depending on the filter type, the following float arguments must be specified:

LP_FILTER
the normalized pasband corner freq.
the normalized stopband corner freq.
HP_FILTER
the normalized stopband corner freq.
the normalized pasband corner freq.
BS_FILTER
the normalized low pasband corner freq.
the normalized low stopband corner freq.
the normalized high stopband corner freq.
the normalized high pasband corner freq.
BP_FILTER
the normalized low stopband corner freq.
the normalized low pasband corner freq.
the normalized high pasband corner freq.
the normalized high stopband corner freq.
Returns
The order of the filter, or (-1) on faillure.
Parameters
filtercalculated filter
ftypefilter type (LP,HP,BP,BS)
mx_ordmax. order of the denominator
bp_ripplemaximum bandpass ripple
sb_attenuationminimum stopband attenuation
int spr_cd_gcd ( unsigned int  i,
unsigned int  j 
)

Calculates the greatest common divider.

void spr_coding_pitch_filter ( float  resid[],
float  ppar[],
float  s[],
int  nfsh 
)

pitch_filter() performs an inverse pitch-filtering to reconstruct the signal before pitch_filtering. Based on Master endwork of G.Bilsen & D.Chantrain. See also : relp_analysis, relp_synthesis, celp_analysis, celp_synthesis.

void spr_coding_pitch_prediction ( float  s[],
int  npwlen,
float  wi2[],
float  ppar[],
int  oset2,
int  m1,
int  m2 
)
void spr_coding_residual ( float  x[],
float  resid[],
float  a[],
int  nwlen,
int  nfsh,
int  p,
int  oset 
)

residual() calculates the LPC-error without pitchfiltering, while pitch_residual performs a pitchprediction filtering first. Based on Master endwork of G.Bilsen & D.Chantrain. See also : relp_analysis, relp_synthesis, celp_analysis, celp_synthesis.

void spr_coding_pitch_residual ( float  s[],
float  ppar[],
float  resid[],
int  oset2,
int  nfsh,
int  npwlen 
)
void spr_coding_pre_emphasis ( short int  buf[],
float  s[],
int  nfsh,
int  nwlen,
float  preem,
int  oset 
)

pre_emphasis() performs preemphasis on speechsignal. Based on Master endwork of G.Bilsen & D.Chantrain. See also : de_emphasis.

void spr_coding_de_emphasis ( float  x[],
int  nfsh,
float  preem,
float  s[] 
)
void spr_coding_synth_flt ( float  err[],
float  lpc_par[],
int  p,
int  nfsh,
float  x[] 
)

synth_flt() performs inverse lpc-filtering. Based on Master endwork of G.Bilsen & D.Chantrain. See also : relp_analysis, relp_synthesis, celp_analysis, celp_synthesis.

double spr_coding_distortion ( float  werr[],
int  vlen 
)

distortion() is used to calculate the short_time_energy of a signalframe, to find signal distortion. Based on Master endwork of G.Bilsen & D.Chantrain. See also : celp_analysis, fullsearch_training.

void spr_coding_weight_flt ( float  lpc_par[],
float  gamma,
float  err[],
float  werr[],
int  p,
int  nfsh 
)
void spr_conv_d ( float  a[],
int  La,
float  b[],
int  Lb,
float  c[] 
)
void spr_fir_d ( int  n,
float  x[],
float  y[],
float  b[],
int  Lb 
)
float spr_fscale_melhtk2hz ( float  mel)

Frequency scale conversion from Mel (Davis & Mermelstein) to Hz, i.e. linear spacing form 0-1000Hz and exponential spacing > 1000 Hz.

float spr_fscale_hz2melhtk ( float  hz)

Frequency scale conversion from Hz to Mel (Davis & Mermelstein), i.e. linear spacing from 0-1000 Hz and exponential spacing > 1000 Hz.

float spr_fscale_meldm2hz ( float  mel)

Frequency scale conversion from Mel (Davis & Mermelstein) to Hz, i.e. linear spacing form 0-1000Hz and exponential spacing > 1000 Hz.

float spr_fscale_hz2meldm ( float  hz)

Frequency scale conversion from Hz to Mel (Davis & Mermelstein), i.e. linear spacing from 0-1000 Hz and exponential spacing > 1000 Hz.

float spr_fscale_mel2hz ( float  mel)

Frequency scale conversion from Mel to Hz.

float spr_fscale_hz2mel ( float  hz)

Frequency scale conversion from Hz to Mel.

float spr_fscale_barkplp2hz ( float  bark)

Frequency scale conversion from Bark (PLP) to Hz.

float spr_fscale_hz2barkplp ( float  hz)

Frequency scale conversion from Hz to Bark (PLP).

float spr_fscale_bark2hz ( float  bark)

Frequency scale conversion from Bark to Hz.

float spr_fscale_hz2bark ( float  hz)

Frequency scale conversion from Hz to Bark.

float spr_fscale_erb2hz ( float  erb)

Frequency scale conversion from Erb to Hz.

float spr_fscale_hz2erb ( float  hz)

Frequency scale conversion from Hz to Erb.

float spr_fscale_erbgm2hz ( float  erb)

Frequency scale conversion from Erb (Glasberg & Moore) to Hz.

float spr_fscale_hz2erbgm ( float  hz)

Frequency scale conversion from Hz to Erb (Glasberg & Moore).

float spr_fscale_lin2hz ( float  hz)

Frequency scale conversion from Hz to Erb.

float spr_fscale_hz2lin ( float  hz)

Frequency scale conversion from Hz to Erb.

int spr_fspec ( int  Lb,
float  b[],
int  La,
float  a[],
int  Lfft,
float  z[],
int  type 
)

fspec() computes the frequency response from an IIR filter description. An FFT is computed from both numerator and denominator. Only a single FFT will be computed if an all-pole or all-zero filter is detected, no intermediate solutions using DFT instead of FFT for short filters are implemented.

int spr_ghfit_fit ( float  hist[],
float  bin[],
int  nbin,
SprGHFitGaussMix gmix,
int  niter 
)

ghfit() computes the best n-gaussian fit to a histogram probability distribution, using the EM (estimate-maximize) algorithm. The bin[] array must contain the center points corresponding to each histogram bin. The hist[] array contains histogram counts or a normalized version of this information. The initial histogram is returned normalized (sum of all values is 1). ghfit() returns :

     0 : normal completion
    -1 : numerical instability, prematurely aborted
    -2 : too many gaussians requested, reset to NGAUSS

For numerical accuracy and speed of computation the EM fit is limited to the central part of the histogram containing 98% of all input.

float spr_ghfit_eval ( SprGHFitGaussMix gmix,
float  x 
)

geval() evaluates the probability at x in a guassian mixture described in gmix.

int spr_ghthr ( SprGHFitGaussMix gmix,
float  thr[],
int  niter 
)

ghthr() finds n-1 thresholds in an n-gaussian histogram fit as equal probability points on the gaussian distributions.

An iterative procedure is used for finding these thresholds. In this the log-probs, rather than probs are compared. In standard fits the threshold should occur in between the two means, if this is not the case a warning is printed and a value of -99 is returned.

ghthr() returns 0 if no problems were detected, -1 if any of the domininance checks yields problems.

int spr_iir_d ( int  n,
float  x[],
float  y[],
float  a[],
int  La,
float  b[],
int  Lb 
)

iir_d( ) is a direct implementation of an IIR filter

           B(z)         b_0+b_1 z^-1+...b_Lb z^-Lb
   Y(z) = ----- X(z) =  --------------------------- X(z)
           A(z)         a_0+a_1z^-1+....  a_La z^-La

        Y(z) = (b_0+b_1z^-1+...)X(z) - (a_1z^-1+a_2z^-2...)Y(z)

        y(j) = ( Sum b_i x(j-i) - Sum a_i y(j-i) ) / a_0
                b_i: i=0:Lb
                a_i: i=1:La
Note
x[] and y[] must be defined with at least Lb-1 and La-1 points respectively into the past ! Standard initialization would be to set La zeros and Lb zeros in the arrays.
Returns
-1 on failure.
Parameters
nNumber of samples of output that are to be computed.
xThe filter input.
yThe filter output.
aThe IIR filter coefficients 0:La.
LaLength of the a array.
bThe FIR filter coefficients 0:Lb.
LbLength of the b array.
void spr_lms ( int  n,
float  d[],
float *  x[],
float  e[],
float *  w[],
int  lw,
float  mu[],
int  nref,
int  delta,
int  norm,
int  adap 
)
void spr_make_A_filter ( float  b[],
int *  Lb,
float  a[],
int *  La,
float  samplefreq 
)
float** spr_read_obs ( int *  f0_read,
int *  nfr_read,
SprSspDesc ssp_des,
SprStream dfptr,
const char *  fname,
double  btime,
double  etime 
)

Reads and process observation datavectors (discrete or continuous) from an open file. The function returns the frame array or (NULL) on error. The number of frames read is returned in nfr_read.

Parameters
f0_readfirst frame read
nfr_readnumber of frames read
ssp_dessignal processing info
dfptrfile to read from
fnamefile name (mesages only)
btimeread data from start time
etimeup to stop time
void spr_rms_ana ( float  x[],
int  nfr,
int  nflength,
int  nfshift,
float  rms[],
float  hist[],
int  nbin,
SprGHFitGaussMix gmix,
float *  thr 
)

rmsana() computes log-energy and histogram fit of a signal. The histogram spans the range [0,nbin] dB with binwidths of 1dB Quantization noise(LSB) is added to avoid LOG(0) computations. The rms[] array contains signal energy in dB, from the thresholding a min value of '0' arises

rmsana() does not apply any window, the first frame consists of samples [0,.. nflength-1]

void spr_rms_histana ( float  rms[],
int  nfr,
float  hist[],
int  nbin,
SprGHFitGaussMix gmix,
float *  thr 
)

histana() computes histogram fit of rms-values. The histogram spans the range [0,nbin] dB with binwidths of 1dB. The rms[] array contains signal energy in dB, from the thresholding a min value of '0' arises.

void spr_rms_bed ( int  nfr,
float  lrms[],
SprGHFitGaussMix gmix,
float  thresh,
int  min_gaplen,
int  min_seglen,
int  extend,
int  seg1[],
int  seg2[],
int *  nseg,
float  min_snr 
)
void spr_sad_ffsad ( int  n,
float  y1[],
float  y2[],
float  e1[],
float  e2[],
float  u1[],
float  u2[],
float  w1[],
float  w2[],
int  lw1,
int  lw2,
float  mu1,
float  mu2 
)
void spr_sad_fbsad ( int  n,
float  y1[],
float  y2[],
float  u1[],
float  u2[],
float  w1[],
float  w2[],
int  lw1,
int  lw2,
float  mu1,
float  mu2 
)
void spr_sel_list_print_info ( SprStream fd,
char *  str,
short *  sel_list,
int  size 
)

Print a selection list (index array). A (size>=0) overrules the default (-1) terminating element.

void spr_sel_vec_copy ( void *  out,
const void *  in,
const short *  sel_info,
size_t  el_size 
)

Copy a part from an input vector to an output vector. The element size (el_size) is the size of the element to be copied.

short* spr_sel_list_make ( char *  str,
int  vlen,
int *  Size,
char *  name,
SprVarlist varlist 
)

Interprets a textual description str and converts it to an index array. The varlist list contains all symbolic names (see feval). The name parameter is solely used for debug information. The size of the selection list is returned in Size. If the description string is empty, all elements are selected.

int spr_sel_list_is_triv ( short *  list)

Detect whether the selected part is a continuous block.

short* spr_sel_list_compl ( short *  list,
int  vlen,
int *  len 
)

Make the complemented list (all elements that are not being selected).

short* spr_sel_list_pack ( short *  list)

Create a special list if the list is a single continuous block. The only operation that supports this special format is sel_vec().

int spr_ssp_line_type ( const char *  str)
const char* spr_ssp_get_line ( const char ***  line_array,
int  req_types,
int  stop_types 
)

Get the next line in the line_array belong to one of the requested types req_types. The the line_array pointer is set to the next line if a matching line was found, or to the first non matching frame otherwise. A NULL is returned if a line belonging to the stop types stop_types is encountered first.

const char* spr_ssp_next_line ( const char ***  line_array)

For use in setup_xxx() scripts only. Get the next non empty command line. Returns NULL if all command lines for this module were read.

SprSspDesc* spr_ssp_free ( SprSspDesc ssp_des)

Free all memory allocated by the signal processing routines.

void spr_ssp_print_fi ( SprStream fd,
SprSspDesc ssp_des 
)

For debug purposes only. Prints where alle frames are located in the process pipe and what there status is.

void spr_ssp_print ( SprStream fd,
SprSspDesc ssp_des 
)

For debug purposes only. Print most information stored in the ssp descriptor and the ssp routine list.

int spr_ssp_reset ( SprSspDesc ssp_des,
SprStream fd,
SprKeySet keys 
)

Initialize / reset the internal buffers and the specific data. Must be called at the start of a new file.

The initialization is done during the first call to spr_ssp_reset() and not during the ssp_setup call. This makes that the size, datatype and other information stored in the keys, is known during the initialization.

When initializing, a valid keyset must be given (either via keys or via fd). This keyset is used to retrieve all relevant information concerning the data that will be processed. If keys equals NULL, the keyset internal to the stream fd will be used (if fd is not NULL).

Whenever a keyset is given (either via keys or via fd), all missing keys are filled in using spr_kset_set_defaults().

If a stream is given (argument fd) and if this stream is either a sample file or if the number of frames is unknown, the silent-eof flag in the stream will be turned on (see SprStream::silenteof() for more info).

A call to spr_ssp_reset() also updated the frame information in ssp_des (nfr_in, nfr_out). Some fields are only changed if a keyset is given (nfr, nfr_left, ord_file).

SprSspDesc* spr_ssp_setup ( const char *  script_name,
char **  line_array 
)

Allocates the ssp_des structure. The initialization is done during the first ssp_reset, so the size, datatype and other information stored in the keys, is known during the initialization.
The line array line_array must contain the complete description of the signal processing, the script name script_name is only used when printing messages. From this call on, the line array is owned by the on-line signal processing system, and will be released automatically at the end.

int spr_ssp_modstatus_do ( SprSspDesc ssp_des,
SprSspStatus action,
SprMsgId routine 
)

Ask/change status from the preprocessing block. Currently, the following actions are supported:

SprSspStatusSave
Save the current status.
SprSspStatusLoad
Load a previously saved status.
SprSspStatusUpdate
Update the status given some feedback info from elsewhere in the recognizer.
Returns
0 on success and -1 on failure.
Note
The preprocessing must be initialized before this routine may be called, hence at least one reset must have been issued. This is especially annoying for the load option, since we first must process something (in order to known the sample frequency, ...) before we can load the speaker specific data.
int spr_ssp_modstatus_load ( SprSspDesc ssp_des,
const char *  fname 
)

Set preprocessing module status (mainly speaker adaptive things) from a the file fname containing previously saved status.

Returns
0 on success and -1 on failure.
Note
The preprocessing must be initialized before this routine may be called, hence at least one reset must have been issued. This is especially annoying when loading speaker specific data, since we first must process something (in order to known the sample frequency, ...) before we can load the speaker specific data.
int spr_ssp_modstatus_save ( SprSspDesc ssp_des,
const char *  fname 
)

Store preprocessing module status (mainly speaker adaptive things) to the file fname.

Returns
0 on success and -1 on failure.
Note
The preprocessing must be initialized before this routine may be called.
int spr_ssp_aux_stream ( SprSspDesc ssp_des,
char *  name,
const SprDT type,
int  vlen,
void *  dest,
char *  optional_used 
)

Define an auxilary output stream. This allows multiple output streams (one main output stream and multiple auxilary streams). This function is called for every additional auxilary stream, after the ssp_setup() routine and before the first call to ssp_reset(). For every output frame, the data from the named buffer name is written to the specified location dest. You must also specify the datatype and the vector length (this is used for checking only). The optional_used parameter indicates whether the buffer is required (NULL pointer) or optional (non NULL pointer). For optional buffers, the content of optional_used will be set to 1/0 if the buffer is available or not (the value is set after the first call to ssp_reset()).

int spr_ssp_setup_END ( SprSspInfo Info,
const char **  descript,
void *  aux_info 
)
int spr_ssp_process_END ( SprSspInfo Info,
const void *  frame_in,
void *  frame_out 
)
int spr_ssp_process ( SprSspDesc ssp_des,
void *  frame_in 
)

Send a single frame to the signal processing routines. A (delayed) output frame is returned or a NULL if the frame is stored for later use (non causal routines). Also an error code is returned in <ssp_des->error>. The possible values are: SSP_FRAME_OUT, SSP_FRAME_SKP, SSP_FRAME_HLD, SSP_FRAME_END and SSP_FRAME_ERR.

int spr_ssp_flist ( SprSspDesc ssp_des,
void ***  res_mat,
int  start 
)

Starts or stops the backup of output frames during the processing. The start flag can have five values:

SSP_FLIST_STOP
stop the backup storage.
SSP_FLIST_CONTINUE
(get data and) continue the backup storage.
SSP_FLIST_START
start the backup storage.
SSP_FLIST_PAUSE
pause the backup storage.
SSP_FLIST_RESUME
resume the backup storage.

If the 'give_result' flag is set, all frames stored are combined in a matrix and returned to the calling process. "Note:" The returned matrix contains the same frames as store in the frame list. This means that only the array of pointers should be freed when the continue backup storage mode is selected (and not the complete matrix). "Return value:" The number of elements in the frame list is before the call is returned or (-1) on error;

int spr_ssp_fseek ( SprSspDesc ssp_des,
int  new_pos,
int  nfr_proc,
int  mode,
int *  skip_fseek,
int *  skip_proc,
int  modify,
SprStream fd,
int  reset_pos 
)

Find the best way to start processing at a certain position in the current file. The position can be relative (SEEK_CUR) to the last returned output frame or absolute (SEEK_SET), according to the mode flag. Both the number of frames to skip using fseek (SEEK_CUR) and the number of frames to be skipped after processing them (history) are returned if the appropriate pointers are non NULL pointers. If the modify flag is set (TRUE), the frame counts in the ssp descriptor (nfr_in, nfr_out, nfr_left) are modified to compensate for the skip and if necessary, a ssp_reset() is done. If the file descriptor fd!=NULL, and the modify flag is set, the skips are performed. A full restart is only performed if the data begin position reset_pos != -1.
The routine can also mark the block to be processed with the nfr_proc argument. This allows the preprocessing to truncate the file before processing. Return value: "(-1)" on error. "1" if a full restart (re-open file) is/was required.

void spr_ssp_help ( SprStream fd,
int  level 
)

Print the syntax of all possible commands and routines.

int spr_ssp_paste ( SprMsgId Routine,
SprSspInfo info,
int  action,
const char *  buffer,
  ... 
)

The following actions are supported:

PASTE_STORE

arguments:
int vlen, const SprDT*, void *frame

decription:
Store the data pointed to by frame in the named buffer buffer. The data is an array with elements of type type (e.g. spr_dt_f32) and size vlen.

Returns
(-1) on faillure.
Note
The info->vlen_out and info->type_out fields have to be filled in correctely when this action is requested.
PASTE_RECALL

arguments:
int vlen, const SprDT*, void *frame, int copy

decription:
Recall the data stored in the named buffer buffer and copy it to the given data array frame. Both the data type type and size vlen are checked w.r.t. the data stored in the named buffer. If the copy flag is selected, the data is not removed from the named buffer, so it can be recalled again later on.

Returns
(-1) on faillure.
PASTE_GET_VLEN
Get the size (vector length) of the data stored in the named buffer buffer.
Returns
The size or (-1) on faillure.
PASTE_GET_TYPE
arguments:
const SprDT**
Get the data type (e.g. spr_dt_f32) of the data stored in the named buffer buffer.
Returns
0
PASTE_CHK_NAME
Check whether there is an open named buffer with the given name.
Returns
1 if the buffer exist, 0 otherwise.
int spr_ssp_new_file ( SprSspDesc ssp_des,
const char *  obsdir,
const char *  dfname,
const char *  suffix 
)

Set the observation directory obsdir and file suffix suffix for a database and/or create the file name for a new observation file. Returns an 1 if a new file name (different from the previous one) was created.

int spr_ssp_process_stream ( SprSspDesc ssp_des,
SprStream fdi,
SprStream fdo,
int  nfr 
)

Process nfr from fdi and write the result to fdo (or ignore the result if fdo equals NULL).

Returns
the number of frames written on success or -1 on failure.
char** spr_ssp_free_txt_block ( char **  line_array)

Free a string array (dynamically allocated).

char** spr_ssp_append_txt_files ( const char **  line_array,
const char *  fnames 
)

Append one or more text files fnames to a given line array line_array. Each file has a header line in the line array, containing the filename. This line is used by find_err_loc() to find the filename and line number in which an error occurred. If the line array equals NULL, a new line array is created. The file names have to be separated with spaces or tabs.

char** spr_ssp_append_line_array ( const char **  line_array,
const char *const *  add_array,
int  free_flag 
)

Append a line array add_array to an other dynamically allocated line array line_array. If the free_flag is set, the add_array is deallocated. The line_array may be a NULL pointer. This results in a dynamically allocated copy of the add_array.

int spr_ssp_check_keycompat ( SprKeySet keys,
int  dtype,
const SprDT dformat,
int  nchan,
int  nparam,
double  samplefreq 
)

Check if the keys of a new file are compatible with some reference info (e.g. the keys of a previous opened file). The compatibility check for a reference value can be avoided by setting the reference value to 'SPR_NOT_DEFINED'.
The dataformat is splitted in to fields (see also ascii_dataformat). If both types have to be striktly equal (both binary or both ascii), the dformat parameter and the new keys should both contain the packed dataformat (and 'ascii' set to SPR_NOT_DEFINED), or both the parameters dformat and 'ascii' should be given while the new keys contains the unpacked dataformat.
The sample frequency samplefreq is only checked if the datatype dtype is SAMPLE.
If an incompatibility is found, a warning is given, and a (-1) is returned.

Parameters
keyskeyset for the new file
dtypeinfo about the reference file
void* spr_ssp_read_frame ( SprStream fd,
SprSspDesc ssp_des 
)

Read one input frame (big endian format). A buffer in the ssp_descriptor structure is used to store the data. If the end of the files was reached, a NULL is returned. The last frame in a sample file is extended with zeroes to make a complete frame.

int spr_ssp_modify_nfr ( SprKeySet keys,
const char *  fname,
int  nfr 
)
void spr_ssp_modify_fshift ( SprKeySet keys,
const char *  fname,
double  fshift 
)
SprStream* spr_ssp_fileclose ( SprStream fd,
SprKeySet keys,
int  nfr_new,
const char *  fname 
)

Update the NFR key, write the modified header and close the file (the keyset is not freed).

Note
The file must be opened for writing.
int spr_ssp_setup_write ( SprSspInfo info,
SprCmdBuf cmdbuf,
SprVarlist varlist 
)
int spr_ssp_setup_read ( SprSspInfo info,
SprCmdBuf cmdbuf,
SprVarlist varlist 
)
int spr_ssp_setup_convert ( SprSspInfo info,
SprCmdBuf cmdbuf,
SprVarlist varlist 
)
int spr_ssp_setup_mix ( SprSspInfo info,
SprCmdBuf cmdbuf,
SprVarlist varlist 
)
int spr_ssp_setup_debug ( SprSspInfo info,
SprCmdBuf cmdbuf,
SprVarlist varlist 
)
SprSspInfo* spr_ssp_scan_store ( SprSspInfo info,
const char *  buffer,
int *  closed 
)

Search the last .store for a given named buffer buffer that is still open. If buffer is NULL, all open named buffers are searched for. The closed flag (if not NULL) is used to indicate why no matching .store command was found (the name buffer does not exist or is already closed).

int spr_ssp_setup_store ( SprSspInfo info,
SprCmdBuf cmdbuf,
SprVarlist varlist 
)
float* spr_win_f32_hamming ( float *restrict  w,
int  N 
)
float* spr_win_f32_rectangular ( float *restrict  w,
int  N 
)
float* spr_win_f32_hanning ( float *restrict  w,
int  N 
)
float* spr_win_f32_triangular ( float *restrict  w,
int  N 
)
float* spr_win_f32_blackman ( float *restrict  w,
int  N 
)
float* spr_win_f32_gaussian ( float *restrict  w,
int  N 
)
float* spr_win_f32_create ( float *restrict  w,
int  N,
int  windowtype 
)

Create a window from one of the five given types:

SPR_WIN_HAMMING
w[i] = 0.54-0.46*cos(2*M_PI*i/(N-1)); i=[0,N-1]
SPR_WIN_RECTANGULAR
w[i] = 1.0; i=[0,N-1]
SPR_WIN_HANNING
w[i] = (1.0-cos(i/(N-1))/2; i=[0,N-1]
SPR_WIN_BLACKMAN
w[i] = 0.42-0.5*cos(2*pi*i/(N-1))+0.08*cos(4*M_PI*i/(N-1)); i=[0,N-1]
SPR_WIN_TRIANGULAR
w[i] = w[N-i-1] = i/floor((N-1)/2); i=[0,floor((N-1)/2)]
SPR_WIN_GAUSSIAN
w[i] = exp(-(5.2*(i-(N-1)/2)/(N-1))^2)
double* spr_win_f64_hamming ( double *restrict  w,
int  N 
)
double* spr_win_f64_rectangular ( double *restrict  w,
int  N 
)
double* spr_win_f64_hanning ( double *restrict  w,
int  N 
)
double* spr_win_f64_triangular ( double *restrict  w,
int  N 
)
double* spr_win_f64_blackman ( double *restrict  w,
int  N 
)
double* spr_win_f64_gaussian ( double *restrict  w,
int  N 
)
double* spr_win_f64_create ( double *restrict  w,
int  N,
int  windowtype 
)

Create a window from one of the five given types:

SPR_WIN_HAMMING
w[i] = 0.54-0.46*cos(2*M_PI*i/(N-1)); i=[0,N-1]
SPR_WIN_RECTANGULAR
w[i] = 1.0; i=[0,N-1]
SPR_WIN_HANNING
w[i] = (1.0-cos(i/(N-1))/2; i=[0,N-1]
SPR_WIN_BLACKMAN
w[i] = 0.42-0.5*cos(2*pi*i/(N-1))+0.08*cos(4*M_PI*i/(N-1)); i=[0,N-1]
SPR_WIN_TRIANGULAR
w[i] = w[N-i-1] = i/floor((N-1)/2); i=[0,floor((N-1)/2)]
SPR_WIN_GAUSSIAN
w[i] = exp(-(5.2*(i-(N-1)/2)/(N-1))^2)

Variable Documentation

const char* const spr_cd_str_filter[]
const char* const spr_ssp_str_scaletype[SPR_FREQSCALE_NFREQSCALE+1]
SprSspFScaleCvt spr_ssp_fscale_to_hz[]
SprSspFScaleCvt spr_ssp_fscale_from_hz[]
char* spr_ssp_str_err[]
char* spr_ssp_str_err_short[]
char* spr_ssp_str_status[]
char* spr_ssp_str_paste[]
SprSspDesc spr_ssp_empty_desc
struct spr_t_ssp_types spr_ssp_types[]
const char* const spr_ssp_str_banktype[SPR_FBSHAPE_NFBSHAPE+1]
const char* const spr_win_type[SPR_WIN_NWINDOWTYPE+1]

Maps enum window types to strings.

SprWinF32Func spr_win_f32_func[]

function pointer to the functions to make any of the filters

SprWinF64Func spr_win_f64_func[]

function pointer to the functions to make any of the filters