/[zanavi_public1]/navit/navit/support/espeak/phoneme.h
ZANavi

Contents of /navit/navit/support/espeak/phoneme.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (show annotations) (download)
Fri Oct 28 21:19:04 2011 UTC (12 years, 5 months ago) by zoff99
File MIME type: text/plain
File size: 6392 byte(s)
import files
1 /***************************************************************************
2 * Copyright (C) 2005 to 2007 by Jonathan Duddington *
3 * email: jonsd@users.sourceforge.net *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 3 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, see: *
17 * <http://www.gnu.org/licenses/>. *
18 ***************************************************************************/
19
20
21
22 // phoneme types
23 #define phPAUSE 0
24 #define phSTRESS 1
25 #define phVOWEL 2
26 #define phLIQUID 3
27 #define phSTOP 4
28 #define phVSTOP 5
29 #define phFRICATIVE 6
30 #define phVFRICATIVE 7
31 #define phNASAL 8
32 #define phVIRTUAL 9
33 #define phDELETED 14
34 #define phINVALID 15
35
36
37 // phoneme properties
38 // bits 16-19 give place of articulation (not currently used)
39 #define phWAVE 0x01
40 #define phUNSTRESSED 0x02
41 #define phFORTIS 0x08
42 #define phVOICED 0x10
43 #define phSIBILANT 0x20
44 #define phNOLINK 0x40
45 #define phTRILL 0x80
46 #define phVOWEL2 0x100 // liquid that is considered a vowel
47 #define phPALATAL 0x200
48 #define phAPPENDPH 0x2000 // always insert another phoneme (link_out) after this one
49 #define phBRKAFTER 0x4000 // [*] add a post-pause
50 #define phBEFOREPAUSE 0x8000 // replace with the link_out phoneme if the next phoneme is a pause
51
52 #define phALTERNATIVE 0x1c00 // bits 10,11,12 specifying use of alternative_ph
53 #define phBEFOREVOWEL 0x0000
54 #define phBEFOREVOWELPAUSE 0x0400
55 #define phBEFORENOTVOWEL 0x0c00
56 #define phBEFORENOTVOWEL2 0x1000
57 #define phSWITCHVOICING 0x0800
58 #define phBEFORE_R 0x1400
59
60 #define phNONSYLLABIC 0x100000 // don't count this vowel as a syllable when finding the stress position
61 #define phLONG 0x200000
62 #define phLENGTHENSTOP 0x400000 // make the pre-pause slightly longer
63 #define phRHOTIC 0x800000
64
65 // fixed phoneme code numbers, these can be used from the program code
66 #define phonCONTROL 1
67 #define phonSTRESS_U 2
68 #define phonSTRESS_D 3
69 #define phonSTRESS_2 4
70 #define phonSTRESS_3 5
71 #define phonSTRESS_P 6
72 #define phonSTRESS_P2 7 // priority stress within a word
73 #define phonSTRESS_PREV 8
74 #define phonPAUSE 9
75 #define phonPAUSE_SHORT 10
76 #define phonPAUSE_NOLINK 11
77 #define phonLENGTHEN 12
78 #define phonSCHWA 13
79 #define phonSCHWA_SHORT 14
80 #define phonEND_WORD 15
81 #define phonSONORANT 16
82 #define phonDEFAULTTONE 17
83 #define phonCAPITAL 18
84 #define phonGLOTTALSTOP 19
85 #define phonSYLLABIC 20
86 #define phonSWITCH 21
87 #define phonX1 22 // a language specific action
88 #define phonPAUSE_VSHORT 23
89 #define phonPAUSE_LONG 24
90 #define phonT_REDUCED 25
91 #define phonSTRESS_TONIC 26
92 #define phonPAUSE_CLAUSE 27
93
94 extern const unsigned char pause_phonemes[8]; // 0, vshort, short, pause, long, glottalstop
95
96 // place of articulation
97 #define phPLACE 0xf0000
98 #define phPLACE_pla 0x60000
99
100 #define N_PHONEME_TABS 100 // number of phoneme tables
101 #define N_PHONEME_TAB 256 // max phonemes in a phoneme table
102 #define N_PHONEME_TAB_NAME 32 // must be multiple of 4
103
104 // main table of phonemes, index by phoneme number (1-254)
105 typedef struct {
106 unsigned int mnemonic; // 1st char is in the l.s.byte
107 unsigned int phflags; // bits 28-30 reduce_to level, bits 16-19 place of articulation
108 // bits 10-11 alternative ph control
109
110 unsigned short std_length; // for vowels, in mS; for phSTRESS, the stress/tone type
111 unsigned short spect;
112 unsigned short before;
113 unsigned short after;
114
115 unsigned char code; // the phoneme number
116 unsigned char type; // phVOWEL, phPAUSE, phSTOP etc
117 unsigned char start_type;
118 unsigned char end_type;
119
120 unsigned char length_mod; // a length_mod group number, used to access length_mod_tab
121 unsigned char reduce_to; // change to this phoneme if unstressed
122 unsigned char alternative_ph; // change to this phoneme if a vowel follows/doesn't follow
123 unsigned char link_out; // insert linking phoneme if a vowel follows
124
125 } PHONEME_TAB;
126
127
128 // Several phoneme tables may be loaded into memory. phoneme_tab points to
129 // one for the current voice
130 extern int n_phoneme_tab;
131 extern int current_phoneme_table;
132 extern PHONEME_TAB *phoneme_tab[N_PHONEME_TAB];
133 extern unsigned char phoneme_tab_flags[N_PHONEME_TAB]; // bit 0: not inherited
134
135 typedef struct {
136 char name[N_PHONEME_TAB_NAME];
137 PHONEME_TAB *phoneme_tab_ptr;
138 int n_phonemes;
139 int includes; // also include the phonemes from this other phoneme table
140 } PHONEME_TAB_LIST;
141
142
143
144 // table of phonemes to be replaced with different phonemes, for the current voice
145 #define N_REPLACE_PHONEMES 60
146 typedef struct {
147 unsigned char old_ph;
148 unsigned char new_ph;
149 char type; // 0=always replace, 1=only at end of word
150 } REPLACE_PHONEMES;
151
152 extern int n_replace_phonemes;
153 extern REPLACE_PHONEMES replace_phonemes[N_REPLACE_PHONEMES];
154
155
156 #define PH(c1,c2) (c2<<8)+c1 // combine two characters into an integer for phoneme name
157 #define PH3(c1,c2,c3) (c3<<16)+(c2<<8)+c1
158 #define PhonemeCode2(c1,c2) PhonemeCode((c2<<8)+c1)
159 int LookupPhonemeString(const char *string);
160 int PhonemeCode(unsigned int mnem);
161
162 char *EncodePhonemes(char *p, char *outptr, unsigned char *bad_phoneme);
163 void DecodePhonemes(const char *inptr, char *outptr);
164
165 extern const char *WordToString(unsigned int word);
166
167 extern PHONEME_TAB_LIST phoneme_tab_list[N_PHONEME_TABS];
168 extern int phoneme_tab_number;

Properties

Name Value
svn:executable *

   
Visit the ZANavi Wiki