From 0529169f7c0ae99f98aad1274e17cec0fc247d49 Mon Sep 17 00:00:00 2001 From: Rob van Son Date: Tue, 22 Sep 2015 15:45:08 +0200 Subject: [PATCH] Windows TTS on pronunciation --- InitialiseSGC2.praat | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/InitialiseSGC2.praat b/InitialiseSGC2.praat index c87754c..f673a06 100644 --- a/InitialiseSGC2.praat +++ b/InitialiseSGC2.praat @@ -94,7 +94,8 @@ config.voicesTTS$ = "default f1 f2 f3 f4 f5 m1 m2 m3 m4 m5 m6 m7" sgc.lastVoice = 12 sgc.nativeOSXTTScommand$ = "say -vTing-Ting --rate=95" sgc.nativeLinuxTTScommand$ = "spd-say -l zh -t female1 -r -60" -sgc.nativeWindowsTTScommand$ = "mshta.exe vbscript:Execute(""CreateObject(""""SAPI.SpVoice"""").Speak """"$$$"""":Close"")" +#sgc.nativeWindowsTTScommand$ = "mshta.exe vbscript:Execute(""CreateObject(""""SAPI.SpVoice"""").Speak """"$$$"""":Close"")" +sgc.nativeWindowsTTScommand$ = "mshta.exe vbscript:Execute(""CreateObject(""""SAPI.SpVoice"""").Speak """""""":Close"")" sgc.nativeTTScommand$ = "" config.savePerf = 0 config.openPerf = 0 @@ -787,7 +788,11 @@ endproc procedure synthesize_sound .pinyin$ .character$ .pinyin$ = replace_regex$(.pinyin$, "(^""|""$)", "", 0) .character$ = replace_regex$(.character$, "(^""|""$)", "", 0) - .pinyinText$ = replace_regex$(.pinyin$, "0$", "''", 0) + .pinyinText$ = replace_regex$(.pinyin$, "0", "''", 0) + .pinyinExpanded$ = replace_regex$(.pinyin$, "0", "5", 0) + .pinyinExpanded$ = replace_regex$(.pinyinExpanded$, "([0-5])", " \1 - ", 0) + .pinyinExpanded$ = replace_regex$(.pinyinExpanded$, " - $", "", 0) + if .character$ = "-" or .character$ = "" or .character$ = "?" .character$ = .pinyinText$ endif @@ -802,6 +807,8 @@ procedure synthesize_sound .pinyin$ .character$ elsif index(.currentCommand$, "&&&") # Find the character representation .currentCommand$ = replace$(.currentCommand$, "&&&", .pinyinText$, 0) + elsif index(sgc.nativeTTScommand$, "@@@") + .currentCommand$ = replace$(sgc.nativeTTScommand$, "@@@", .pinyinExpanded$, 0) else .currentCommand$ = .currentCommand$ + " ""'.pinyinText$'""" endif @@ -815,11 +822,11 @@ procedure synthesize_sound .pinyin$ .character$ elsif sgc.nativeTTScommand$ <> "" and config.voice <= 0 # Get the pinyin text on the correct place if index(sgc.nativeTTScommand$, "$$$") - # Find the character representation .currentCommand$ = replace$(sgc.nativeTTScommand$, "$$$", .character$, 0) elsif index(sgc.nativeTTScommand$, "&&&") - # Find the character representation .currentCommand$ = replace$(sgc.nativeTTScommand$, "&&&", .pinyinText$, 0) + elsif index(sgc.nativeTTScommand$, "@@@") + .currentCommand$ = replace$(sgc.nativeTTScommand$, "@@@", .pinyinExpanded$, 0) else .currentCommand$ = sgc.nativeTTScommand$ + " ""'.pinyinText$'""" endif -- 2.11.4.GIT