text2speech library  v0.5.5
C language translation of Phil Pilgrim's Phonemic Speech Syntesizer pronouces phonetically spelled phrases in strings.
text2speech.h
Go to the documentation of this file.
1 
21 #ifdef __cplusplus
22 extern "C"
23 {
24 #endif
25 
26 
27 #ifndef DOXYGEN_SHOULD_SKIP_THIS
28 
29  #ifndef VocalTract_Class_Defined__
30  #define VocalTract_Class_Defined__
31 
32  #include <stdint.h>
33 
34  // frame buffers (2n)
35  #define frame_buffers (8)
36  /* for stepsize */
37  /* for aa..ff */
38  // 16 bytes per frame
39  #define frame_bytes ((3 + 13))
40  // 4 longs per frame
41  #define frame_longs ((frame_bytes / 4))
42  #define frame_buffer_bytes ((frame_bytes * frame_buffers))
43  #define frame_buffer_longs ((frame_longs * frame_buffers))
44 
45  typedef struct VocalTract {
46  volatile int32_t cog, tract, pace;
47  // 3 longs ...must
48  volatile int32_t index, attenuation, sample;
49  // 6 longs ...be
50  volatile int32_t dira_, dirb_, ctra_, ctrb_, frqa_, cnt_;
51  // many longs ...contiguous
52  volatile int32_t frames[frame_buffer_longs];
53  } VocalTract;
54 
55  int32_t VocalTract_start( VocalTract *talkId, int32_t tract_ptr, int32_t pos_pin, int32_t neg_pin, int32_t fm_offset);
56  int32_t VocalTract_stop( VocalTract *talkId );
57  int32_t VocalTract_set_attenuation( VocalTract *talkId, int32_t level);
58  int32_t VocalTract_set_pace( VocalTract *talkId, int32_t percentage);
59  int32_t VocalTract_go( VocalTract *talkId, int32_t time);
60  int32_t VocalTract_full( VocalTract *talkId );
61  int32_t VocalTract_empty( VocalTract *talkId );
62  int32_t VocalTract_sample_ptr( VocalTract *talkId );
63  int32_t VocalTract_aural_id( VocalTract *talkId );
64  #endif //VocalTract_Class_Defined__
65 
66 #endif // DOXYGEN_SHOULD_SKIP_THIS
67 
68 //
69 // automatically generated by spin2cpp v1.93 on Thu Oct 08 13:24:57 2015
70 // spin2cpp --ccode --main talk_demo2.spin
71 //
72 
73 #ifndef talk_Class_Defined__
74 #define talk_Class_Defined__
75 
76 #include <stdint.h>
77 
78 #ifndef DOXYGEN_SHOULD_SKIP_THIS
79 
80  #define ZERO (255)
81  #define AAZ (0)
82  #define GAZ (1)
83  #define GP (2)
84  #define VP (3)
85  #define VR (4)
86  #define F1 (5)
87  #define F2 (6)
88  #define F3 (7)
89  #define F4 (8)
90  #define NAZ (9)
91  #define NF (10)
92  #define FAZ (11)
93  #define FF (12)
94  #define AA (13)
95  #define GA (14)
96  #define NA (15)
97  #define FA (16)
98  #define GPS (17)
99  #define QT (18)
100 
101  typedef struct talk {
102  volatile uint16_t glide, base_freq, gain, dilate;
103  volatile uint8_t vt[18], vtp[18], cbuf[300], speaker[10];
104  volatile uint8_t vocal_cog, aspirate, initial_k, initial_g, whisper, volume;
105  VocalTract v;
106  } talk;
107 
108 #endif // DOXYGEN_SHOULD_SKIP_THIS
109 
123 talk *talk_run(int pin, int npin);
124 
131 void talk_end(talk *talkId);
132 
145 int32_t talk_set_speaker( talk *talkId, int32_t spkr, int32_t base);
146 
157 int32_t talk_spell( talk *talkId, char *ptr);
158 
159 
249 int32_t talk_say( talk *talkId, char *ptr);
250 
251 
259 void talk_setVolume(talk *self, int level);
260 
261 
262 #endif //talk_Class_Defined__
263 
264 #ifdef __cplusplus
265 }
266 #endif
267 
268 //
269 // automatically generated by spin2cpp v1.93 on Thu Oct 08 13:24:57 2015
270 // spin2cpp --ccode --main talk_demo2.spin
271 //
272 
273 
274 /*
275 ''Phonemic voice synthesizer.
276 ''
277 ''Original copyright (C) 2006 Philip C. Pilgrim
278 ''
279 ''This program is free software; you can redistribute it and/or modify
280 ''it under the terms of the GNU General Public License as published by
281 ''the Free Software Foundation; either version 2 of the License.
282 ''
283 ''This program is distributed in the hope that it will be useful,
284 ''but WITHOUT ANY WARRANTY; without even the implied warranty of
285 ''MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
286 ''GNU General Public License for more details.
287 ''
288 ''You should have received a copy of the GNU General Public License
289 ''along with this program; if not, write to the Free Software
290 ''Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
291 ''
292 */
293 
void talk_setVolume(talk *self, int level)
set volume for all speakers.
int32_t talk_spell(talk *talkId, char *ptr)
Pronounce the letters in a character string.
int32_t talk_set_speaker(talk *talkId, int32_t spkr, int32_t base)
Create speaker numbers, each with a unique tone.
talk * talk_run(int pin, int npin)
Run a talk process, uses a cog.
int32_t talk_say(talk *talkId, char *ptr)
Pronounce speech using strings spelled phonetically. Make sure to look over the function details (fol...
void talk_end(talk *talkId)
End a talk process and recover a cog.