SPRAAK
|
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) |
Functions | |
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) |
SprCdFilter * | spr_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) |
SprSspDesc * | spr_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) |
SprSspDesc * | spr_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) |
SprStream * | spr_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) |
SprSspInfo * | spr_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... | |
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) |
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
note: lowest bits reverved for FEVAL_SUBST_... flags
anonymous enum |
anonymous enum |
anonymous enum |
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:
filter | calculated filter |
ftype | filter type (LP,HP,BP,BS) |
mx_ord | max. order of the denominator |
bp_ripple | maximum bandpass ripple |
sb_attenuation | minimum 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
n | Number of samples of output that are to be computed. |
x | The filter input. |
y | The filter output. |
a | The IIR filter coefficients 0:La. |
La | Length of the a array. |
b | The FIR filter coefficients 0:Lb. |
Lb | Length 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.
f0_read | first frame read |
nfr_read | number of frames read |
ssp_des | signal processing info |
dfptr | file to read from |
fname | file name (mesages only) |
btime | read data from start time |
etime | up 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:
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.
int spr_ssp_modstatus_save | ( | SprSspDesc * | ssp_des, |
const char * | fname | ||
) |
Store preprocessing module status (mainly speaker adaptive things) to the file fname.
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:
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:
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.
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.
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).
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.
keys | keyset for the new file |
dtype | info 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 | ||
) |
Update the NFR key, write the modified header and close the file (the keyset is not freed).
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:
w[i] = 0.54-0.46*cos(2*M_PI*i/(N-1)); i=[0,N-1]
w[i] = 1.0; i=[0,N-1]
w[i] = (1.0-cos(i/(N-1))/2; i=[0,N-1]
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]
w[i] = w[N-i-1] = i/floor((N-1)/2); i=[0,floor((N-1)/2)]
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:
w[i] = 0.54-0.46*cos(2*M_PI*i/(N-1)); i=[0,N-1]
w[i] = 1.0; i=[0,N-1]
w[i] = (1.0-cos(i/(N-1))/2; i=[0,N-1]
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]
w[i] = w[N-i-1] = i/floor((N-1)/2); i=[0,floor((N-1)/2)]
w[i] = exp(-(5.2*(i-(N-1)/2)/(N-1))^2)
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