Edinburgh Speech Tools  2.1-release
srpd.h
Go to the documentation of this file.
1 /*************************************************************************/
2 /* */
3 /* Centre for Speech Technology Research */
4 /* University of Edinburgh, UK */
5 /* Copyright (c) 1995,1996 */
6 /* All Rights Reserved. */
7 /* */
8 /* Permission is hereby granted, free of charge, to use and distribute */
9 /* this software and its documentation without restriction, including */
10 /* without limitation the rights to use, copy, modify, merge, publish, */
11 /* distribute, sublicense, and/or sell copies of this work, and to */
12 /* permit persons to whom this work is furnished to do so, subject to */
13 /* the following conditions: */
14 /* 1. The code must retain the above copyright notice, this list of */
15 /* conditions and the following disclaimer. */
16 /* 2. Any modifications must be clearly marked as such. */
17 /* 3. Original authors' names are not deleted. */
18 /* 4. The authors' names are not used to endorse or promote products */
19 /* derived from this software without specific prior written */
20 /* permission. */
21 /* */
22 /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */
23 /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
24 /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
25 /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */
26 /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
27 /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
28 /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
29 /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
30 /* THIS SOFTWARE. */
31 /* */
32 /*************************************************************************/
33 /* Author : Paul Taylor */
34 /* Date : April 1994 */
35 /*************************************************************************/
36 #ifndef __SRPD_H__
37 #define __SRPD_H__
38 
39 #include <stdio.h>
40 
41 /********************
42  * define constants *
43  ********************/
44 
45 #define MINARG 5
46 #define BREAK_NUMBER 0.0
47 
48 #define DEFAULT_DECIMATION 4 /* samples */
49 #define DEFAULT_MIN_PITCH 40.0 /* Hz */
50 #define DEFAULT_MAX_PITCH 400.0 /* Hz */
51 
52 #define DEFAULT_SF 20000 /* Hz. Sampling Frequency */
53 #define DEFAULT_SHIFT 5.0 /* ms */
54 #define DEFAULT_LENGTH 10.0 /* ms */
55 #define DEFAULT_TSILENT 120 /* max. abs sample amplitude of noise */
56 #define DEFAULT_TMIN 0.75
57 #define DEFAULT_TMAX_RATIO 0.85
58 #define DEFAULT_THIGH 0.88
59 #define DEFAULT_TDH 0.77
60 
61 #define UNVOICED 0 /* segment classifications */
62 #define VOICED 1
63 #define SILENT 2
64 
65 #define HOLD 1
66 #define HELD 1
67 #define SEND 2
68 #define SENT 2
69 
70 /******************************
71  * define abstract data types *
72  ******************************/
73 
74 typedef struct {
75  int size;
76  double *coeff;
77 } CROSS_CORR_;
78 
79 
80 typedef struct { /* segment of speech data */
81  int size, shift, length; /* in samples */
82  short *data;
83 } SEGMENT_;
84 
85 
86 struct Srpd_Op {
87  int sample_freq; /* Hz */
88  int Nmax, Nmin;
89  double shift, length; /* ms */
90  double min_pitch; /* Hz */
91  double max_pitch; /* Hz */
92  int L; /* Decimation factor (samples) */
93  double Tmin, Tmax_ratio, Thigh, Tdh;
94  int Tsilent;
97 };
98 
99 typedef struct status {
100  double pitch_freq;
101  char v_uv, s_h;
102  double cc_max, threshold;
103 } STATUS_;
104 
105 typedef struct list {
106  int N0, score;
107  struct list *next_item;
108 } LIST_;
109 
110 typedef enum {
114  } error_flags;
115 
116 
117 void add_to_list (LIST_ **p_list_hd, LIST_ **p_list_tl, int N_val,
118  int score_val);
119 
120 void super_resolution_pda (struct Srpd_Op *paras, SEGMENT_ seg,
121  CROSS_CORR_ *p_cc, STATUS_ *p_status);
122 void write_track(STATUS_ status, struct Srpd_Op paras, FILE *outfile);
123 
124 
125 int read_next_segment (FILE *voxfile, struct Srpd_Op *paras, SEGMENT_ *p_seg);
126 void end_structure_use(SEGMENT_ *p_seg, CROSS_CORR_ *p_cc);
127 void initialise_status (struct Srpd_Op *p, STATUS_ *p_status);
128 void initialise_structures (struct Srpd_Op *p, SEGMENT_ *p_seg,
129  CROSS_CORR_ *p_cc);
130 
131 void initialise_parameters (struct Srpd_Op *p_par);
132 void error (error_flags err_type);
133 
134 void free_list (LIST_ **p_list_hd);
135 
136 #endif // __SRPD_H__
void initialise_parameters(struct Srpd_Op *p_par)
Definition: srpd1.3.cc:495
Definition: srpd.h:112
void end_structure_use(SEGMENT_ *p_seg, CROSS_CORR_ *p_cc)
Definition: srpd1.3.cc:547
void write_track(STATUS_ status, struct Srpd_Op paras, FILE *outfile)
Definition: srpd1.3.cc:716
Definition: srpd.h:80
void free_list(LIST_ **p_list_hd)
Definition: srpd1.3.cc:730
Definition: srpd.h:86
Definition: srpd.h:111
double threshold
Definition: srpd.h:102
char v_uv
Definition: srpd.h:101
error_flags
Definition: srpd.h:110
int L
Definition: srpd.h:92
Definition: srpd.h:99
Definition: srpd.h:111
void error(error_flags err_type)
Definition: srpd1.3.cc:406
int peak_tracking
Definition: srpd.h:96
int Nmin
Definition: srpd.h:88
void initialise_status(struct Srpd_Op *p, STATUS_ *p_status)
Definition: srpd1.3.cc:535
struct list * next_item
Definition: srpd.h:107
int sample_freq
Definition: srpd.h:87
void super_resolution_pda(struct Srpd_Op *paras, SEGMENT_ seg, CROSS_CORR_ *p_cc, STATUS_ *p_status)
Definition: srpd1.3.cc:84
Definition: srpd.h:111
void add_to_list(LIST_ **p_list_hd, LIST_ **p_list_tl, int N_val, int score_val)
Definition: srpd1.3.cc:381
double shift
Definition: srpd.h:89
int make_ascii
Definition: srpd.h:95
double * coeff
Definition: srpd.h:76
double min_pitch
Definition: srpd.h:90
Definition: srpd.h:105
int size
Definition: srpd.h:81
EST_String outfile
int score
Definition: srpd.h:106
Definition: srpd.h:112
Definition: srpd.h:112
short * data
Definition: srpd.h:82
double pitch_freq
Definition: srpd.h:100
int Tsilent
Definition: srpd.h:94
double Tmin
Definition: srpd.h:93
int size
Definition: srpd.h:75
double max_pitch
Definition: srpd.h:91
void initialise_structures(struct Srpd_Op *p, SEGMENT_ *p_seg, CROSS_CORR_ *p_cc)
Definition: srpd1.3.cc:515
int read_next_segment(FILE *voxfile, struct Srpd_Op *paras, SEGMENT_ *p_seg)
Definition: srpd1.3.cc:560
Definition: srpd.h:112
Definition: srpd.h:112
Definition: srpd.h:113