Merge tag '1.48.15' into android

espeak 1.48.15
This commit is contained in:
Reece H. Dunn
2015-07-25 09:51:12 +01:00
77 changed files with 6916 additions and 3702 deletions
+1 -1
View File
@@ -3749,7 +3749,7 @@ fprintf(f_errors,"\nRefs %d, Reused %d\n",count_references,duplicate_references
#include <errno.h>
void CompileMbrola(const char *mbrola_file)
void CompileMbrola(const wxChar *mbrola_file)
{//=================
char *p;
FILE *f_in;
+4 -2
View File
@@ -1200,6 +1200,7 @@ void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags,
If 'tonic' is set (>= 0), replace highest stress by this value.
control: bit 0 This is an individual symbol, not a word
bit 1 Suffix phonemes are still to be added
*/
unsigned char phcode;
@@ -1586,11 +1587,12 @@ void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags,
break;
}
if((stressflags & S_FINAL_VOWEL_UNSTRESSED) && (vowel_count > 2) && (max_stress_input < 3) && (vowel_stress[vowel_count - 1] == 4))
if((stressflags & S_FINAL_VOWEL_UNSTRESSED) && ((control & 2) == 0) && (vowel_count > 2) && (max_stress_input < 3) && (vowel_stress[vowel_count - 1] == 4))
{
// Don't allow stress on a word-final vowel
// Only do this if there is no suffix phonemes to be added, and if a stress position was not given explicitly
if(phoneme_tab[final_ph]->type == phVOWEL)
{
// don't allow stress on a word-final vowel
vowel_stress[vowel_count - 1] = 1;
vowel_stress[vowel_count - 2] = 4;
}
+3 -3
View File
@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2005 to 2014 by Jonathan Duddington *
* Copyright (C) 2005 to 2015 by Jonathan Duddington *
* email: jonsd@users.sourceforge.net *
* Copyright (C) 2013 by Reece H. Dunn *
* *
@@ -63,7 +63,7 @@ extern void DictionarySort(const char *dictname);
extern void init_z();
extern void CompilePhonemeData(void);
extern void CompileSampleRate(void);
extern void CompileMbrola(const char *mbrola_file = NULL);
extern void CompileMbrola(const wxChar *mbrola_file = NULL);
extern void CompileIntonation();
extern void InitSpectrumDisplay();
extern void InitProsodyDisplay();
@@ -652,7 +652,7 @@ void OnOptions2(int event_id)
break;
case MENU_PATH_DATA:
string = wxDirSelector(_T("espeak_data directory"), wxEmptyString);
string = wxDirSelector(_T("espeak_data directory"), path_espeakdata);
if(!string.IsEmpty())
{
if(!wxDirExists(string+_T("/voices")))
+31 -9
View File
@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2005 to 2014 by Jonathan Duddington *
* Copyright (C) 2005 to 2015 by Jonathan Duddington *
* email: jonsd@users.sourceforge.net *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -39,7 +39,7 @@
#include "translate.h"
#define M_LIGATURE 0x8000
#define M_NAME 0
#define M_SMALLCAP 1
#define M_TURNED 2
@@ -111,7 +111,7 @@ static ACCENTS accents_tab[] = {
#define CAPITAL 0
#define LETTER(ch,mod1,mod2) (ch-59)+(mod1 << 6)+(mod2 << 11)
#define LIGATURE(ch1,ch2,mod1) (ch1-59)+((ch2-59) << 6)+(mod1 << 12)+0x8000
#define LIGATURE(ch1,ch2,mod1) (ch1-59)+((ch2-59) << 6)+(mod1 << 12)+M_LIGATURE
#define L_ALPHA 60 // U+3B1
@@ -128,11 +128,12 @@ static ACCENTS accents_tab[] = {
#define L_EZH 70 // U+292
#define L_GLOTTAL 71 // U+294
#define L_RTAP 72 // U+27E
#define L_RLONG 73 // U+27C
static const short non_ascii_tab[] = {
0, 0x3b1, 0x259, 0x25b, 0x3b3, 0x3b9, 0x153, 0x3c9,
0x3c6, 0x283, 0x3c5, 0x292, 0x294, 0x27e
0x3c6, 0x283, 0x3c5, 0x292, 0x294, 0x27e, 0x27c
};
@@ -298,6 +299,8 @@ static const unsigned short letter_accents_0e0[] = {
CAPITAL,
LETTER('z',M_CARON,0),
LETTER('s',M_NAME,0), // long-s // U+17f
// LETTER('b',M_STROKE,0),
};
@@ -345,7 +348,7 @@ static const unsigned short letter_accents_250[] = {
0,//LETTER(L_OMEGA,M_CLOSED,0),
LETTER(L_PHI,0,0), // U+278
LETTER('r',M_TURNED,0),
0,//LETTER('r',M_TURNED,M_LEG),
LETTER(L_RLONG,M_TURNED,0),
LETTER('r',M_RETROFLEX,M_TURNED),
0,//LETTER('r',M_LEG,0),
LETTER('r',M_RETROFLEX,0),
@@ -355,7 +358,7 @@ static const unsigned short letter_accents_250[] = {
LETTER('r',M_TURNED,M_SMALLCAP),
LETTER('s',M_RETROFLEX,0),
0, // esh
0,//LETTER('j',M_BAR,L_IMPLOSIVE),
LETTER('j',M_HOOK,0), //LETTER('j',M_HOOK,M_BAR),
LETTER(L_ESH,M_REVERSED,0),
LETTER(L_ESH,M_CURL,0),
LETTER('t',M_TURNED,0),
@@ -448,7 +451,7 @@ void LookupAccentedLetter(Translator *tr, unsigned int letter, char *ph_buf)
if(basic_letter < 'a')
basic_letter = non_ascii_tab[basic_letter-59];
if(accent_data & 0x8000)
if(accent_data & M_LIGATURE)
{
letter2 = (accent_data >> 6) & 0x3f;
letter2 += 59;
@@ -461,6 +464,12 @@ void LookupAccentedLetter(Translator *tr, unsigned int letter, char *ph_buf)
}
if((accent1==0) && !(accent_data & M_LIGATURE))
{
// just a letter name, not an accented character or ligature
return;
}
if((flags1 = Lookup(tr, accents_tab[accent1].name, ph_accent1)) != 0)
{
@@ -1173,7 +1182,14 @@ int TranslateRoman(Translator *tr, char *word, char *ph_out, WORD_TAB *wtab)
return(0); // not '2xx'
if(word[1] == ' ')
return(0); // only one letter, don't speak as a Roman Number
{
if((tr->langopts.numbers & (NUM_ROMAN_CAPITALS | NUM_ROMAN_ORDINAL | NUM_ORDINAL_DOT)) && (wtab[0].flags & FLAG_HAS_DOT))
{
// allow single letter Roman ordinal followed by dot.
}
else
return(0); // only one letter, don't speak as a Roman Number
}
word_start = word;
while((c = *word++) != ' ')
@@ -1552,7 +1568,7 @@ static int LookupNum2(Translator *tr, int value, int thousandplex, const int con
// no, speak as tens+units
if((control & 0x10) && (value < 10))
if((value < 10) && (control & 0x10))
{
// speak leading zero
Lookup(tr, "_0", ph_tens);
@@ -1967,6 +1983,12 @@ static int LookupNum3(Translator *tr, int value, char *ph_out, int suppress_null
x |= 0x208; // use #f form for both tens and units
}
if((tr->langopts.numbers2 & NUM2_ZERO_TENS) && ((control & 1) || (hundreds > 0)))
{
// LANG=zh,
x |= 0x10;
}
if(LookupNum2(tr, tensunits, thousandplex, x | (control & 0x100), buf2) != 0)
{
if(tr->langopts.numbers & NUM_SINGLE_AND)
+4 -4
View File
@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2005 to 2014 by Jonathan Duddington *
* Copyright (C) 2005 to 2015 by Jonathan Duddington *
* email: jonsd@users.sourceforge.net *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -44,7 +44,7 @@
#endif
#include <locale.h>
#define N_XML_BUF 256
#define N_XML_BUF 500
static const char *xmlbase = ""; // base URL from <speak>
@@ -2407,9 +2407,9 @@ f_input = f_in; // for GetC etc
else
if((c1 == '<') && (ssml_ignore_l_angle != '<'))
{
if(c2 == '!')
if((c2 == '!') || (c2 == '?'))
{
// a comment, ignore until closing '<'
// a comment, ignore until closing '<' (or <?xml tag )
while(!Eof() && (c1 != '>'))
{
c1 = GetC();
+2 -2
View File
@@ -168,7 +168,7 @@ void SetSpeed(int control)
{
DoSonicSpeed(1 * 1024);
}
if((wpm_value > 450) || ((wpm_value > speed.fast_settings[0]) && (wpm > 350)))
if((wpm_value >= 450) || ((wpm_value > speed.fast_settings[0]) && (wpm > 350)))
{
wpm2 = wpm;
wpm = 175;
@@ -313,7 +313,7 @@ speed.min_sample_len = (speed.min_sample_len * samplerate_native) / 22050;
#ifdef TEST_SPEED
//if(control==3)
printf("%3d: speedf %d %d %d pause=%d %d wav=%d lenmod=%d %d\n",wpm,speed1,speed2,speed3, speed.pause_factor,speed.clause_pause_factor, speed.wav_factor,speed.lenmod_factor,speed.lenmod2_factor);
printf("%3d: speedf %d %d %d x=%d pause=%d %d wav=%d lenmod=%d %d\n",wpm,speed1,speed2,speed3, speed_lookup[wpm2-80], speed.pause_factor,speed.clause_pause_factor, speed.wav_factor,speed.lenmod_factor,speed.lenmod2_factor);
#endif
} // end of SetSpeed
+1 -1
View File
@@ -773,7 +773,7 @@ static int skipPitchPeriod(
float speed,
int period)
{
long newSamples;
long newSamples = period;
int numChannels = stream->numChannels;
if(speed >= 2.0f) {
+1 -1
View File
@@ -35,7 +35,7 @@
#include "translate.h"
#include "wave.h"
const char *version_string = "1.48.11 31.Aug.14";
const char *version_string = "1.48.15 16.Apr.15";
const int version_phdata = 0x014801;
int option_device_number = -1;
+14 -4
View File
@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2005 to 2014 by Jonathan Duddington *
* Copyright (C) 2005 to 2015 by Jonathan Duddington *
* email: jonsd@users.sourceforge.net *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -72,7 +72,7 @@
#define OFFSET_ETHIOPIC 0x1200
// character ranges must be listed in ascending order
// character ranges must be listed in ascending unicode order
ALPHABET alphabets [] = {
{"_el", OFFSET_GREEK, 0x380, 0x3ff, L('e','l'), AL_DONT_NAME | AL_NOT_LETTERS | AL_WORDS},
{"_cyr", OFFSET_CYRILLIC, 0x400, 0x52f, 0, 0},
@@ -563,6 +563,13 @@ Translator *SelectTranslator(const char *name)
tr->langopts.numbers = NUM_SWAP_TENS;
tr->langopts.break_numbers = 0x24924aa8; // for languages which have numbers for 100,000 and 100,00,000, eg Hindi
if(name2 == L_mni)
{
tr->langopts.numbers = 1;
tr->langopts.numbers2 = NUM2_SWAP_THOUSANDS;
}
}
break;
@@ -887,6 +894,7 @@ Translator *SelectTranslator(const char *name)
case L('o','r'): // Oriya
case L('p','a'): // Punjabi
case L('g','u'): // Gujarati
case L('m','r'): // Marathi
{
static const short stress_lengths_hi[8] = {190, 190, 210, 210, 0, 0, 230, 250};
static const unsigned char stress_amps_hi[8] = {17,14, 20,19, 20,22, 22,21 };
@@ -1078,6 +1086,7 @@ SetLengthMods(tr,3); // all equal
tr->langopts.param[LOPT_REDUCE] = 1; // reduce vowels even if phonemes are specified in it_list
tr->langopts.param[LOPT_ALT] = 2; // call ApplySpecialAttributes2() if a word has $alt or $alt2
tr->langopts.numbers = NUM_SINGLE_VOWEL | NUM_OMIT_1_HUNDRED |NUM_DECIMAL_COMMA | NUM_ROMAN | NUM_DFRACTION_1 | NUM_ROMAN_CAPITALS | NUM_ROMAN_AFTER;
tr->langopts.numbers2 = NUM2_NO_TEEN_ORDINALS;
tr->langopts.accents = 2; // Say "Capital" after the letter.
SetLetterVowel(tr,'y');
}
@@ -1500,7 +1509,6 @@ SetLengthMods(tr,3); // all equal
case L('t','a'): // Tamil
case L('k','n'): // Kannada
case L('m','l'): // Malayalam
case L('m','r'): // Marathi
case L('t','e'): // Telugu
{
SetupTranslator(tr,stress_lengths_ta2, stress_amps_ta);
@@ -1681,7 +1689,9 @@ SetLengthMods(tr,3); // all equal
{
tr->langopts.textmode = 1;
tr->langopts.listx = 1; // compile zh_listx after zh_list
}
tr->langopts.numbers = 1;
tr->langopts.numbers2 = NUM2_ZERO_TENS;
tr->langopts.break_numbers = 0x00018; }
}
break;
+9 -2
View File
@@ -865,6 +865,7 @@ int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wt
int wmark;
int was_unpronouncable = 0;
int loopcount;
int add_suffix_phonemes = 0;
WORD_TAB wtab_null[8];
// translate these to get pronunciations of plural 's' suffix (different forms depending on
@@ -1469,6 +1470,12 @@ if(end_type & SUFX_UNPRON)
/* determine stress pattern for this word */
/******************************************/
add_suffix_phonemes = 0;
if(end_phonemes[0] != 0)
{
add_suffix_phonemes = 2;
}
prefix_stress = 0;
for(p = prefix_phonemes; *p != 0; p++)
{
@@ -1520,9 +1527,9 @@ if(end_type & SUFX_UNPRON)
else
{
if(prefix_phonemes[0] == 0)
SetWordStress(tr, phonemes, dictionary_flags, -1, 0);
SetWordStress(tr, phonemes, dictionary_flags, -1, add_suffix_phonemes);
else
SetWordStress(tr, phonemes, dictionary_flags, -1, 0);
SetWordStress(tr, phonemes, dictionary_flags, -1, add_suffix_phonemes);
#ifdef PLATFORM_WINDOWS
sprintf(word_phonemes, "%s%s%s", unpron_phonemes, prefix_phonemes, phonemes);
#else
+3
View File
@@ -518,6 +518,7 @@ typedef struct {
#define NUM2_THOUSANDS_VAR4 0x100
#define NUM2_THOUSANDS_VAR5 0x140
#define NUM2_SWAP_THOUSANDS 0x200
#define NUM2_ORDINAL_NO_AND 0x800
#define NUM2_MULTIPLE_ORDINAL 0x1000
#define NUM2_NO_TEEN_ORDINALS 0x2000
@@ -527,6 +528,7 @@ typedef struct {
#define NUM2_OMIT_1_HUNDRED_ONLY 0x20000
#define NUM2_ORDINAL_AND_THOUSANDS 0x40000
#define NUM2_ORDINAL_DROP_VOWEL 0x80000 // currently only for tens and units
#define NUM2_ZERO_TENS 0x100000
// bits 1-4 use variant form of numbers before thousands,millions,etc.
// bits 6-8 use different forms of thousand, million, etc (M MA MB)
// bit9=(LANG=rw) say "thousand" and "million" before its number, not after
@@ -539,6 +541,7 @@ typedef struct {
// bit17=(LANG=ml) omit "one" before hundred only if there are no previous digits
// bit18=(LANG=ta) same variant for ordinals and thousands (#o = #a)
// bit19=(LANG=te) drop final vowel from cardial number before adding ordinal suffix
// bit20=(LANG=zh) say zero tens
int numbers2;
#define BREAK_THOUSANDS 0x49249248
+3 -3
View File
@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2005 to 2014 by Jonathan Duddington *
* Copyright (C) 2005 to 2015 by Jonathan Duddington *
* email: jonsd@users.sourceforge.net *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -613,7 +613,7 @@ voice_t *LoadVoice(const char *vname, int control)
static const char *voices_asia =
"az bn fa fa-pin gu hi hy hy-west id ka kn ku ml ms ne pa ta te tr vi vi-hue vi-sgn zh zh-yue ";
static const char *voices_europe =
"an bg bs ca cs cy da de el en en-us es et fi fr fr-be ga hr hu is it lt lv mk nl no pl pt-pt ro ru sk sq sr sv ";
"an bg bs ca cs cy da de el en en-us es et eu fi fr fr-be ga hr hu is it lt lv mk nl no pl pt-pt ro ru sk sq sr sv ";
strncpy0(voicename, vname, sizeof(voicename));
@@ -875,7 +875,7 @@ voice_t *LoadVoice(const char *vname, int control)
else
{
if((key==V_NUMBERS) && (n < 64))
langopts->numbers |= (1 << (n-32));
langopts->numbers2 |= (1 << (n-32));
else
fprintf(stderr,"Bad option number %d\n", n);
}