[1.47.14]

Language changes:
an, en, es, fa, gu, it, pt, ta, te.

Voice files: added attribute 'dictdialect', eg:
dictdialect en-us
uses the US English voice to speak words or rules which are marked with _^_EN


git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@366 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
jonsd
2013-11-29 22:16:55 +00:00
parent eaba1458d3
commit e8b87dbf8c
45 changed files with 8281 additions and 1678 deletions
+3 -3
View File
@@ -268,18 +268,18 @@ Note, that matching characters in the <pre> part do not affect the syllabl
</ul>
eg.
<pre> @) ly (_$2 lI // "ly", at end of a word with at least one other
<pre> @) ly (_S2 lI // "ly", at end of a word with at least one other
// syllable, is a suffix pronounced [lI]. Remove
// it and retranslate the word.
_) un (@P2 ¬Vn // "un" at the start of a word is an unstressed
_) un (@P2 %Vn // "un" at the start of a word is an unstressed
// prefix pronounced [Vn]
_) un (i ju: // ... except in words starting "uni"
_) un (inP2 ,Vn // ... but it is for words starting "unin"
</pre>
S and P must be at the end of the &lt;post&gt; string.
<p>
S&lt;number&gt; may be followed by additonal letters (eg. S2ei ). Some of these are probably specific to English, but similar functions could be made for other languages.
S&lt;number&gt; may be followed by additional letters (eg. S2ei ). Some of these are probably specific to English, but similar functions could be made for other languages.
<ul><table>
<tbody>
+125 -58
View File
@@ -1,7 +1,7 @@
#ifndef SPEAK_LIB_H
#define SPEAK_LIB_H
/***************************************************************************
* Copyright (C) 2005 to 2010 by Jonathan Duddington *
* Copyright (C) 2005 to 2012 by Jonathan Duddington *
* email: jonsd@users.sourceforge.net *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -28,7 +28,13 @@
#include <stdio.h>
#include <stddef.h>
#define ESPEAK_API_REVISION 5
#ifdef __WIN32__
#define ESPEAK_API __declspec(dllexport)
#else
#define ESPEAK_API
#endif
#define ESPEAK_API_REVISION 9
/*
Revision 2
Added parameter "options" to eSpeakInitialize()
@@ -41,11 +47,30 @@ Revision 4
Revision 5
Added espeakCHARS_16BIT
Revision 6
Added macros: espeakRATE_MINIMUM, espeakRATE_MAXIMUM, espeakRATE_NORMAL
Revision 7 24.Dec.2011
Changed espeak_EVENT structure to add id.string[] for phoneme mnemonics.
Added espeakINITIALIZE_PHONEME_IPA option for espeak_Initialize() to report phonemes as IPA names.
Revision 8 26.Apr.2013
Added function espeak_TextToPhonemes().
Revision 9 30.May.2013
Changed function espeak_TextToPhonemes().
*/
/********************/
/* Initialization */
/********************/
// values for 'value' in espeak_SetParameter(espeakRATE, value, 0), nominally in words-per-minute
#define espeakRATE_MINIMUM 80
#define espeakRATE_MAXIMUM 450
#define espeakRATE_NORMAL 175
typedef enum {
espeakEVENT_LIST_TERMINATED = 0, // Retrieval mode: terminates the event list.
@@ -70,11 +95,12 @@ typedef struct {
int sample; // sample id (internal use)
void* user_data; // pointer supplied by the calling program
union {
int number; // used for WORD and SENTENCE events. For PHONEME events this is the phoneme mnemonic.
int number; // used for WORD and SENTENCE events.
const char *name; // used for MARK and PLAY events. UTF8 string
char string[8]; // used for phoneme names (UTF8). Terminated by a zero byte unless the name needs the full 8 bytes.
} id;
} espeak_EVENT;
/*
/*
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.
@@ -82,16 +108,16 @@ typedef struct {
In PLAYBACK mode, the callback function is called as soon as an event happens.
For example suppose that the following message is supplied to espeak_Synth:
For example suppose that the following message is supplied to espeak_Synth:
"hello, hello."
* Once processed in RETRIEVAL mode, it could lead to 3 calls of the callback function :
** Block 1:
<audio data> +
<audio data> +
List of events: SENTENCE + WORD + LIST_TERMINATED
** Block 2:
<audio data> +
List of events: WORD + END + LIST_TERMINATED
@@ -128,11 +154,11 @@ typedef enum {
typedef enum {
/* PLAYBACK mode: plays the audio data, supplies events to the calling program*/
AUDIO_OUTPUT_PLAYBACK,
AUDIO_OUTPUT_PLAYBACK,
/* RETRIEVAL mode: supplies audio data and events to the calling program */
AUDIO_OUTPUT_RETRIEVAL,
/* SYNCHRONOUS mode: as RETRIEVAL but doesn't return until synthesis is completed */
AUDIO_OUTPUT_SYNCHRONOUS,
@@ -149,20 +175,26 @@ typedef enum {
EE_NOT_FOUND=2
} espeak_ERROR;
#define espeakINITIALIZE_PHONEME_EVENTS 0x0001
#define espeakINITIALIZE_PHONEME_IPA 0x0002
#define espeakINITIALIZE_DONT_EXIT 0x8000
#ifdef __cplusplus
extern "C"
#endif
int espeak_Initialize(espeak_AUDIO_OUTPUT output, int buflength, const char *path, int options);
ESPEAK_API int espeak_Initialize(espeak_AUDIO_OUTPUT output, int buflength, const char *path, int options);
/* Must be called before any synthesis functions are called.
output: the audio data can either be played by eSpeak or passed back by the SynthCallback function.
buflength: The length in mS of sound buffers passed to the SynthCallback function.
Value=0 gives a default of 200mS.
This paramater is only used for AUDIO_OUTPUT_RETRIEVAL and AUDIO_OUTPUT_SYNCHRONOUS modes.
path: The directory which contains the espeak-data directory, or NULL for the default location.
options: bit 0: 1=allow espeakEVENT_PHONEME events.
options: bit 0: 1=allow espeakEVENT_PHONEME events.
bit 1: 1= espeakEVENT_PHONEME events give IPA phoneme names, not eSpeak phoneme names
bit 15: 1=don't exit if espeak_data is not found (used for --help)
Returns: sample rate in Hz, or -1 (EE_INTERNAL_ERROR).
*/
@@ -172,10 +204,10 @@ typedef int (t_espeak_callback)(short*, int, espeak_EVENT*);
#ifdef __cplusplus
extern "C"
#endif
void espeak_SetSynthCallback(t_espeak_callback* SynthCallback);
ESPEAK_API void espeak_SetSynthCallback(t_espeak_callback* SynthCallback);
/* Must be called before any synthesis functions are called.
This specifies a function in the calling program which is called when a buffer of
speech sound data has been produced.
speech sound data has been produced.
The callback function is of the form:
@@ -200,7 +232,7 @@ int SynthCallback(short *wav, int numsamples, espeak_EVENT *events);
#ifdef __cplusplus
extern "C"
#endif
void espeak_SetUriCallback(int (*UriCallback)(int, const char*, const char*));
ESPEAK_API void espeak_SetUriCallback(int (*UriCallback)(int, const char*, const char*));
/* This function may be called before synthesis functions are used, in order to deal with
<audio> tags. It specifies a callback function which is called when an <audio> element is
encountered and allows the calling program to indicate whether the sound file which
@@ -241,7 +273,7 @@ int UriCallback(int type, const char *uri, const char *base);
#ifdef __cplusplus
extern "C"
#endif
espeak_ERROR espeak_Synth(const void *text,
ESPEAK_API espeak_ERROR espeak_Synth(const void *text,
size_t size,
unsigned int position,
espeak_POSITION_TYPE position_type,
@@ -264,7 +296,7 @@ espeak_ERROR espeak_Synth(const void *text,
start of the text.
position_type: Determines whether "position" is a number of characters, words, or sentences.
Values:
Values:
end_position: If set, this gives a character position at which speaking will stop. A value
of zero indicates no end position.
@@ -275,6 +307,7 @@ espeak_ERROR espeak_Synth(const void *text,
espeakCHARS_8BIT The 8 bit ISO-8859 character set for the particular language.
espeakCHARS_AUTO 8 bit or UTF8 (this is the default)
espeakCHARS_WCHAR Wide characters (wchar_t)
espeakCHARS_16BIT 16 bit characters.
espeakSSML Elements within < > are treated as SSML elements, or if not recognised are ignored.
@@ -283,13 +316,16 @@ espeak_ERROR espeak_Synth(const void *text,
espeakENDPAUSE If set then a sentence pause is added at the end of the text. If not set then
this pause is suppressed.
unique_identifier: message identifier; helpful for identifying later
data supplied to the callback.
unique_identifier: This must be either NULL, or point to an integer variable to
which eSpeak writes a message identifier number.
eSpeak includes this number in espeak_EVENT messages which are the result of
this call of espeak_Synth().
user_data: pointer which will be passed to the callback function.
user_data: a pointer (or NULL) which will be passed to the callback function in
espeak_EVENT messages.
Return: EE_OK: operation achieved
EE_BUFFER_FULL: the command can not be buffered;
Return: EE_OK: operation achieved
EE_BUFFER_FULL: the command can not be buffered;
you may try after a while to call the function again.
EE_INTERNAL_ERROR.
*/
@@ -297,7 +333,7 @@ espeak_ERROR espeak_Synth(const void *text,
#ifdef __cplusplus
extern "C"
#endif
espeak_ERROR espeak_Synth_Mark(const void *text,
ESPEAK_API espeak_ERROR espeak_Synth_Mark(const void *text,
size_t size,
const char *index_mark,
unsigned int end_position,
@@ -312,8 +348,8 @@ espeak_ERROR espeak_Synth_Mark(const void *text,
For the other parameters, see espeak_Synth()
Return: EE_OK: operation achieved
EE_BUFFER_FULL: the command can not be buffered;
Return: EE_OK: operation achieved
EE_BUFFER_FULL: the command can not be buffered;
you may try after a while to call the function again.
EE_INTERNAL_ERROR.
*/
@@ -321,13 +357,13 @@ espeak_ERROR espeak_Synth_Mark(const void *text,
#ifdef __cplusplus
extern "C"
#endif
espeak_ERROR espeak_Key(const char *key_name);
ESPEAK_API espeak_ERROR espeak_Key(const char *key_name);
/* Speak the name of a keyboard key.
If key_name is a single character, it speaks the name of the character.
Otherwise, it speaks key_name as a text string.
Return: EE_OK: operation achieved
EE_BUFFER_FULL: the command can not be buffered;
Return: EE_OK: operation achieved
EE_BUFFER_FULL: the command can not be buffered;
you may try after a while to call the function again.
EE_INTERNAL_ERROR.
*/
@@ -335,11 +371,11 @@ espeak_ERROR espeak_Key(const char *key_name);
#ifdef __cplusplus
extern "C"
#endif
espeak_ERROR espeak_Char(wchar_t character);
/* Speak the name of the given character
ESPEAK_API espeak_ERROR espeak_Char(wchar_t character);
/* Speak the name of the given character
Return: EE_OK: operation achieved
EE_BUFFER_FULL: the command can not be buffered;
Return: EE_OK: operation achieved
EE_BUFFER_FULL: the command can not be buffered;
you may try after a while to call the function again.
EE_INTERNAL_ERROR.
*/
@@ -380,7 +416,7 @@ typedef enum {
#ifdef __cplusplus
extern "C"
#endif
espeak_ERROR espeak_SetParameter(espeak_PARAMETER parameter, int value, int relative);
ESPEAK_API espeak_ERROR espeak_SetParameter(espeak_PARAMETER parameter, int value, int relative);
/* Sets the value of the specified parameter.
relative=0 Sets the absolute value of the parameter.
relative=1 Sets a relative value of the parameter.
@@ -396,7 +432,7 @@ espeak_ERROR espeak_SetParameter(espeak_PARAMETER parameter, int value, int rela
espeakRANGE: pitch range, range 0-100. 0-monotone, 50=normal
espeakPUNCTUATION: which punctuation characters to announce:
value in espeak_PUNCT_TYPE (none, all, some),
value in espeak_PUNCT_TYPE (none, all, some),
see espeak_GetParameter() to specify which characters are announced.
espeakCAPITALS: announce capital letters by:
@@ -408,8 +444,8 @@ espeak_ERROR espeak_SetParameter(espeak_PARAMETER parameter, int value, int rela
espeakWORDGAP: pause between words, units of 10mS (at the default speed)
Return: EE_OK: operation achieved
EE_BUFFER_FULL: the command can not be buffered;
Return: EE_OK: operation achieved
EE_BUFFER_FULL: the command can not be buffered;
you may try after a while to call the function again.
EE_INTERNAL_ERROR.
*/
@@ -417,7 +453,7 @@ espeak_ERROR espeak_SetParameter(espeak_PARAMETER parameter, int value, int rela
#ifdef __cplusplus
extern "C"
#endif
int espeak_GetParameter(espeak_PARAMETER parameter, int current);
ESPEAK_API int espeak_GetParameter(espeak_PARAMETER parameter, int current);
/* current=0 Returns the default value of the specified parameter.
current=1 Returns the current value of the specified parameter, as set by SetParameter()
*/
@@ -425,14 +461,14 @@ int espeak_GetParameter(espeak_PARAMETER parameter, int current);
#ifdef __cplusplus
extern "C"
#endif
espeak_ERROR espeak_SetPunctuationList(const wchar_t *punctlist);
ESPEAK_API espeak_ERROR espeak_SetPunctuationList(const wchar_t *punctlist);
/* Specified a list of punctuation characters whose names are to be spoken when the
value of the Punctuation parameter is set to "some".
punctlist: A list of character codes, terminated by a zero character.
Return: EE_OK: operation achieved
EE_BUFFER_FULL: the command can not be buffered;
Return: EE_OK: operation achieved
EE_BUFFER_FULL: the command can not be buffered;
you may try after a while to call the function again.
EE_INTERNAL_ERROR.
*/
@@ -440,7 +476,7 @@ espeak_ERROR espeak_SetPunctuationList(const wchar_t *punctlist);
#ifdef __cplusplus
extern "C"
#endif
void espeak_SetPhonemeTrace(int value, FILE *stream);
ESPEAK_API void espeak_SetPhonemeTrace(int value, FILE *stream);
/* Controls the output of phoneme symbols for the text
value=0 No phoneme output (default)
value=1 Output the translated phoneme symbols for the text
@@ -453,7 +489,38 @@ void espeak_SetPhonemeTrace(int value, FILE *stream);
#ifdef __cplusplus
extern "C"
#endif
void espeak_CompileDictionary(const char *path, FILE *log, int flags);
ESPEAK_API const char *espeak_TextToPhonemes(const void **textptr, int textmode, int phonememode);
/* Translates text into phonemes. Call espeak_SetVoiceByName() first, to select a language.
It returns a pointer to a character string which contains the phonemes for the text up to
end of a sentence, or comma, semicolon, colon, or similar punctuation.
textptr: The address of a pointer to the input text which is terminated by a zero character.
On return, the pointer has been advanced past the text which has been translated, or else set
to NULL to indicate that the end of the text has been reached.
textmode: Type of character codes, one of:
espeakCHARS_UTF8 UTF8 encoding
espeakCHARS_8BIT The 8 bit ISO-8859 character set for the particular language.
espeakCHARS_AUTO 8 bit or UTF8 (this is the default)
espeakCHARS_WCHAR Wide characters (wchar_t)
espeakCHARS_16BIT 16 bit characters.
phonememode: bits0-3:
0= just phonemes.
1= include ties (U+361) for phoneme names of more than one letter.
2= include zero-width-joiner for phoneme names of more than one letter.
3= separate phonemes with underscore characters.
bits 4-7:
0= eSpeak's ascii phoneme names.
1= International Phonetic Alphabet (as UTF-8 characters).
*/
#ifdef __cplusplus
extern "C"
#endif
ESPEAK_API void espeak_CompileDictionary(const char *path, FILE *log, int flags);
/* Compile pronunciation dictionary for a language which corresponds to the currently
selected voice. The required voice should be selected before calling this function.
@@ -477,7 +544,7 @@ typedef struct {
unsigned char gender; // 0=none 1=male, 2=female,
unsigned char age; // 0=not specified, or age in years
unsigned char variant; // only used when passed as a parameter to espeak_SetVoiceByProperties
unsigned char xx1; // for internal use
unsigned char xx1; // for internal use
int score; // for internal use
void *spare; // for internal use
} espeak_VOICE;
@@ -506,7 +573,7 @@ typedef struct {
#ifdef __cplusplus
extern "C"
#endif
const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec);
ESPEAK_API const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec);
/* Reads the voice files from espeak-data/voices and creates an array of espeak_VOICE pointers.
The list is terminated by a NULL pointer
@@ -518,12 +585,12 @@ const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec);
#ifdef __cplusplus
extern "C"
#endif
espeak_ERROR espeak_SetVoiceByName(const char *name);
ESPEAK_API espeak_ERROR espeak_SetVoiceByName(const char *name);
/* Searches for a voice with a matching "name" field. Language is not considered.
"name" is a UTF8 string.
Return: EE_OK: operation achieved
EE_BUFFER_FULL: the command can not be buffered;
Return: EE_OK: operation achieved
EE_BUFFER_FULL: the command can not be buffered;
you may try after a while to call the function again.
EE_INTERNAL_ERROR.
*/
@@ -531,7 +598,7 @@ espeak_ERROR espeak_SetVoiceByName(const char *name);
#ifdef __cplusplus
extern "C"
#endif
espeak_ERROR espeak_SetVoiceByProperties(espeak_VOICE *voice_spec);
ESPEAK_API espeak_ERROR espeak_SetVoiceByProperties(espeak_VOICE *voice_spec);
/* An espeak_VOICE structure is used to pass criteria to select a voice. Any of the following
fields may be set:
@@ -551,7 +618,7 @@ espeak_ERROR espeak_SetVoiceByProperties(espeak_VOICE *voice_spec);
#ifdef __cplusplus
extern "C"
#endif
espeak_VOICE *espeak_GetCurrentVoice(void);
ESPEAK_API espeak_VOICE *espeak_GetCurrentVoice(void);
/* Returns the espeak_VOICE data for the currently selected voice.
This is not affected by temporary voice changes caused by SSML elements such as <voice> and <s>
*/
@@ -559,12 +626,12 @@ espeak_VOICE *espeak_GetCurrentVoice(void);
#ifdef __cplusplus
extern "C"
#endif
espeak_ERROR espeak_Cancel(void);
ESPEAK_API espeak_ERROR espeak_Cancel(void);
/* Stop immediately synthesis and audio output of the current text. When this
function returns, the audio output is fully stopped and the synthesizer is ready to
synthesize a new message.
Return: EE_OK: operation achieved
Return: EE_OK: operation achieved
EE_INTERNAL_ERROR.
*/
@@ -572,25 +639,25 @@ espeak_ERROR espeak_Cancel(void);
#ifdef __cplusplus
extern "C"
#endif
int espeak_IsPlaying(void);
ESPEAK_API int espeak_IsPlaying(void);
/* Returns 1 if audio is played, 0 otherwise.
*/
#ifdef __cplusplus
extern "C"
#endif
espeak_ERROR espeak_Synchronize(void);
ESPEAK_API espeak_ERROR espeak_Synchronize(void);
/* This function returns when all data have been spoken.
Return: EE_OK: operation achieved
Return: EE_OK: operation achieved
EE_INTERNAL_ERROR.
*/
#ifdef __cplusplus
extern "C"
#endif
espeak_ERROR espeak_Terminate(void);
ESPEAK_API espeak_ERROR espeak_Terminate(void);
/* last function to be called.
Return: EE_OK: operation achieved
Return: EE_OK: operation achieved
EE_INTERNAL_ERROR.
*/
@@ -598,8 +665,8 @@ espeak_ERROR espeak_Terminate(void);
#ifdef __cplusplus
extern "C"
#endif
const char *espeak_Info(void* ptr);
ESPEAK_API const char *espeak_Info(const char **path_data);
/* Returns the version number string.
The parameter is for future use, and should be set to NULL
path_data returns the path to espeak_data
*/
#endif
+14
View File
@@ -255,6 +255,20 @@ Used to specify a language to be used to speak words which are written in a non-
Alphabets names include: latin, cyr (cyrillic), ar (arabic). The default language for latin alphabet is English.
</dd>
<p>
<dt>
<strong>dictdialect &nbsp;&lt;dialect&gt;</strong><br>
<dd>
Words can be marked in the *_list or *_rules file to be spoken using a foreign voice. This <b>dictdialect</b> attribute
can be used to specify which dialect of the foreign language should be used, instead of the default dialect.
The currently available dialects are:<br>
<b>en-us</b> (US English)<br>
<b>es-la</b> (Latin American Spanish).<br>
eg.
<pre> dictdialect en-us
</pre>
This means that any words or rules which are maked with _^_EN will be spoken with the US English voice instead of the default UK English voice.
</dd>
<p>
Additional attributes are available to set various internal options which control how language is processed. These would normally be set in the program code rather than in a voice file.
</ul>
<hr>