[1.30] Add option for a pause between words: command option -g or espeak_SetParameter(espeak_WORDGAP)

Add different intonation styles (attribute "intonation"  in voices files).


git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@114 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
jonsd
2007-12-31 15:56:11 +00:00
parent fb7230a912
commit dc09dd11f1
58 changed files with 684 additions and 497 deletions
+2 -2
View File
@@ -654,8 +654,8 @@ int Translator::IsLetterGroup(char *word, int group, int pre)
w = word;
while(*p == *w)
{
*w++;
*p++;
w++;
p++;
}
if(*p == 0)
return(w-word); // matched a complete string
+10 -1
View File
@@ -39,6 +39,8 @@ static const char *help_text =
"spoken from stdin, each line separately.\n\n"
"-a <integer>\n"
"\t Amplitude, 0 to 200, default is 100\n"
"-g <integer>\n"
"\t Word gap. Pause between words, units of 10mS at the default speed\n"
"-l <integer>\n"
"\t Line length. If not zero (which is the default), consider\n"
"\t lines less than this length as end-of-clause\n"
@@ -297,6 +299,7 @@ int main (int argc, char **argv)
int volume = -1;
int speed = -1;
int pitch = -1;
int wordgap = -1;
int option_capitals = -1;
int option_punctuation = -1;
int option_phonemes = -1;
@@ -319,7 +322,7 @@ int main (int argc, char **argv)
while(true)
{
c = getopt_long (argc, argv, "a:bf:hk:l:mp:qs:v:w:xXz",
c = getopt_long (argc, argv, "a:bf:g:hk:l:mp:qs:v:w:xXz",
long_options, &option_index);
/* Detect the end of the options. */
@@ -378,6 +381,10 @@ int main (int argc, char **argv)
speed = atoi(optarg);
break;
case 'g':
wordgap = atoi(optarg);
break;
case 'v':
strncpy0(voicename,optarg,sizeof(voicename));
break;
@@ -474,6 +481,8 @@ int main (int argc, char **argv)
espeak_SetParameter(espeakCAPITALS,option_capitals,0);
if(option_punctuation >= 0)
espeak_SetParameter(espeakPUNCTUATION,option_punctuation,0);
if(wordgap >= 0)
espeak_SetParameter(espeakWORDGAP,wordgap,0);
if(option_linelength > 0)
espeak_SetParameter(espeakLINELENGTH,option_linelength,0);
if(option_punctuation == 2)
+42 -24
View File
@@ -272,36 +272,59 @@ typedef struct {
unsigned char tail_shape;
} TONE_TABLE;
#define N_TONE_TABLE 15
#define N_TONE_TABLE 11
static TONE_TABLE tone_table[N_TONE_TABLE] = {
{PITCHfall, 30, 5, PITCHfall, 30, 8, // statement
{PITCHfall, 30, 5, PITCHfall, 30, 8, // 0 statement
20, 25, 34, 22, drops_0, 3, 3, 5, oflow, NULL, 12, 7, 0},
{PITCHfrise, 37,10, PITCHfrise2, 35,10, // comma
20, 25, 34, 20, drops_0, 3, 3, 5, oflow, NULL, 15, 24, 0},
{PITCHfrise, 35,8, PITCHfrise2, 35,10, // 1 comma
20, 25, 34, 20, drops_0, 3, 3, 5, oflow, NULL, 15, 23, 0},
{PITCHfrise, 39,10, PITCHfrise2, 36,10, // question
20, 25, 34, 20, drops_0, 3, 3, 5, oflow, NULL, 15, 29, 0},
{PITCHfrise, 39,10, PITCHfrise2, 36,10, // 2 question
20, 25, 34, 20, drops_0, 3, 3, 5, oflow, NULL, 15, 28, 0},
{PITCHfall, 41, 4, PITCHfall, 41, 27, // exclamation
20, 25, 34, 24, drops_0, 3, 4, 5, oflow_emf, back_emf, 16, 5, 0},
{PITCHfall, 41, 4, PITCHfall, 41, 27, // 3 exclamation
20, 25, 34, 24, drops_0, 3, 4, 5, oflow_emf, back_emf, 16, 4, 0},
{PITCHfall, 38, 2, PITCHfall, 42, 30, // statement, emphatic
{PITCHfall, 38, 2, PITCHfall, 42, 30, // 4 statement, emphatic
20, 25, 34, 22, drops_0, 3, 3, 5, oflow, NULL, 15, 5, 0},
{PITCHfall, 28, 6, PITCHfall, 28, 10, // statement, less intonation
{PITCHfall, 28, 6, PITCHfall, 28, 10, // 5 statement, less intonation
20, 25, 30, 22, drops_0, 4, 3, 5, oflow_less, NULL, 12, 6, 0},
{PITCHfrise2, 34,12, PITCHfall, 28,10, // comma, less intonation
{PITCHfrise2, 33,11, PITCHfall, 28,10, // 6 comma, less intonation
20, 25, 30, 22, drops_0, 4, 3, 5, oflow_less, NULL, 9,14, 0},
{PITCHfrise2, 28, 7, PITCHfall, 28, 12, // 7 comma, less intonation, less rise
20, 25, 30, 22, drops_0, 4, 3, 5, oflow_less, NULL, 14, 8, 0},
{PITCHrise, 30, 20, PITCHfall, 19, 14, // 8 pitch raises at end of sentence
20, 25, 34, 22, drops_0, 3, 3, 5, oflow, NULL, 24, 30, 0},
{PITCHfrise, 35,11, PITCHfrise2, 32,10, // 9 comma
20, 25, 34, 20, drops_0, 3, 3, 5, oflow, NULL, 19, 24, 0},
{PITCHfrise, 39, 15, PITCHfall, 28, 14, // 10 question
20, 25, 34, 22, drops_0, 3, 3, 5, oflow, NULL, 20, 36, 0},
};
/* index by 0=. 1=, 2=?, 3=! 4=none, 5=emphasized */
unsigned char punctuation_to_tone[INTONATION_TYPES][PUNCT_INTONATIONS] = {
{0,1,2,3,0,4},
{0,1,2,3,0,4},
{5,6,2,0,0,4},
{5,7,1,0,0,4},
{8,9,10,3,0,0},
{8,8,10,3,0,0},
{0,1,2,3,0,4},
{0,1,2,3,0,0} };
/* indexed by stress */
static int min_drop[] = {0x300,0x300,0x400,0x400,0x900,0x900,0x900,0xb00};
@@ -332,13 +355,11 @@ static void count_pitch_vowels(int start, int end, int clause_end)
int max_stress = 0;
int max_stress_posn = 0; // last syllable ot the highest stress
int max_stress_posn2 = 0; // penuntimate syllable of the highest stress
int last2_primary;
number_pre = -1; /* number of vowels before 1st primary stress */
number_body = 0;
number_tail = 0; /* number between tonic syllable and next primary */
last_primary = -1;
last2_primary = 0;
for(ix=start; ix<end; ix++)
{
@@ -652,13 +673,10 @@ static int calc_pitches(int start, int end, int group_tone)
/* body of tonic segment */
/*************************/
if(option_tone2 & 1)
{
static int count=0;
count++;
//if(count & 1)
tone_posn = tone_posn2; // TEST put tone on the penultimate stressed word
}
if(option_tone_flags & OPTION_EMPHASIZE_PENULTIMATE)
{
tone_posn = tone_posn2; // put tone on the penultimate stressed word
}
ix = calc_pitch_segment(ix,tone_posn, t, PRIMARY, continuing);
if(no_tonic)
@@ -884,18 +902,18 @@ void Translator::CalcPitches(int clause_type)
syllable_tab = syllable_tab2; // don't use permanent storage. it's only needed during the call of CalcPitches()
if(langopts.intonation == 1)
if(langopts.tone_language == 1)
{
CalcPitches_Tone(clause_type);
return;
}
option = option_tone1 & 0xf;
if(option > 4)
option = langopts.intonation_group;
if(option > INTONATION_TYPES)
option = 0;
group_tone_emph = group_tone = punct_to_tone[option][clause_type];
group_tone = punct_to_tone[option][clause_type];
group_tone_emph = punct_to_tone[option][5]; // emphatic form of statement
if(clause_type == 4)
+9
View File
@@ -526,6 +526,10 @@ void Translator::MakePhonemeList(int post_pause, int start_sentence)
{
insert_ph = pause_phonemes[x];
}
if(option_wordgap > 0)
{
insert_ph = phonPAUSE_LONG;
}
}
next2 = phoneme_tab[(plist2+2)->phcode];
@@ -590,6 +594,11 @@ void Translator::MakePhonemeList(int post_pause, int start_sentence)
}
phlist[ix].length = ph->std_length;
if((ph->code == phonPAUSE_LONG) && (option_wordgap > 0))
{
phlist[ix].ph = phoneme_tab[phonPAUSE_SHORT];
phlist[ix].length = option_wordgap*14; // 10mS per unit at the default speed
}
if(ph->type==phVOWEL || ph->type==phLIQUID || ph->type==phNASAL || ph->type==phVSTOP || ph->type==phVFRICATIVE)
{
+6 -1
View File
@@ -138,12 +138,17 @@ int speech_parameters[N_SPEECH_PARAM]; // current values, from param_stack
const int param_defaults[N_SPEECH_PARAM] = {
0, // silence (internal use)
165, // rate wpm
170, // rate wpm
100, // volume
50, // pitch
50, // range
0, // punctuation
0, // capital letters
0, // wordgap
0, // options
0, // intonation
0,
0,
0, // emphasis
0, // line length
0, // voice type
+10 -6
View File
@@ -209,16 +209,20 @@ void SetParameter(int parameter, int value, int relative)
embedded_value[EMBED_R] = new_value;
break;
case espeakPUNCTUATION:
break;
case espeakCAPITALS:
break;
case espeakLINELENGTH:
option_linelength = new_value;
break;
case espeakWORDGAP:
option_wordgap = new_value;
break;
case espeakINTONATION:
if((new_value & 0xff) != 0)
translator->langopts.intonation_group = new_value & 0xff;
option_tone_flags = new_value;
break;
default:
break;
}
+10 -1
View File
@@ -65,6 +65,8 @@ static const char *help_text =
"spoken from stdin, each line separately.\n\n"
"-a <integer>\n"
"\t Amplitude, 0 to 200, default is 100\n"
"-g <integer>\n"
"\t Word gap. Pause between words, units of 10mS at the default speed\n"
"-l <integer>\n"
"\t Line length. If not zero (which is the default), consider\n"
"\t lines less than this length as end-of-clause\n"
@@ -373,6 +375,7 @@ int main (int argc, char **argv)
int ix;
char *optarg2;
int amp = 100; // default
int wordgap = 0;
int speaking = 0;
int quiet = 0;
int flag_stdin = 0;
@@ -390,6 +393,7 @@ int main (int argc, char **argv)
option_linelength = 0;
option_phonemes = 0;
option_waveout = 0;
option_wordgap = 0;
option_multibyte = espeakCHARS_AUTO; // auto
f_trans = stdout;
@@ -449,7 +453,7 @@ int main (int argc, char **argv)
#else
while(true)
{
c = getopt_long (argc, argv, "a:bf:hk:l:p:qs:v:w:xXm",
c = getopt_long (argc, argv, "a:bf:g:hk:l:p:qs:v:w:xXm",
long_options, &option_index);
/* Detect the end of the options. */
@@ -512,6 +516,10 @@ int main (int argc, char **argv)
speed = atoi(optarg2);
break;
case 'g':
wordgap = atoi(optarg2);
break;
case 'v':
strncpy0(voicename,optarg2,sizeof(voicename));
break;
@@ -597,6 +605,7 @@ int main (int argc, char **argv)
SetParameter(espeakVOLUME,amp,0);
SetParameter(espeakCAPITALS,option_capitals,0);
SetParameter(espeakPUNCTUATION,option_punctuation,0);
SetParameter(espeakWORDGAP,wordgap,0);
if(pitch_adjustment != 50)
{
+10 -8
View File
@@ -306,7 +306,7 @@ static void init_path(const char *path)
sprintf(path_home,"%s\\espeak-data",buf);
#else
// char *env;
char *env;
if(path != NULL)
{
@@ -314,12 +314,13 @@ static void init_path(const char *path)
return;
}
// if((env = getenv("ESPEAK_DATA_PATH")) != NULL)
// {
// snprintf(path_home,sizeof(path_home),"%s/espeak-data",env);
// if(GetFileLength(path_home) == -2)
// return; // an espeak-data directory exists
// }
// check for environment variable
if((env = getenv("ESPEAK_DATA_PATH")) != NULL)
{
snprintf(path_home,sizeof(path_home),"%s/espeak-data",env);
if(GetFileLength(path_home) == -2)
return; // an espeak-data directory exists
}
snprintf(path_home,sizeof(path_home),"%s/espeak-data",getenv("HOME"));
if(access(path_home,R_OK) != 0)
@@ -335,7 +336,7 @@ static int initialise(void)
int result;
#ifndef __WIN32__
LoadConfig(); // causes problem on Windows, don't know why
LoadConfig();
#endif
WavegenInit(22050,0); // 22050
if((result = LoadPhData()) != 1)
@@ -710,6 +711,7 @@ ENTER("espeak_Initialize");
SetParameter(espeakVOLUME,100,0);
SetParameter(espeakCAPITALS,option_capitals,0);
SetParameter(espeakPUNCTUATION,option_punctuation,0);
SetParameter(espeakWORDGAP,0,0);
DoVoiceChange(voice);
#ifdef USE_ASYNC
+19 -9
View File
@@ -27,11 +27,14 @@
#include <stdio.h>
#define ESPEAK_API_REVISION 2
#define ESPEAK_API_REVISION 3
/*
Revision 2
Added parameter "options" to eSpeakInitialize()
Revision 3
Added espeakWORDGAP to espeak_PARAMETER
*/
/********************/
/* Initialization */
@@ -332,7 +335,6 @@ espeak_ERROR espeak_Char(wchar_t character);
EE_INTERNAL_ERROR.
*/
/* Note, there is no function to play a sound icon. This would be done by the calling program */
@@ -342,12 +344,18 @@ espeak_ERROR espeak_Char(wchar_t character);
typedef enum {
espeakSILENCE=0, /* internal use */
espeakRATE,
espeakVOLUME,
espeakPITCH,
espeakRANGE,
espeakPUNCTUATION,
espeakCAPITALS,
espeakRATE=1,
espeakVOLUME=2,
espeakPITCH=3,
espeakRANGE=4,
espeakPUNCTUATION=5,
espeakCAPITALS=6,
espeakWORDGAP=7,
espeakOPTIONS=8, // reserved for misc. options. not yet used
espeakINTONATION=9,
espeakRESERVED1=10,
espeakRESERVED2=11,
espeakEMPHASIS, /* internal use */
espeakLINELENGTH, /* internal use */
espeakVOICETYPE, // internal, 1=mbrola
@@ -379,7 +387,7 @@ espeak_ERROR espeak_SetParameter(espeak_PARAMETER parameter, int value, int rela
espeakPUNCTUATION: which punctuation characters to announce:
value in espeak_PUNCT_TYPE (none, all, some),
see espeak_GetParameter() to specify which characters are announced.
see espeak_GetParameter() to specify which characters are announced.
espeakCAPITALS: announce capital letters by:
0=none,
@@ -388,6 +396,8 @@ espeak_ERROR espeak_SetParameter(espeak_PARAMETER parameter, int value, int rela
3 or higher, by raising pitch. This values gives the amount in Hz by which the pitch
of a word raised to indicate it has a capital letter.
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;
you may try after a while to call the function again.
+66 -50
View File
@@ -29,9 +29,9 @@
#include "speech.h"
#include "speak_lib.h"
#include "voice.h"
#include "phoneme.h"
#include "synthesize.h"
#include "voice.h"
#include "translate.h"
#define os_X 0x20000
@@ -64,10 +64,11 @@ extern int current_source_index;
FILE *f_text;
int (* uri_callback)(int, const char *, const char *) = NULL;
int (* phoneme_callback)(const char *) = NULL;
int amp = 8; // default
char path_home[80] = "";
char path_home[N_PATH_HOME] = "";
char wavefile[120];
char textbuffile[L_tmpnam];
int sample_rate_index; // current value
@@ -80,7 +81,7 @@ static void *module_data;
static int callback_inhibit = 0;
static int more_text=0;
#define N_VOICE_NAMES 40
#define N_VOICE_NAMES 60
static char *voice_names[40];
#define N_STATIC_BUF 8000
@@ -94,11 +95,13 @@ USHORT voice_pcnt[N_PEAKS+1][3];
static const char *help_text =
"\nspeak [options] [\"<words>\"]\n\n"
"-f <text file> Text file to speak\n"
"--stdin Read text input from stdin instead of a file\n\n"
//"--stdin Read text input from stdin instead of a file\n\n"
"If neither -f nor --stdin, <words> are spoken, or if none then text is\n"
"spoken from stdin, each line separately.\n\n"
"-a <integer>\n"
"\t Amplitude, 0 to 200, default is 100\n"
"-g <integer>\n"
"\t Word gap. Pause between words, units of 10mS at the default speed\n"
"-l <integer>\n"
"\t Line length. If not zero (which is the default), consider\n"
"\t lines less than this length as end-of-clause\n"
@@ -115,16 +118,19 @@ static const char *help_text =
"-q\t Quiet, don't produce any speech (may be useful with -x)\n"
"-x\t Write phoneme mnemonics to stdout\n"
"-X\t Write phonemes mnemonics and translation trace to stdout\n"
"--stdout Write speech output to stdout\n"
//"--stdout Write speech output to stdout\n"
"--compile=<voice name>\n"
"\t Compile the pronunciation rules and dictionary in the current\n"
"\t directory. =<voice name> is optional and specifies which language\n"
"--punct=\"<characters>\"\n"
"\t Speak the names of punctuation characters during speaking. If\n"
"\t =<characters> is omitted, all punctuation is spoken.\n"
"--voices=<langauge>\n"
"\t List the available voices for the specified language.\n"
"\t If <language> is omitted, then list all voices.\n";
//"--voices=<langauge>\n"
//"\t List the available voices for the specified language.\n"
//"\t If <language> is omitted, then list all voices.\n"
"-k <integer>\n"
"\t Indicate capital letters with: 1=sound, 2=the word \"capitals\",\n"
"\t higher values = a pitch increase (try -k20).\n";
int GetFileLength(const char *filename)
@@ -583,7 +589,7 @@ _kernel_oserror *swi_handler(int swi_no, int *r, void *pw)
break;
case 9: /* word_gap */
// not implemented
SetParameter(espeakWORDGAP,value,0);
break;
case 10: /* pitch_range */
@@ -608,8 +614,8 @@ _kernel_oserror *swi_handler(int swi_no, int *r, void *pw)
void PitchAdjust(int pitch_adjustment)
{//===================================
int ix, factor;
voice_t *voice = &voice_data;
extern unsigned char pitch_adjust_tab[100];
extern unsigned char pitch_adjust_tab[MAX_PITCH_VALUE+1];
voice->pitch_base = (voice->pitch_base * pitch_adjust_tab[pitch_adjustment])/128;
@@ -661,6 +667,7 @@ void command_line(char *arg_string, int wait)
int value;
int speed;
int amp;
int wordgap;
int speaking = 0;
int flag_stdin = 0;
int flag_compile = 0;
@@ -700,54 +707,19 @@ void command_line(char *arg_string, int wait)
p++;
switch(*p++)
{
case 'h':
printf("\nspeak text-to-speech: %s\n%s",version_string,help_text);
return;
case 'b':
option_multibyte = espeakCHARS_8BIT;
break;
case 'a':
amp = param_number(&p);
SetParameter(espeakVOLUME,amp,0);
break;
case 'f':
strncpy0(filename,param_string(&p),sizeof(filename));
break;
case 'h':
printf("\nspeak text-to-speech: %s\n%s",version_string,help_text);
return;
case 'k':
option_capitals = param_number(&p);
SetParameter(espeakCAPITALS,option_capitals,0);
break;
case 'l':
option_linelength = param_number(&p);
break;
case 'p':
pitch_adjustment = param_number(&p);
break;
case 'q':
option_quiet = 1;
break;
case 's':
speed = param_number(&p);
SetParameter(espeakRATE,speed,0);
break;
case 'v':
strncpy0(voicename,param_string(&p),sizeof(voicename));
break;
case 'w':
option_waveout=1;
strncpy0(wavefile,param_string(&p),sizeof(wavefile));
break;
case 'x':
option_phonemes = 1;
break;
@@ -756,6 +728,50 @@ void command_line(char *arg_string, int wait)
option_phonemes = 2;
break;
case 'm':
option_ssml = 1;
break;
case 'p':
pitch_adjustment = param_number(&p);
break;
case 'q':
option_quiet = 1;
break;
case 'f':
strncpy0(filename,param_string(&p),sizeof(filename));
break;
case 'l':
option_linelength = param_number(&p);
break;
case 'a':
amp = param_number(&p);
SetParameter(espeakVOLUME,amp,0);
break;
case 's':
speed = param_number(&p);
SetParameter(espeakRATE,speed,0);
break;
case 'g':
wordgap = param_number(&p);
SetParameter(espeakWORDGAP,wordgap,0);
break;
case 'v':
strncpy0(voicename,param_string(&p),sizeof(voicename));
break;
case 'w':
option_waveout=1;
strncpy0(wavefile,param_string(&p),sizeof(wavefile));
break;
case '-':
strncpy0(command,param_string(&p),sizeof(command));
if(memcmp(command,"compile=",8)==0)
@@ -766,7 +782,7 @@ void command_line(char *arg_string, int wait)
else
if(strcmp(command,"help")==0)
{
printf("\nspeak text-to-speech: %s\n%s",version,help_text);
printf("\nspeak text-to-speech: %s\n%s",version_string,help_text);
return;
}
else
+2 -2
View File
@@ -35,8 +35,8 @@
#include "translate.h"
#include "wave.h"
const char *version_string = "1.29.29 20.Dec.07";
const int version_phdata = 0x012924;
const char *version_string = "1.30 31.Dec.07";
const int version_phdata = 0x013000;
int option_device_number = -1;
+1 -1
View File
@@ -43,7 +43,7 @@ Translator_English::Translator_English() : Translator()
langopts.stress_rule = 0;
langopts.numbers = 0x41 + NUM_ROMAN;
langopts.param[LOPT_COMBINE_WORDS] = 5; // allow "mc" to cmbine with the following word
langopts.param[LOPT_COMBINE_WORDS] = 2; // allow "mc" to cmbine with the following word
}
+8 -9
View File
@@ -112,8 +112,8 @@ Translator *SelectTranslator(const char *name)
case L('c','y'): // Welsh
{
static const short stress_lengths_cy[8] = {170,230, 190,190, 0, 0, 250,270};
static const unsigned char stress_amps_cy[8] = {16,15, 18,18, 0,0, 24,22 }; // 'diminished' is used to mark a quieter, final unstressed syllable
static const short stress_lengths_cy[8] = {170,220, 180,180, 0, 0, 250,270};
static const unsigned char stress_amps_cy[8] = {17,15, 18,18, 0,0, 22,20 }; // 'diminished' is used to mark a quieter, final unstressed syllable
tr = new Translator();
SetupTranslator(tr,stress_lengths_cy,stress_amps_cy);
@@ -121,6 +121,7 @@ Translator *SelectTranslator(const char *name)
tr->charset_a0 = charsets[14]; // ISO-8859-14
// tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable
tr->langopts.stress_rule = 2;
// tr->langopts.intonation_group = 4;
// 'diminished' is an unstressed final syllable
tr->langopts.stress_flags = 0x6 | 0x10;
@@ -261,8 +262,7 @@ Translator *SelectTranslator(const char *name)
SetLetterVowel(tr,'y');
tr->langopts.max_initial_consonants = 2;
tr->langopts.spelling_stress = 1;
tr->punct_to_tone[0][1] = 0; // don't raise pitch for comma
// tr->punct_to_tone[0][2] = 0; // don't raise pitch for question
tr->langopts.intonation_group = 3; // less intonation, don't raise pitch at comma
}
break;
@@ -503,7 +503,6 @@ SetLengthMods(tr,3); // all equal
tr->langopts.stress_rule = 3; // stress on final syllable
tr->langopts.stress_flags = 0x6 | 0x10 | 0x20000;
tr->langopts.numbers = 0xa69 + 0x2000 + NUM_ROMAN;
tr->punct_to_tone[0][3] = 2; // use exclamation intonation
SetLetterVowel(tr,'y');
}
break;
@@ -607,8 +606,8 @@ SetLengthMods(tr,3); // all equal
tr->langopts.stress_rule = 6; // stress on last heaviest syllable, excluding final syllable
tr->langopts.stress_flags = 0x10004; // use 'diminished' for unstressed final syllable
tr->langopts.numbers = 0x811;
tr->langopts.numbers2 = 0x100;
// tr->langopts.numbers = 0x811;
// tr->langopts.numbers2 = 0x100;
tr->letter_bits_offset = OFFSET_TAMIL;
memset(tr->letter_bits,0,sizeof(tr->letter_bits));
@@ -663,7 +662,7 @@ SetLengthMods(tr,3); // all equal
tr->langopts.vowel_pause = 4;
tr->letter_groups[0] = vowels_vi;
// tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words
tr->langopts.intonation = 1; // Tone language, use CalcPitches_Tone() rather than CalcPitches()
tr->langopts.tone_language = 1; // Tone language, use CalcPitches_Tone() rather than CalcPitches()
tr->langopts.unstressed_wd1 = 2;
}
@@ -681,7 +680,7 @@ SetLengthMods(tr,3); // all equal
tr->langopts.stress_rule = 3; // stress on final syllable of a "word"
tr->langopts.stress_flags = 1; // don't automatically set diminished stress (may be set in the intonation module)
tr->langopts.vowel_pause = 0;
tr->langopts.intonation = 1; // Tone language, use CalcPitches_Tone() rather than CalcPitches()
tr->langopts.tone_language = 1; // Tone language, use CalcPitches_Tone() rather than CalcPitches()
tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable
tr->langopts.tone_numbers = 1; // a number after letters indicates a tone number (eg. pinyin or jyutping)
tr->langopts.ideographs = 1;
+3 -11
View File
@@ -44,6 +44,7 @@ static char translator2_language[20] = {0};
FILE *f_trans = NULL; // phoneme output text
int option_tone1 = 0;
int option_tone2 = 0;
int option_tone_flags = 0; // bit 8=emphasize allcaps, bit 9=emphasize penultimate stress
int option_phonemes = 0;
int option_phoneme_events = 0;
int option_quiet = 0;
@@ -53,10 +54,10 @@ int option_punctuation = 0;
int option_sayas = 0;
int option_sayas2 = 0; // used in translate_clause()
int option_emphasis = 0; // 0=normal, 1=normal, 2=weak, 3=moderate, 4=strong
int option_emphasize_allcaps = 0;
int option_ssml = 0;
int option_phoneme_input = 1; // allow [[phonemes]] in input
int option_phoneme_variants = 0; // 0= don't display phoneme variant mnemonics
int option_wordgap = 0;
int count_sayas_digits;
int skip_sentences;
@@ -339,14 +340,6 @@ unsigned char *length_mod_tabs[6] = {
};
/* index by 0=. 1=, 2=?, 3=! 4=none, 5=emphasized */
static unsigned char punctuation_to_tone[4][6] = {
{0,1,2,3,0,4},
{5,6,2,0,0,4},
{0,1,2,3,0,0},
{0,1,2,3,0,0} };
void SetLengthMods(Translator *tr, int value)
{//==========================================
int value2;
@@ -457,7 +450,6 @@ Translator::Translator()
langopts.decimal_sep = '.';
memcpy(punct_to_tone,punctuation_to_tone,sizeof(punct_to_tone));
// punct_to_tone[0][3] = 0; // exclamation, use period until we can improve the exclamation intonation
}
@@ -706,7 +698,7 @@ if((wmark > 0) && (wmark < 8))
if((wflags & FLAG_ALL_UPPER) && (word_length > 1) && (clause_lower_count > 3) && iswalpha(first_char))
{
if((option_emphasize_allcaps) && !(dictionary_flags[0] & FLAG_ABBREV))
if((option_tone_flags & OPTION_EMPHASIZE_ALLCAPS) && !(dictionary_flags[0] & FLAG_ABBREV))
{
// emphasize words which are in capitals
emphasize_allcaps = FLAG_EMPHASIZED;
+11 -3
View File
@@ -332,7 +332,8 @@ typedef struct {
int max_roman;
int thousands_sep;
int decimal_sep;
int intonation; // 1=tone language
int tone_language; // 1=tone language
int intonation_group;
int long_stop; // extra mS pause for a lengthened stop
int phoneme_change; // TEST, change phonemes, after translation
char max_initial_consonants;
@@ -395,7 +396,9 @@ public:
const wchar_t *letter_groups[8];
/* index1=option, index2 by 0=. 1=, 2=?, 3=! 4=none */
unsigned char punct_to_tone[4][5];
#define INTONATION_TYPES 8
#define PUNCT_INTONATIONS 6
unsigned char punct_to_tone[INTONATION_TYPES][PUNCT_INTONATIONS];
char *data_dictrules; // language_1 translation rules file
char *data_dictlist; // language_2 dictionary lookup file
@@ -486,6 +489,9 @@ protected:
extern int option_tone1;
extern int option_tone2;
#define OPTION_EMPHASIZE_ALLCAPS 0x100
#define OPTION_EMPHASIZE_PENULTIMATE 0x200
extern int option_tone_flags;
extern int option_waveout;
extern int option_quiet;
extern int option_phonemes;
@@ -500,6 +506,7 @@ extern int option_ssml;
extern int option_phoneme_input; // allow [[phonemes]] in input text
extern int option_phoneme_variants;
extern int option_sayas;
extern int option_wordgap;
extern int count_characters;
extern int count_words;
@@ -519,7 +526,8 @@ extern char *namedata;
extern char skip_marker[N_MARKER_LENGTH];
#define N_PUNCTLIST 60
extern wchar_t option_punctlist[N_PUNCTLIST];
extern wchar_t option_punctlist[N_PUNCTLIST]; // which punctuation characters to announce
extern unsigned char punctuation_to_tone[INTONATION_TYPES][PUNCT_INTONATIONS];
extern int speech_parameters[];
+1
View File
@@ -43,6 +43,7 @@ typedef struct {
short freq[N_PEAKS]; // 100% = 256
short height[N_PEAKS]; // 100% = 256
short width[N_PEAKS]; // 100% = 256
short freqadd[N_PEAKS]; // Hz
// copies without temporary adjustments from embedded commands
short freq2[N_PEAKS]; // 100% = 256
+6 -2
View File
@@ -382,6 +382,7 @@ void VoiceReset(int tone_only)
voice->width[pk] = 256;
voice->breath[pk] = 0;
voice->breathw[pk] = breath_widths[pk]; // default breath formant woidths
voice->freqadd[pk] = 0;
// adjust formant smoothing depending on sample rate
formant_rate[pk] = (formant_rate_22050[pk] * 22050)/samplerate;
@@ -416,8 +417,9 @@ static void VoiceFormant(char *p)
int freq = 100;
int height = 100;
int width = 100;
int freqadd = 0;
ix = sscanf(p,"%d %d %d %d",&formant,&freq,&height,&width);
ix = sscanf(p,"%d %d %d %d %d",&formant,&freq,&height,&width,&freqadd);
if(ix < 2)
return;
@@ -430,6 +432,7 @@ static void VoiceFormant(char *p)
voice->height[formant] = int(height * 2.56001);
if(width >= 0)
voice->width[formant] = int(width * 2.56001);
voice->freqadd[formant] = freqadd;
}
@@ -581,6 +584,7 @@ voice_t *LoadVoice(const char *vname, int control)
*p = 0; // remove previous variant name
sprintf(buf,"+%s",&vname[3]); // omit !v/ from the variant filename
strcat(voice_identifier,buf);
langopts = &translator->langopts;
}
VoiceReset(tone_only);
@@ -719,7 +723,7 @@ voice_t *LoadVoice(const char *vname, int control)
break;
case V_INTONATION: // intonation
sscanf(p,"%d %d",&option_tone1,&option_tone2);
sscanf(p,"%d %d",&langopts->intonation_group,&option_tone2);
break;
case V_DICTRULES: // conditional dictionary rules and list entries
+2 -2
View File
@@ -1713,9 +1713,9 @@ if(option_log_frames)
length4 = length2/4;
for(ix=0; ix<N_PEAKS; ix++)
{
peaks[ix].freq1 = (fr1->ffreq[ix] * v->freq[ix]) << 8;
peaks[ix].freq1 = (fr1->ffreq[ix] * v->freq[ix] + v->freqadd[ix]*256) << 8;
peaks[ix].freq = int(peaks[ix].freq1);
next = (fr2->ffreq[ix] * v->freq[ix]) << 8;
next = (fr2->ffreq[ix] * v->freq[ix] + v->freqadd[ix]*256) << 8;
peaks[ix].freq_inc = ((next - peaks[ix].freq1) * (STEPSIZE/4)) / length4; // lower headroom for fixed point math
peaks[ix].height1 = (fr1->fheight[ix] * v->height[ix]) << 6;