Edinburgh Speech Tools 2.4-release
srpd.h
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
74typedef struct {
75 int size;
76 double *coeff;
78
79
80typedef struct { /* segment of speech data */
81 int size, shift, length; /* in samples */
82 short *data;
83} SEGMENT_;
84
85
86struct 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;
95 int make_ascii;
96 int peak_tracking;
97};
98
99typedef struct status {
100 double pitch_freq;
101 char v_uv, s_h;
102 double cc_max, threshold;
103} STATUS_;
104
105typedef struct list {
106 int N0, score;
107 struct list *next_item;
108} LIST_;
109
110typedef enum {
111 CANT_WRITE, DECI_FCTR, INSUF_MEM, FILE_ERR, FILE_SEEK, LEN_OOR, MAX_FREQ,
112 MIN_FREQ, MISUSE, NOISE_FLOOR, SAMPLE_FREQ, SFT_OOR, THR_DH, THR_HIGH,
113 THR_MAX_RTO, THR_MIN
114 } error_flags;
115
116
117void add_to_list (LIST_ **p_list_hd, LIST_ **p_list_tl, int N_val,
118 int score_val);
119
120void super_resolution_pda (struct Srpd_Op *paras, SEGMENT_ seg,
121 CROSS_CORR_ *p_cc, STATUS_ *p_status);
122void write_track(STATUS_ status, struct Srpd_Op paras, FILE *outfile);
123
124
125int read_next_segment (FILE *voxfile, struct Srpd_Op *paras, SEGMENT_ *p_seg);
126void end_structure_use(SEGMENT_ *p_seg, CROSS_CORR_ *p_cc);
127void initialise_status (struct Srpd_Op *p, STATUS_ *p_status);
128void initialise_structures (struct Srpd_Op *p, SEGMENT_ *p_seg,
129 CROSS_CORR_ *p_cc);
130
131void initialise_parameters (struct Srpd_Op *p_par);
132void error (error_flags err_type);
133
134void free_list (LIST_ **p_list_hd);
135
136#endif // __SRPD_H__
Definition: srpd.h:105
Definition: srpd.h:80
Definition: srpd.h:99
Definition: srpd.h:86