From 15ed485321d4469b752e42a166f3a42b30ed934d Mon Sep 17 00:00:00 2001 From: Rob van Son Date: Thu, 23 Feb 2012 10:25:07 +0100 Subject: [PATCH] eSpeak is now integrated in Praat, renamed example wordlist --- Config.praat | 2 +- InitialiseSGC2.praat | 14 ++++++++++---- MainPage.praat | 2 +- .../wordlist.Table | 0 4 files changed, 12 insertions(+), 6 deletions(-) rename wordlists/{Examples of tone combinations => An example wordlist}/wordlist.Table (100%) diff --git a/Config.praat b/Config.praat index 9f71cd8..13d656f 100644 --- a/Config.praat +++ b/Config.praat @@ -129,7 +129,7 @@ endproc procedure processConfigSynthesis .tts$ .clickX .clickY .pressed$ .table$ = "Config" .label$ = "Synthesis_'.tts$'" - if speakCommandFile$ <> "" and fileReadable(speakCommandFile$) + if sgc.synthesizer > 0 or (speakCommandFile$ <> "" and fileReadable(speakCommandFile$)) if config.synthesis$ = "" config.synthesis$ = .tts$ .displayButton = 2 diff --git a/InitialiseSGC2.praat b/InitialiseSGC2.praat index 7de5dc9..e920dd8 100644 --- a/InitialiseSGC2.praat +++ b/InitialiseSGC2.praat @@ -304,6 +304,8 @@ endproc # speakCommandDir$ = "'preferencesAppDir$'/TTS" # speakCommandFile$ = "" procedure set_up_TTS + sgc.synthesizer = Create SpeechSynthesizer... Mandarin m1 44100 0.01 50 100 100 yes no + if macintosh .ttscommand$ = "speak" .osName$ = "OSX" @@ -325,12 +327,13 @@ procedure set_up_TTS config.synthesis$ = "eSpeak" endif endif - + # Local TTS command, if there is no global one # Command does not exist yet, create it if eSpeak is installed # Make sure to quote the path! if speakCommandFile$ = "" - if not fileReadable("'speakCommandDir$'/TTS_'.osName$'_eSpeak_command.txt") + # Autodetect synthesizer command + if not (sgc.synthesizer > 0 or fileReadable("'speakCommandDir$'/TTS_'.osName$'_eSpeak_command.txt")) .command_path$ = "" if macintosh system_nocheck PATH=${PATH}:/opt/local/bin; bash -c -- 'which '.ttscommand$' > "'speakCommandDir$'/command_path.txt"' @@ -361,7 +364,7 @@ procedure set_up_TTS endif # Close off (other TTS maybe a later option) - if speakCommandFile$ <> "" and fileReadable(speakCommandFile$) + if sgc.synthesizer > 0 or (speakCommandFile$ <> "" and fileReadable(speakCommandFile$)) config.synthesis$ = "eSpeak" endif endproc @@ -507,7 +510,10 @@ endproc # TTS synthesis procedure synthesize_sound .pinyin$ .command$ = "" - if fileReadable(speakCommandFile$) + if sgc.synthesizer > 0 + select sgc.synthesizer + Play text... '.pinyin$' + elsif fileReadable(speakCommandFile$) .command$ < 'speakCommandFile$' .command$ = replace$(.command$, "'newline$'", " ", 0) if macintosh diff --git a/MainPage.praat b/MainPage.praat index 5df09b5..92c4845 100644 --- a/MainPage.praat +++ b/MainPage.praat @@ -289,7 +289,7 @@ procedure generate_example Read from file... '.soundFilePath$' Play Remove - elsif fileReadable(speakCommandFile$) and config.synthesis$ <> "" and config.synthesis$ <> "_DISABLED_" + elsif config.synthesis$ <> "" and config.synthesis$ <> "_DISABLED_" call synthesize_sound '.pinyin$' else call humToneContour '.pinyin$' 'config.register' diff --git a/wordlists/Examples of tone combinations/wordlist.Table b/wordlists/An example wordlist/wordlist.Table similarity index 100% rename from wordlists/Examples of tone combinations/wordlist.Table rename to wordlists/An example wordlist/wordlist.Table -- 2.11.4.GIT