eSpeak NG is an open source speech synthesizer that supports more than hundred languages and accents.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

speak_lib.h 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672
  1. #ifndef SPEAK_LIB_H
  2. #define SPEAK_LIB_H
  3. /***************************************************************************
  4. * Copyright (C) 2005 to 2012 by Jonathan Duddington *
  5. * email: [email protected] *
  6. * *
  7. * This program is free software; you can redistribute it and/or modify *
  8. * it under the terms of the GNU General Public License as published by *
  9. * the Free Software Foundation; either version 3 of the License, or *
  10. * (at your option) any later version. *
  11. * *
  12. * This program is distributed in the hope that it will be useful, *
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  15. * GNU General Public License for more details. *
  16. * *
  17. * You should have received a copy of the GNU General Public License *
  18. * along with this program; if not, see: *
  19. * <http://www.gnu.org/licenses/>. *
  20. ***************************************************************************/
  21. /*************************************************************/
  22. /* This is the header file for the library version of espeak */
  23. /* */
  24. /*************************************************************/
  25. #include <stdio.h>
  26. #include <stddef.h>
  27. #ifdef __WIN32__
  28. #define ESPEAK_API __declspec(dllexport)
  29. #else
  30. #define ESPEAK_API
  31. #endif
  32. #define ESPEAK_API_REVISION 9
  33. /*
  34. Revision 2
  35. Added parameter "options" to eSpeakInitialize()
  36. Revision 3
  37. Added espeakWORDGAP to espeak_PARAMETER
  38. Revision 4
  39. Added flags parameter to espeak_CompileDictionary()
  40. Revision 5
  41. Added espeakCHARS_16BIT
  42. Revision 6
  43. Added macros: espeakRATE_MINIMUM, espeakRATE_MAXIMUM, espeakRATE_NORMAL
  44. Revision 7 24.Dec.2011
  45. Changed espeak_EVENT structure to add id.string[] for phoneme mnemonics.
  46. Added espeakINITIALIZE_PHONEME_IPA option for espeak_Initialize() to report phonemes as IPA names.
  47. Revision 8 26.Apr.2013
  48. Added function espeak_TextToPhonemes().
  49. Revision 9 30.May.2013
  50. Changed function espeak_TextToPhonemes().
  51. */
  52. /********************/
  53. /* Initialization */
  54. /********************/
  55. // values for 'value' in espeak_SetParameter(espeakRATE, value, 0), nominally in words-per-minute
  56. #define espeakRATE_MINIMUM 80
  57. #define espeakRATE_MAXIMUM 450
  58. #define espeakRATE_NORMAL 175
  59. typedef enum {
  60. espeakEVENT_LIST_TERMINATED = 0, // Retrieval mode: terminates the event list.
  61. espeakEVENT_WORD = 1, // Start of word
  62. espeakEVENT_SENTENCE = 2, // Start of sentence
  63. espeakEVENT_MARK = 3, // Mark
  64. espeakEVENT_PLAY = 4, // Audio element
  65. espeakEVENT_END = 5, // End of sentence or clause
  66. espeakEVENT_MSG_TERMINATED = 6, // End of message
  67. espeakEVENT_PHONEME = 7, // Phoneme, if enabled in espeak_Initialize()
  68. espeakEVENT_SAMPLERATE = 8 // internal use, set sample rate
  69. } espeak_EVENT_TYPE;
  70. typedef struct {
  71. espeak_EVENT_TYPE type;
  72. unsigned int unique_identifier; // message identifier (or 0 for key or character)
  73. int text_position; // the number of characters from the start of the text
  74. int length; // word length, in characters (for espeakEVENT_WORD)
  75. int audio_position; // the time in mS within the generated speech output data
  76. int sample; // sample id (internal use)
  77. void* user_data; // pointer supplied by the calling program
  78. union {
  79. int number; // used for WORD and SENTENCE events.
  80. const char *name; // used for MARK and PLAY events. UTF8 string
  81. char string[8]; // used for phoneme names (UTF8). Terminated by a zero byte unless the name needs the full 8 bytes.
  82. } id;
  83. } espeak_EVENT;
  84. /*
  85. When a message is supplied to espeak_synth, the request is buffered and espeak_synth returns. When the message is really processed, the callback function will be repetedly called.
  86. In RETRIEVAL mode, the callback function supplies to the calling program the audio data and an event list terminated by 0 (LIST_TERMINATED).
  87. In PLAYBACK mode, the callback function is called as soon as an event happens.
  88. For example suppose that the following message is supplied to espeak_Synth:
  89. "hello, hello."
  90. * Once processed in RETRIEVAL mode, it could lead to 3 calls of the callback function :
  91. ** Block 1:
  92. <audio data> +
  93. List of events: SENTENCE + WORD + LIST_TERMINATED
  94. ** Block 2:
  95. <audio data> +
  96. List of events: WORD + END + LIST_TERMINATED
  97. ** Block 3:
  98. no audio data
  99. List of events: MSG_TERMINATED + LIST_TERMINATED
  100. * Once processed in PLAYBACK mode, it could lead to 5 calls of the callback function:
  101. ** SENTENCE
  102. ** WORD (call when the sounds are actually played)
  103. ** WORD
  104. ** END (call when the end of sentence is actually played.)
  105. ** MSG_TERMINATED
  106. The MSG_TERMINATED event is the last event. It can inform the calling program to clear the user data related to the message.
  107. So if the synthesis must be stopped, the callback function is called for each pending message with the MSG_TERMINATED event.
  108. A MARK event indicates a <mark> element in the text.
  109. A PLAY event indicates an <audio> element in the text, for which the calling program should play the named sound file.
  110. */
  111. typedef enum {
  112. POS_CHARACTER = 1,
  113. POS_WORD,
  114. POS_SENTENCE
  115. } espeak_POSITION_TYPE;
  116. typedef enum {
  117. /* PLAYBACK mode: plays the audio data, supplies events to the calling program*/
  118. AUDIO_OUTPUT_PLAYBACK,
  119. /* RETRIEVAL mode: supplies audio data and events to the calling program */
  120. AUDIO_OUTPUT_RETRIEVAL,
  121. /* SYNCHRONOUS mode: as RETRIEVAL but doesn't return until synthesis is completed */
  122. AUDIO_OUTPUT_SYNCHRONOUS,
  123. /* Synchronous playback */
  124. AUDIO_OUTPUT_SYNCH_PLAYBACK
  125. } espeak_AUDIO_OUTPUT;
  126. typedef enum {
  127. EE_OK=0,
  128. EE_INTERNAL_ERROR=-1,
  129. EE_BUFFER_FULL=1,
  130. EE_NOT_FOUND=2
  131. } espeak_ERROR;
  132. #define espeakINITIALIZE_PHONEME_EVENTS 0x0001
  133. #define espeakINITIALIZE_PHONEME_IPA 0x0002
  134. #define espeakINITIALIZE_DONT_EXIT 0x8000
  135. #ifdef __cplusplus
  136. extern "C"
  137. #endif
  138. ESPEAK_API int espeak_Initialize(espeak_AUDIO_OUTPUT output, int buflength, const char *path, int options);
  139. /* Must be called before any synthesis functions are called.
  140. output: the audio data can either be played by eSpeak or passed back by the SynthCallback function.
  141. buflength: The length in mS of sound buffers passed to the SynthCallback function.
  142. Value=0 gives a default of 200mS.
  143. This paramater is only used for AUDIO_OUTPUT_RETRIEVAL and AUDIO_OUTPUT_SYNCHRONOUS modes.
  144. path: The directory which contains the espeak-data directory, or NULL for the default location.
  145. options: bit 0: 1=allow espeakEVENT_PHONEME events.
  146. bit 1: 1= espeakEVENT_PHONEME events give IPA phoneme names, not eSpeak phoneme names
  147. bit 15: 1=don't exit if espeak_data is not found (used for --help)
  148. Returns: sample rate in Hz, or -1 (EE_INTERNAL_ERROR).
  149. */
  150. typedef int (t_espeak_callback)(short*, int, espeak_EVENT*);
  151. #ifdef __cplusplus
  152. extern "C"
  153. #endif
  154. ESPEAK_API void espeak_SetSynthCallback(t_espeak_callback* SynthCallback);
  155. /* Must be called before any synthesis functions are called.
  156. This specifies a function in the calling program which is called when a buffer of
  157. speech sound data has been produced.
  158. The callback function is of the form:
  159. int SynthCallback(short *wav, int numsamples, espeak_EVENT *events);
  160. wav: is the speech sound data which has been produced.
  161. NULL indicates that the synthesis has been completed.
  162. numsamples: is the number of entries in wav. This number may vary, may be less than
  163. the value implied by the buflength parameter given in espeak_Initialize, and may
  164. sometimes be zero (which does NOT indicate end of synthesis).
  165. events: an array of espeak_EVENT items which indicate word and sentence events, and
  166. also the occurance if <mark> and <audio> elements within the text. The list of
  167. events is terminated by an event of type = 0.
  168. Callback returns: 0=continue synthesis, 1=abort synthesis.
  169. */
  170. #ifdef __cplusplus
  171. extern "C"
  172. #endif
  173. ESPEAK_API void espeak_SetUriCallback(int (*UriCallback)(int, const char*, const char*));
  174. /* This function may be called before synthesis functions are used, in order to deal with
  175. <audio> tags. It specifies a callback function which is called when an <audio> element is
  176. encountered and allows the calling program to indicate whether the sound file which
  177. is specified in the <audio> element is available and is to be played.
  178. The callback function is of the form:
  179. int UriCallback(int type, const char *uri, const char *base);
  180. type: type of callback event. Currently only 1= <audio> element
  181. uri: the "src" attribute from the <audio> element
  182. base: the "xml:base" attribute (if any) from the <speak> element
  183. Return: 1=don't play the sound, but speak the text alternative.
  184. 0=place a PLAY event in the event list at the point where the <audio> element
  185. occurs. The calling program can then play the sound at that point.
  186. */
  187. /********************/
  188. /* Synthesis */
  189. /********************/
  190. #define espeakCHARS_AUTO 0
  191. #define espeakCHARS_UTF8 1
  192. #define espeakCHARS_8BIT 2
  193. #define espeakCHARS_WCHAR 3
  194. #define espeakCHARS_16BIT 4
  195. #define espeakSSML 0x10
  196. #define espeakPHONEMES 0x100
  197. #define espeakENDPAUSE 0x1000
  198. #define espeakKEEP_NAMEDATA 0x2000
  199. #ifdef __cplusplus
  200. extern "C"
  201. #endif
  202. ESPEAK_API espeak_ERROR espeak_Synth(const void *text,
  203. size_t size,
  204. unsigned int position,
  205. espeak_POSITION_TYPE position_type,
  206. unsigned int end_position,
  207. unsigned int flags,
  208. unsigned int* unique_identifier,
  209. void* user_data);
  210. /* Synthesize speech for the specified text. The speech sound data is passed to the calling
  211. program in buffers by means of the callback function specified by espeak_SetSynthCallback(). The command is asynchronous: it is internally buffered and returns as soon as possible. If espeak_Initialize was previously called with AUDIO_OUTPUT_PLAYBACK as argument, the sound data are played by eSpeak.
  212. text: The text to be spoken, terminated by a zero character. It may be either 8-bit characters,
  213. wide characters (wchar_t), or UTF8 encoding. Which of these is determined by the "flags"
  214. parameter.
  215. size: Equal to (or greatrer than) the size of the text data, in bytes. This is used in order
  216. to allocate internal storage space for the text. This value is not used for
  217. AUDIO_OUTPUT_SYNCHRONOUS mode.
  218. position: The position in the text where speaking starts. Zero indicates speak from the
  219. start of the text.
  220. position_type: Determines whether "position" is a number of characters, words, or sentences.
  221. Values:
  222. end_position: If set, this gives a character position at which speaking will stop. A value
  223. of zero indicates no end position.
  224. flags: These may be OR'd together:
  225. Type of character codes, one of:
  226. espeakCHARS_UTF8 UTF8 encoding
  227. espeakCHARS_8BIT The 8 bit ISO-8859 character set for the particular language.
  228. espeakCHARS_AUTO 8 bit or UTF8 (this is the default)
  229. espeakCHARS_WCHAR Wide characters (wchar_t)
  230. espeakCHARS_16BIT 16 bit characters.
  231. espeakSSML Elements within < > are treated as SSML elements, or if not recognised are ignored.
  232. espeakPHONEMES Text within [[ ]] is treated as phonemes codes (in espeak's Hirshenbaum encoding).
  233. espeakENDPAUSE If set then a sentence pause is added at the end of the text. If not set then
  234. this pause is suppressed.
  235. unique_identifier: This must be either NULL, or point to an integer variable to
  236. which eSpeak writes a message identifier number.
  237. eSpeak includes this number in espeak_EVENT messages which are the result of
  238. this call of espeak_Synth().
  239. user_data: a pointer (or NULL) which will be passed to the callback function in
  240. espeak_EVENT messages.
  241. Return: EE_OK: operation achieved
  242. EE_BUFFER_FULL: the command can not be buffered;
  243. you may try after a while to call the function again.
  244. EE_INTERNAL_ERROR.
  245. */
  246. #ifdef __cplusplus
  247. extern "C"
  248. #endif
  249. ESPEAK_API espeak_ERROR espeak_Synth_Mark(const void *text,
  250. size_t size,
  251. const char *index_mark,
  252. unsigned int end_position,
  253. unsigned int flags,
  254. unsigned int* unique_identifier,
  255. void* user_data);
  256. /* Synthesize speech for the specified text. Similar to espeak_Synth() but the start position is
  257. specified by the name of a <mark> element in the text.
  258. index_mark: The "name" attribute of a <mark> element within the text which specified the
  259. point at which synthesis starts. UTF8 string.
  260. For the other parameters, see espeak_Synth()
  261. Return: EE_OK: operation achieved
  262. EE_BUFFER_FULL: the command can not be buffered;
  263. you may try after a while to call the function again.
  264. EE_INTERNAL_ERROR.
  265. */
  266. #ifdef __cplusplus
  267. extern "C"
  268. #endif
  269. ESPEAK_API espeak_ERROR espeak_Key(const char *key_name);
  270. /* Speak the name of a keyboard key.
  271. If key_name is a single character, it speaks the name of the character.
  272. Otherwise, it speaks key_name as a text string.
  273. Return: EE_OK: operation achieved
  274. EE_BUFFER_FULL: the command can not be buffered;
  275. you may try after a while to call the function again.
  276. EE_INTERNAL_ERROR.
  277. */
  278. #ifdef __cplusplus
  279. extern "C"
  280. #endif
  281. ESPEAK_API espeak_ERROR espeak_Char(wchar_t character);
  282. /* Speak the name of the given character
  283. Return: EE_OK: operation achieved
  284. EE_BUFFER_FULL: the command can not be buffered;
  285. you may try after a while to call the function again.
  286. EE_INTERNAL_ERROR.
  287. */
  288. /***********************/
  289. /* Speech Parameters */
  290. /***********************/
  291. typedef enum {
  292. espeakSILENCE=0, /* internal use */
  293. espeakRATE=1,
  294. espeakVOLUME=2,
  295. espeakPITCH=3,
  296. espeakRANGE=4,
  297. espeakPUNCTUATION=5,
  298. espeakCAPITALS=6,
  299. espeakWORDGAP=7,
  300. espeakOPTIONS=8, // reserved for misc. options. not yet used
  301. espeakINTONATION=9,
  302. espeakRESERVED1=10,
  303. espeakRESERVED2=11,
  304. espeakEMPHASIS, /* internal use */
  305. espeakLINELENGTH, /* internal use */
  306. espeakVOICETYPE, // internal, 1=mbrola
  307. N_SPEECH_PARAM /* last enum */
  308. } espeak_PARAMETER;
  309. typedef enum {
  310. espeakPUNCT_NONE=0,
  311. espeakPUNCT_ALL=1,
  312. espeakPUNCT_SOME=2
  313. } espeak_PUNCT_TYPE;
  314. #ifdef __cplusplus
  315. extern "C"
  316. #endif
  317. ESPEAK_API espeak_ERROR espeak_SetParameter(espeak_PARAMETER parameter, int value, int relative);
  318. /* Sets the value of the specified parameter.
  319. relative=0 Sets the absolute value of the parameter.
  320. relative=1 Sets a relative value of the parameter.
  321. parameter:
  322. espeakRATE: speaking speed in word per minute. Values 80 to 450.
  323. espeakVOLUME: volume in range 0-200 or more.
  324. 0=silence, 100=normal full volume, greater values may produce amplitude compression or distortion
  325. espeakPITCH: base pitch, range 0-100. 50=normal
  326. espeakRANGE: pitch range, range 0-100. 0-monotone, 50=normal
  327. espeakPUNCTUATION: which punctuation characters to announce:
  328. value in espeak_PUNCT_TYPE (none, all, some),
  329. see espeak_GetParameter() to specify which characters are announced.
  330. espeakCAPITALS: announce capital letters by:
  331. 0=none,
  332. 1=sound icon,
  333. 2=spelling,
  334. 3 or higher, by raising pitch. This values gives the amount in Hz by which the pitch
  335. of a word raised to indicate it has a capital letter.
  336. espeakWORDGAP: pause between words, units of 10mS (at the default speed)
  337. Return: EE_OK: operation achieved
  338. EE_BUFFER_FULL: the command can not be buffered;
  339. you may try after a while to call the function again.
  340. EE_INTERNAL_ERROR.
  341. */
  342. #ifdef __cplusplus
  343. extern "C"
  344. #endif
  345. ESPEAK_API int espeak_GetParameter(espeak_PARAMETER parameter, int current);
  346. /* current=0 Returns the default value of the specified parameter.
  347. current=1 Returns the current value of the specified parameter, as set by SetParameter()
  348. */
  349. #ifdef __cplusplus
  350. extern "C"
  351. #endif
  352. ESPEAK_API espeak_ERROR espeak_SetPunctuationList(const wchar_t *punctlist);
  353. /* Specified a list of punctuation characters whose names are to be spoken when the
  354. value of the Punctuation parameter is set to "some".
  355. punctlist: A list of character codes, terminated by a zero character.
  356. Return: EE_OK: operation achieved
  357. EE_BUFFER_FULL: the command can not be buffered;
  358. you may try after a while to call the function again.
  359. EE_INTERNAL_ERROR.
  360. */
  361. #ifdef __cplusplus
  362. extern "C"
  363. #endif
  364. ESPEAK_API void espeak_SetPhonemeTrace(int value, FILE *stream);
  365. /* Controls the output of phoneme symbols for the text
  366. value=0 No phoneme output (default)
  367. value=1 Output the translated phoneme symbols for the text
  368. value=2 as (1), but also output a trace of how the translation was done (matching rules and list entries)
  369. value=3 as (1), but produces IPA rather than ascii phoneme names
  370. stream output stream for the phoneme symbols (and trace). If stream=NULL then it uses stdout.
  371. */
  372. #ifdef __cplusplus
  373. extern "C"
  374. #endif
  375. ESPEAK_API const char *espeak_TextToPhonemes(const void **textptr, int textmode, int phonememode);
  376. /* Translates text into phonemes. Call espeak_SetVoiceByName() first, to select a language.
  377. It returns a pointer to a character string which contains the phonemes for the text up to
  378. end of a sentence, or comma, semicolon, colon, or similar punctuation.
  379. textptr: The address of a pointer to the input text which is terminated by a zero character.
  380. On return, the pointer has been advanced past the text which has been translated, or else set
  381. to NULL to indicate that the end of the text has been reached.
  382. textmode: Type of character codes, one of:
  383. espeakCHARS_UTF8 UTF8 encoding
  384. espeakCHARS_8BIT The 8 bit ISO-8859 character set for the particular language.
  385. espeakCHARS_AUTO 8 bit or UTF8 (this is the default)
  386. espeakCHARS_WCHAR Wide characters (wchar_t)
  387. espeakCHARS_16BIT 16 bit characters.
  388. phonememode: bits0-3:
  389. 0= just phonemes.
  390. 1= include ties (U+361) for phoneme names of more than one letter.
  391. 2= include zero-width-joiner for phoneme names of more than one letter.
  392. 3= separate phonemes with underscore characters.
  393. bits 4-7:
  394. 0= eSpeak's ascii phoneme names.
  395. 1= International Phonetic Alphabet (as UTF-8 characters).
  396. */
  397. #ifdef __cplusplus
  398. extern "C"
  399. #endif
  400. ESPEAK_API void espeak_CompileDictionary(const char *path, FILE *log, int flags);
  401. /* Compile pronunciation dictionary for a language which corresponds to the currently
  402. selected voice. The required voice should be selected before calling this function.
  403. path: The directory which contains the language's '_rules' and '_list' files.
  404. 'path' should end with a path separator character ('/').
  405. log: Stream for error reports and statistics information. If log=NULL then stderr will be used.
  406. flags: Bit 0: include source line information for debug purposes (This is displayed with the
  407. -X command line option).
  408. */
  409. /***********************/
  410. /* Voice Selection */
  411. /***********************/
  412. // voice table
  413. typedef struct {
  414. const char *name; // a given name for this voice. UTF8 string.
  415. const char *languages; // list of pairs of (byte) priority + (string) language (and dialect qualifier)
  416. const char *identifier; // the filename for this voice within espeak-data/voices
  417. unsigned char gender; // 0=none 1=male, 2=female,
  418. unsigned char age; // 0=not specified, or age in years
  419. unsigned char variant; // only used when passed as a parameter to espeak_SetVoiceByProperties
  420. unsigned char xx1; // for internal use
  421. int score; // for internal use
  422. void *spare; // for internal use
  423. } espeak_VOICE;
  424. /* Note: The espeak_VOICE structure is used for two purposes:
  425. 1. To return the details of the available voices.
  426. 2. As a parameter to espeak_SetVoiceByProperties() in order to specify selection criteria.
  427. In (1), the "languages" field consists of a list of (UTF8) language names for which this voice
  428. may be used, each language name in the list is terminated by a zero byte and is also preceded by
  429. a single byte which gives a "priority" number. The list of languages is terminated by an
  430. additional zero byte.
  431. A language name consists of a language code, optionally followed by one or more qualifier (dialect)
  432. names separated by hyphens (eg. "en-uk"). A voice might, for example, have languages "en-uk" and
  433. "en". Even without "en" listed, voice would still be selected for the "en" language (because
  434. "en-uk" is related) but at a lower priority.
  435. The priority byte indicates how the voice is preferred for the language. A low number indicates a
  436. more preferred voice, a higher number indicates a less preferred voice.
  437. In (2), the "languages" field consists simply of a single (UTF8) language name, with no preceding
  438. priority byte.
  439. */
  440. #ifdef __cplusplus
  441. extern "C"
  442. #endif
  443. ESPEAK_API const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec);
  444. /* Reads the voice files from espeak-data/voices and creates an array of espeak_VOICE pointers.
  445. The list is terminated by a NULL pointer
  446. If voice_spec is NULL then all voices are listed.
  447. If voice spec is given, then only the voices which are compatible with the voice_spec
  448. are listed, and they are listed in preference order.
  449. */
  450. #ifdef __cplusplus
  451. extern "C"
  452. #endif
  453. ESPEAK_API espeak_ERROR espeak_SetVoiceByName(const char *name);
  454. /* Searches for a voice with a matching "name" field. Language is not considered.
  455. "name" is a UTF8 string.
  456. Return: EE_OK: operation achieved
  457. EE_BUFFER_FULL: the command can not be buffered;
  458. you may try after a while to call the function again.
  459. EE_INTERNAL_ERROR.
  460. */
  461. #ifdef __cplusplus
  462. extern "C"
  463. #endif
  464. ESPEAK_API espeak_ERROR espeak_SetVoiceByProperties(espeak_VOICE *voice_spec);
  465. /* An espeak_VOICE structure is used to pass criteria to select a voice. Any of the following
  466. fields may be set:
  467. name NULL, or a voice name
  468. languages NULL, or a single language string (with optional dialect), eg. "en-uk", or "en"
  469. gender 0=not specified, 1=male, 2=female
  470. age 0=not specified, or an age in years
  471. variant After a list of candidates is produced, scored and sorted, "variant" is used to index
  472. that list and choose a voice.
  473. variant=0 takes the top voice (i.e. best match). variant=1 takes the next voice, etc
  474. */
  475. #ifdef __cplusplus
  476. extern "C"
  477. #endif
  478. ESPEAK_API espeak_VOICE *espeak_GetCurrentVoice(void);
  479. /* Returns the espeak_VOICE data for the currently selected voice.
  480. This is not affected by temporary voice changes caused by SSML elements such as <voice> and <s>
  481. */
  482. #ifdef __cplusplus
  483. extern "C"
  484. #endif
  485. ESPEAK_API espeak_ERROR espeak_Cancel(void);
  486. /* Stop immediately synthesis and audio output of the current text. When this
  487. function returns, the audio output is fully stopped and the synthesizer is ready to
  488. synthesize a new message.
  489. Return: EE_OK: operation achieved
  490. EE_INTERNAL_ERROR.
  491. */
  492. #ifdef __cplusplus
  493. extern "C"
  494. #endif
  495. ESPEAK_API int espeak_IsPlaying(void);
  496. /* Returns 1 if audio is played, 0 otherwise.
  497. */
  498. #ifdef __cplusplus
  499. extern "C"
  500. #endif
  501. ESPEAK_API espeak_ERROR espeak_Synchronize(void);
  502. /* This function returns when all data have been spoken.
  503. Return: EE_OK: operation achieved
  504. EE_INTERNAL_ERROR.
  505. */
  506. #ifdef __cplusplus
  507. extern "C"
  508. #endif
  509. ESPEAK_API espeak_ERROR espeak_Terminate(void);
  510. /* last function to be called.
  511. Return: EE_OK: operation achieved
  512. EE_INTERNAL_ERROR.
  513. */
  514. #ifdef __cplusplus
  515. extern "C"
  516. #endif
  517. ESPEAK_API const char *espeak_Info(const char **path_data);
  518. /* Returns the version number string.
  519. path_data returns the path to espeak_data
  520. */
  521. #endif