1 /* 2 * This software has been licensed to the Centre of Speech Technology, KTH 3 * by Microsoft Corp. with the terms in the accompanying file BSD.txt, 4 * which is a BSD style license. 5 * 6 * "Copyright (c) 1990-1996 Entropic Research Laboratory, Inc. 7 * All rights reserved" 8 * 9 * Written by: David Talkin 10 * Checked by: 11 * Revised by: 12 * @(#)f0.h 1.4 9/9/96 ERL 13 * Brief description: 14 * 15 */ 16 17 18 19 /* f0.h */ 20 /* Some definitions used by the "Pitch Tracker Software". */ 21 22 typedef struct f0_params { 23 float cand_thresh, /* only correlation peaks above this are considered */ 24 lag_weight, /* degree to which shorter lags are weighted */ 25 freq_weight, /* weighting given to F0 trajectory smoothness */ 26 trans_cost, /* fixed cost for a voicing-state transition */ 27 trans_amp, /* amplitude-change-modulated VUV trans. cost */ 28 trans_spec, /* spectral-change-modulated VUV trans. cost */ 29 voice_bias, /* fixed bias towards the voiced hypothesis */ 30 double_cost, /* cost for octave F0 jumps */ 31 mean_f0, /* talker-specific mean F0 (Hz) */ 32 mean_f0_weight, /* weight to be given to deviations from mean F0 */ 33 min_f0, /* min. F0 to search for (Hz) */ 34 max_f0, /* max. F0 to search for (Hz) */ 35 frame_step, /* inter-frame-interval (sec) */ 36 wind_dur; /* duration of correlation window (sec) */ 37 int n_cands, /* max. # of F0 cands. to consider at each frame */ 38 conditioning; /* Specify optional signal pre-conditioning. */ 39 } F0_params; 40 41 /* Possible values returned by the function f0(). */ 42 #define F0_OK 0 43 #define F0_NO_RETURNS 1 44 #define F0_TOO_FEW_SAMPLES 2 45 #define F0_NO_INPUT 3 46 #define F0_NO_PAR 4 47 #define F0_BAD_PAR 5 48 #define F0_BAD_INPUT 6 49 #define F0_INTERNAL_ERR 7 50 51 /* Bits to specify optional pre-conditioning of speech signals by f0() */ 52 /* These may be OR'ed together to specify all preprocessing. */ 53 #define F0_PC_NONE 0x00 /* no pre-processing */ 54 #define F0_PC_DC 0x01 /* remove DC */ 55 #define F0_PC_LP2000 0x02 /* 2000 Hz lowpass */ 56 #define F0_PC_HP100 0x04 /* 100 Hz highpass */ 57 #define F0_PC_AR 0x08 /* inf_order-order LPC inverse filter */ 58 #define F0_PC_DIFF 0x010 /* 1st-order difference */ 59 60 extern F0_params *new_f0_params(); 61 extern int atoi(), eround(), lpc(), window(), get_window(); 62 extern void get_fast_cands(), a_to_aca(), cross(), crossf(), crossfi(), 63 autoc(), durbin(); 64 65 #define Fprintf (void)fprintf 66 67 /* f0_structs.h */ 68 69 #define BIGSORD 100 70 71 typedef struct cross_rec { /* for storing the crosscorrelation information */ 72 float rms; /* rms energy in the reference window */ 73 float maxval; /* max in the crosscorr. fun. q15 */ 74 short maxloc; /* lag # at which max occured */ 75 short firstlag; /* the first non-zero lag computed */ 76 float *correl; /* the normalized corsscor. fun. q15 */ 77 } Cross; 78 79 typedef struct dp_rec { /* for storing the DP information */ 80 short ncands; /* # of candidate pitch intervals in the frame */ 81 short *locs; /* locations of the candidates */ 82 float *pvals; /* peak values of the candidates */ 83 float *mpvals; /* modified peak values of the candidates */ 84 short *prept; /* pointers to best previous cands. */ 85 float *dpvals; /* cumulative error for each candidate */ 86 } Dprec; 87 88 typedef struct windstat_rec { /* for lpc stat measure in a window */ 89 float rho[BIGSORD+1]; 90 float err; 91 float rms; 92 } Windstat; 93 94 typedef struct sta_rec { /* for stationarity measure */ 95 float *stat; 96 float *rms; 97 float *rms_ratio; 98 } Stat; 99 100 101 typedef struct frame_rec{ 102 Cross *cp; 103 Dprec *dp; 104 float rms; 105 struct frame_rec *next; 106 struct frame_rec *prev; 107 } Frame; 108 109 extern Frame *alloc_frame(); 110