3
3
/***************************************************************************
4
* Copyright (C) 2005 to 2007 by Jonathan Duddington *
4
* Copyright (C) 2005 to 2010 by Jonathan Duddington *
5
5
* email: jonsd@users.sourceforge.net *
7
7
* This program is free software; you can redistribute it and/or modify *
24
24
/* This is the header file for the library version of espeak */
26
26
/*************************************************************/
27
#define ESPEAK_API __declspec(dllexport)
31
#define ESPEAK_API_REVISION 5
31
#define ESPEAK_API_REVISION 6
34
34
Added parameter "options" to eSpeakInitialize()
43
43
Added espeakCHARS_16BIT
46
Added macros: espeakRATE_MINIMUM, espeakRATE_MAXIMUM, espeakRATE_NORMAL
45
48
/********************/
46
49
/* Initialization */
47
50
/********************/
52
// values for 'value' in espeak_SetParameter(espeakRATE, value, 0), nominally in words-per-minute
53
#define espeakRATE_MINIMUM 80
54
#define espeakRATE_MAXIMUM 450
55
#define espeakRATE_NORMAL 175
51
59
espeakEVENT_LIST_TERMINATED = 0, // Retrieval mode: terminates the event list.
52
60
espeakEVENT_WORD = 1, // Start of word
53
espeakEVENT_SENTENCE, // Start of sentence
54
espeakEVENT_MARK, // Mark
55
espeakEVENT_PLAY, // Audio element
56
espeakEVENT_END, // End of sentence or clause
57
espeakEVENT_MSG_TERMINATED, // End of message
58
espeakEVENT_PHONEME // Phoneme, if enabled in espeak_Initialize()
61
espeakEVENT_SENTENCE = 2, // Start of sentence
62
espeakEVENT_MARK = 3, // Mark
63
espeakEVENT_PLAY = 4, // Audio element
64
espeakEVENT_END = 5, // End of sentence or clause
65
espeakEVENT_MSG_TERMINATED = 6, // End of message
66
espeakEVENT_PHONEME = 7, // Phoneme, if enabled in espeak_Initialize()
67
espeakEVENT_SAMPLERATE = 8 // internal use, set sample rate
59
68
} espeak_EVENT_TYPE;
152
161
#ifdef __cplusplus
155
ESPEAK_API int espeak_Initialize(espeak_AUDIO_OUTPUT output, int buflength, const char *path, int options);
164
int espeak_Initialize(espeak_AUDIO_OUTPUT output, int buflength, const char *path, int options);
156
165
/* Must be called before any synthesis functions are called.
157
166
output: the audio data can either be played by eSpeak or passed back by the SynthCallback function.
171
180
#ifdef __cplusplus
174
ESPEAK_API void espeak_SetSynthCallback(t_espeak_callback* SynthCallback);
183
void espeak_SetSynthCallback(t_espeak_callback* SynthCallback);
175
184
/* Must be called before any synthesis functions are called.
176
185
This specifies a function in the calling program which is called when a buffer of
177
186
speech sound data has been produced.
199
208
#ifdef __cplusplus
202
ESPEAK_API void espeak_SetUriCallback(int (*UriCallback)(int, const char*, const char*));
211
void espeak_SetUriCallback(int (*UriCallback)(int, const char*, const char*));
203
212
/* This function may be called before synthesis functions are used, in order to deal with
204
213
<audio> tags. It specifies a callback function which is called when an <audio> element is
205
214
encountered and allows the calling program to indicate whether the sound file which
240
249
#ifdef __cplusplus
243
ESPEAK_API espeak_ERROR espeak_Synth(const void *text,
252
espeak_ERROR espeak_Synth(const void *text,
245
254
unsigned int position,
246
255
espeak_POSITION_TYPE position_type,
296
305
#ifdef __cplusplus
299
ESPEAK_API espeak_ERROR espeak_Synth_Mark(const void *text,
308
espeak_ERROR espeak_Synth_Mark(const void *text,
301
310
const char *index_mark,
302
311
unsigned int end_position,
320
329
#ifdef __cplusplus
323
ESPEAK_API espeak_ERROR espeak_Key(const char *key_name);
332
espeak_ERROR espeak_Key(const char *key_name);
324
333
/* Speak the name of a keyboard key.
325
334
If key_name is a single character, it speaks the name of the character.
326
335
Otherwise, it speaks key_name as a text string.
379
388
#ifdef __cplusplus
382
ESPEAK_API espeak_ERROR espeak_SetParameter(espeak_PARAMETER parameter, int value, int relative);
391
espeak_ERROR espeak_SetParameter(espeak_PARAMETER parameter, int value, int relative);
383
392
/* Sets the value of the specified parameter.
384
393
relative=0 Sets the absolute value of the parameter.
385
394
relative=1 Sets a relative value of the parameter.
388
espeakRATE: speaking speed in word per minute.
397
espeakRATE: speaking speed in word per minute. Values 80 to 450.
390
espeakVOLUME: volume in range 0-100 0=silence
399
espeakVOLUME: volume in range 0-200 or more.
400
0=silence, 100=normal full volume, greater values may produce amplitude compression or distortion
392
402
espeakPITCH: base pitch, range 0-100. 50=normal
415
425
#ifdef __cplusplus
418
ESPEAK_API int espeak_GetParameter(espeak_PARAMETER parameter, int current);
428
int espeak_GetParameter(espeak_PARAMETER parameter, int current);
419
429
/* current=0 Returns the default value of the specified parameter.
420
430
current=1 Returns the current value of the specified parameter, as set by SetParameter()
423
433
#ifdef __cplusplus
426
ESPEAK_API espeak_ERROR espeak_SetPunctuationList(const wchar_t *punctlist);
436
espeak_ERROR espeak_SetPunctuationList(const wchar_t *punctlist);
427
437
/* Specified a list of punctuation characters whose names are to be spoken when the
428
438
value of the Punctuation parameter is set to "some".
438
448
#ifdef __cplusplus
441
ESPEAK_API void espeak_SetPhonemeTrace(int value, FILE *stream);
451
void espeak_SetPhonemeTrace(int value, FILE *stream);
442
452
/* Controls the output of phoneme symbols for the text
443
453
value=0 No phoneme output (default)
444
454
value=1 Output the translated phoneme symbols for the text
445
455
value=2 as (1), but also output a trace of how the translation was done (matching rules and list entries)
456
value=3 as (1), but produces IPA rather than ascii phoneme names
447
458
stream output stream for the phoneme symbols (and trace). If stream=NULL then it uses stdout.
450
461
#ifdef __cplusplus
453
ESPEAK_API void espeak_CompileDictionary(const char *path, FILE *log, int flags);
464
void espeak_CompileDictionary(const char *path, FILE *log, int flags);
454
465
/* Compile pronunciation dictionary for a language which corresponds to the currently
455
466
selected voice. The required voice should be selected before calling this function.
503
514
#ifdef __cplusplus
506
ESPEAK_API const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec);
517
const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec);
507
518
/* Reads the voice files from espeak-data/voices and creates an array of espeak_VOICE pointers.
508
519
The list is terminated by a NULL pointer
510
521
If voice_spec is NULL then all voices are listed.
511
If voice spec is give, then only the voices which are compatible with the voice_spec
522
If voice spec is given, then only the voices which are compatible with the voice_spec
512
523
are listed, and they are listed in preference order.
515
526
#ifdef __cplusplus
518
ESPEAK_API espeak_ERROR espeak_SetVoiceByName(const char *name);
529
espeak_ERROR espeak_SetVoiceByName(const char *name);
519
530
/* Searches for a voice with a matching "name" field. Language is not considered.
520
531
"name" is a UTF8 string.
548
559
#ifdef __cplusplus
551
ESPEAK_API espeak_VOICE *espeak_GetCurrentVoice(void);
562
espeak_VOICE *espeak_GetCurrentVoice(void);
552
563
/* Returns the espeak_VOICE data for the currently selected voice.
553
564
This is not affected by temporary voice changes caused by SSML elements such as <voice> and <s>
556
567
#ifdef __cplusplus
559
ESPEAK_API espeak_ERROR espeak_Cancel(void);
570
espeak_ERROR espeak_Cancel(void);
560
571
/* Stop immediately synthesis and audio output of the current text. When this
561
572
function returns, the audio output is fully stopped and the synthesizer is ready to
562
573
synthesize a new message.
569
580
#ifdef __cplusplus
572
ESPEAK_API int espeak_IsPlaying(void);
583
int espeak_IsPlaying(void);
573
584
/* Returns 1 if audio is played, 0 otherwise.
576
587
#ifdef __cplusplus
579
ESPEAK_API espeak_ERROR espeak_Synchronize(void);
590
espeak_ERROR espeak_Synchronize(void);
580
591
/* This function returns when all data have been spoken.
581
592
Return: EE_OK: operation achieved
582
593
EE_INTERNAL_ERROR.
595
606
#ifdef __cplusplus
598
ESPEAK_API const char *espeak_Info(void* ptr);
609
const char *espeak_Info(void* ptr);
599
610
/* Returns the version number string.
600
611
The parameter is for future use, and should be set to NULL