?2 _3C tR'ist'a_ | ?2 _3C tR'ist'a_ | ||||
?2 _4C tSetR'ist'o_ | ?2 _4C tSetR'ist'o_ | ||||
_6C S'Est'o | _6C S'Est'o | ||||
_0M1 t'isUtS;& | _0M1 t'isUtS;& | ||||
_0MA1 t'isUtS;e | _0MA1 t'isUtS;e | ||||
_1M1 t'isUtS;U | _1M1 t'isUtS;U | ||||
?3 _0M1 h'il^ad& | ?3 _0M1 h'il^ad& | ||||
?3 _0MA1 h'il^ade | ?3 _0MA1 h'il^ade | ||||
?3 _1M1 h'il^adU | ?3 _1M1 h'il^adU | ||||
_0M2 m'ilijUna | _0M2 m'ilijUna | ||||
_0MA2 m'ilijUna | _0MA2 m'ilijUna | ||||
_1M2 m'ilijUn | _1M2 m'ilijUn | ||||
?4 _0M2 m'ilijOna | ?4 _0M2 m'ilijOna | ||||
?4 _0MA2 m'ilijOna | ?4 _0MA2 m'ilijOna | ||||
?4 _1M2 m'ilijOn | ?4 _1M2 m'ilijOn | ||||
_0M3 m'iliaRdI | _0M3 m'iliaRdI | ||||
_0MA3 m'iliaRde | _0MA3 m'iliaRde | ||||
_1M3 m'iliaRdU | _1M3 m'iliaRdU | ||||
?2 _0M3 milijArdI | ?2 _0M3 milijArdI | ||||
?2 _0MA3 milijArde | ?2 _0MA3 milijArde | ||||
?2 _1M3 milijArdU | ?2 _1M3 milijArdU | ||||
_0M4 b'ilijUna | _0M4 b'ilijUna | ||||
_1M4 b'ilijUn | _1M4 b'ilijUn | ||||
?4 _0M4 b'ilijOna | ?4 _0M4 b'ilijOna | ||||
?4 _1M4 b'ilijOn | ?4 _1M4 b'ilijOn | ||||
_dpt _:z'a*Ez_ | _dpt _:z'a*Ez_ | ||||
_roman r*'imsko | _roman r*'imsko | ||||
acerto $alt2 $noun | acerto $alt2 $noun | ||||
adore $alt | adore $alt | ||||
albatrozes $alt | |||||
alferes $alt | alferes $alt | ||||
algozes $alt | |||||
atrozes $alt | |||||
ameba $alt | ameba $alt | ||||
belo $alt | |||||
besta $alt2 | |||||
boca $alt2 | boca $alt2 | ||||
bolo $alt2 | |||||
borboleta $alt2 | borboleta $alt2 | ||||
bordo $alt | |||||
cabeça $alt2 | |||||
casebre $alt | |||||
catorze $alt2 | catorze $alt2 | ||||
cerca $alt $verb | cerca $alt $verb | ||||
cerco $alt $verb | cerco $alt $verb | ||||
chamego $alt2 | chamego $alt2 | ||||
chefe $alt | |||||
chinelo $alt | |||||
coco $alt2 | |||||
começo $alt2 $noun | |||||
comeres $alt2 | comeres $alt2 | ||||
conheço $alt2 | conheço $alt2 | ||||
copa $alt | copa $alt | ||||
copo $alt | copo $alt | ||||
cornos $alt | |||||
corpos $alt | corpos $alt | ||||
corto $alt | |||||
corvos $alt | corvos $alt | ||||
coto $alt2 | |||||
couber $alt | couber $alt | ||||
couberem $alt | couberem $alt | ||||
couberdes $alt | couberdes $alt | ||||
couberes $alt | couberes $alt | ||||
der $alt | der $alt | ||||
descova $alt2 | |||||
desfecho $alt2 | |||||
dez $alt | dez $alt | ||||
doce $alt2 | doce $alt2 | ||||
descova $alt2 | |||||
droga $alt | |||||
enumerem $alt | enumerem $alt | ||||
erro $alt2 $noun | erro $alt2 $noun | ||||
esforços $alt | |||||
esperma $alt | |||||
estrofe $alt | |||||
estiverdes $alt | estiverdes $alt | ||||
estiveres $alt | estiveres $alt | ||||
farofa $alt | farofa $alt | ||||
fere $alt | fere $alt | ||||
ferem $alt | ferem $alt | ||||
fezes $alt | |||||
fizer $alt | fizer $alt | ||||
fizerem $alt | fizerem $alt | ||||
fizerdes $alt | fizerdes $alt | ||||
fizeres $alt | fizeres $alt | ||||
fogos $alt | fogos $alt | ||||
fores $alt2 | |||||
fosse $alt2 | fosse $alt2 | ||||
fossem $alt2 | fossem $alt2 | ||||
foste $alt2 | |||||
frevo $alt2 | |||||
gelo $alt $verb | |||||
germe $alt | germe $alt | ||||
grego $alt2 | |||||
groselha $alt | |||||
grosso $alt2 | grosso $alt2 | ||||
grozo $alt $verb | |||||
hoje $alt2 | hoje $alt2 | ||||
joga $alt | |||||
jogam $alt | |||||
jogos $alt | jogos $alt | ||||
jogue $alt | |||||
joguem $alt | |||||
líderes $alt2 | líderes $alt2 | ||||
lopes $alt | lopes $alt | ||||
mantiverdes $alt | mantiverdes $alt | ||||
mexa m'eS& | mexa m'eS& | ||||
mexi meS'i | mexi meS'i | ||||
mexo m'eSU | mexo m'eSU | ||||
miolo $alt2 | |||||
modo $alt | modo $alt | ||||
modos $alt | modos $alt | ||||
molho $alt $verb | |||||
morcego $alt2 | |||||
morda $alt2 | |||||
mortos $alt | mortos $alt | ||||
?2 mulher mulj'Er | ?2 mulher mulj'Er | ||||
?4 mulher mul^'Er | ?4 mulher mul^'Er | ||||
muito mw'iNtU // -s is included as a suffix | muito mw'iNtU // -s is included as a suffix | ||||
muita mw'iNt& | muita mw'iNt& | ||||
mulheres $alt | mulheres $alt | ||||
negro $alt2 | |||||
novos $alt | novos $alt | ||||
onu $1 | onu $1 | ||||
opereta $alt2 | |||||
osso $alt2 | |||||
ovos $alt | ovos $alt | ||||
paexa paeSa | paexa paeSa | ||||
pedra $alt | pedra $alt | ||||
pelego $alt2 | |||||
perdem $alt | perdem $alt | ||||
perede $alt2 | |||||
pesa $alt | pesa $alt | ||||
pesam $alt | pesam $alt | ||||
pesque $alt | |||||
pesquem $alt | |||||
peso $alt | peso $alt | ||||
peso $alt2 $noun | peso $alt2 $noun | ||||
portos $alt | portos $alt | ||||
pose $alt2 | |||||
povos $alt | povos $alt | ||||
preto $alt2 | preto $alt2 | ||||
profere $alt | profere $alt | ||||
selvagem seUv'aZeIN | selvagem seUv'aZeIN | ||||
soco $alt2 | soco $alt2 | ||||
sofrem $alt | sofrem $alt | ||||
sofres $alt | |||||
sofre $alt | |||||
sofreste $alt2 | |||||
sopre $alt | sopre $alt | ||||
soprem $alt | soprem $alt | ||||
souber $alt | souber $alt | ||||
souberdes $alt | souberdes $alt | ||||
souberes $alt | souberes $alt | ||||
souberem $alt | souberem $alt | ||||
sugere $alt | |||||
sugerem $alt | sugerem $alt | ||||
suor swOr | suor swOr | ||||
tapete $alt2 | tapete $alt2 | ||||
tiver $alt | tiver $alt | ||||
tiveres $alt | tiveres $alt | ||||
torres $alt2 | torres $alt2 | ||||
tortos $alt | |||||
travesso $alt2 | |||||
trevo $alt2 | |||||
troco $alt2 $noun | |||||
tropeço $alt2 $noun | tropeço $alt2 $noun | ||||
vanessa $alt2 | vanessa $alt2 | ||||
verbo $alt | verbo $alt | ||||
verme $alt | verme $alt | ||||
vierem $alt | vierem $alt | ||||
violeta $alt2 | violeta $alt2 | ||||
vozes $alt | |||||
// Close [o] | // Close [o] | ||||
?1 calculadora $alt2 | ?1 calculadora $alt2 |
// G a voiced consonant | // G a voiced consonant | ||||
// K not a vowel | // K not a vowel | ||||
// endings | |||||
.L01 a am o | |||||
.L02 a am e em o | |||||
.group a | .group a | ||||
_) a (_ a | _) a (_ a | ||||
_) a (_W 'a // in an acronym | _) a (_W 'a // in an acronym | ||||
?1 v) e (l_ ,E // eg: possível, amovível, disponível, etc... | ?1 v) e (l_ ,E // eg: possível, amovível, disponível, etc... | ||||
?1 l) e (ta 'E // eg: bicicleta, atleta. | ?1 l) e (ta 'E // eg: bicicleta, atleta. | ||||
_com) e (tL01_ e | |||||
_prom) e (tL01_ e | |||||
_esqu) e (çL01_ e | |||||
_derr) e (tL01_ e | |||||
_atr) e (vL01_ e | |||||
_f) e (rvL01_ e | |||||
_per) e (çL01_ e | |||||
_pad) e (çL01_ e | |||||
_dec) e (pL02_ E | |||||
_p) e (scL01_ E | |||||
.group é | .group é | ||||
é ''E | é ''E | ||||
?1 f) o (rmulá u // eg: formulário, formulários. | ?1 f) o (rmulá u // eg: formulário, formulários. | ||||
?1 v) o (lt O | ?1 v) o (lt O | ||||
_m) o (lhL02_ O | |||||
.group ô | .group ô | ||||
ô ''o | ô ''o |
name irish-test | |||||
language ga | |||||
stressrule 0 | |||||
} /* end of GetFileLength */ | } /* end of GetFileLength */ | ||||
void MarkerEvent(int type, unsigned int char_position, int value, int value2, unsigned char *out_ptr) | |||||
{ | |||||
} | |||||
void ReadVoiceNames2(char *directory) | void ReadVoiceNames2(char *directory) | ||||
{//================================== | {//================================== | ||||
if(n_voice_files >= (N_VOICE_NAMES-1)) | if(n_voice_files >= (N_VOICE_NAMES-1)) | ||||
continue; | continue; | ||||
voice_names[n_voice_files++] = p; | voice_names[n_voice_files++] = p; | ||||
if(strcmp(p,"en")==0) | |||||
{ | |||||
voice_names[n_voice_files++] = "en+f2"; | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } | ||||
WavegenInit(22050,0); | WavegenInit(22050,0); | ||||
LoadPhData(); | LoadPhData(); | ||||
SetVoiceStack(NULL); | |||||
SetVoiceStack(NULL, ""); | |||||
SynthesizeInit(); | SynthesizeInit(); | ||||
return(0); | return(0); | ||||
} | } | ||||
{ | { | ||||
int value; | int value; | ||||
int q_length; | int q_length; | ||||
int speed; | |||||
int amp; | |||||
value = r[0]; | value = r[0]; | ||||
switch(swi_no) | switch(swi_no) | ||||
break; | break; | ||||
case 8: /* speed */ | case 8: /* speed */ | ||||
speed = (value * 160)/140; | |||||
SetParameter(espeakRATE,speed,0); | |||||
SetParameter(espeakRATE,value,0); | |||||
break; | break; | ||||
case 9: /* word_gap */ | case 9: /* word_gap */ | ||||
break; | break; | ||||
case 13: /* volume */ | case 13: /* volume */ | ||||
amp = (value*45)/100; | |||||
SetParameter(espeakVOLUME,amp,0); | |||||
SetParameter(espeakVOLUME,value,0); | |||||
WavegenSetVoice(voice); | WavegenSetVoice(voice); | ||||
break; | break; | ||||
} | } | ||||
void PitchAdjust(int pitch_adjustment) | void PitchAdjust(int pitch_adjustment) | ||||
{//=================================== | {//=================================== | ||||
int ix, factor; | int ix, factor; | ||||
extern unsigned char pitch_adjust_tab[MAX_PITCH_VALUE+1]; | extern unsigned char pitch_adjust_tab[MAX_PITCH_VALUE+1]; | ||||
voice->pitch_base = (voice->pitch_base * pitch_adjust_tab[pitch_adjustment])/128; | voice->pitch_base = (voice->pitch_base * pitch_adjust_tab[pitch_adjustment])/128; | ||||
case 'm': | case 'm': | ||||
option_ssml = 1; | option_ssml = 1; | ||||
break; | break; | ||||
case 'p': | case 'p': | ||||
pitch_adjustment = param_number(&p); | pitch_adjustment = param_number(&p); | ||||
break; | break; | ||||
wordgap = param_number(&p); | wordgap = param_number(&p); | ||||
SetParameter(espeakWORDGAP,wordgap,0); | SetParameter(espeakWORDGAP,wordgap,0); | ||||
break; | break; | ||||
case 'v': | case 'v': | ||||
strncpy0(voicename,param_string(&p),sizeof(voicename)); | strncpy0(voicename,param_string(&p),sizeof(voicename)); | ||||
break; | break; | ||||
for(param=0; param<N_SPEECH_PARAM; param++) | for(param=0; param<N_SPEECH_PARAM; param++) | ||||
param_stack[0].parameter[param] = param_defaults[param]; | param_stack[0].parameter[param] = param_defaults[param]; | ||||
SetParameter(espeakRATE,170,0); | |||||
SetParameter(espeakVOLUME,65,0); | |||||
SetParameter(espeakRATE,175,0); | |||||
SetParameter(espeakVOLUME,70,0); | |||||
WavegenSetVoice(voice); | WavegenSetVoice(voice); | ||||
atexit(terminate_module); | atexit(terminate_module); |
initialisation-code: user_init | initialisation-code: user_init | ||||
title-string: Speak | title-string: Speak | ||||
help-string: Speak 3.40 Text to Speech (32 bit) | |||||
help-string: Speak 3.46 Text to Speech (32 bit) | |||||
swi-chunk-base-number: &4ad80 | swi-chunk-base-number: &4ad80 | ||||
swi-handler-code: swi_handler | swi-handler-code: swi_handler |
//#define SPECT_EDITOR | //#define SPECT_EDITOR | ||||
#define INCLUDE_KLATT | #define INCLUDE_KLATT | ||||
#define INCLUDE_MBROLA | #define INCLUDE_MBROLA | ||||
#define INCLUDE_SONIC | |||||
#include <windows.h> | #include <windows.h> | ||||
#define PLATFORM_WINDOWS | #define PLATFORM_WINDOWS |
//#define SPECT_EDITOR | //#define SPECT_EDITOR | ||||
#define INCLUDE_KLATT | #define INCLUDE_KLATT | ||||
#define INCLUDE_MBROLA | #define INCLUDE_MBROLA | ||||
#define INCLUDE_SONIC | |||||
#include <windows.h> | #include <windows.h> | ||||
#define PLATFORM_WINDOWS | #define PLATFORM_WINDOWS |
#define NO_VARIADIC_MACROS | #define NO_VARIADIC_MACROS | ||||
#define INCLUDE_KLATT | #define INCLUDE_KLATT | ||||
#define INCLUDE_MBROLA | #define INCLUDE_MBROLA | ||||
#define INCLUDE_SONIC | |||||
// will look for espeak_data directory here, and also in user's home directory | // will look for espeak_data directory here, and also in user's home directory | ||||
#define PATH_ESPEAK_DATA "/usr/share/espeak-data" | #define PATH_ESPEAK_DATA "/usr/share/espeak-data" |
#define LIBRARY | #define LIBRARY | ||||
#define INCLUDE_KLATT | #define INCLUDE_KLATT | ||||
#define INCLUDE_MBROLA | #define INCLUDE_MBROLA | ||||
#define INCLUDE_SONIC | |||||
// will look for espeak_data directory here, and also in user's home directory | // will look for espeak_data directory here, and also in user's home directory | ||||
#define PATH_ESPEAK_DATA "/usr/share/espeak-data" | #define PATH_ESPEAK_DATA "/usr/share/espeak-data" |
//#define USE_NANOSLEEP | //#define USE_NANOSLEEP | ||||
#define INCLUDE_KLATT | #define INCLUDE_KLATT | ||||
#define INCLUDE_MBROLA | #define INCLUDE_MBROLA | ||||
#define INCLUDE_SONIC | |||||
// will look for espeak_data directory here, and also in user's home directory | // will look for espeak_data directory here, and also in user's home directory | ||||
#define PATH_ESPEAK_DATA "/usr/share/espeak-data" | #define PATH_ESPEAK_DATA "/usr/share/espeak-data" |
static const char *M_Variant(int value) | static const char *M_Variant(int value) | ||||
{//==================================== | {//==================================== | ||||
// returns M, or perhaps MA for some cases | |||||
// returns M, or perhaps MA or MB for some cases | |||||
if(translator->translator_name == L('l','t')) | |||||
int teens = 0; | |||||
if(((value % 100) > 10) && ((value % 100) < 20)) | |||||
teens = 1; | |||||
switch((translator->langopts.numbers2 >> 6) & 0x7) | |||||
{ | { | ||||
// Lithuanian | |||||
if((value % 10) == 1) | |||||
case 1: // lang=ru use singular for xx1 except for x11 | |||||
if((teens == 0) && ((value % 10) == 1)) | |||||
return("1M"); | |||||
break; | |||||
case 2: // lang=cs,sk | |||||
if((value >= 2) && (value <= 4)) | |||||
return("0MA"); | return("0MA"); | ||||
if(((value % 10) == 0) || ((value % 100) > 10) && ((value % 100) < 20)) | |||||
{ | |||||
return("0MB"); | |||||
} | |||||
return("0M"); | |||||
} | |||||
break; | |||||
if((translator->langopts.numbers2 & 0x100) && (value >= 2) && (value <= 4)) | |||||
return("0MA"); // Czech, Slovak | |||||
else | |||||
if(((value % 100) < 10) || ((value % 100) > 20)) // but not teens, 10 to 19 | |||||
{ | |||||
if ((translator->langopts.numbers2 & 0x40) && | |||||
((value % 10)>=2) && | |||||
((value % 10)<=4)) | |||||
{ | |||||
// for Polish language - two forms of plural! | |||||
case 3: // lang=pl | |||||
if((teens == 0) && (((value % 10) >= 2) && ((value % 10) <= 4))) | |||||
return("0MA"); | return("0MA"); | ||||
} | |||||
break; | |||||
case 4: // lang=lt | |||||
if((teens == 1) || ((value % 10) == 0)) | |||||
return("0MB"); | |||||
if((value % 10) == 1) | |||||
return("0MA"); | |||||
break; | |||||
if((translator->langopts.numbers2 & 0x80) && | |||||
((value % 10)==1)) | |||||
case 5: // lang=bs,hr,sr | |||||
if(teens == 0) | |||||
{ | { | ||||
return("1MA"); | |||||
if((value % 10) == 1) | |||||
return("1M"); | |||||
if(((value % 10) >= 2) && ((value % 10) <= 4)) | |||||
return("0MA"); | |||||
} | } | ||||
break; | |||||
} | } | ||||
return("0M"); | return("0M"); | ||||
} | } |
static int ReplaceKeyName(char *outbuf, int index, int &outix) | static int ReplaceKeyName(char *outbuf, int index, int &outix) | ||||
{//=========================================================== | {//=========================================================== | ||||
// Replace some key-names by single characters, so they can be pronounced in different languages | // Replace some key-names by single characters, so they can be pronounced in different languages | ||||
MNEM_TAB keynames[] = { | |||||
static MNEM_TAB keynames[] = { | |||||
{"space ",0xe020}, | {"space ",0xe020}, | ||||
{"tab ", 0xe009}, | {"tab ", 0xe009}, | ||||
{"underscore ", 0xe05f}, | {"underscore ", 0xe05f}, |
//#define TEST_SPEED | //#define TEST_SPEED | ||||
#ifdef INCLUDE_SONIC | |||||
void SetSpeed(int control) | void SetSpeed(int control) | ||||
{//======================= | {//======================= | ||||
int x; | int x; | ||||
#endif | #endif | ||||
} // end of SetSpeed | } // end of SetSpeed | ||||
#else // not using sonic speed-up | |||||
void SetSpeed(int control) | |||||
{//======================= | |||||
// This is the earlier version of SetSpeed() before sonic speed-up was added | |||||
int x; | |||||
int s1; | |||||
int wpm; | |||||
int wpm2; | |||||
speed.loud_consonants = 0; | |||||
speed.min_sample_len = 450; | |||||
speed.lenmod_factor = 110; // controls the effect of FRFLAG_LEN_MOD reduce length change | |||||
speed.lenmod2_factor = 100; | |||||
wpm = embedded_value[EMBED_S]; | |||||
if(control == 2) | |||||
wpm = embedded_value[EMBED_S2]; | |||||
#ifdef TEST_SPEED | |||||
if(wpm > 1000) | |||||
{ | |||||
// TESTING | |||||
test = wpm / 1000; | |||||
wpm = wpm % 1000; | |||||
} | |||||
#endif | |||||
if(voice->speed_percent > 0) | |||||
{ | |||||
wpm = (wpm * voice->speed_percent)/100; | |||||
} | |||||
if(wpm > 450) | |||||
wpm = 450; | |||||
if(wpm > 360) | |||||
{ | |||||
speed.loud_consonants = (wpm - 360) / 8; | |||||
} | |||||
wpm2 = wpm; | |||||
if(wpm > 359) wpm2 = 359; | |||||
if(wpm < 80) wpm2 = 80; | |||||
x = speed_lookup[wpm2-80]; | |||||
if(wpm >= 380) | |||||
x = 7; | |||||
if(wpm >= 400) | |||||
x = 6; | |||||
if(control & 1) | |||||
{ | |||||
// set speed factors for different syllable positions within a word | |||||
// these are used in CalcLengths() | |||||
speed1 = (x * voice->speedf1)/256; | |||||
speed2 = (x * voice->speedf2)/256; | |||||
speed3 = (x * voice->speedf3)/256; | |||||
if(x <= 7) | |||||
{ | |||||
speed1 = x; | |||||
speed2 = speed3 = x - 1; | |||||
} | |||||
} | |||||
if(control & 2) | |||||
{ | |||||
// these are used in synthesis file | |||||
if(wpm > 350) | |||||
{ | |||||
speed.lenmod_factor = 85 - (wpm - 350) / 3; | |||||
speed.lenmod2_factor = 60 - (wpm - 350) / 8; | |||||
} | |||||
else | |||||
if(wpm > 250) | |||||
{ | |||||
speed.lenmod_factor = 110 - (wpm - 250)/4; | |||||
speed.lenmod2_factor = 110 - (wpm - 250)/2; | |||||
} | |||||
s1 = (x * voice->speedf1)/256; | |||||
if(wpm >= 170) | |||||
speed.wav_factor = 110 + (150*s1)/128; // reduced speed adjustment, used for playing recorded sounds | |||||
else | |||||
speed.wav_factor = 128 + (128*s1)/130; // = 215 at 170 wpm | |||||
if(wpm >= 350) | |||||
{ | |||||
speed.wav_factor = wav_factor_350[wpm-350]; | |||||
} | |||||
if(wpm >= 390) | |||||
{ | |||||
speed.min_sample_len = 450 - (wpm - 400)/2; | |||||
if(wpm > 440) | |||||
speed.min_sample_len = 420 - (wpm - 440); | |||||
} | |||||
speed.pause_factor = (256 * s1)/115; // full speed adjustment, used for pause length | |||||
speed.clause_pause_factor = 0; | |||||
if(wpm > 430) | |||||
{ | |||||
speed.pause_factor = 12; | |||||
// speed.clause_pause_factor = 15; | |||||
} | |||||
else | |||||
if(wpm > 400) | |||||
{ | |||||
speed.pause_factor = 13; | |||||
// speed.clause_pause_factor = 15; | |||||
} | |||||
else | |||||
if(wpm > 374) | |||||
{ | |||||
speed.pause_factor = 14; | |||||
} | |||||
else | |||||
if(wpm > 350) | |||||
{ | |||||
speed.pause_factor = pause_factor_350[wpm - 350]; | |||||
} | |||||
if(speed.clause_pause_factor == 0) | |||||
{ | |||||
// restrict the reduction of pauses between clauses | |||||
if((speed.clause_pause_factor = speed.pause_factor) < 16) | |||||
speed.clause_pause_factor = 16; | |||||
} | |||||
} | |||||
#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); | |||||
#endif | |||||
} // end of SetSpeed | |||||
#endif // of INCLUDE_SONIC | |||||
#ifdef deleted | #ifdef deleted | ||||
void SetAmplitude(int amp) | void SetAmplitude(int amp) |
#include "StdAfx.h" | #include "StdAfx.h" | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <stdarg.h> | #include <stdarg.h> | ||||
#include "speech.h" | |||||
#include "sonic.h" | #include "sonic.h" | ||||
#ifdef INCLUDE_SONIC | |||||
struct sonicStreamStruct { | struct sonicStreamStruct { | ||||
short *inputBuffer; | short *inputBuffer; | ||||
sonicDestroyStream(stream); | sonicDestroyStream(stream); | ||||
return numSamples; | return numSamples; | ||||
} | } | ||||
#endif // INCLUDE_SONIC |
// conditional compilation options | // conditional compilation options | ||||
#define INCLUDE_KLATT | #define INCLUDE_KLATT | ||||
#define INCLUDE_MBROLA | #define INCLUDE_MBROLA | ||||
#define INCLUDE_SONIC | |||||
#if defined(BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN | #if defined(BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN | ||||
#define ARCH_BIG | #define ARCH_BIG |
#include "translate.h" | #include "translate.h" | ||||
#include "wave.h" | #include "wave.h" | ||||
const char *version_string = "1.46.21 25.Jul.12"; | |||||
const char *version_string = "1.46.22 09.Aug.12"; | |||||
const int version_phdata = 0x014600; | const int version_phdata = 0x014600; | ||||
int option_device_number = -1; | int option_device_number = -1; | ||||
if(instn2 < 8) | if(instn2 < 8) | ||||
{ | { | ||||
// ChangeIf | // ChangeIf | ||||
if(StressCondition(tr, plist, instn2 & 7, 1)) | |||||
if(StressCondition(tr, plist, instn2 & 7, 1) == true) | |||||
{ | { | ||||
phdata->pd_param[i_CHANGE_PHONEME] = instn & 0xff; | phdata->pd_param[i_CHANGE_PHONEME] = instn & 0xff; | ||||
end_flag = 1; // change phoneme, exit | end_flag = 1; // change phoneme, exit |
} // end of DoMarker | } // end of DoMarker | ||||
#ifdef INCLUDE_SONIC | |||||
void DoSonicSpeed(int value) | void DoSonicSpeed(int value) | ||||
{//========================= | {//========================= | ||||
// value, multiplier * 1024 | // value, multiplier * 1024 | ||||
wcmdq[wcmdq_tail][1] = value; | wcmdq[wcmdq_tail][1] = value; | ||||
WcmdqInc(); | WcmdqInc(); | ||||
} // end of DoSonicSpeed | } // end of DoSonicSpeed | ||||
#endif | |||||
void DoVoiceChange(voice_t *v) | void DoVoiceChange(voice_t *v) |
0, 0 }; | 0, 0 }; | ||||
// alternatively, ignore characters but allow zero-width-non-joiner (lang-fa) | // alternatively, ignore characters but allow zero-width-non-joiner (lang-fa) | ||||
static const unsigned short chars_ignore_fa[] = { | |||||
0x200c, 0x0605, // zero width non-joiner, replace with not-used Arabic character code | |||||
static const unsigned short chars_ignore_zwnj_hyphen[] = { | |||||
0x200c, '-', // zero width non-joiner, replace with hyphen | |||||
0x200d, 1, // zero width joiner | 0x200d, 1, // zero width joiner | ||||
0, 0 }; | 0, 0 }; | ||||
case L('f','a'): // Farsi | case L('f','a'): // Farsi | ||||
{ | { | ||||
static const char fa_ZWNJ[] = {0x05, 0}; // use letter group G for ZWNJ U+200c | |||||
tr->letter_bits_offset = OFFSET_ARABIC; | tr->letter_bits_offset = OFFSET_ARABIC; | ||||
tr->langopts.numbers = NUM_AND_UNITS | NUM_HUNDRED_AND; | tr->langopts.numbers = NUM_AND_UNITS | NUM_HUNDRED_AND; | ||||
tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words | tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words | ||||
tr->chars_ignore = chars_ignore_fa; | |||||
SetLetterBits(tr,LETTERGP_G,(char *)fa_ZWNJ); | |||||
tr->chars_ignore = chars_ignore_zwnj_hyphen; // replace ZWNJ by hyphen | |||||
} | } | ||||
break; | break; | ||||
tr->langopts.accents = 1; | tr->langopts.accents = 1; | ||||
tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_HUNDRED_AND | NUM_OMIT_1_HUNDRED | NUM_DECIMAL_COMMA | NUM_THOUS_SPACE | NUM_DFRACTION_2 | NUM_ROMAN_CAPITALS; | tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_HUNDRED_AND | NUM_OMIT_1_HUNDRED | NUM_DECIMAL_COMMA | NUM_THOUS_SPACE | NUM_DFRACTION_2 | NUM_ROMAN_CAPITALS; | ||||
tr->langopts.numbers2 = 0x4a; // variant numbers before thousands,milliards | |||||
tr->langopts.numbers2 = 0xa + NUM2_THOUSANDS_VAR5; // variant numbers before thousands,milliards | |||||
tr->langopts.replace_chars = replace_cyrillic_latin; | tr->langopts.replace_chars = replace_cyrillic_latin; | ||||
SetLetterVowel(tr,'y'); | SetLetterVowel(tr,'y'); | ||||
tr->langopts.unstressed_wd2 = 2; | tr->langopts.unstressed_wd2 = 2; | ||||
tr->langopts.param[LOPT_DIERESES] = 1; | tr->langopts.param[LOPT_DIERESES] = 1; | ||||
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_OMIT_1_HUNDRED | NUM_DFRACTION_4 | NUM_ORDINAL_DOT; | tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_OMIT_1_HUNDRED | NUM_DFRACTION_4 | NUM_ORDINAL_DOT; | ||||
tr->langopts.numbers2 = 0x100; | |||||
tr->langopts.numbers2 = NUM2_THOUSANDS_VAR4; | |||||
tr->langopts.max_roman = 5000; | tr->langopts.max_roman = 5000; | ||||
} | } | ||||
break; | break; | ||||
tr->langopts.param[LOPT_REGRESSIVE_VOICING] = 0x9; | tr->langopts.param[LOPT_REGRESSIVE_VOICING] = 0x9; | ||||
tr->langopts.max_initial_consonants = 7; // for example: wchrzczony :) | tr->langopts.max_initial_consonants = 7; // for example: wchrzczony :) | ||||
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_DFRACTION_2; | tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_DFRACTION_2; | ||||
tr->langopts.numbers2 = 0x40; | |||||
tr->langopts.numbers2 = NUM2_THOUSANDS_VAR3; | |||||
tr->langopts.param[LOPT_COMBINE_WORDS] = 4 + 0x100; // combine 'nie' (marked with $alt2) with some 1-syllable (and 2-syllable) words (marked with $alt) | tr->langopts.param[LOPT_COMBINE_WORDS] = 4 + 0x100; // combine 'nie' (marked with $alt2) with some 1-syllable (and 2-syllable) words (marked with $alt) | ||||
SetLetterVowel(tr,'y'); | SetLetterVowel(tr,'y'); | ||||
} | } | ||||
tr->langopts.param[LOPT_COMBINE_WORDS] = 4; // combine some prepositions with the following word | tr->langopts.param[LOPT_COMBINE_WORDS] = 4; // combine some prepositions with the following word | ||||
tr->langopts.numbers = NUM_OMIT_1_HUNDRED | NUM_DFRACTION_2 | NUM_ROMAN; | tr->langopts.numbers = NUM_OMIT_1_HUNDRED | NUM_DFRACTION_2 | NUM_ROMAN; | ||||
tr->langopts.numbers2 = 0x100; | |||||
tr->langopts.numbers2 = NUM2_THOUSANDS_VAR2; | |||||
tr->langopts.thousands_sep = STRESSPOSN_1L; //no thousands separator | tr->langopts.thousands_sep = STRESSPOSN_1L; //no thousands separator | ||||
tr->langopts.decimal_sep = ','; | tr->langopts.decimal_sep = ','; | ||||
tr->langopts.stress_flags = 0x0020; // waas 0x1010 | tr->langopts.stress_flags = 0x0020; // waas 0x1010 | ||||
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_OMIT_1_HUNDRED; | tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_OMIT_1_HUNDRED; | ||||
tr->langopts.numbers2 = 0xc2; // variant numbers before thousands | |||||
tr->langopts.numbers2 = 0x2 + NUM2_THOUSANDS_VAR1; // variant numbers before thousands | |||||
tr->langopts.phoneme_change = 1; | tr->langopts.phoneme_change = 1; | ||||
tr->langopts.testing = 2; | tr->langopts.testing = 2; | ||||
{//======================== | {//======================== | ||||
// Replacement for iswalph() which also checks for some in-word symbols | // Replacement for iswalph() which also checks for some in-word symbols | ||||
const unsigned short extra_indic_alphas[] = { | |||||
static const unsigned short extra_indic_alphas[] = { | |||||
0xa70,0xa71, // Gurmukhi: tippi, addak | 0xa70,0xa71, // Gurmukhi: tippi, addak | ||||
0 }; | 0 }; | ||||
found = TranslateNumber(tr, word1, phonemes, dictionary_flags, wtab, 0); | found = TranslateNumber(tr, word1, phonemes, dictionary_flags, wtab, 0); | ||||
} | } | ||||
if(!found & ((wflags & FLAG_UPPERS) != FLAG_FIRST_UPPER)) | |||||
if(!found && ((wflags & FLAG_UPPERS) != FLAG_FIRST_UPPER)) | |||||
{ | { | ||||
// either all upper or all lower case | // either all upper or all lower case | ||||
#define NUM2_MULTIPLE_ORDINAL 0x1000 | #define NUM2_MULTIPLE_ORDINAL 0x1000 | ||||
#define NUM2_ENGLISH_NUMERALS 0x2000 | #define NUM2_ENGLISH_NUMERALS 0x2000 | ||||
#define NUM2_THOUSANDS_VAR1 0x40 | |||||
#define NUM2_THOUSANDS_VAR2 0x80 | |||||
#define NUM2_THOUSANDS_VAR3 0xc0 | |||||
#define NUM2_THOUSANDS_VAR4 0x100 | |||||
#define NUM2_THOUSANDS_VAR5 0x140 | |||||
// bits 1-4 use variant form of numbers before thousands,millions,etc. | // bits 1-4 use variant form of numbers before thousands,millions,etc. | ||||
// bit6=(LANG=pl) two forms of plural, M or MA | |||||
// bit7=(LANG-ru) use MB for 1 thousand, million, etc | |||||
// bit8=(LANG=cs,sk) two forms of plural, M or MA | |||||
// 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 | // bit9=(LANG=rw) say "thousand" and "million" before its number, not after | ||||
// bit12=(LANG=el,es) use ordinal form of hundreds and tens as well as units | // bit12=(LANG=el,es) use ordinal form of hundreds and tens as well as units | ||||
// bit13=(LANG=ne) speak (non-replaced) English numerals in English | // bit13=(LANG=ne) speak (non-replaced) English numerals in English |
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "synthesize.h" | #include "synthesize.h" | ||||
#include "voice.h" | #include "voice.h" | ||||
#include "sonic.h" | |||||
//#undef INCLUDE_KLATT | |||||
#ifdef INCLUDE_SONIC | |||||
#include "sonic.h" | |||||
#endif | |||||
#ifdef USE_PORTAUDIO | #ifdef USE_PORTAUDIO | ||||
#include "portaudio.h" | #include "portaudio.h" | ||||
static PaStream *pa_stream=NULL; | static PaStream *pa_stream=NULL; | ||||
#endif | #endif | ||||
#ifdef INCLUDE_SONIC | |||||
static sonicStream sonicSpeedupStream = NULL; | static sonicStream sonicSpeedupStream = NULL; | ||||
double sonicSpeed = 1.0; | double sonicSpeed = 1.0; | ||||
#endif | |||||
// 1st index=roughness | // 1st index=roughness | ||||
// 2nd index=modulation_type | // 2nd index=modulation_type | ||||
{//============= | {//============= | ||||
wcmdq_head = 0; | wcmdq_head = 0; | ||||
wcmdq_tail = 0; | wcmdq_tail = 0; | ||||
#ifdef INCLUDE_SONIC | |||||
if(sonicSpeedupStream != NULL) | if(sonicSpeedupStream != NULL) | ||||
{ | { | ||||
sonicDestroyStream(sonicSpeedupStream); | sonicDestroyStream(sonicSpeedupStream); | ||||
sonicSpeedupStream = NULL; | sonicSpeedupStream = NULL; | ||||
} | } | ||||
#endif | |||||
#ifdef USE_PORTAUDIO | #ifdef USE_PORTAUDIO | ||||
Pa_AbortStream(pa_stream); | Pa_AbortStream(pa_stream); | ||||
#endif | #endif | ||||
} | } | ||||
wdata.n_mix_wavefile = 0; | wdata.n_mix_wavefile = 0; | ||||
wdata.amplitude_fmt = 100; | wdata.amplitude_fmt = 100; | ||||
#ifdef INCLUDE_KLATT | |||||
KlattReset(1); | KlattReset(1); | ||||
#endif | |||||
result = PlaySilence(length,resume); | result = PlaySilence(length,resume); | ||||
break; | break; | ||||
case WCMD_WAVE: | case WCMD_WAVE: | ||||
echo_complete = echo_length; | echo_complete = echo_length; | ||||
wdata.n_mix_wavefile = 0; | wdata.n_mix_wavefile = 0; | ||||
#ifdef INCLUDE_KLATT | |||||
KlattReset(1); | KlattReset(1); | ||||
#endif | |||||
result = PlayWave(length,resume,(unsigned char*)q[2], q[3] & 0xff, q[3] >> 8); | result = PlayWave(length,resume,(unsigned char*)q[2], q[3] & 0xff, q[3] >> 8); | ||||
break; | break; | ||||
wdata.amplitude_fmt = 100; // percentage, but value=0 means 100% | wdata.amplitude_fmt = 100; // percentage, but value=0 means 100% | ||||
break; | break; | ||||
#ifdef INCLUDE_SONIC | |||||
case WCMD_SONIC_SPEED: | case WCMD_SONIC_SPEED: | ||||
sonicSpeed = (double)q[1] / 1024; | sonicSpeed = (double)q[1] / 1024; | ||||
break; | break; | ||||
#endif | |||||
} | } | ||||
if(result==0) | if(result==0) | ||||
} // end of WavegenFill2 | } // end of WavegenFill2 | ||||
#ifdef INCLUDE_SONIC | |||||
/* Speed up the audio samples with libsonic. */ | /* Speed up the audio samples with libsonic. */ | ||||
static int SpeedUp(short *outbuf, int length_in, int length_out, int end_of_text) | static int SpeedUp(short *outbuf, int length_in, int length_out, int end_of_text) | ||||
{//============================================================================== | {//============================================================================== | ||||
} | } | ||||
return sonicReadShortFromStream(sonicSpeedupStream, outbuf, length_out); | return sonicReadShortFromStream(sonicSpeedupStream, outbuf, length_out); | ||||
} // end of SpeedUp | } // end of SpeedUp | ||||
#endif | |||||
/* Call WavegenFill2, and then speed up the output samples. */ | /* Call WavegenFill2, and then speed up the output samples. */ | ||||
{//============================ | {//============================ | ||||
int finished; | int finished; | ||||
unsigned char *p_start; | unsigned char *p_start; | ||||
int length; | |||||
int max_length; | |||||
p_start = out_ptr; | p_start = out_ptr; | ||||
// fill_zeros is ignored. It is now done in the portaudio callback | // fill_zeros is ignored. It is now done in the portaudio callback | ||||
finished = WavegenFill2(0); | finished = WavegenFill2(0); | ||||
#ifdef INCLUDE_SONIC | |||||
if(sonicSpeed > 1.0) | if(sonicSpeed > 1.0) | ||||
{ | { | ||||
int length; | |||||
int max_length; | |||||
max_length = (out_end - p_start); | max_length = (out_end - p_start); | ||||
length = 2*SpeedUp((short *)p_start, (out_ptr-p_start)/2, max_length/2, finished); | length = 2*SpeedUp((short *)p_start, (out_ptr-p_start)/2, max_length/2, finished); | ||||
out_ptr = p_start + length; | out_ptr = p_start + length; | ||||
if(length >= max_length) | if(length >= max_length) | ||||
finished = 0; // there may be more data to flush | finished = 0; // there may be more data to flush | ||||
} | } | ||||
#endif | |||||
return finished; | return finished; | ||||
} // end of WavegenFill | } // end of WavegenFill | ||||