mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-08 23:47:27 +00:00
Merge branch 'master' into build
This commit is contained in:
+9
-6
@@ -1605,7 +1605,7 @@ int LoadSpect(const char *path, int control)
|
||||
displ = ftell(f_phdata);
|
||||
|
||||
seq_out.n_frames=0;
|
||||
seq_out.flags=0;
|
||||
seq_out.sqflags=0;
|
||||
seq_out.length_total=0;
|
||||
|
||||
total = 0;
|
||||
@@ -1752,7 +1752,7 @@ for(ix=0; ix<8; ix++)
|
||||
if(klatt_flag)
|
||||
{
|
||||
seqk_out.n_frames = seq_out.n_frames;
|
||||
seqk_out.flags = seq_out.flags;
|
||||
seqk_out.sqflags = seq_out.sqflags;
|
||||
seqk_out.length_total = seq_out.length_total;
|
||||
|
||||
ix = (char *)(&seqk_out.frame[seqk_out.n_frames]) - (char *)(&seqk_out);
|
||||
@@ -1925,8 +1925,11 @@ static int LoadEnvelope(FILE *f, const char *fname)
|
||||
displ = ftell(f_phdata);
|
||||
|
||||
fseek(f,12,SEEK_SET);
|
||||
fread(buf,1,128,f);
|
||||
fwrite(buf,1,128,f_phdata);
|
||||
if(fread(buf,128,1,f) == 0)
|
||||
{
|
||||
error("Failed to read envelope: %s",fname);
|
||||
}
|
||||
fwrite(buf,128,1,f_phdata);
|
||||
|
||||
if(n_envelopes < N_ENVELOPES)
|
||||
{
|
||||
@@ -3576,7 +3579,7 @@ void CompileMbrola()
|
||||
wxFileName filename = wxFileName(filepath);
|
||||
strcpy(mbrola_voice,filename.GetName().mb_str(wxConvLocal));
|
||||
sprintf(buf,"%s/mbrola_ph/%s_phtrans",path_home,mbrola_voice);
|
||||
if((f_out = fopen(buf,"w")) == NULL)
|
||||
if((f_out = fopen(buf,"wb")) == NULL)
|
||||
{
|
||||
wxLogError(_T("Can't write to: ")+wxString(buf,wxConvLocal));
|
||||
return;
|
||||
@@ -3610,7 +3613,7 @@ static const TUNE default_tune = {
|
||||
PITCHfall, 64, 8,
|
||||
PITCHfall, 70, 18, 24, 12,
|
||||
PITCHfall, 70, 18, 24, 12, 0,
|
||||
{0,0,0,0,0,0,0,0,0,0}
|
||||
{0,0,0,0,0,0,0,0}, 0
|
||||
};
|
||||
|
||||
#define N_TUNE_NAMES 100
|
||||
|
||||
+6
-4
@@ -273,7 +273,7 @@ int LoadDictionary(Translator *tr, const char *name, int no_error)
|
||||
}
|
||||
|
||||
tr->data_dictlist = Alloc(size);
|
||||
fread(tr->data_dictlist,size,1,f);
|
||||
size = fread(tr->data_dictlist,1,size,f);
|
||||
fclose(f);
|
||||
|
||||
|
||||
@@ -516,7 +516,7 @@ unsigned short ipa1[96] = {
|
||||
0x252,0x31,0x32,0x25c,0x34,0x35,0x36,0x37,0x275,0x39,0x2d0,0x2b2,0x3c,0x3d,0x3e,0x294,
|
||||
0x259,0x251,0x3b2,0xe7,0xf0,0x25b,0x46,0x262,0x127,0x26a,0x25f,0x4b,0x4c,0x271,0x14b,0x254,
|
||||
0x3a6,0x263,0x280,0x283,0x3b8,0x28a,0x28c,0x153,0x3c7,0xf8,0x292,0x32a,0x5c,0x5d,0x5e,0x5f,
|
||||
0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,
|
||||
0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x261,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,
|
||||
0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x303,0x7f
|
||||
};
|
||||
|
||||
@@ -1639,6 +1639,7 @@ void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags,
|
||||
}
|
||||
*output++ = 0;
|
||||
|
||||
return;
|
||||
} /* end of SetWordStress */
|
||||
|
||||
|
||||
@@ -2620,6 +2621,9 @@ int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, c
|
||||
|
||||
if(match1.points > 0)
|
||||
{
|
||||
if(word_flags & FLAG_UNPRON_TEST)
|
||||
return(match1.end_type | 1);
|
||||
|
||||
if((match1.phonemes[0] == phonSWITCH) && ((word_flags & FLAG_DONT_SWITCH_TRANSLATOR)==0))
|
||||
{
|
||||
// an instruction to switch language, return immediately so we can re-translate
|
||||
@@ -2627,8 +2631,6 @@ int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, c
|
||||
return(0);
|
||||
}
|
||||
|
||||
if(word_flags & FLAG_UNPRON_TEST)
|
||||
return(match1.end_type | 1);
|
||||
match1.end_type &= ~SUFX_UNPRON;
|
||||
|
||||
if((match1.end_type != 0) && (end_phonemes != NULL))
|
||||
|
||||
+3
-1
@@ -247,6 +247,8 @@ END_EVENT_TABLE()
|
||||
|
||||
MyFrame::~MyFrame(void)
|
||||
{//====================
|
||||
myframe->Show(false);
|
||||
myframe->Iconize(false); // os=Windows, get the non-iconsized size
|
||||
myframe->GetPosition(&frame_x, &frame_y);
|
||||
myframe->GetSize(&frame_w, &frame_h);
|
||||
}
|
||||
@@ -566,7 +568,7 @@ void DisplayErrorFile(const char *fname)
|
||||
if(msg != NULL)
|
||||
{
|
||||
f = fopen(fname,"r");
|
||||
fread(msg,len,1,f);
|
||||
len = fread(msg,1, len, f);
|
||||
fclose(f);
|
||||
msg[len] = 0;
|
||||
msg_string = wxString(msg,wxConvUTF8);
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "speech.h"
|
||||
#ifdef INCLUDE_MBROLA
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
@@ -603,3 +606,5 @@ void resetError_MBR(void)
|
||||
{
|
||||
mbr_errorbuf[0] = 0;
|
||||
}
|
||||
|
||||
#endif // INCLUDE_MBROLA
|
||||
|
||||
+12
-1
@@ -1343,6 +1343,7 @@ static int LookupNum3(Translator *tr, int value, char *ph_out, int suppress_null
|
||||
int hundreds;
|
||||
int tensunits;
|
||||
int x;
|
||||
int ix;
|
||||
int exact;
|
||||
int ordinal;
|
||||
char string[12]; // for looking up entries in **_list
|
||||
@@ -1500,6 +1501,16 @@ static int LookupNum3(Translator *tr, int value, char *ph_out, int suppress_null
|
||||
ph_hundred_and[0] = 0; // don't put 'and' after 'hundred' if there's 'and' between tens and units
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(ph_ordinal2[0] != 0)
|
||||
{
|
||||
ix = strlen(buf1);
|
||||
if((ix > 0) && (buf1[ix-1] == phonPAUSE_SHORT))
|
||||
buf1[ix-1] = 0; // remove pause before addding ordinal suffix
|
||||
strcpy(buf2, ph_ordinal2);
|
||||
}
|
||||
}
|
||||
|
||||
sprintf(ph_out,"%s%s%s",buf1,ph_hundred_and,buf2);
|
||||
|
||||
@@ -1883,7 +1894,7 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
|
||||
|
||||
int TranslateNumber(Translator *tr, char *word1, char *ph_out, unsigned int *flags, WORD_TAB *wtab, int control)
|
||||
{//=============================================================================================================
|
||||
if(option_sayas == SAYAS_DIGITS1)
|
||||
if((option_sayas == SAYAS_DIGITS1) || (wtab[0].flags & FLAG_INDIVIDUAL_DIGITS))
|
||||
return(0); // speak digits individually
|
||||
|
||||
if(tr->langopts.numbers != 0)
|
||||
|
||||
+5
-6
@@ -774,7 +774,7 @@ static int LoadSoundFile(const char *fname, int index)
|
||||
fclose(f);
|
||||
return(4);
|
||||
}
|
||||
fread(p,length,1,f);
|
||||
length = fread(p,1,length,f);
|
||||
fclose(f);
|
||||
remove(fname_temp);
|
||||
|
||||
@@ -889,13 +889,13 @@ static int AnnouncePunctuation(Translator *tr, int c1, int *c2_ptr, char *output
|
||||
else
|
||||
if(punct_count < 4)
|
||||
{
|
||||
sprintf(buf,"\001+15S");
|
||||
sprintf(buf,"\001+10S");
|
||||
while(punct_count-- > 0)
|
||||
{
|
||||
sprintf(buf2," %s",punctname);
|
||||
strcat(buf, buf2);
|
||||
}
|
||||
sprintf(buf2," \001-15S");
|
||||
sprintf(buf2," \001-10S");
|
||||
strcat(buf, buf2);
|
||||
}
|
||||
else
|
||||
@@ -1482,8 +1482,8 @@ static void SetProsodyParameter(int param_type, wchar_t *attr1, PARAM_STACK *sp)
|
||||
{"x-slow",60},
|
||||
{"slow",80},
|
||||
{"medium",100},
|
||||
{"fast",120},
|
||||
{"x-fast",150},
|
||||
{"fast",125},
|
||||
{"x-fast",160},
|
||||
{NULL, -1}};
|
||||
|
||||
static const MNEM_TAB mnem_pitch[] = {
|
||||
@@ -2032,7 +2032,6 @@ int ReadClause(Translator *tr, FILE *f_in, char *buf, short *charix, int *charix
|
||||
int stressed_word = 0;
|
||||
int end_clause_after_tag = 0;
|
||||
int end_clause_index = 0;
|
||||
const char *p;
|
||||
wchar_t xml_buf[N_XML_BUF+1];
|
||||
|
||||
#define N_XML_BUF2 20
|
||||
|
||||
+1
-1
@@ -154,7 +154,7 @@ void SetSpeed(int control)
|
||||
if(wpm > 1000)
|
||||
{
|
||||
// TESTING
|
||||
test = wpm / 1000;
|
||||
// test = wpm / 1000;
|
||||
wpm = wpm % 1000;
|
||||
}
|
||||
#endif
|
||||
|
||||
+12
-3
@@ -28,7 +28,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#define ESPEAK_API_REVISION 5
|
||||
#define ESPEAK_API_REVISION 6
|
||||
/*
|
||||
Revision 2
|
||||
Added parameter "options" to eSpeakInitialize()
|
||||
@@ -41,11 +41,19 @@ Revision 4
|
||||
|
||||
Revision 5
|
||||
Added espeakCHARS_16BIT
|
||||
|
||||
Revision 6
|
||||
Added macros: espeakRATE_MINIMUM, espeakRATE_MAXIMUM, espeakRATE_NORMAL
|
||||
*/
|
||||
/********************/
|
||||
/* 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.
|
||||
@@ -386,9 +394,10 @@ espeak_ERROR espeak_SetParameter(espeak_PARAMETER parameter, int value, int rela
|
||||
relative=1 Sets a relative value of the parameter.
|
||||
|
||||
parameter:
|
||||
espeakRATE: speaking speed in word per minute.
|
||||
espeakRATE: speaking speed in word per minute. Values 80 to 450.
|
||||
|
||||
espeakVOLUME: volume in range 0-100 0=silence
|
||||
espeakVOLUME: volume in range 0-200 or more.
|
||||
0=silence, 100=normal full volume, greater values may produce amplitude compression or distortion
|
||||
|
||||
espeakPITCH: base pitch, range 0-100. 50=normal
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
// conditional compilation options
|
||||
#define INCLUDE_KLATT
|
||||
#define INCLUDE_MBROLA
|
||||
|
||||
#if defined(BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN
|
||||
#define ARCH_BIG
|
||||
|
||||
+39
-3
@@ -17,6 +17,8 @@
|
||||
* <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -33,6 +35,10 @@
|
||||
#include "translate.h"
|
||||
#include "voice.h"
|
||||
|
||||
int option_mbrola_phonemes;
|
||||
|
||||
#ifdef INCLUDE_MBROLA
|
||||
|
||||
extern int Read4Bytes(FILE *f);
|
||||
extern void SetPitch2(voice_t *voice, int pitch1, int pitch2, int *pitch_base, int *pitch_range);
|
||||
extern unsigned char *outbuf;
|
||||
@@ -103,7 +109,6 @@ void unload_MBR()
|
||||
|
||||
static MBROLA_TAB *mbrola_tab = NULL;
|
||||
static int mbrola_control = 0;
|
||||
int option_mbrola_phonemes;
|
||||
|
||||
|
||||
espeak_ERROR LoadMbrolaTable(const char *mbrola_voice, const char *phtrans, int srate)
|
||||
@@ -133,6 +138,11 @@ espeak_ERROR LoadMbrolaTable(const char *mbrola_voice, const char *phtrans, int
|
||||
// mbrola voice file not found, look in /usr/share
|
||||
sprintf(path,"/usr/share/mbrola/%s",mbrola_voice);
|
||||
}
|
||||
if(GetFileLength(path) <= 0)
|
||||
{
|
||||
// mbrola voice file not found, look in /usr/share
|
||||
sprintf(path,"/usr/share/mbrola/voices/%s",mbrola_voice);
|
||||
}
|
||||
#endif
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
if(load_MBR() == FALSE) // load mbrola.dll
|
||||
@@ -147,7 +157,7 @@ espeak_ERROR LoadMbrolaTable(const char *mbrola_voice, const char *phtrans, int
|
||||
// read eSpeak's mbrola phoneme translation data, eg. en1_phtrans
|
||||
sprintf(path,"%s/mbrola_ph/%s",path_home,phtrans);
|
||||
size = GetFileLength(path);
|
||||
if((f_in = fopen(path,"r")) == NULL) {
|
||||
if((f_in = fopen(path,"rb")) == NULL) {
|
||||
close_MBR();
|
||||
return(EE_NOT_FOUND);
|
||||
}
|
||||
@@ -165,7 +175,7 @@ espeak_ERROR LoadMbrolaTable(const char *mbrola_voice, const char *phtrans, int
|
||||
{
|
||||
*pw++ = Read4Bytes(f_in);
|
||||
}
|
||||
fread(mbrola_tab,size,1,f_in);
|
||||
size = fread(mbrola_tab,1,size,f_in);
|
||||
fclose(f_in);
|
||||
|
||||
setVolumeRatio_MBR((float)(mbrola_control & 0xff) /16.0f);
|
||||
@@ -639,3 +649,29 @@ void MbrolaReset(void)
|
||||
|
||||
reset_MBR();
|
||||
}
|
||||
|
||||
#else // INCLUDE_MBROLA
|
||||
|
||||
// mbrola interface is not compiled, provide dummy functions.
|
||||
|
||||
espeak_ERROR LoadMbrolaTable(const char *mbrola_voice, const char *phtrans, int srate)
|
||||
{
|
||||
return(EE_INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
int MbrolaGenerate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
int MbrolaFill(int length, int resume)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
void MbrolaReset(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#endif // INCLUDE_MBROLA
|
||||
|
||||
+2
-2
@@ -35,8 +35,8 @@
|
||||
#include "translate.h"
|
||||
#include "wave.h"
|
||||
|
||||
const char *version_string = "1.43.63 02.Aug.10";
|
||||
const int version_phdata = 0x014361;
|
||||
const char *version_string = "1.44.04 14.Sep.10";
|
||||
const int version_phdata = 0x014404;
|
||||
|
||||
int option_device_number = -1;
|
||||
FILE *f_logespeak = NULL;
|
||||
|
||||
+7
-2
@@ -1236,10 +1236,15 @@ void DoEmbedded(int *embix, int sourceix)
|
||||
int command;
|
||||
|
||||
do {
|
||||
word = embedded_list[(*embix)++];
|
||||
word = embedded_list[*embix];
|
||||
value = word >> 8;
|
||||
command = word & 0x7f;
|
||||
|
||||
if(command == 0)
|
||||
return; // error
|
||||
|
||||
(*embix)++;
|
||||
|
||||
switch(command & 0x1f)
|
||||
{
|
||||
case EMBED_S: // speed
|
||||
@@ -1464,7 +1469,7 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
|
||||
DoSpect2(ph, 0, &fmtp, p, 0);
|
||||
if(p->synthflags & SFLAG_LENGTHEN)
|
||||
{
|
||||
DoPause(20,0);
|
||||
DoPause(25,1);
|
||||
DoSpect2(ph, 0, &fmtp, p, 0);
|
||||
}
|
||||
}
|
||||
|
||||
+8
-30
@@ -89,7 +89,7 @@ extern int embedded_default[N_EMBEDDED_VALUES];
|
||||
|
||||
|
||||
|
||||
typedef struct { // 44 bytes
|
||||
typedef struct { // 64 bytes
|
||||
short frflags;
|
||||
short ffreq[7];
|
||||
unsigned char length;
|
||||
@@ -102,8 +102,10 @@ typedef struct { // 44 bytes
|
||||
unsigned char klattp2[5]; // continuation of klattp[], Avp, Fric, FricBP, Turb
|
||||
unsigned char klatt_ap[7]; // Klatt parallel amplitude
|
||||
unsigned char klatt_bp[7]; // Klatt parallel bandwidth /2
|
||||
unsigned char spare; // pad to multiple of 4 bytes
|
||||
} frame_t; // with extra Klatt parameters for parallel resonators
|
||||
|
||||
|
||||
typedef struct { // 44 bytes
|
||||
short frflags;
|
||||
short ffreq[7];
|
||||
@@ -114,32 +116,7 @@ typedef struct { // 44 bytes
|
||||
unsigned char fright[3]; // width/4 f0-2
|
||||
unsigned char bw[4]; // Klatt bandwidth BNZ /2, f1,f2,f3
|
||||
unsigned char klattp[5]; // AV, FNZ, Tilt, Aspr, Skew
|
||||
} frame_t2; // TESTING
|
||||
|
||||
|
||||
#ifdef deleted
|
||||
typedef struct {
|
||||
short frflags;
|
||||
unsigned char length;
|
||||
unsigned char rms;
|
||||
short ffreq[9];
|
||||
unsigned char fheight[9];
|
||||
unsigned char fwidth[6]; // width/4
|
||||
unsigned char fright[6]; // width/4
|
||||
unsigned char fwidth6, fright6;
|
||||
unsigned char klattp[N_KLATTP];
|
||||
} frame_t;
|
||||
|
||||
typedef struct { // 43 bytes
|
||||
short frflags;
|
||||
unsigned char length;
|
||||
unsigned char rms;
|
||||
short ffreq[9];
|
||||
unsigned char fheight[9];
|
||||
unsigned char fwidth[6]; // width/4
|
||||
unsigned char fright[6]; // width/4
|
||||
} frame_t2; // the original, without Klatt additions, used for file "phondata"
|
||||
#endif
|
||||
} frame_t2; // without the extra Klatt parameters
|
||||
|
||||
|
||||
|
||||
@@ -193,14 +170,14 @@ typedef struct {
|
||||
typedef struct {
|
||||
short length_total; // not used
|
||||
unsigned char n_frames;
|
||||
unsigned char flags;
|
||||
unsigned char sqflags;
|
||||
frame_t2 frame[N_SEQ_FRAMES]; // max. frames in a spectrum sequence
|
||||
} SPECT_SEQ; // sequence of espeak formant frames
|
||||
|
||||
typedef struct {
|
||||
short length_total; // not used
|
||||
unsigned char n_frames;
|
||||
unsigned char flags;
|
||||
unsigned char sqflags;
|
||||
frame_t frame[N_SEQ_FRAMES]; // max. frames in a spectrum sequence
|
||||
} SPECT_SEQK; // sequence of klatt formants frames
|
||||
|
||||
@@ -433,7 +410,8 @@ typedef struct {
|
||||
unsigned char split_tail_end;
|
||||
unsigned char split_tune;
|
||||
|
||||
unsigned char spare[10];
|
||||
unsigned char spare[8];
|
||||
int spare2; // the struct length should be a multiple of 4 bytes
|
||||
} TUNE;
|
||||
|
||||
extern int n_tunes;
|
||||
|
||||
+13
-12
@@ -122,7 +122,8 @@ static Translator* NewTranslator(void)
|
||||
tr->data_dictrules = NULL; // language_1 translation rules file
|
||||
tr->data_dictlist = NULL; // language_2 dictionary lookup file
|
||||
|
||||
tr->transpose_min = 0;
|
||||
tr->transpose_min = 'a';
|
||||
tr->transpose_max = 'z';
|
||||
tr->frequent_pairs = NULL;
|
||||
|
||||
// only need lower case
|
||||
@@ -167,6 +168,7 @@ static Translator* NewTranslator(void)
|
||||
tr->langopts.replace_chars = NULL;
|
||||
tr->langopts.ascii_language = ""; // Non-Latin alphabet languages, use this language to speak Latin words, default is English
|
||||
|
||||
|
||||
SetLengthMods(tr,201);
|
||||
// tr->langopts.length_mods = length_mods_en;
|
||||
// tr->langopts.length_mods0 = length_mods_en0;
|
||||
@@ -178,6 +180,7 @@ static Translator* NewTranslator(void)
|
||||
tr->langopts.thousands_sep = ',';
|
||||
tr->langopts.decimal_sep = '.';
|
||||
tr->langopts.break_numbers = BREAK_THOUSANDS; // 1000, 1000,000 1,000,000 etc
|
||||
tr->langopts.max_digits = 14;
|
||||
|
||||
memcpy(tr->punct_to_tone, punctuation_to_tone, sizeof(tr->punct_to_tone));
|
||||
|
||||
@@ -278,14 +281,14 @@ static void SetCyrillicLetters(Translator *tr)
|
||||
|
||||
tr->letter_bits_offset = OFFSET_CYRILLIC;
|
||||
memset(tr->letter_bits,0,sizeof(tr->letter_bits));
|
||||
SetLetterBits(tr,0,ru_vowels);
|
||||
SetLetterBits(tr,LETTERGP_A,ru_vowels);
|
||||
SetLetterBits(tr,1,ru_soft);
|
||||
SetLetterBits(tr,2,ru_consonants);
|
||||
SetLetterBits(tr,3,ru_hard);
|
||||
SetLetterBits(tr,4,ru_nothard);
|
||||
SetLetterBits(tr,5,ru_voiced);
|
||||
SetLetterBits(tr,6,ru_ivowels);
|
||||
SetLetterBits(tr,7,ru_vowels);
|
||||
SetLetterBits(tr,LETTERGP_VOWEL2,ru_vowels);
|
||||
} // end of SetCyrillicLetters
|
||||
|
||||
|
||||
@@ -419,10 +422,8 @@ Translator *SelectTranslator(const char *name)
|
||||
static const short stress_lengths_da[8] = {160,140, 200,200, 0,0, 220,230};
|
||||
SetupTranslator(tr,stress_lengths_da,NULL);
|
||||
|
||||
tr->transpose_min = 'a';
|
||||
tr->transpose_max = 'z';
|
||||
|
||||
tr->langopts.stress_rule = STRESSPOSN_1L;
|
||||
tr->langopts.param[LOPT_PREFIXES] = 1;
|
||||
SetLetterVowel(tr,'y');
|
||||
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_SWAP_TENS | NUM_HUNDRED_AND | NUM_OMIT_1_HUNDRED | NUM_ORDINAL_DOT | NUM_1900 | NUM_ROMAN | NUM_ROMAN_CAPITALS | NUM_ROMAN_ORDINAL;
|
||||
}
|
||||
@@ -451,9 +452,6 @@ Translator *SelectTranslator(const char *name)
|
||||
static const short stress_lengths_en[8] = {182,140, 220,220, 0,0, 248,275};
|
||||
SetupTranslator(tr,stress_lengths_en,NULL);
|
||||
|
||||
tr->transpose_min = 'a';
|
||||
tr->transpose_max = 'z';
|
||||
|
||||
tr->langopts.stress_rule = STRESSPOSN_1L;
|
||||
tr->langopts.stress_flags = 0x08;
|
||||
tr->langopts.numbers = NUM_HUNDRED_AND | NUM_ROMAN | NUM_1900;
|
||||
@@ -485,6 +483,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->letter_bits_offset = OFFSET_GREEK;
|
||||
memset(tr->letter_bits,0,sizeof(tr->letter_bits));
|
||||
SetLetterBits(tr,LETTERGP_A,el_vowels);
|
||||
SetLetterBits(tr,LETTERGP_VOWEL2,el_vowels);
|
||||
SetLetterBits(tr,LETTERGP_B,el_voiceless);
|
||||
SetLetterBits(tr,LETTERGP_C,el_consonants);
|
||||
SetLetterBits(tr,LETTERGP_Y,el_fvowels); // front vowels: ε η ι υ
|
||||
@@ -733,6 +732,7 @@ SetLengthMods(tr,3); // all equal
|
||||
tr->letter_bits_offset = OFFSET_ARMENIAN;
|
||||
memset(tr->letter_bits,0,sizeof(tr->letter_bits));
|
||||
SetLetterBits(tr,LETTERGP_A,hy_vowels);
|
||||
SetLetterBits(tr,LETTERGP_VOWEL2,hy_vowels);
|
||||
SetLetterBits(tr,LETTERGP_C,hy_consonants);
|
||||
tr->langopts.max_initial_consonants = 6;
|
||||
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_OMIT_1_HUNDRED;
|
||||
@@ -883,7 +883,7 @@ SetLengthMods(tr,3); // all equal
|
||||
|
||||
SetupTranslator(tr,stress_lengths_mk,stress_amps_mk);
|
||||
tr->charset_a0 = charsets[5]; // ISO-8859-5
|
||||
tr->letter_groups[0] = vowels_cyrillic;
|
||||
tr->letter_groups[0] = tr->letter_groups[7] = vowels_cyrillic;
|
||||
|
||||
tr->langopts.stress_rule = STRESSPOSN_3R; // antipenultimate
|
||||
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_AND_UNITS | NUM_OMIT_1_HUNDRED | NUM_OMIT_1_THOUSAND | NUM_DFRACTION_2;
|
||||
@@ -902,7 +902,7 @@ SetLengthMods(tr,3); // all equal
|
||||
tr->langopts.param[LOPT_PREFIXES] = 1;
|
||||
tr->langopts.param[LOPT_REGRESSIVE_VOICING] = 0x10; // devoice at end of word
|
||||
SetLetterVowel(tr,'y');
|
||||
|
||||
|
||||
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_SWAP_TENS | NUM_OMIT_1_HUNDRED | NUM_ALLOW_SPACE | NUM_1900 | NUM_ORDINAL_DOT;
|
||||
tr->langopts.ordinal_indicator = "e";
|
||||
memcpy(tr->stress_lengths,stress_lengths_nl,sizeof(tr->stress_lengths));
|
||||
@@ -1037,6 +1037,7 @@ SetLengthMods(tr,3); // all equal
|
||||
tr->langopts.stress_flags = 0x20;
|
||||
tr->langopts.param[LOPT_REGRESSIVE_VOICING] = 0x13;
|
||||
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_SWAP_TENS | NUM_OMIT_1_HUNDRED | NUM_DFRACTION_2 | NUM_ORDINAL_DOT | NUM_ROMAN;
|
||||
tr->langopts.numbers2 = 0x100; // plural forms of millions etc
|
||||
tr->langopts.thousands_sep = ' '; // don't allow dot as thousands separator
|
||||
SetLetterVowel(tr,'r');
|
||||
break;
|
||||
@@ -1192,7 +1193,7 @@ SetLengthMods(tr,3); // all equal
|
||||
tr->langopts.stress_rule = STRESSPOSN_1L;
|
||||
tr->langopts.word_gap = 0x21; // length of a final vowel is less dependent on the next consonant, don't merge consonant with next word
|
||||
// tr->langopts.vowel_pause = 4;
|
||||
tr->letter_groups[0] = vowels_vi;
|
||||
tr->letter_groups[0] = tr->letter_groups[7] = vowels_vi;
|
||||
tr->langopts.tone_language = 1; // Tone language, use CalcPitches_Tone() rather than CalcPitches()
|
||||
tr->langopts.unstressed_wd1 = 2;
|
||||
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_HUNDRED_AND | NUM_DFRACTION_4;
|
||||
|
||||
+34
-11
@@ -766,12 +766,14 @@ int TranslateWord(Translator *tr, char *word1, int next_pause, WORD_TAB *wtab)
|
||||
|
||||
int word_length;
|
||||
int ix;
|
||||
char *p;
|
||||
int pfix;
|
||||
int n_chars;
|
||||
unsigned int dictionary_flags[2];
|
||||
unsigned int dictionary_flags2[2];
|
||||
int end_type=0;
|
||||
int prefix_type=0;
|
||||
int prefix_stress;
|
||||
char *wordx;
|
||||
char phonemes[N_WORD_PHONEMES];
|
||||
char *ph_limit;
|
||||
@@ -1007,7 +1009,6 @@ if((wmark > 0) && (wmark < 8))
|
||||
|
||||
while(((length < 3) && (length > 0))|| (word_length > 1 && Unpronouncable(tr,wordx)))
|
||||
{
|
||||
char *p;
|
||||
// This word looks "unpronouncable", so speak letters individually until we
|
||||
// find a remainder that we can pronounce.
|
||||
emphasize_allcaps = 0;
|
||||
@@ -1311,9 +1312,15 @@ if(dictionary_flags2[0] & FLAG_ABBREV)
|
||||
|
||||
/* determine stress pattern for this word */
|
||||
/******************************************/
|
||||
/* NOTE: this also adds a single PAUSE if the previous word ended
|
||||
in a primary stress, and this one starts with one */
|
||||
if(prefix_flags || (strchr(prefix_phonemes,phonSTRESS_P)!=NULL))
|
||||
prefix_stress = 0;
|
||||
for(p = prefix_phonemes; *p != 0; p++)
|
||||
{
|
||||
if((*p == phonSTRESS_P) || (*p == phonSTRESS_P2))
|
||||
{
|
||||
prefix_stress = *p;
|
||||
}
|
||||
}
|
||||
if(prefix_flags || (prefix_stress != 0))
|
||||
{
|
||||
if((tr->langopts.param[LOPT_PREFIXES]) || (prefix_type & SUFX_T))
|
||||
{
|
||||
@@ -1698,7 +1705,7 @@ static int TranslateWord2(Translator *tr, char *word, WORD_TAB *wtab, int pre_pa
|
||||
return(flags);
|
||||
}
|
||||
|
||||
if(flags & FLAG_COMBINE)
|
||||
if((flags & FLAG_COMBINE) && !(wtab[1].flags & FLAG_PHONEMES))
|
||||
{
|
||||
char *p2;
|
||||
int ok = 1;
|
||||
@@ -1800,6 +1807,7 @@ static int TranslateWord2(Translator *tr, char *word, WORD_TAB *wtab, int pre_pa
|
||||
// ?? Option to set the word-stress according to language1 rules eg. lang=fr)
|
||||
if(ChangeEquivalentPhonemes(tr, switch_phonemes, (char *)p))
|
||||
{
|
||||
// Phonemes have been converted from the foreign language to the native language
|
||||
switch_phonemes = -1;
|
||||
}
|
||||
|
||||
@@ -1807,6 +1815,10 @@ static int TranslateWord2(Translator *tr, char *word, WORD_TAB *wtab, int pre_pa
|
||||
{
|
||||
strcpy(dictionary_name, old_dictionary_name);
|
||||
SelectPhonemeTable(voice->phoneme_tab_ix);
|
||||
|
||||
// leave switch_phonemes set, but use the original phoneme table number.
|
||||
// This will suppress LOPT_REGRESSIVE_VOICING
|
||||
switch_phonemes = voice->phoneme_tab_ix; // original phoneme table
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2303,6 +2315,7 @@ void *TranslateClause(Translator *tr, FILE *f_text, const void *vp_input, int *t
|
||||
char *p;
|
||||
int j, k;
|
||||
int n_digits;
|
||||
int individual_digits;
|
||||
int charix_top=0;
|
||||
|
||||
short charix[N_TR_SOURCE+4];
|
||||
@@ -2338,7 +2351,9 @@ void *TranslateClause(Translator *tr, FILE *f_text, const void *vp_input, int *t
|
||||
for(p=source; *p != 0; p++)
|
||||
fputc(*p, f_logespeak);
|
||||
fprintf(f_logespeak,"ENDCLAUSE\n");
|
||||
fflush(f_logespeak);
|
||||
}
|
||||
p = source;
|
||||
|
||||
charix[charix_top+1] = 0;
|
||||
charix[charix_top+2] = 0x7fff;
|
||||
@@ -2947,7 +2962,11 @@ if((c == '/') && (tr->langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(pre
|
||||
words[word_count].pre_pause = 8;
|
||||
if(word_count > 0)
|
||||
{
|
||||
words[word_count-1].flags |= FLAG_LAST_WORD;
|
||||
ix = word_count-1;
|
||||
while((ix > 0) && (IsBracket(sbuf[words[ix].start])))
|
||||
ix--; // the last word is a bracket, mark the previous word as last
|
||||
words[ix].flags |= FLAG_LAST_WORD;
|
||||
|
||||
// FLAG_NOSPACE check to avoid recognizing .mr -mr
|
||||
if((terminator & CLAUSE_DOT) && !(words[word_count-1].flags & FLAG_NOSPACE))
|
||||
words[word_count-1].flags |= FLAG_HAS_DOT;
|
||||
@@ -2962,8 +2981,8 @@ if((c == '/') && (tr->langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(pre
|
||||
char *pn;
|
||||
char *pw;
|
||||
int nw;
|
||||
char number_buf[60];
|
||||
WORD_TAB num_wtab[15]; // copy of 'words', when splitting numbers into parts
|
||||
char number_buf[150];
|
||||
WORD_TAB num_wtab[50]; // copy of 'words', when splitting numbers into parts
|
||||
|
||||
// start speaking at a specified word position in the text?
|
||||
count_words++;
|
||||
@@ -2984,7 +3003,7 @@ if((c == '/') && (tr->langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(pre
|
||||
{
|
||||
// Languages with 100000 numbers. Remove thousands separators so that we can insert them again later
|
||||
pn = number_buf;
|
||||
while(pn < &number_buf[sizeof(number_buf)-3])
|
||||
while(pn < &number_buf[sizeof(number_buf)-20])
|
||||
{
|
||||
if(iswdigit(*pw))
|
||||
{
|
||||
@@ -3010,15 +3029,19 @@ if((c == '/') && (tr->langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(pre
|
||||
|
||||
for(n_digits=0; iswdigit(word[n_digits]); n_digits++); // count consecutive digits
|
||||
|
||||
if((n_digits > 4) && (word[0] != '0'))
|
||||
if(n_digits > 4)
|
||||
{
|
||||
// word is entirely digits, insert commas and break into 3 digit "words"
|
||||
number_buf[0] = ' ';
|
||||
pn = &number_buf[1];
|
||||
nx = n_digits;
|
||||
nw = 0;
|
||||
individual_digits = 0;
|
||||
|
||||
while(pn < &number_buf[sizeof(number_buf)-3])
|
||||
if((n_digits > tr->langopts.max_digits) || (word[0] == '0'))
|
||||
words[ix].flags |= FLAG_INDIVIDUAL_DIGITS;
|
||||
|
||||
while(pn < &number_buf[sizeof(number_buf)-20])
|
||||
{
|
||||
if(!isdigit(c = *pw++) && (c != tr->langopts.decimal_sep))
|
||||
break;
|
||||
|
||||
+14
-12
@@ -108,6 +108,7 @@
|
||||
#define FLAG_HAS_DOT 0x10000 // dot after this word
|
||||
#define FLAG_COMMA_AFTER 0x20000 // comma after this word
|
||||
#define FLAG_MULTIPLE_SPACES 0x40000 // word is preceded by multiple spaces, newline, or tab
|
||||
#define FLAG_INDIVIDUAL_DIGITS 0x80000 // speak number as individual digits
|
||||
|
||||
#define FLAG_SUFFIX_VOWEL 0x08000000 // remember an initial vowel from the suffix
|
||||
#define FLAG_NO_TRACE 0x10000000 // passed to TranslateRules() to suppress dictionary lookup printout
|
||||
@@ -194,18 +195,18 @@
|
||||
#define PUNCT_SAY_NAME 0x200000
|
||||
#define CLAUSE_DOT 0x400000
|
||||
|
||||
#define CLAUSE_NONE 0 + 0x04000
|
||||
#define CLAUSE_PARAGRAPH 70 + 0x80000
|
||||
#define CLAUSE_EOF 40 + 0x90000
|
||||
#define CLAUSE_VOICE 0 + 0x24000
|
||||
#define CLAUSE_PERIOD 40 + 0x80000
|
||||
#define CLAUSE_COMMA 20 + 0x41000
|
||||
#define CLAUSE_SHORTCOMMA 4 + 0x41000
|
||||
#define CLAUSE_SHORTFALL 4 + 0x40000
|
||||
#define CLAUSE_QUESTION 40 + 0x82000
|
||||
#define CLAUSE_EXCLAMATION 45 + 0x83000
|
||||
#define CLAUSE_COLON 30 + 0x40000
|
||||
#define CLAUSE_SEMICOLON 30 + 0x41000
|
||||
#define CLAUSE_NONE ( 0 + 0x04000)
|
||||
#define CLAUSE_PARAGRAPH (70 + 0x80000)
|
||||
#define CLAUSE_EOF (40 + 0x90000)
|
||||
#define CLAUSE_VOICE ( 0 + 0x24000)
|
||||
#define CLAUSE_PERIOD (40 + 0x80000)
|
||||
#define CLAUSE_COMMA (20 + 0x41000)
|
||||
#define CLAUSE_SHORTCOMMA ( 4 + 0x41000)
|
||||
#define CLAUSE_SHORTFALL ( 4 + 0x40000)
|
||||
#define CLAUSE_QUESTION (40 + 0x82000)
|
||||
#define CLAUSE_EXCLAMATION (45 + 0x83000)
|
||||
#define CLAUSE_COLON (30 + 0x40000)
|
||||
#define CLAUSE_SEMICOLON (30 + 0x41000)
|
||||
|
||||
#define SAYAS_CHARS 0x12
|
||||
#define SAYAS_GLYPHS 0x13
|
||||
@@ -439,6 +440,7 @@ typedef struct {
|
||||
int min_roman;
|
||||
int thousands_sep;
|
||||
int decimal_sep;
|
||||
int max_digits; // max number of digits which can be spoken as an integer number (rather than individual digits)
|
||||
const char *ordinal_indicator; // UTF-8 string
|
||||
|
||||
// bit 0, accent name before the letter name, bit 1 "capital" after letter name
|
||||
|
||||
+6
-3
@@ -921,7 +921,10 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
|
||||
phtrans[0] = 0;
|
||||
sscanf(p,"%s %s %d",name,phtrans,&srate);
|
||||
LoadMbrolaTable(name,phtrans,srate);
|
||||
if(LoadMbrolaTable(name,phtrans,srate) != EE_OK)
|
||||
{
|
||||
fprintf(stderr,"mbrola voice not found\n");
|
||||
}
|
||||
voice->samplerate = srate;
|
||||
}
|
||||
break;
|
||||
@@ -934,7 +937,7 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
|
||||
case V_FAST:
|
||||
Read8Numbers(p,speed.fast_settings);
|
||||
SetSpeed(2);
|
||||
SetSpeed(3);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -958,7 +961,7 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
new_translator = SelectTranslator(translator_name);
|
||||
}
|
||||
|
||||
SetSpeed(1); // for speed_percent
|
||||
SetSpeed(3); // for speed_percent
|
||||
|
||||
for(ix=0; ix<N_PEAKS; ix++)
|
||||
{
|
||||
|
||||
+1
-1
@@ -611,7 +611,7 @@ void MakeVowelLists(void)
|
||||
prog_log_table = (PHONEME_PROG_LOG *)malloc(ix);
|
||||
if(prog_log_table == NULL)
|
||||
return;
|
||||
fread(prog_log_table, 1, ix, f_prog_log);
|
||||
ix = fread(prog_log_table, 1, ix, f_prog_log);
|
||||
fclose(f_prog_log);
|
||||
prog_log_end = prog_log_table + ix;
|
||||
n_prog_log = ix / sizeof(PHONEME_PROG_LOG);
|
||||
|
||||
+1
-1
@@ -133,7 +133,7 @@ int wcmdq_head=0;
|
||||
int wcmdq_tail=0;
|
||||
|
||||
// pitch,speed,
|
||||
int embedded_default[N_EMBEDDED_VALUES] = {0,50,175,100,50, 0,0, 0,175,0,0,0,0,0,0};
|
||||
int embedded_default[N_EMBEDDED_VALUES] = {0, 50,175,100,50, 0, 0, 0,175,0,0,0,0,0,0};
|
||||
static int embedded_max[N_EMBEDDED_VALUES] = {0,0x7fff,600,300,99,99,99, 0,600,0,0,0,0,4,0};
|
||||
|
||||
#define N_CALLBACK_IX N_WAV_BUF-2 // adjust this delay to match display with the currently spoken word
|
||||
|
||||
Reference in New Issue
Block a user