SpeakJet
Main Page
Classes
Files
Examples
File List
SpeakJet.h
1
// SpeakJet.h
2
//
3
// Author: Mike McCauley (mikem@airspayce.com)
4
// Copyright (C) 2011 Mike McCauley
5
// $Id: SpeakJet.h,v 1.3 2012/11/26 21:01:51 mikem Exp mikem $
6
/// \mainpage SpeakJet library for Arduino
7
///
8
/// This is the Arduino SpeakJet library.
9
/// It provides an object-oriented class for driving a SpeakJet
10
/// http://www.sparkfun.com/datasheets/Components/General/speakjet-usermanual.pdf speech synthesizer chip,
11
/// such as installed on SparkFun VoiceBox shield https://www.sparkfun.com/products/10661
12
///
13
/// It supports speaking of:
14
/// - raw individual phonemes
15
/// - arrays of phonemes
16
/// - words from a custom dictionary or the standard built-in dictionary
17
/// - sentences (sequences of words) from a custom dictionary or the standard built-in dicitonary
18
/// - integers from 0 to over 4 billion
19
/// - strings of digits or IP addresses
20
/// - creation and conversion of custom word-to-phonemes dictionaries
21
///
22
/// The version of the package that this documentation refers to can be downloaded
23
/// from http://www.airspayce.com/mikem/arduino/SpeakJet/SpeakJet-1.4.zip
24
/// You can find the latest version at http://www.airspayce.com/mikem/arduino/SpeakJet
25
///
26
/// Tested with SparkFun VoiceBox on Uno, Duemilanove, Diecimila, Mega.
27
/// Tested with Arduino 0021 and 1.0.2
28
///
29
/// \par Electrical connection to the SpeakJet
30
///
31
/// The connection to the SpeakJet chip requires 3 digital pins:
32
/// - Serial Data Tx from Arduino to the SpeakJet (RS232, using the SoftwereSerial class)
33
/// - Chip ready pin from the SpeakJet 'Speak' to the Arduino (low is ready)
34
/// - Reset from the Arduino to the SpeakJet (high is reset)
35
///
36
/// Naturally, ground and 5V are also required to supply the chip.
37
///
38
/// The SpeakJet library uses SoftwareSerial to send Serial commands at 9600 baud to the SpeakJet chip, using any of the
39
/// Arduino Digital output pins. The default is pin D2. No serial data is read from the SpeakJet chip.
40
///
41
/// The SpeakJet constructor is where you specify the Arduino digital pins to use for each of these functions.
42
/// The default values work with a standard SparkFun VoideBox shield https://www.sparkfun.com/products/10661
43
///
44
/// \par Dictionaries
45
///
46
/// The SpeakJet library comes with a standard dictionary of approximately 1400 words, phrases and sound effects.
47
/// The functions speakWord() and speakWords() speak sound effects and words from this dictionary. It is based on the
48
/// PhraseALator.Dic dictionary file provided by SpeakJet, but converted to a 'C' structure
49
/// for use by this SpeakJet library (see standardDict.cpp).
50
///
51
/// Alternatively you can create your own dictionary (either as a subset of the standard dictionary,
52
/// or from scratch with your own words, or a combination of the two) and use speakWordfromDictionary()
53
/// and speakWordsfromDictionary().
54
///
55
/// The included convertDict.pl perl script reads one or more dictionary files in the same format as
56
/// PhraseALator.Dic and emits a 'C' file suitable for including in a header file or a .c or .cpp file.
57
///
58
/// Also included is a smaller dictionary (numericDict.cpp) that includes mostly only numbers, and is used to speak
59
/// integers and digits with speakNumber() and speakDigits().
60
///
61
/// In SpeakJet, a Dictionary is an array of DictionaryItem structures, terminated by an empty DictionaryItem.
62
/// You can build these by hand in your sketch, or you can rely on convertDict to create them from
63
/// a text .dic file. In any case, it is essential that the Dictionary, and all the words and code sequences it
64
/// points to are in PROGMEN. This will save you RAM.
65
///
66
/// The standard dictionary and it set of 1400 or so words occupies about 30kbytes of Flash program memory.
67
/// This is far biger than some Arduinos can handle, and is quite close to the total permissable program size
68
/// for say the Arduino Uno. Fortunately the standard dictionary is only linked if you use
69
/// speakWord() or speakWords().
70
///
71
/// The supplied standard and numeric dicitonaries only support English, but you could contruct your own
72
/// dictionaries to support other languages.
73
///
74
/// \par convertDict.pl
75
///
76
/// This support script is used to convert text dictionary files into 'C' structures suitable for including in
77
/// sketches or other C program files. It is used to create the numericDict.cpp and standardDict.cpp header
78
/// files that are shippped with the SpeakJet library, but you can use to to create your own dictionary header files.
79
///
80
/// Command line arguments can be used to control the C variable name of the dictionary,
81
/// so you can have several different dictionaries in your sketch.
82
/// It can be used to creat a single dictionary out of one or more dictionary text files.
83
///
84
/// Caution: while the .dic file format permits words to be defined in terms of other words, this is not supported
85
/// by convertDict.pl. Any word defintion that is *not* in terms of basic phonemes is flagged as an error and
86
/// is not added to the dictionary structure. This is mainly to avoid the fx* words int the PhraseALator.Dic file
87
/// being included in the standard dictionary and blowing the size out to more that 32 k.
88
///
89
/// The format of the input dictionary files is:
90
/// [words]
91
/// word=\\PH \\PH \\PH \\PH ....
92
/// where 'word' is the ASCII text of the word to be spoken, and \\PH \\PH ... is a sequence of standard phoneme
93
/// mnemonics or control codes that will be used to speak the word.
94
///
95
/// convertDict.pl will automatically append the EndOfPhrase byte required by every DictionaryEntry code array.
96
///
97
/// \par Examples.
98
///
99
/// A number of example sketches and a test suite illustrating the use of the public functions in SpeakJet is included.
100
///
101
/// \par Installation
102
///
103
/// Install in the usual way: unzip the distribution zip file to the libraries
104
/// sub-folder of your sketchbook.
105
///
106
/// This software is Copyright (C) 2011 Mike McCauley. Use is subject to license
107
/// conditions. The main licensing options available are GPL V2 or Commercial:
108
///
109
/// \par Open Source Licensing GPL V2
110
///
111
/// This is the appropriate option if you want to share the source code of your
112
/// application with everyone you distribute it to, and you also want to give them
113
/// the right to share who uses it. If you wish to use this software under Open
114
/// Source Licensing, you must contribute all your source code to the open source
115
/// community in accordance with the GPL Version 2 when your application is
116
/// distributed. See http://www.gnu.org/copyleft/gpl.html
117
///
118
/// \par Commercial Licensing
119
///
120
/// This is the appropriate option if you are creating proprietary applications
121
/// and you are not prepared to distribute and share the source code of your
122
/// application. Contact info@airspayce.com for details.
123
///
124
/// \par Revision History
125
///
126
/// \version 1.0 Initial release
127
/// \version 1.1 Improve documentation
128
/// \version 1.3 Now Compiles amd runs with Arduino 0021. Added more documentation.
129
/// Constructor invertPin argument
130
/// removed (not available before Arduino 1.0)
131
/// \version 1.4 Updated author and distribution location details to airspayce.com
132
///
133
134
#ifndef SPEAKJET_h
135
#define SPEAKJET_h
136
137
#if ARDUINO >= 100
138
#include <Arduino.h>
139
#else
140
#include <wiring.h>
141
#include <avr/pgmspace.h>
142
// These defs cause trouble on some versions of Arduino
143
#undef abs
144
#undef double
145
#undef round
146
#endif
147
148
#include <SoftwareSerial.h>
149
150
/////////////////////////////////////////////////////////////////////
151
/// \class SpeakJet SpeakJet.h <SpeakJet.h>
152
/// \brief Driver object for SpeakJet chips such as on SparkFun
153
/// VoiceBox shield https://www.sparkfun.com/products/10661
154
///
155
/// Uses SoftwareSerial class to send command codes to the SpeakJet chip.
156
/// Supports a wide range of funcitons for speaking words, phrases, numbers and strings of digits.
157
///
158
class
SpeakJet
:
public
SoftwareSerial
159
{
160
public
:
161
162
/// \brief Structure for translating text words into SpeakJet codes.
163
///
164
/// word is a pointer to the ASCII text of the word to be pronounced.
165
/// codes is an array of SpeakJet phoneme codes that will be used to speak the word.
166
/// It must end with EndOfPhrase (0xff).
167
/// The entire dictionary must also be in PROGMEM.
168
/// See the included dicitonary files standardDict.cpp and numericDict.cpp for examples on
169
/// how to achieve this.
170
/// Alternatively use convertDict.pl to create correctly structured Dictionary from a .dic text file.
171
typedef
struct
172
{
173
const
prog_char*
word
;
///< ASCII text of word to speak (must be in PROGMEM)
174
const
prog_uchar*
codes
;
///< Array of speakjet control codes. End with EndOfPhrase (0xff) (must be in PROGMEM)
175
}
DictionaryEntry
;
176
177
/// Command codes for SpeakJet chip.
178
/// These can be passed to speakCode().
179
/// Arrays of them can be passed to speakCodes(), with an EndOfPhrase at the end.
180
/// Based on http://www.sparkfun.com/datasheets/Components/General/speakjet-usermanual.pdf
181
typedef
enum
182
{
183
Pause0
= 0,
///< Pause 0ms
184
Pause1
= 1,
///< Pause 100ms
185
Pause2
= 2,
///< Pause 200ms
186
Pause3
= 3,
///< Pause 700ms
187
Pause4
= 4,
///< Pause 30ms
188
Pause5
= 5,
///< Pause 60ms
189
Pause6
= 6,
///< Pause 90ms
190
Fast
= 7,
///< Next phoneme at 0.5 speed
191
Slow
= 8,
///< Next phoneme at 1.5 speed
192
Stress
= 14,
///< Next phoneme with some stress
193
Relax
= 15,
///< Next phoneme with relaxation
194
Wait
= 16,
///< Stops and waits for a Start (see manual)
195
Soft
= 18,
///< Stops and waits for a Start (see manual)
196
Volume
= 20,
///< Next octet is volume 0 to 127. Default 96
197
Speed
= 21,
///< Next octet is speed 0 to 127. Default 114
198
Pitch
= 22,
///< Next octet is pitch in Hz = to 255
199
Bend
= 23,
///< Next octet is frequency bend to 15. Default is 5
200
PortCtr
= 24,
///< Next octet is port control value. See manual. Default is 7
201
Port
= 25,
///< Next octet is Port Output Value. See manual. Default is 0
202
Repeat
= 26,
///< Next octet is repeat count. 0 to 255
203
CallPhrase
= 28,
///< Next octet is EEPROM phrase to play and return. See manual.
204
GotoPhrase
= 29,
///< Next octet is EEPROM phgrase to go to. See manual.
205
Delay
= 30,
///< Next octet is delay in multiples of 10ms. 0 to 255.
206
Reset
= 31,
///< Reset Volume Speed, Pitch, Bend to defaults.
207
208
// 32 to 127 reserved
209
210
// 128 to 254 Sound codes
211
// Phonemes, standard names
212
Phoneme_IY
= 128,
///< 70ms Voiced Long Vowel
213
Phoneme_IH
= 129,
///< 70ms Voiced Long Vowel
214
Phoneme_EY
= 130,
///< 70ms Voiced Long Vowel
215
Phoneme_EH
= 131,
///< 70ms Voiced Long Vowel
216
Phoneme_AY
= 132,
///< 70ms Voiced Long Vowel
217
Phoneme_AX
= 133,
///< 70ms Voiced Long Vowel
218
Phoneme_UX
= 134,
///< 70ms Voiced Long Vowel
219
Phoneme_OH
= 135,
///< 70ms Voiced Long Vowel
220
Phoneme_AW
= 136,
///< 70ms Voiced Long Vowel
221
Phoneme_OW
= 137,
///< 70ms Voiced Long Vowel
222
Phoneme_UH
= 138,
///< 70ms Voiced Long Vowel
223
Phoneme_UW
= 139,
///< 70ms Voiced Long Vowel
224
Phoneme_MM
= 140,
///< 70ms Voiced Nasal
225
Phoneme_NE
= 141,
///< 70ms Voiced Nasal
226
Phoneme_NO
= 142,
///< 70ms Voiced Nasal
227
Phoneme_NGE
= 143,
///< 70ms Voiced Nasal
228
Phoneme_NGO
= 144,
///< 70ms Voiced Nasal
229
Phoneme_LE
= 145,
///< 70ms Voiced Resonate
230
Phoneme_LO
= 146,
///< 70ms Voiced Resonate
231
Phoneme_WW
= 147,
///< 70ms Voiced Resonate
232
Phoneme_RR
= 149,
///< 70ms Voiced Resonate
233
Phoneme_IYRR
= 149,
///< 200ms Voiced R Color Vowel
234
Phoneme_EYRR
= 150,
///< 200ms Voiced R Color Vowel
235
Phoneme_AXRR
= 151,
///< 190ms Voiced R Color Vowel
236
Phoneme_AWRR
= 152,
///< 200ms Voiced R Color Vowel
237
Phoneme_OWRR
= 153,
///< 185ms Voiced R Color Vowel
238
Phoneme_EYIY
= 154,
///< 165ms Voiced Diphthong
239
Phoneme_OHIY
= 155,
///< 200ms Voiced Diphthong
240
Phoneme_OWIY
= 156,
///< 225ms Voiced Diphthong
241
Phoneme_OHIH
= 157,
///< 185ms Voiced Diphthong
242
Phoneme_IYEH
= 158,
///< 170ms Voiced Diphthong
243
Phoneme_EHLE
= 159,
///< 140ms Voiced Diphthong
244
Phoneme_IYUW
= 160,
///< 180ms Voiced Diphthong
245
Phoneme_AXUW
= 161,
///< 170ms Voiced Diphthong
246
Phoneme_IHWW
= 162,
///< 170ms Voiced Diphthong
247
Phoneme_AYWW
= 163,
///< 200ms Voiced Diphthong
248
Phoneme_OWWW
= 164,
///< 131ms Voiced Diphthong
249
Phoneme_JH
= 165,
///< 70ms Voiced Affricate
250
Phoneme_VV
= 166,
///< 70ms Voiced Fricative
251
Phoneme_ZZ
= 167,
///< 70ms Voiced Fricative
252
Phoneme_ZH
= 168,
///< 70ms Voiced Fricative
253
Phoneme_DH
= 169,
///< 70ms Voiced Fricative
254
Phoneme_BE
= 170,
///< 45ms Voiced Stop
255
Phoneme_BO
= 171,
///< 45ms Voiced Stop
256
Phoneme_EB
= 172,
///< 10ms Voiced Stop
257
Phoneme_OB
= 173,
///< 10ms Voiced Stop
258
Phoneme_DE
= 174,
///< 45ms Voiced Stop
259
Phoneme_DO
= 174,
///< 45ms Voiced Stop
260
Phoneme_ED
= 176,
///< 10ms Voiced Stop
261
Phoneme_OD
= 177,
///< 10ms Voiced Stop
262
Phoneme_GE
= 178,
///< 55ms Voiced Stop
263
Phoneme_GO
= 179,
///< 55ms Voiced Stop
264
Phoneme_EG
= 180,
///< 55ms Voiced Stop
265
Phoneme_OG
= 181,
///< 55ms Voiced Stop
266
Phoneme_CH
= 182,
///< 70ms Voiceless Affricate
267
Phoneme_HE
= 183,
///< 70ms Voiceless Fricative
268
Phoneme_HO
= 184,
///< 70ms Voiceless Fricative
269
Phoneme_WH
= 185,
///< 70ms Voiceless Fricative
270
Phoneme_FF
= 186,
///< 70ms Voiceless Fricative
271
Phoneme_SE
= 187,
///< 40ms Voiceless Fricative
272
Phoneme_SO
= 188,
///< 40ms Voiceless Fricative
273
Phoneme_SH
= 189,
///< 50ms Voiceless Fricative
274
Phoneme_TH
= 190,
///< 40ms Voiceless Fricative
275
Phoneme_TT
= 191,
///< 50ms Voiceless Stop
276
Phoneme_TU
= 192,
///< 70ms Voiceless Stop
277
Phoneme_TS
= 193,
///< 170ms Voiceless Stop
278
Phoneme_KE
= 194,
///< 55ms Voiceless Stop
279
Phoneme_KO
= 195,
///< 55ms Voiceless Stop
280
Phoneme_EK
= 196,
///< 55ms Voiceless Stop
281
Phoneme_OK
= 197,
///< 45ms Voiceless Stop
282
Phoneme_PE
= 198,
///< 99ms Voiceless Stop
283
Phoneme_PO
= 199,
///< 99ms Voiceless Stop
284
// Robot sound
285
Sound_R0
= 200,
///< 80ms Robot
286
Sound_R1
= 201,
///< 80ms Robot
287
Sound_R2
= 202,
///< 80ms Robot
288
Sound_R3
= 203,
///< 80ms Robot
289
Sound_R4
= 204,
///< 80ms Robot
290
Sound_R5
= 205,
///< 80ms Robot
291
Sound_R6
= 206,
///< 80ms Robot
292
Sound_R7
= 207,
///< 80ms Robot
293
Sound_R8
= 208,
///< 80ms Robot
294
Sound_R9
= 209,
///< 80ms Robot
295
// Alarm sound
296
Sound_A0
= 210,
///< 300ms Alarm
297
Sound_A1
= 211,
///< 101ms Alarm
298
Sound_A2
= 212,
///< 102ms Alarm
299
Sound_A3
= 213,
///< 540ms Alarm
300
Sound_A4
= 214,
///< 530ms Alarm
301
Sound_A5
= 215,
///< 500ms Alarm
302
Sound_A6
= 216,
///< 135ms Alarm
303
Sound_A7
= 217,
///< 600ms Alarm
304
Sound_A8
= 218,
///< 300ms Alarm
305
Sound_A9
= 219,
///< 250ms Alarm
306
// Beeps
307
Sound_B0
= 220,
///< 200ms Beep
308
Sound_B1
= 221,
///< 270ms Beep
309
Sound_B2
= 222,
///< 280ms Beep
310
Sound_B3
= 223,
///< 260ms Beep
311
Sound_B4
= 224,
///< 300ms Beep
312
Sound_B5
= 225,
///< 100ms Beep
313
Sound_B6
= 226,
///< 104ms Beep
314
Sound_B7
= 227,
///< 100ms Beep
315
Sound_B8
= 228,
///< 270ms Beep
316
Sound_B9
= 229,
///< 262ms Beep
317
// Biological
318
Sound_C0
= 230,
///< 160ms Biological
319
Sound_C1
= 231,
///< 300ms Biological
320
Sound_C2
= 232,
///< 182ms Biological
321
Sound_C3
= 233,
///< 120ms Biological
322
Sound_C4
= 234,
///< 175ms Biological
323
Sound_C5
= 235,
///< 350ms Biological
324
Sound_C6
= 236,
///< 160ms Biological
325
Sound_C7
= 237,
///< 260ms Biological
326
Sound_C8
= 238,
///< 95ms Biological
327
Sound_C9
= 239,
///< 75ms Biological
328
// DTMF
329
DTMF_0
= 240,
///< DTMF 0 95ms
330
DTMF_1
= 241,
///< DTMF 1 95ms
331
DTMF_2
= 242,
///< DTMF 2 95ms
332
DTMF_3
= 243,
///< DTMF 3 95ms
333
DTMF_4
= 244,
///< DTMF 4 95ms
334
DTMF_5
= 245,
///< DTMF 5 95ms
335
DTMF_6
= 246,
///< DTMF 6 95ms
336
DTMF_7
= 247,
///< DTMF 7 95ms
337
DTMF_8
= 248,
///< DTMF 8 95ms
338
DTMF_9
= 249,
///< DTMF 9 95ms
339
DTMF_STAR
= 250,
///< DTMF * 95ms
340
DTMF_HASH
= 251,
///< DTMF # 95ms
341
// Miscellaneous
342
Sound_M0
= 252,
///< Sonar ping 125ms
343
Sound_M1
= 253,
///< Pistol shot 250ms
344
Sound_M2
= 254,
///< WOW 530ms
345
346
EndOfPhrase
= 255,
///< End of phrase marker. Required at end of code arrays
347
348
}
CommandCodes
;
349
350
351
/// Constructor.
352
/// Specifies the Arduino digital pins to use to communicate with the SpeakJet chip.
353
/// The default values of the arguments are suitable for use with the standard SparkFun VoiceBox shield.
354
/// You can have multiple instances to talk to different SpeakJet chips, provided they use
355
/// interface pins.
356
/// \param[in] txPin Digital pin to use to send command codes to the SpeakJet. Defaults to 2.
357
/// \param[in] resetPin Digital pin to use to force a reset of the SpeakJet. Defaults to 3.
358
/// \param[in] readyPin Digital pin to use to read if the SpeakJet is ready for another code.
359
/// Defaults to 4, the SPK pin output from the SpeakJet chip.
360
SpeakJet
(uint8_t txPin = 2, uint8_t resetPin = 3, uint8_t readyPin = 4);
361
362
/// Object initialiser.
363
/// This causes the digital interface pins in the constructor to be set for input or output as the case may be
364
/// The SoftwareSerial interface is initialised to 9600 baud, and the SpeakJet is reset by
365
/// forcing the Reset pin high for 100ms.
366
/// \return true if the reset succeeded.
367
bool
init
();
368
369
/// Reset the SpeakJet chip.
370
/// Forces the Reset pin high for 100ms.
371
bool
reset
();
372
373
/// Check if the SpeakJet chip is ready
374
/// to receive another code. Reads the state of the readyPin configured in the constructor. Low is ready.
375
/// \return true if it is ready.
376
bool
isReady
();
377
378
/// Wait until the SpeakJet chip is ready.
379
/// Blocks until isReady() return true.
380
void
waitReady
();
381
382
/// Speak a single phoneme code.
383
/// Waits until the SpeakJet chip is ready, then sends a single code (one of the CommandCodes enum entries)
384
/// This is the basic function used to send all codes to the chip.
385
/// Can also be used to sen control codes like Pause, Volume Speed etc to control the enunciation of following
386
/// Phonemes.
387
/// Returns after the code has been sent.
388
/// \param[in] code One of the CommandCodes enum entries or a raw code number
389
void
speakCode
(uint8_t code);
390
391
/// Speak a an array of phoneme codes.
392
/// Waits until the SpeakJet chip is ready, then sends a single code (one of the CommandCodes enum entries)
393
/// This is the basic function used to send all codes to the chip.
394
/// Returns after the code has been sent.
395
/// \param[in] codes Array of command codes, terminated by EndOfPhrase (255)
396
void
speakCodes
(uint8_t *codes);
397
398
/// Speaks a single dictionary entry
399
/// This low level function sends the code array of a DictionaryEntry to the SpeakJet chip.
400
/// You can call it from your own sketches, but it probably rarely necessary.
401
/// \param[in] dict Pointer to a DictionaryEntry in PROGMEM
402
/// \return true if successful.
403
bool
speakDictionaryEntry
(DictionaryEntry* dict);
404
405
/// Speaks a single word from a Dictionary.
406
/// Searches a Dictionary for an exactly matching word and then sends the corresponding codes
407
/// to the SpeakJet chip.
408
/// Caution: A linear search is currently used.
409
/// \param[in] word The word to speak in the dictionary
410
/// \param[in] dict Pointer to the first of a set of DictionaryEntry structures, one for each word in the Dictionary.
411
/// \return true if successful. False if the word is not present in the dictionary.
412
bool
speakWordFromDictionary
(
const
char
* word, DictionaryEntry* dict);
413
414
/// Speak a sequence of words from a Dictionary.
415
/// The sequnce of words is spit by whitespace and the individual words are spoken one after another,
416
/// with a Pause1 between each word.
417
/// \param[in] words String of space separated words
418
/// \param[in] dict Pointer to the first of a set of DictionaryEntry structures, one for each word in the Dictionary.
419
/// \return true if successful.
420
bool
speakWordsFromDictionary
(
char
* words, DictionaryEntry* dict);
421
422
/// Speak a word from the standard Dictionary.
423
/// If the word is present in the standard dictionary, the codes will be sent to the SpeakJet chip.
424
/// \param[in] word The word to speak in the dictionary
425
/// \return true if successful.
426
bool
speakWord
(
const
char
* word);
427
428
/// Speak a sequence of words from a standard Dictionary.
429
/// \param[in] words String of space separated words
430
/// \return true if successful.
431
bool
speakWords
(
char
* words);
432
433
/// Speak the digits in a string.
434
/// Each digit (and some punctuation) is spoken one charavcter at a time. Suported are:
435
/// - Digits 0 through 9
436
/// - '-' (sp0ken as "plus")
437
/// - '+' (spoken as "minus")
438
/// - '.' (spoken as "dot")
439
/// Other characters are ignored
440
/// \param[in] digits String of digits to be spoken, one at a time
441
/// \return true if successful.
442
bool
speakDigits
(
const
char
* digits);
443
444
/// Speaks an integer number from 0 to 99
445
/// This low level function is used internally, and you probably would not need to call it from your sketch.
446
/// See instead speakNumber()
447
/// \param[in] n Integer from 0 to 99. Returns false if the number exceeds 99.
448
/// \return true if successful.
449
bool
speakNumber99
(uint8_t n);
450
451
/// Speaks an integer number from 0 to 999
452
/// This low level function is used internally, and you probably would not need to call it from your sketch.
453
/// See instead speakNumber()
454
/// \param[in] n Integer from 0 to 99. Returns false if the number exceeds 999.
455
/// \return true if successful.
456
bool
speakNumber999
(uint16_t n);
457
458
/// Speaks an integer number from 0 to (2^32 -1)
459
/// Converts the integer into an conventional English phrase for saying he number out loud such as:
460
/// 0 -> "zero"
461
/// 9 -> "nine"
462
/// 10 -> "ten"
463
/// 999 -> "nine hundred and ninety nine"
464
/// 1000 -> "one thousand"
465
/// 1001 -> "one thousand and one"
466
/// 65377 -> "sixty five thousand three hundred and seventy seven"
467
/// \param[in] n integer number from 0 to (2^32 -1)
468
/// \return true if successful.
469
bool
speakNumber
(uint32_t n);
470
471
472
private
:
473
474
/// The digital out pin used to issue a reset to the SpeakJet chip
475
uint8_t _resetPin;
476
477
/// The digital input pin used to check whether the SpeakJet chip is ready for another code.
478
uint8_t _readyPin;
479
480
};
481
482
483
/// @example test.pde
484
/// Test suite sketch.
485
/// Tests all the SpeakJet library calls, and shows how to call them.
486
/// Demonstrates the use of custom and standard dictionaries, and the numeric dicitonary
487
/// for digits and numbers.
488
/// Uses the standard dictionary and therefore links to about 32K in size
489
/// which will not fit in some Arduinos.
490
/// Tested on Arduino Uno.
491
#endif
Generated by
1.8.1