Skip to content

Dump IPA transcription. Also fix some wrong words #115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ config.status
include/flite_version.h
main/flite_lang_list.c
main/flite_voice_list.c
*.json
*.o
1 change: 1 addition & 0 deletions Exports.def
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ EXPORTS
flite_voice_select
flite_file_to_speech
flite_text_to_speech
flite_text_to_ipa
flite_phones_to_speech
flite_ssml_file_to_speech
flite_ssml_text_to_speech
Expand Down
3 changes: 3 additions & 0 deletions include/flite.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ float flite_file_to_speech(const char *filename,
float flite_text_to_speech(const char *text,
cst_voice *voice,
const char *outtype);
void flite_text_to_ipa(const char *text,
cst_voice *voice,
const char *outtype);
float flite_phones_to_speech(const char *text,
cst_voice *voice,
const char *outtype);
Expand Down
3 changes: 2 additions & 1 deletion lang/cmu_us_kal/cmu_us_kal.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ static void fix_ah(cst_utterance *u)
static cst_utterance *cmu_us_kal_postlex(cst_utterance *u)
{
cmu_postlex(u);
fix_ah(u);
/* Why? what was wrong with the ah? This seems wrong to me. ah sounds were good. Maybe you meant to change them to shcwa? */
/* fix_ah(u); */

return u;
}
Expand Down
18 changes: 14 additions & 4 deletions lang/cmulex/cmu_lex_data_raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -6208,7 +6208,7 @@
213,248,172,220, 255, /* 67021 0chalkley */ 153,239,223,199,248,0,
254,248,188,220, 255, /* 67032 0chalks */ 153,239,223,250,0,
143,205,235,220, 255, /* 67042 0challender */ 153,145,102,252,0,
253,225,199,227,220, 255, /* 67053 0challenged */ 153,145,234,217,227,0,
253,225,245,199,227,220, 255, /* 67053 0challenged */ 153,145,234,217,227,0,
117,102,220, 255, /* 67063 0chalmers */ 153,239,222,161,0,
153,251,247,161,224, 255, /* 67074 0chalmette */ 153,239,222,9,0,
107,246,226,235,220, 255, /* 67085 0chaloupka */ 153,239,117,229,223,253,0,
Expand Down Expand Up @@ -11926,6 +11926,7 @@
152,254,133,222, 255, /* 130935 0eversole */ 133,213,161,251,199,0,
252,212,125, 255, /* 130945 0evert */ 133,213,103,0,
197,133,222, 255, /* 130953 0everts */ 133,213,103,250,0,
203,244,222, 255, /* numbering is wrong now, we'll fix at the end. 0every */ 133,213,252,248,0,
159,228,200,203,244,222, 255, /* 130965 0everything */ 133,213,252,248,238,245,211,0,
195,229,203,244,222, 255, /* 130979 0everywhere */ 133,213,252,248,188,55,254,0,
149,244,222, 255, /* 130991 0evett */ 133,213,65,0,
Expand Down Expand Up @@ -17394,6 +17395,7 @@
245,213,218, 255, /* 192728 0isleen */ 247,207,199,234,0,
250,247,218, 255, /* 192737 0isles */ 247,207,230,244,0,
247,183,251,82, 255, /* 192747 0ismail */ 247,207,222,253,194,0,
119,44, 255, /* numbering is wrong now, we'll fix at the end 0isn't */ 247,207,231,238,0,
150,237,218,210,254,218, 255, /* 192760 0isocyanate */ 247,207,132,248,228,116,0,
136,233,254,232, 255, /* 192772 0isoda */ 247,207,135,253,0,
64,254,177, 255, /* 192781 0isola */ 247,207,210,253,0,
Expand Down Expand Up @@ -19728,8 +19730,8 @@
111,186,126,247, 255, /* 217619 0lenexa */ 208,234,254,168,253,0,
241,159,222,247, 255, /* 217630 0lenger */ 208,234,217,252,0,
235,159,228,247, 255, /* 217640 0lengle */ 208,234,217,199,0,
200,91,222,247, 255, /* 217650 0length */ 208,234,217,238,245,0,
254,200,91,222,247, 255, /* 217662 0lengths */ 208,234,217,238,245,250,0,
200,159,222,247, 255, /* 217650 0length */ 208,234,217,238,245,0,
254,200,159,222,247, 255, /* 217662 0lengths */ 208,234,217,238,245,250,0,
193,209,159,222,247, 255, /* 217675 0lengyel */ 208,234,217,248,219,0,
253,241,205,247, 255, /* 217686 0lenhard */ 208,234,245,138,0,
252,204,239,205,247, 255, /* 217697 0lenhardt */ 208,234,245,138,238,0,
Expand Down Expand Up @@ -32519,7 +32521,7 @@
253,250,185,243,111, 255, /* 360588 0suffused */ 242,226,131,195,227,0,
245,183,248,10,144,224, 255, /* 360601 nsugarcane */ 231,250,12,241,233,228,254,0,
230,10,144,224, 255, /* 360614 0sugary */ 242,12,241,248,0,
67,225,242,111, 255, /* 360624 0suggest */ 242,12,217,141,0,
67,225,111, 255, /* 360624 0suggest */ 242,12,217,141,0,
250,242,206,254, 255, /* 360634 0suggs */ 242,12,217,250,0,
206,254, 255, /* 360642 0suh */ 242,226,245,0,
113,204,239,194,254, 255, /* 360652 0suharto */ 242,226,245,126,251,0,
Expand Down Expand Up @@ -36963,3 +36965,11 @@
230,122,229,216,250, 255, /* 410508 0zywicki */ 104,248,188,225,58,0,
27,250, 255, /* 410517 0zzzz */ 104,205,205,205,0,
/* num_bytes = 410522 */
/* took away one byte in challenged and one byte in suggest. added 8 bytes in isn't and 9 bytes in every so actually */
/* real num_bytes = 410537 */


/*
On the left we have indices of lines in cmu_lex_phones_huff_table.c
On the right, indices of lines in cmu_lex_entries_huff_table.c
*/
2 changes: 1 addition & 1 deletion lang/cmulex/cmu_lex_num_bytes.c
Original file line number Diff line number Diff line change
@@ -1 +1 @@
410522
410537
2 changes: 2 additions & 0 deletions lang/cmulex/cmu_lex_phones_huff_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,3 +252,5 @@
"\007" , /* 0.026273 */
"\024" , /* 0.026581 */
"\020" , /* 0.029376 */

// Octal numbers that are indices in the cmu_lex_phone_table (cmu_lex_entries.c) without the epsilon entry
1 change: 1 addition & 0 deletions lang/cmulex/cmu_lts_rules.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ const char * const cmu_lts_letter_table[30] =
NULL
};

//index into the cmu_lts_model.c table
const cst_lts_addr cmu_lts_letter_index[27] =
{
0, /* a */
Expand Down
11 changes: 8 additions & 3 deletions lang/usenglish/us_text.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,9 +824,14 @@ static cst_val *us_tokentowords_one(cst_item *token, const char *name)
(!us_aswd(name)))
/* Still not quiet right, if there is a user_lex we need to check */
/* it too -- but user_lex isn't user setable yet */
/* Need common exception list */
/* unpronouncable list of alphas */
r = en_exp_letters(name);
/* Need common exception list */
/* unpronouncable list of alphas */

/* I had some misspelled word in my input (wannth), and got a weird output-
dʌbəljueɪɛnɛntieɪtʃ (In the spoken wav file as well)
I think it both reads better and sounds better when I do this*/
r = cons_val(string_val(name),NULL);
/* r = en_exp_letters(name); */

/* buckets of other stuff missing */

Expand Down
4 changes: 2 additions & 2 deletions lang/usenglish/usenglish.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
#include "us_text.h"
#include "us_ffeatures.h"

static const char * const us_english_punctuation = "\"'`.,:;!?(){}[]";
static const char * const us_english_prepunctuation = "\"'`({[";
static const char * const us_english_punctuation = "\"'`.,:;!?(){}[]-_*/+#$%^&";
static const char * const us_english_prepunctuation = "\"'`.,:;!?(){}[]-_*/+#$%^&";
static const char * const us_english_singlecharsymbols = "";
static const char * const us_english_whitespace = " \t\n\r";

Expand Down
51 changes: 44 additions & 7 deletions main/flite_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ static void flite_usage()
" -f TEXTFILE Explicitly set input filename\n"
" -t TEXT Explicitly set input textstring\n"
" -p PHONES Explicitly set input textstring and synthesize as phones\n"
" -i Print IPA output to screen or to output wavefile if it was given\n"
" --set F=V Set feature (guesses type)\n"
" -s F=V Set feature (guesses type)\n"
" --seti F=V Set int feature\n"
Expand Down Expand Up @@ -206,19 +207,22 @@ int main(int argc, char **argv)
int i;
float durs;
double time_start, time_end;
int flite_verbose, flite_loop, flite_bench;
int flite_verbose, flite_loop, ipa_only, flite_bench;
int explicit_filename, explicit_text, explicit_phones, ssml_mode;
#define ITER_MAX 3
int bench_iter = 0;
cst_features *extra_feats;
const char *lex_addenda_file = NULL;
const char *voicedumpfile = NULL;
cst_audio_streaming_info *asi;
FILE *fd;
long length;

filename = 0;
outtype = "play"; /* default is to play */
flite_verbose = FALSE;
flite_loop = FALSE;
ipa_only = FALSE;
flite_bench = FALSE;
explicit_text = explicit_filename = explicit_phones = FALSE;
ssml_mode = FALSE;
Expand Down Expand Up @@ -249,6 +253,8 @@ int main(int argc, char **argv)
}
else if (cst_streq(argv[i],"-l"))
flite_loop = TRUE;
else if (cst_streq(argv[i],"-i"))
ipa_only = TRUE;
else if (cst_streq(argv[i],"-b"))
{
flite_bench = TRUE;
Expand Down Expand Up @@ -393,26 +399,57 @@ int main(int argc, char **argv)

if (flite_bench)
{
outtype = "none";
filename = "A whole joy was reaping, but they've gone south, you should fetch azure mike.";
explicit_text = TRUE;
outtype = "none";
filename = "A whole joy was reaping, but they've gone south, you should fetch azure mike.";
explicit_text = TRUE;
}


loop:
gettimeofday(&tv,NULL);
time_start = (double)(tv.tv_sec)+(((double)tv.tv_usec)/1000000.0);

if (explicit_phones)
durs = flite_phones_to_speech(filename,v,outtype);
else if ((strchr(filename,' ') && !explicit_filename) || explicit_text)
if (explicit_phones) {
/* filename is actually input phones and not filename */
durs = flite_phones_to_speech(filename,v,outtype);
return 0;
}
else if ((strchr(filename,' ') && !explicit_filename) || explicit_text || access(filename, F_OK) != 0)
{
/* filename is actually input text and not filename */
if (ipa_only) {
flite_text_to_ipa(filename, v, outtype);
return 0;
}
if (ssml_mode)
durs = flite_ssml_text_to_speech(filename,v,outtype);
else
durs = flite_text_to_speech(filename,v,outtype);
}
else
{
if (ipa_only) {
FILE *fd = fopen(filename, "r");
if (fd == NULL)
{
cst_errmsg("flite_text_to_ipa: can't open file \"%s\"\n", filename);
return 1;
}
fseek(fd, 0, SEEK_END);
length = ftell(fd);
fseek(fd, 0, SEEK_SET);
filename = malloc (length);
if (filename == NULL)
{
cst_errmsg("flite_text_to_ipa: failed to allocated %d bytes\n", length);
return 1;
}
fread(filename, length, 1, fd);
fclose(fd);
flite_text_to_ipa(filename, v, outtype);
free(filename);
return 0;
}
if (ssml_mode)
durs = flite_ssml_file_to_speech(filename,v,outtype);
else
Expand Down
3 changes: 3 additions & 0 deletions src/lexicon/cst_lts.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ static cst_lts_phone apply_model(cst_lts_letter *vals,cst_lts_addr start,

cst_lts_get_state(&state,model,nstate,sizeof_cst_lts_rule);
}
// Fix `suggest` to remove the 'g' sound before the jh
if (strstr(vals, "sugest") && state.val == 43)
return 0;

return (cst_lts_phone)state.val;
}
8 changes: 5 additions & 3 deletions src/synth/cst_synth.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include "cst_units.h"
#include "cst_synth.h"
#include "cst_phoneset.h"
#include <assert.h>

CST_VAL_REGISTER_FUNCPTR(breakfunc,cst_breakfunc)

Expand Down Expand Up @@ -219,16 +220,17 @@ cst_utterance *default_tokenization(cst_utterance *u)
while(!ts_eof(fd))
{
token = ts_get(fd);
if (cst_strlen(token) > 0)
{
/* allow empty token for cases where we have a puncuation on it's own. Example - "I . am"*/
// if (cst_strlen(token) > 0)
// {
t = relation_append(r,NULL);
item_set_string(t,"name",token);
item_set_string(t,"whitespace",fd->whitespace);
item_set_string(t,"prepunctuation",fd->prepunctuation);
item_set_string(t,"punc",fd->postpunctuation);
item_set_int(t,"file_pos",fd->file_pos);
item_set_int(t,"line_number",fd->line_number);
}
// }
}

ts_close(fd);
Expand Down
Loading