build_SHA$ = "B601FAD486 2011-12-08T07:54:14Z" # # SpeakGoodChinese 2.0 # # Master Praat script # # SpeakGoodChinese: sgc2.praat is the master GUI of SpeakGoodChinese # It is written in Praat script for the Demo window # # Copyright (C) 2007-2010 R.J.J.H. van Son and 2010 the Netherlands Cancer Institute # The SpeakGoodChinese team are: # Guangqin Chen, Zhonyan Chen, Stefan de Koning, Eveline van Hagen, # Rob van Son, Dennis Vierkant, David Weenink # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # # The real application name sgc2.demoAppName$ = "SpeakGoodChinese2" # Define variable that might be reset in Initialise*.praat if not variableExists("build_SHA$") build_SHA$ = "-" endif # These are simply "useful" defaults localTableDir$ = "Data" buttonsTableName$ = "MainPage" configTableName$ = "Config" buttons$ = "" config$ = "" recordedSound$ = "" samplingFrequency = 44100 recordingTime = 4 # Pop-Up window colors sgc2.popUp_bordercolor$ = "{0.5,0.5,1}" sgc2.popUp_backgroundcolor$ = "{0.9,0.9,1}" # If running in a packed script binary if index_regex(preferencesDirectory$, "(?i'sgc2.demoAppName$')$") preferencesAppDir$ = preferencesDirectory$ elsif index_regex(preferencesDirectory$, "[pP]raat(\-dir| Prefs)?$") # If running as a Praat script, create a new preferences directory if unix preferencesAppDir$ = "'preferencesDirectory$'/../.'sgc2.demoAppName$'" else preferencesAppDir$ = "'preferencesDirectory$'/../'sgc2.demoAppName$'" endif else # It has to go somewhere. Make a subdirectory in the current preferences directory preferencesAppDir$ = "'preferencesDirectory$'/'sgc2.demoAppName$'" endif # Parameters for isolating recorded speech from noise # Should be mostly left alone unless you are using ultra clean # or very noisy recordings noiseThresshold = -30 minimumPitch = 60 soundMargin = 0.25 minimumIntensity = 30 # Set up button height buttonbevel = 0 # Define canvas viewportMargin = 5 defaultFontSize = 12 defaultFont$ = "Helvetica" defaultLineWidth = 1 # Set up system call reset_viewport # Load supporting scripts # Set up system and load preferences # # SpeakGoodChinese 2.0 # # Intializing Praat script # # SpeakGoodChinese: InitializeSGC2.praat defines and sets the global variables # and loads general SGC2 code # # Copyright (C) 2007-2010 R.J.J.H. van Son and 2010 the Netherlands Cancer Institute # The SpeakGoodChinese team are: # Guangqin Chen, Zhonyan Chen, Stefan de Koning, Eveline van Hagen, # Rob van Son, Dennis Vierkant, David Weenink # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # # Information for logging currentDate$ = date$() dateYear$ = right$(currentDate$, length(currentDate$) - rindex(currentDate$, " ")) logtimeStamp$ = replace_regex$(currentDate$, "[^a-zA-Z0-9\-_]", "-", 0) currentLogDirectory$ = "" # Define canvas viewportMargin = 5 yWordlist = 11 yFeedback = yWordlist + 5 yPinyin = yFeedback + 10 yContour = yPinyin + 15 wipeContourArea$ = "demo Paint rectangle... White 20 80 'yContour' 100" wipePinyinArea$ = "demo Paint rectangle... White 20 80 'yPinyin' 'yContour'" wipeFeedbackArea$ = "demo Paint rectangle... White 0 100 'yFeedback' 'yPinyin'" wipeWordlistArea$ = "demo Paint rectangle... White 20 80 'yWordlist' 'yFeedback'" # Pop-Up window colors sgc2.popUp_bordercolor$ = "{0.5,0.5,1}" sgc2.popUp_backgroundcolor$ = "{0.9,0.9,1}" # Initialize parameters alertText$ = "" currentWord = 1 pinyin$ = "" character$ = "" buttons$ = "" config$ = "" wordlistNum = 1 wordlistName$ = "" wordlist$ = "" config.deleteWordlist = -1 config.displayNumbers = 1 config.displayPinyin = 1 config.displayChar = 0 config.displayTrans = 1 config.useSoundExample = 1 config.synthesis$ = "_DISABLED_" config.input$ = "Microphone" config.showBackground = 1 sgc2.noiseThresshold = -30 config.strict = 0 # Platform dependent settings if macintosh or windows config.displayChar = 1 config.displayNumbers = 0 endif if windows and endsWith(build_SHA$, " XP") config.displayChar = 0 config.displayNumbers = 0 endif if unix config.displayChar = 0 config.displayNumbers = 1 endif if unix samplingFrequency = 44100 elsif macintosh samplingFrequency = 44100 elsif windows samplingFrequency = 44100 endif recordingTime = 2 logging = 0 config.language$ = "EN" config.register = 249 config.logPerformance = 0 preferencesLogDir$ = "'preferencesAppDir$'/log" preferencesTableDir$ = "'preferencesAppDir$'/Data" sgc2wordlists$ = "'preferencesAppDir$'/wordlists" localWordlistDir$ = sgc2wordlists$ # Global word lists must be installed BY THE ADMINISTRATOR # This means, create the directory 'globalwordlists$' and # fill it with wordlist directories containing wordlist.Table # and audio files. They can be copied from a local directory. globalwordlists$ = "" globaltablelists$ = "" globalTTSdir$ = "" if unix globalwordlists$ = "/etc/'sgc2.demoAppName$'/wordlists" globaltablelists$ = "/etc/'sgc2.demoAppName$'/Data" globalTTSdir$ = "/etc/'sgc2.demoAppName$'/TTS" elsif macintosh globalwordlists$ = "/Library/Preferences/'sgc2.demoAppName$'/wordlists" globaltablelists$ = "/Library/Preferences/'sgc2.demoAppName$'/Data" globalTTSdir$ = "/Library/Preferences/'sgc2.demoAppName$'/TTS" elsif windows globalwordlists$ = "C:/Documents and Settings/All Users/Application Data/'sgc2.demoAppName$'/wordlists" globaltablelists$ = "C:/Documents and Settings/All Users/Application Data/'sgc2.demoAppName$'/Data" globalTTSdir$ = "C:/Documents and Settings/All Users/Application Data/'sgc2.demoAppName$'/TTS" endif ############################################################## config.shuffleLists = 1 defaultFontSize = 12 defaultFont$ = "Helvetica" defaultLineWidth = 1 # Set up directories if they do not exist already call set_up_directories # Get saved preferences call read_preferences "" # Set up TTS system speakCommandDir$ = "'preferencesAppDir$'/TTS" speakCommandFile$ = "" call set_up_TTS # Set inital language call set_language 'config.language$' # Get the word-list call load_word_list "'localWordlistDir$'" 0 # Set up evaluation table initialiseSGC2.toneevaluation_table$ = "" call initialize_toneevaluation_tables # Draw inital window call init_window ############################################################### # # Obligatory procedures # ############################################################### # Initialize Demo Window procedure init_window demo Erase all if config.showBackground call draw_background Background endif demo Line width... 'defaultLineWidth' demo 'defaultFont$' call set_font_size 'defaultFontSize' demo Black call reset_viewport # Define buttons in a table call init_buttons .windowTitle$ = replace$(wordlistName$, "_", " ", 0) call set_window_title 'buttons$' '.windowTitle$' # Display the word-list call write_word_list # Logging light call paint_logging_light endproc # Make sure all Preferences directories are available procedure set_up_directories .dirPath$ = "'preferencesAppDir$'" createDirectory(.dirPath$) .dirPath$ > '.dirPath$'/directory.txt createDirectory("'.dirPath$'/wordlists") .dirPath$ > '.dirPath$'/wordlists/directory.txt createDirectory("'.dirPath$'/log") .dirPath$ > '.dirPath$'/log/directory.txt createDirectory("'.dirPath$'/TTS") .dirPath$ > '.dirPath$'/TTS/directory.txt endproc # # Retrieve and store setting between sessions # procedure read_preferences .preferencesFile$ if not fileReadable(.preferencesFile$) .preferencesFile$ = preferencesAppDir$+"/sgc2rc.txt" endif if fileReadable(.preferencesFile$) Read from file... 'preferencesAppDir$'/sgc2rc.txt .preferenceTable$ = selected$("Table") .numPrefKeys = Get number of rows for .row to .numPrefKeys .variableName$ = Get value... '.row' Key if variableExists(.variableName$) .variableValue = Get value... '.row' Value if .variableValue <> undefined '.variableName$' = '.variableValue' endif elsif variableExists(.variableName$+"$") .variableValue$ = Get value... '.row' Value .variableName$ = .variableName$+"$" '.variableName$' = "'.variableValue$'" endif endfor select Table '.preferenceTable$' Remove endif endproc procedure write_preferences .preferencesFile$ Create Table with column names... Preferences 0 Key Value if index_regex(.preferencesFile$, "[a-zA-Z0-9]") <= 0 .preferencesFile$ = preferencesAppDir$ + "/sgc2rc.txt" endif .row = 0 for .tableNum from 1 to 2 if .tableNum = 1 .table$ = "Config" elsif .tableNum = 2 .table$ = "MainPage" endif .varPrefix$ = replace_regex$(.table$, "^(.)", "\l\1", 0) select Table '.table$' .numTableRows = Get number of rows for .tablerow to .numTableRows select Table '.table$' .label$ = Get value... '.tablerow' Label .variableName$ = .varPrefix$+"."+(replace_regex$(.label$, "^(.)", "\l\1", 0)) .keyName$ = .variableName$ .value$ = "" if variableExists(.variableName$) .value = '.variableName$' .value$ = "'.value'" elsif variableExists(.variableName$ + "$") .variableName$ = .variableName$ + "$" .value$ = '.variableName$' elsif index(.variableName$, "_") > 0 .variableName$ = left$(.variableName$, rindex(.variableName$, "_") - 1) .keyName$ = .variableName$ select Table Preferences .prefRow = Search column... Key '.keyName$' if .prefRow <= 0 if variableExists(.variableName$) .value = '.variableName$' .value$ = "'.value'" elsif variableExists(.variableName$ + "$") .variableName$ = .variableName$ + "$" .value$ = '.variableName$' endif endif endif if .value$ <> "" select Table Preferences Append row .row += 1 Set string value... '.row' Key '.keyName$' Set string value... '.row' Value '.value$' endif endfor endfor # Some extra settings select Table Preferences Append row .row += 1 Set string value... '.row' Key wordlistDir Set string value... '.row' Value 'localWordlistDir$' select Table Preferences Append row .row += 1 Set string value... '.row' Key wordlistName Set string value... '.row' Value 'wordlistName$' select Table Preferences Write to table file... '.preferencesFile$' Remove endproc ############################################################### # # TTS (speech synthesis). Place commands in user info # # Prerequisites # speakCommandDir$ = "'preferencesAppDir$'/TTS" # speakCommandFile$ = "" procedure set_up_TTS if macintosh .ttscommand$ = "speak" .osName$ = "OSX" .quote$ = "" elsif unix .ttscommand$ = "espeak" .osName$ = "UNIX" .quote$ = "" elsif windows .ttscommand$ = "C:/Program Files/eSpeak/command_line/espeak.exe" .osName$ = "WIN" .quote$ = """" endif # Global TTS command has precedence if fileReadable("'globalTTSdir$'/TTS_'.osName$'_command.txt") speakCommandFile$ = "'globalTTSdir$'/TTS_'.osName$'_command.txt" if config.synthesis$ = "_DISABLED_" # Default is ON 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") .command_path$ = "" if macintosh system_nocheck PATH=${PATH}:/opt/local/bin; bash -c -- 'which '.ttscommand$' > "'speakCommandDir$'/command_path.txt"' .command_path$ < 'speakCommandDir$'/command_path.txt elsif unix system_nocheck PATH=${PATH};bash -c -- 'which '.ttscommand$' > "'speakCommandDir$'/command_path.txt"' .command_path$ < 'speakCommandDir$'/command_path.txt elsif windows if fileReadable(.ttscommand$) .command_path$ = .ttscommand$ endif endif # Remove any newlines .command_path$ = replace$(.command_path$, "'newline$'", "", 0) # Command path found if .command_path$ <> "" and fileReadable(.command_path$) deleteFile("'speakCommandDir$'/TTS_'.osName$'_eSpeak_command.txt") fileappend "'speakCommandDir$'/TTS_'.osName$'_eSpeak_command.txt" ...'.quote$''.ttscommand$''.quote$' -v zh+f4 -s 100 'newline$' speakCommandFile$ = "'speakCommandDir$'/TTS_'.osName$'_eSpeak_command.txt" endif endif if fileReadable("'speakCommandDir$'/TTS_'.osName$'_eSpeak_command.txt") speakCommandFile$ = "'speakCommandDir$'/TTS_'.osName$'_eSpeak_command.txt" endif deleteFile("'speakCommandDir$'/command_path.txt") endif # Close off (other TTS maybe a later option) if speakCommandFile$ <> "" and fileReadable(speakCommandFile$) config.synthesis$ = "eSpeak" endif endproc ############################################################### # # Evaluation tables # # Prerequisites # initialiseSGC2.toneevaluation_table$ = "" procedure initialize_toneevaluation_tables # Remove old table if initialiseSGC2.toneevaluation_table$ != "" select Table 'initialiseSGC2.toneevaluation_table$' Remove endif initialiseSGC2.toneevaluation_table$ = "" # Create new table Create Table with column names... Performance 0 Tones Correct Wrong Total High Low Wide Narrow Unknown Commented initialiseSGC2.toneevaluation_table$ = "Performance" call get_toneevaluation_row Total endproc procedure get_toneevaluation_row .tones$ select Table 'initialiseSGC2.toneevaluation_table$' .row = Search column... Tones '.tones$' if .row < 1 Append row .row = Get number of rows Set string value... '.row' Tones '.tones$' Set numeric value... '.row' Correct 0 Set numeric value... '.row' Wrong 0 Set numeric value... '.row' Total 0 Set numeric value... '.row' High 0 Set numeric value... '.row' Low 0 Set numeric value... '.row' Wide 0 Set numeric value... '.row' Narrow 0 Set numeric value... '.row' Unknown 0 Set numeric value... '.row' Commented 0 Sort rows... Tones .row = Search column... Tones '.tones$' endif endproc procedure increment_toneevaluation_in_row .row .column$ select Table 'initialiseSGC2.toneevaluation_table$' .tmp = Get value... '.row' '.column$' .tmp += 1 Set numeric value... '.row' '.column$' '.tmp' endproc procedure increment_toneevaluation_value .tones$ .column$ call get_toneevaluation_row '.tones$' .row = get_toneevaluation_row.row call increment_toneevaluation_in_row '.row' '.column$' call get_toneevaluation_row Total .row = get_toneevaluation_row.row call increment_toneevaluation_in_row '.row' '.column$' endproc procedure add_feedback_to_toneevaluation .table$ select Table '.table$' .line1$ = Get value... 1 Text .line2$ = Get value... 2 Text .label$ = Get value... 3 Text if .label$ = "6" .label$ = "Unknown" endif .tones$ = replace_regex$(left$(.line1$, rindex(.line1$, ":")), "[^0-9]", "", 0) .recognized$ = replace_regex$(right$(.line1$, length(.line1$)-rindex(.line1$, ":")), "[^0-9]", "", 0) # Set evaluation call increment_toneevaluation_value '.tones$' Total if .tones$ = .recognized$ call increment_toneevaluation_value '.tones$' Correct else call increment_toneevaluation_value '.tones$' Wrong endif if index_regex(.label$, "(Correct|Wrong)") <= 0 call increment_toneevaluation_value '.tones$' '.label$' call increment_toneevaluation_value '.tones$' Commented endif endproc procedure CreateSummaryToneEvaluation .font$ = "Helvetica" # Summarize tone evaluation Create Table with column names... SummaryToneEvaluation 0 Total Correct Problematic # Create texts call get_toneevaluation_row Total .row = get_toneevaluation_row.row select Table 'initialiseSGC2.toneevaluation_table$' .total = Get value... '.row' Total .correct = Get value... '.row' Correct if .total > 0 .correctPerc = 100 * .correct / .total else .correctPerc = 0 endif .problematic = Get value... '.row' Commented if .total > 0 .problematicPerc = 100 * .problematic / .total else .problematicPerc = 0 endif select Table SummaryToneEvaluation Append row Set numeric value... 1 Total '.total' Set numeric value... 1 Correct '.correctPerc' Set numeric value... 1 Problematic '.problematicPerc' endproc ############################################################### # # Miscelaneous procedures # ############################################################### # # Create a file 'preferencesAppDir$'/log/logPerformance # This file contains the path to the target directory where logging # is to be stored. # Note that this procedure is nowhere used in SGC2. It has to # be explicitely called in a separate script. # procedure activate_sgc2_logging .targetDirectory$ createDirectory("'preferencesAppDir$'") preferencesAppDir$ > 'preferencesAppDir$'/directory.txt createDirectory("'preferencesLogDir$'") preferencesLogDir$ > 'preferencesLogDir$'/directory.txt if startsWith(.targetDirectory$, "~") .targetDirectory$ = replace$(.targetDirectory$, "~", homeDirectory$, 1) endif .targetDirectory$ > 'preferencesLogDir$'/logPerformance.txt newline$ >> 'preferencesLogDir$'/logPerformance.txt endproc # TTS synthesis procedure synthesize_sound .pinyin$ .command$ = "" if fileReadable(speakCommandFile$) .command$ < 'speakCommandFile$' .command$ = replace$(.command$, "'newline$'", " ", 0) if macintosh system_nocheck PATH=${PATH}:/usr/local/bin:/opt/local/bin; bash -rc -- ''.command$' "'.pinyin$'"' elsif unix system_nocheck bash -rc -- ''.command$' "'.pinyin$'"' elsif windows system_nocheck call '.command$' "'.pinyin$'"' endif endif endproc # Include the main page buttons and procedures # # SpeakGoodChinese 2.0 # # Praat script handling buttons page # # SpeakGoodChinese: MainPage.praat loads the code needed for the # main, practice, page of SGC2 and the sound handling and recognition. # # Copyright (C) 2007-2010 R.J.J.H. van Son and 2010 the Netherlands Cancer Institute # The SpeakGoodChinese team are: # Guangqin Chen, Zhonyan Chen, Stefan de Koning, Eveline van Hagen, # Rob van Son, Dennis Vierkant, David Weenink # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # # Includes at the bottom # ############################################################### # # Button Drawing Routines # ############################################################### procedure DrawPrevious .color$ .x .y .size demo '.color$' .size *= 2/3 call drawTriangle -1 .x .y .size .currentX = drawTriangle.currentX .endX = .currentX - 0.5 .lowY = .y - .size .highY = .y + .size demo Paint rectangle... '.color$' '.currentX' '.endX' '.lowY' '.highY' endproc procedure DrawNext .color$ .x .y .size demo '.color$' .size *= 2/3 call drawTriangle 1 .x .y .size .currentX = drawTriangle.currentX .endX = .currentX + 0.5 .lowY = .y - .size .highY = .y + .size demo Paint rectangle... '.color$' '.currentX' '.endX' '.lowY' '.highY' endproc procedure DrawWordListUp .color$ .x .y .size .xleft = .x - .size .xright = .x + .size .xmidleft = .x + 0.1 .xmidright = .x - 0.1 .ylow = .y .yhigh = .y + .size demo '.color$' demo Line width... 3 demo Draw line... .xleft .ylow .xmidleft .yhigh demo Draw line... .xright .ylow .xmidright .yhigh demo Line width... 'defaultLineWidth' demo Black endproc procedure DrawWordListDown .color$ .x .y .size .xleft = .x - .size .xright = .x + .size .xmidleft = .x + 0.1 .xmidright = .x - 0.1 .yhigh = .y + .size .ylow = .y demo '.color$' demo Line width... 3 demo Draw line... .xleft .yhigh .xmidleft .ylow demo Draw line... .xright .yhigh .xmidright .ylow demo Line width... 'defaultLineWidth' demo Black endproc procedure drawTriangle .direction .x .y .size # Make sure direction = +/- 1 if .direction = 0 .direction = 1 endif .direction /= abs(.direction) .offset = 0.01 .currentHeight = .size .currentX = .x - .direction*.size demo Line width... 2.0 while .currentHeight> 0 .ystart = .y + .currentHeight .yend = .y - .currentHeight demo Draw line... .currentX .ystart .currentX .yend .currentHeight -= .offset *3/4 .currentX += .direction*.offset * 1.5 endwhile demo Line width... 'defaultLineWidth' endproc ############################################################### # # Obligatory button Drawing Routines # # These MUST be defined # ############################################################### procedure DrawRecord .color$ .x .y .size .size /= 2 demo Paint circle... '.color$' '.x' '.y' '.size' endproc procedure DrawPlay .color$ .x .y .size demo '.color$' call drawTriangle 1 .x .y .size endproc procedure DrawQuit .color$ .x .y .size demo Colour... '.color$' .lineWidth = 0.5*.size**2 demo Line width... '.lineWidth' .xstart = .x - .size .ystart = .y + .size .xend = .x + .size .yend = .y - .size demo Draw line... .xstart .ystart .xend .yend .xstart = .x - .size .ystart = .y - .size .xend = .x + .size .yend = .y + .size demo Draw line... .xstart .ystart .xend .yend demo Line width... 'defaultLineWidth' demo Colour... Black endproc procedure DrawConfig .color$ .x .y .size .size *= 1 .lineWidth = 0.4*.size demo Arrow size... '.lineWidth' .lineWidth = 0.4*.size**2 demo Line width... '.lineWidth' .y += .size/2 .xstart = .x - .size .xend = .x + .size demo Draw arrow... .xstart .y .xend .y demo Line width... 'defaultLineWidth' endproc procedure DrawRefresh .color$ .x .y .size .lineWidth = 0.5*.size**2 .size /= 2 demo Line width... '.lineWidth' demo Draw arc... '.x' '.y' '.size' 0 270 demo Line width... 'defaultLineWidth' endproc ############################################################### # # Button Processing Routines # ############################################################### procedure processMainPageExample .clickX .clickY .pressed$ call generate_example endproc procedure processMainPagePrevious .clickX .clickY .pressed$ call display_text Grey currentWord -= 1 call init_window # Draw the contour call draw_tone_contour call wipeArea 'wipeFeedbackArea$' call display_text Black endproc procedure processMainPageNext .clickX .clickY .pressed$ call display_text Grey currentWord += 1 call init_window # Draw the contour call draw_tone_contour call wipeArea 'wipeFeedbackArea$' call display_text Black endproc procedure processMainPageWordlistUp .clickX .clickY .pressed$ call wipeArea 'wipeFeedbackArea$' call load_word_list "'localWordlistDir$'" -1 call write_word_list call display_text Black endproc procedure processMainPageWordlistDown .clickX .clickY .pressed$ call wipeArea 'wipeFeedbackArea$' call load_word_list "'localWordlistDir$'" 1 call write_word_list call display_text Black endproc ############################################################### # # Obligatory button Processing Routines # # These MUST be defined # ############################################################### procedure processMainPageQuit .clickX .clickY .pressed$ call end_program endproc procedure processMainPageRefresh .clickX .clickY .pressed$ call init_window endproc procedure processMainPageConfig .clickX .clickY .pressed$ call config_page endproc procedure processMainPageHelp .clickX .clickY .pressed$ call help_loop 'buttons$' init_window endproc procedure processMainPagePlay .clickX .clickY .pressed$ call play_sound 'recordedSound$' endproc procedure processMainPageRecord .clickX .clickY .pressed$ call record_sound call recognizeTone # Write text (again) call display_word_list_name call display_text Black call add_feedback_to_toneevaluation Feedback call write_feedback Feedback select Table Feedback Remove endproc ############################################################### # # Miscelaneous supporting code # ############################################################### # The example procedure generate_example select Table 'wordlist$' if currentWord > 0 and currentWord <= numberOfWords select Table 'wordlist$' .sound$ = Get value... 'currentWord' Sound .pinyin$ = Get value... 'currentWord' Pinyin if .sound$ = "-" or .sound$ = "" .sound$ = .pinyin$+".wav" endif .soundFilePath$ = localWordlistDir$+"/"+wordlistName$+"/"+.sound$ .wordlistDirectory$ = "" if localWordlistDir$ <> "" and fileReadable("'localWordlistDir$'/'wordlistName$'") .wordlistDirectory$ = "'localWordlistDir$'/'wordlistName$'" elsif sgc2wordlists$ <> "" and fileReadable("'sgc2wordlists$'/'wordlistName$'") .wordlistDirectory$ = "'sgc2wordlists$'/'wordlistName$'" elsif globalwordlists$ <> "" and fileReadable("'globalwordlists$'/'wordlistName$'") .wordlistDirectory$ = "'globalwordlists$'/'wordlistName$'" endif if .wordlistDirectory$ <> "" .audioExampleList = Create Strings as file list... AudioList '.wordlistDirectory$'/'.pinyin$'.* .number_of_examples = Get number of strings if .number_of_examples > 0 Randomize .sound$ = Get string... 1 .soundFilePath$ = "'.wordlistDirectory$'/'.sound$'" endif Remove endif if fileReadable(.soundFilePath$) and config.useSoundExample Read from file... '.soundFilePath$' Play Remove elsif fileReadable(speakCommandFile$) and config.synthesis$ <> "" and config.synthesis$ <> "_DISABLED_" call synthesize_sound '.pinyin$' else call humToneContour '.pinyin$' 'config.register' call reset_viewport endif endif demoShow() endproc # Draw a tone contour procedure draw_tone_contour # Wipe screen call reset_viewport call wipeArea 'wipeContourArea$' select Table 'wordlist$' if currentWord > 0 and currentWord <= numberOfWords .sound$ = Get value... 'currentWord' Sound .pinyin$ = Get value... 'currentWord' Pinyin call drawToneContour '.pinyin$' 'config.register' call reset_viewport endif endproc procedure recognizeTone select Table 'wordlist$' if currentWord > 0 and currentWord <= numberOfWords .sound$ = Get value... 'currentWord' Sound .pinyin$ = Get value... 'currentWord' Pinyin call sgc_ToneProt 'recordedSound$' '.pinyin$' 'config.register' 'config.strict' 'config.language$' call reset_viewport endif endproc procedure write_feedback .table$ select Table '.table$' .line1$ = Get value... 1 Text .line2$ = Get value... 2 Text .label$ = Get value... 3 Text # convert numbers to Pinyin if needed if not config.displayNumbers call numbers2pinyin '.line1$' .line1$ = numbers2pinyin.pinyin$ endif .color$ = "Red" if index(.line1$, "???") > 0 .color$ = "Black" elsif .label$ = "Correct" .color$ = "Green" elsif config.strict .line2$ = .line2$ + " *" endif .currentFeedbackFontSize = 14 .maxHeight = 21 - 17 call adjustFontSizeOnHeight 'defaultFont$' '.currentFeedbackFontSize' '.maxHeight' .currentFeedbackFontSize = adjustFontSizeOnHeight.newFontSize call wipeArea 'wipeFeedbackArea$' call set_font_size '.currentFeedbackFontSize' demo '.color$' demo Text... 50 Centre 21 Bottom '.line1$' demo Text... 50 Centre 17 Bottom '.line2$' demoShow() demo 'defaultFont$' call set_font_size 'defaultFontSize' # Log performance .splitIndex = index(.line1$, ": ") .pinyin$ = left$(.line1$, (.splitIndex - 1)) .choice$ = right$(.line1$, (length(.line1$) - .splitIndex - 1)) call log_performance 'recordedSound$' 'config.register' 'config.strict' '.pinyin$' '.choice$' endproc # Text display procedure display_text .color$ select Table 'wordlist$' if currentWord < 0 or currentWord > numberOfWords+1 if config.shuffleLists Randomize rows endif if currentWord < 0 currentWord = numberOfWords else currentWord = 1 endif endif if currentWord > 0 and currentWord <= numberOfWords .displayText$ = "" .displayPinyin$ = Get value... 'currentWord' Pinyin .displayChar$ = Get value... 'currentWord' Character .displayTrans$ = Get value... 'currentWord' Translation if .displayPinyin$ <> "-" and config.displayPinyin if not config.displayNumbers call numbers2pinyin '.displayPinyin$' .displayPinyin$ = numbers2pinyin.pinyin$ endif # Insert u umlaut .displayPinyin$ = replace_regex$(.displayPinyin$, "v", "\\u\X22", 0) .displayText$ = .displayText$ + .displayPinyin$ endif if .displayChar$ <> "-" and config.displayChar .displayText$ = .displayText$ + " "+ .displayChar$ endif if .displayTrans$ <> "-" and config.displayTrans .displayText$ = .displayText$ + " \s{%%"+ .displayTrans$ + "%}" endif elsif currentWord = 0 or currentWord = numberOfWords+1 .displayText$ = "---" endif # Adapt font size call adjustFontSizeOnHeight 'defaultFont$' 24 15 .currentFontSize = adjustFontSizeOnHeight.newFontSize call adjustFontSizeOnWidth 'defaultFont$' '.currentFontSize' 95 '.displayText$' .currentFontSize = adjustFontSizeOnWidth.newFontSize # Actually display text call wipeArea 'wipePinyinArea$' demo '.color$' call set_font_size '.currentFontSize' demo Text... 50 Centre 26 Bottom '.displayText$' demoShow() demo Black demo 'defaultFont$' call set_font_size 'defaultFontSize' endproc procedure numbers2pinyin .numberstext$ .intermediatePinyin$ = .numberstext$ # Move numbers to the nucleus vowel # Tot he vowel .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "([aeuiov])([^aeuiov0-9]*)([0-9])", "\1\3\2", 0) # Either a/e .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "([ae])([aeuiov]*)([0-9])", "\1\3\2", 0) # Or the Oo in /ou/ .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "(ou)([0-9])", "o\2u", 0) # or the second vowel .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "([uiov][aeuiov])([uiov])([0-9])", "\1\3\2", 0) # Convert all to special characters # Tone 1 .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "a1", "ā", 0) .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "e1", "ē", 0) .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "u1", "ū", 0) .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "i1", "ī", 0) .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "o1", "ō", 0) .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "v1", "ǖ", 0) .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "1", "\\-^", 0) # Tone 2 .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "v2", "ǘ", 0) .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "([iaeou])2", "\\\1'", 0) .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "2", "\\'^", 0) # Tone 3 .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "a3", "ǎ", 0) .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "e3", "ě", 0) .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "u3", "ǔ", 0) .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "i3", "ǐ", 0) .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "o3", "ǒ", 0) .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "v3", "ǚ", 0) .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "3", "\\N^", 0) # Tone 4 .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "v4", "ǜ", 0) .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "([iaeou])4", "\\\1`", 0) .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "4", "\\`^", 0) # Tone 0 # Remove tone 0 symbol completely .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "0", "", 0) .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "a0", "å", 0) .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "e0", "e̊", 0) .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "u0", "ů", 0) .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "i0", "i̊", 0) .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "o0", "o̊", 0) .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "v0", "ü̊", 0) #.intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "0", "\\0^", 0) # Pick best vowel symbols available in cases not caught before # Ugly clutch to get the 1, 3, 0 tone diacritics at least in the neighbourhood .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "i(\\[-N0]\^)", "i\\s{_ }\1", 0) # Insert u umlaut .intermediatePinyin$ = replace_regex$(.intermediatePinyin$, "v", "\\u\X22", 0) .pinyin$ = .intermediatePinyin$ endproc # Includes #! praat # # SpeakGoodChinese: SGC_ToneRecognizer.praat processes student utterances # and generates a report on their tone production # # Copyright (C) 2007-2010 R.J.J.H. van Son # The SpeakGoodChinese team are: # Guangqin Chen, Zhonyan Chen, Stefan de Koning, Eveline van Hagen, # Rob van Son, Dennis Vierkant, David Weenink # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # # Needs: # include ToneRecognition.praat # include ToneScript.praat # procedure loadTable # procedure sgc_ToneProt sgc_ToneProt.currentSound$ sgc_ToneProt.pinyin$ sgc_ToneProt.register sgc_ToneProt.proficiency sgc_ToneProt.language$ # Remove if included in main program! sgc_ToneProt.viewportMargin = 5 sgc_ToneProt.precision = 3 if sgc_ToneProt.proficiency sgc_ToneProt.precision = 1.5 endif # Stick to the raw recognition results or not sgc_ToneProt.ultraStrict = sgc_ToneProt.proficiency # Read and select the feedbacktext call loadTable ToneFeedback_'sgc_ToneProt.language$' Rename... ToneFeedback numberOfFeedbackRows = Get number of rows # Clean up input if sgc_ToneProt.pinyin$ <> "" sgc_ToneProt.pinyin$ = replace_regex$(sgc_ToneProt.pinyin$, "^\s*(.+)\s*$", "\1", 1) sgc_ToneProt.pinyin$ = replace_regex$(sgc_ToneProt.pinyin$, "5", "0", 0) endif # Reduction (lower sgc_ToneProt.register and narrow range) means errors # The oposite mostly not. Asymmetry alows more room upward # than downward (asymmetry = 2 => highBoundaryFactor ^ 2) asymmetry = 2 # Kill octave jumps: DANGEROUS killOctaveJumps = 0 # Limit pitch range sgc_ToneProt.minimumPitch = 60 sgc_ToneProt.maximumPitch = 500 if sgc_ToneProt.register > 400 sgc_ToneProt.minimumPitch = 100 sgc_ToneProt.maximumPitch = 600 elsif sgc_ToneProt.register > 250 sgc_ToneProt.minimumPitch = 80 sgc_ToneProt.maximumPitch = 500 else sgc_ToneProt.minimumPitch = 60 sgc_ToneProt.maximumPitch = 400 endif sgc_ToneProt.currentTestWord$ = sgc_ToneProt.pinyin$ spacing = 0.5 sgc_ToneProt.precisionFactor = 2^(sgc_ToneProt.precision/12) highBoundaryFactor = sgc_ToneProt.precisionFactor ^ asymmetry lowBoundaryFactor = 1/sgc_ToneProt.precisionFactor # Generate reference example # Start with a range of 1 octave and a speed factor of 1 toneRange = 1.0 speedFactor = 1.0 sgc_ToneProt.upperRegisterInput = sgc_ToneProt.register call toneScript 'sgc_ToneProt.currentTestWord$' 'sgc_ToneProt.upperRegisterInput' 1 1 CorrectPitch # Get range and top select Pitch 'sgc_ToneProt.currentTestWord$' sgc_ToneProt.durationModel = Get total duration maximumModelFzero = Get quantile... 0 0 0.95 Hertz minimumModelFzero = Get quantile... 0 0 0.05 Hertz sgc_ToneProt.modelPitchRange = 2 if minimumModelFzero > 0 sgc_ToneProt.modelPitchRange = maximumModelFzero / minimumModelFzero endif # Get the sounds if fileReadable(sgc_ToneProt.currentSound$) Read from file... 'sgc_ToneProt.currentSound$' Rename... Source else select Sound 'sgc_ToneProt.currentSound$' Copy... Source endif # Calculate pitch select Sound Source durationSource = Get total duration # noprogress To Pitch (ac)... 0 'sgc_ToneProt.minimumPitch' 15 yes 0.2 0.6 0.02 0.5 0.3 'sgc_ToneProt.maximumPitch' noprogress To Pitch... 0.0 'sgc_ToneProt.minimumPitch' 'sgc_ToneProt.maximumPitch' Rename... SourcePitch # It is rather dangerous to kill Octave errors, so be careful if killOctaveJumps > 0 Rename... OldSource Kill octave jumps Rename... SourcePitch select Pitch OldSource Remove endif # Remove all pitch points outside a band around the upper sgc_ToneProt.register select Pitch SourcePitch upperCutOff = 1.7*sgc_ToneProt.upperRegisterInput lowerCutOff = sgc_ToneProt.upperRegisterInput/4 Formula... if self > 'upperCutOff' then -1 else self endif Formula... if self < 'lowerCutOff' then -1 else self endif # Get range and top select Pitch SourcePitch maximumRecFzero = Get quantile... 0 0 0.95 Hertz timeMaximum = Get time of maximum... 0 0 Hertz Parabolic minimumRecFzero = Get quantile... 0 0 0.05 Hertz timeMinimum = Get time of minimum... 0 0 Hertz Parabolic if maximumRecFzero = undefined # Determine what should be told to the student .recognitionText$ = "'sgc_ToneProt.currentTestWord$': ???" for i from 1 to numberOfFeedbackRows select Table ToneFeedback .toneOne$ = Get value... 'i' T1 .toneTwo$ = Get value... 'i' T2 .toneText$ = Get value... 'i' Feedback .label$ = "Unknown" if .toneOne$ = "NoSound" .feedbackText$ = .toneText$ endif endfor #exit Error, nothing recorded goto END endif recPitchRange = 2 if minimumRecFzero > 0 recPitchRange = maximumRecFzero / minimumRecFzero endif sgc_ToneProt.newUpperRegister = maximumRecFzero / maximumModelFzero * sgc_ToneProt.upperRegisterInput sgc_ToneProt.newToneRange = recPitchRange / sgc_ToneProt.modelPitchRange sgc_ToneProt.registerUsed$ = "OK" rangeUsed$ = "OK" # Advanced speakers must not speak too High, or too "Dramatic" # Beginning speakers also not too Low or too Narrow ranges if sgc_ToneProt.newUpperRegister > highBoundaryFactor * sgc_ToneProt.upperRegisterInput sgc_ToneProt.newUpperRegister = highBoundaryFactor * sgc_ToneProt.upperRegisterInput sgc_ToneProt.registerUsed$ = "High" elsif not sgc_ToneProt.proficiency and sgc_ToneProt.newUpperRegister < lowBoundaryFactor * sgc_ToneProt.upperRegisterInput sgc_ToneProt.newUpperRegister = lowBoundaryFactor * sgc_ToneProt.upperRegisterInput sgc_ToneProt.registerUsed$ = "Low" endif if sgc_ToneProt.newToneRange > highBoundaryFactor sgc_ToneProt.newToneRange = highBoundaryFactor rangeUsed$ = "Wide" elsif not sgc_ToneProt.proficiency and sgc_ToneProt.newToneRange < lowBoundaryFactor and not sgc_ToneProt.proficiency # Don't do this for advanced speakers sgc_ToneProt.newToneRange = lowBoundaryFactor rangeUsed$ = "Narrow" endif # Duration if sgc_ToneProt.durationModel > spacing speedFactor = (durationSource - spacing) / (sgc_ToneProt.durationModel - spacing) endif # Round values sgc_ToneProt.newUpperRegister = round(sgc_ToneProt.newUpperRegister) # Remove all pitch points outside a band around the upper sgc_ToneProt.register select Pitch SourcePitch upperCutOff = 1.5*sgc_ToneProt.newUpperRegister lowerCutOff = sgc_ToneProt.newUpperRegister/3 Formula... if self > 'upperCutOff' then -1 else self endif Formula... if self < 'lowerCutOff' then -1 else self endif if killOctaveJumps > 0 Rename... OldSourcePitch Kill octave jumps Rename... SourcePitch select Pitch OldSourcePitch Remove endif # It is good to have the lowest and highest pitch frequencies select Pitch SourcePitch timeMaximum = Get time of maximum... 0 0 Hertz Parabolic timeMinimum = Get time of minimum... 0 0 Hertz Parabolic # Clean up the old example pitch select Pitch 'sgc_ToneProt.currentTestWord$' Remove # Do the tone recognition call FreeToneRecognition 'sgc_ToneProt.currentTestWord$' "REUSEPITCH" "" 'sgc_ToneProt.newUpperRegister' 'sgc_ToneProt.newToneRange' 'speedFactor' call toneScript 'sgc_ToneProt.currentTestWord$' 'sgc_ToneProt.upperRegisterInput' 'sgc_ToneProt.newToneRange' 'speedFactor' CorrectPitch # Special cases originalRecognizedWord$ = sgc_ToneProt.choiceReference$ if sgc_ToneProt.ultraStrict = 0 # First syllable: 2<->3 (6) exchanges (incl 6) if rindex_regex(sgc_ToneProt.currentTestWord$, "^[a-zA-Z]+2[a-zA-Z]+[0-4]$") > 0 if rindex_regex(sgc_ToneProt.choiceReference$, "^[a-zA-Z]+[36][a-zA-Z]+[0-4]$") > 0 sgc_ToneProt.choiceReference$ = replace_regex$(sgc_ToneProt.choiceReference$, "[36]([a-zA-Z]+[0-4])$", "2\1", 0) endif elsif rindex_regex(sgc_ToneProt.currentTestWord$, "^[a-zA-Z]+3[a-zA-Z]+[0-4]$") > 0 if rindex_regex(sgc_ToneProt.choiceReference$, "^[a-zA-Z]+[26][a-zA-Z]+[0-4]$") > 0 sgc_ToneProt.choiceReference$ = replace_regex$(sgc_ToneProt.choiceReference$, "[26]([a-zA-Z]+[0-4])$", "3\1", 0) endif # A single second tone is often misidentified as a neutral tone, # A real neutral tone would be too low or too narrow and be discarded # Leaves us with erroneous tone 4 elsif rindex_regex(sgc_ToneProt.currentTestWord$, "^[a-zA-Z]+2$") > 0 if rindex_regex(sgc_ToneProt.choiceReference$, "^[a-zA-Z]+0$") > 0 and timeMinimum < timeMaximum sgc_ToneProt.choiceReference$ = replace_regex$(sgc_ToneProt.choiceReference$, "0", "2", 0) endif # A single fourth tone is often misidentified as a neutral tone, # A real neutral tone would be too low or too narrow and be discarded # Leaves us with erroneous tones 2 and 3 elsif rindex_regex(sgc_ToneProt.currentTestWord$, "^[a-zA-Z]+4$") > 0 if rindex_regex(sgc_ToneProt.choiceReference$, "^[a-zA-Z]+0$") > 0 and timeMaximum < timeMinimum sgc_ToneProt.choiceReference$ = replace_regex$(sgc_ToneProt.choiceReference$, "0", "4", 0) endif endif # Second (last) syllable, 0<->6 exchanges and 2<->3 # A recognized 0 after a 4 can be a 2: 4-0 => 4-2 if rindex_regex(sgc_ToneProt.currentTestWord$, "[a-zA-Z]+[4][a-zA-Z]+2$") > 0 if rindex_regex(sgc_ToneProt.choiceReference$, "[a-zA-Z]+[4][a-zA-Z]+[0]$") > 0 sgc_ToneProt.choiceReference$ = replace_regex$(sgc_ToneProt.choiceReference$, "[0]$", "2", 0) endif endif # A final 6 after a valid tone is often a recognition error # A final 6 can be a 0 if rindex_regex(sgc_ToneProt.currentTestWord$, "[a-zA-Z]+[0-9][a-zA-Z]+0$") > 0 if rindex_regex(sgc_ToneProt.choiceReference$, "[a-zA-Z]+[0-4][a-zA-Z]+6$") > 0 sgc_ToneProt.choiceReference$ = replace_regex$(sgc_ToneProt.choiceReference$, "6$", "0", 0) endif # Second (last) syllable, 2<->3 exchanges after [23] tones # A recognized 6 (or 3) after a valid tone [1-4] is mostly wrong, can be a 2 elsif rindex_regex(sgc_ToneProt.currentTestWord$, "[a-zA-Z]+[1-4][a-zA-Z]+2$") > 0 if rindex_regex(sgc_ToneProt.choiceReference$, "[a-zA-Z]+[1-4][a-zA-Z]+[36]$") > 0 sgc_ToneProt.choiceReference$ = replace_regex$(sgc_ToneProt.choiceReference$, "[36]$", "2", 0) endif # A recognized 6 after a [23] is mostly wrong, can be a 3 elsif rindex_regex(sgc_ToneProt.currentTestWord$, "[a-zA-Z]+[23][a-zA-Z]+3$") > 0 if rindex_regex(sgc_ToneProt.choiceReference$, "[a-zA-Z]+[23][a-zA-Z]+[26]$") > 0 sgc_ToneProt.choiceReference$ = replace_regex$(sgc_ToneProt.choiceReference$, "[26]$", "3", 0) endif # A recognized 6 after a [3] is mostly wrong, can be a 1 elsif rindex_regex(sgc_ToneProt.currentTestWord$, "[a-zA-Z]+[3][a-zA-Z]+1$") > 0 if rindex_regex(sgc_ToneProt.choiceReference$, "[a-zA-Z]+[3][a-zA-Z]+[6]$") > 0 sgc_ToneProt.choiceReference$ = replace_regex$(sgc_ToneProt.choiceReference$, "[6]$", "1", 0) endif endif # Clean up odd things constructed with special cases # Target is 3-3, but recognized is 2-3, which is CORRECT. Change it into 3-3 if rindex_regex(sgc_ToneProt.currentTestWord$, "[a-zA-Z]+[3][a-zA-Z]+[3]$") > 0 if rindex_regex(sgc_ToneProt.choiceReference$, "[a-zA-Z]+[2][a-zA-Z]+[3]$") > 0 sgc_ToneProt.choiceReference$ = replace_regex$(sgc_ToneProt.choiceReference$, "[2]([a-zA-Z]+[3])$", "3\1", 0) endif endif endif # If wrong, then undo all changes if sgc_ToneProt.currentTestWord$ != sgc_ToneProt.choiceReference$ sgc_ToneProt.choiceReference$ = originalRecognizedWord$ endif sgc_ToneProt.toneChoiceReference$ = sgc_ToneProt.choiceReference$ ############################################### # # Report # ############################################### result$ = "'tab$''sgc_ToneProt.currentTestWord$''tab$''sgc_ToneProt.choiceReference$''tab$''sgc_ToneProt.newUpperRegister''tab$''sgc_ToneProt.newToneRange''tab$''speedFactor''tab$''sgc_ToneProt.registerUsed$''tab$''rangeUsed$'" if sgc_ToneProt.currentTestWord$ = sgc_ToneProt.toneChoiceReference$ result$ = "Correct:"+result$ else result$ = "Wrong:"+result$ endif # Initialize result texts .recognitionText$ = "'sgc_ToneProt.currentTestWord$': " .choiceText$ = replace_regex$(sgc_ToneProt.choiceReference$, "6", "\?", 0) .feedbackText$ = "----" # Separate tone from pronunciation errors currentToneWord$ = replace_regex$(sgc_ToneProt.currentTestWord$, "[a-z]+", "\*", 0) choiceToneReference$ = replace_regex$(sgc_ToneProt.choiceReference$, "[a-z]+", "\*", 0) # Determine what should be told to the student if sgc_ToneProt.registerUsed$ = "Low" .recognitionText$ = .recognitionText$ + "???" for i from 1 to numberOfFeedbackRows select Table ToneFeedback .toneOne$ = Get value... 'i' T1 .toneTwo$ = Get value... 'i' T2 .toneText$ = Get value... 'i' Feedback if .toneOne$ = "Low" .feedbackText$ = .toneText$ .label$ = .toneOne$ endif endfor elsif rangeUsed$ = "Narrow" .recognitionText$ = .recognitionText$ + "???" for i from 1 to numberOfFeedbackRows select Table ToneFeedback .toneOne$ = Get value... 'i' T1 .toneTwo$ = Get value... 'i' T2 .toneText$ = Get value... 'i' Feedback if .toneOne$ = "Narrow" .feedbackText$ = .toneText$ .label$ = .toneOne$ endif endfor elsif sgc_ToneProt.registerUsed$ = "High" .recognitionText$ = .recognitionText$ + .choiceText$ for i from 1 to numberOfFeedbackRows select Table ToneFeedback .toneOne$ = Get value... 'i' T1 .toneTwo$ = Get value... 'i' T2 .toneText$ = Get value... 'i' Feedback if .toneOne$ = "High" .feedbackText$ = .toneText$ .label$ = .toneOne$ endif endfor elsif rangeUsed$ = "Wide" .recognitionText$ = .recognitionText$ + .choiceText$ for i from 1 to numberOfFeedbackRows select Table ToneFeedback .toneOne$ = Get value... 'i' T1 .toneTwo$ = Get value... 'i' T2 .toneText$ = Get value... 'i' Feedback if .toneOne$ = "Wide" .feedbackText$ = .toneText$ .label$ = .toneOne$ endif endfor # Bad tones, first handle first syllable elsif rindex_regex(sgc_ToneProt.choiceReference$, "^[a-zA-Z]+6") > 0 .recognitionText$ = .recognitionText$ + .choiceText$ # First syllable for i from 1 to numberOfFeedbackRows select Table ToneFeedback .toneOne$ = Get value... 'i' T1 .toneTwo$ = Get value... 'i' T2 .toneText$ = Get value... 'i' Feedback # .feedbackText$ = "" if .toneOne$ = "6" .recognitionText$ = .recognitionText$ + " ('.toneText$')" .label$ = .toneOne$ elsif rindex_regex(sgc_ToneProt.currentTestWord$, "^[a-zA-Z]+'.toneOne$'") > 0 and .toneTwo$ = "-" .feedbackText$ = .feedbackText$ + .toneText$ + " " endif endfor # Bad tones, then handle second syllable elsif rindex_regex(sgc_ToneProt.choiceReference$, "[a-zA-Z]+6$") > 0 .recognitionText$ = .recognitionText$ + .choiceText$ # Last syllable for i from 1 to numberOfFeedbackRows select Table ToneFeedback .toneOne$ = Get value... 'i' T1 .toneTwo$ = Get value... 'i' T2 .toneText$ = Get value... 'i' Feedback # .feedbackText$ = "" if .toneOne$ = "6" .recognitionText$ = .recognitionText$ + " ('.toneText$')" .label$ = .toneOne$ elsif rindex_regex(sgc_ToneProt.currentTestWord$, "[a-zA-Z]+'.toneOne$'$") > 0 and .toneTwo$ = "-" .feedbackText$ = .feedbackText$ + .toneText$ + " " endif endfor # Just plain wrong tones elsif currentToneWord$ <> choiceToneReference$ .recognitionText$ = .recognitionText$ + .choiceText$ for i from 1 to numberOfFeedbackRows select Table ToneFeedback .toneOne$ = Get value... 'i' T1 .toneTwo$ = Get value... 'i' T2 .toneText$ = Get value... 'i' Feedback if rindex_regex(sgc_ToneProt.currentTestWord$, "^[a-zA-Z]+'.toneOne$'$") > 0 and .toneTwo$ = "-" .feedbackText$ = .toneText$ elsif rindex_regex(sgc_ToneProt.currentTestWord$, "^[a-zA-Z]+'.toneOne$'[a-zA-Z]+'.toneTwo$'$") > 0 .feedbackText$ = .toneText$ elsif .toneOne$ = "Wrong" .recognitionText$ = .recognitionText$ + " ('.toneText$')" .label$ = .toneOne$ endif endfor # Correct else .recognitionText$ = .recognitionText$ + .choiceText$ for i from 1 to numberOfFeedbackRows select Table ToneFeedback .toneOne$ = Get value... 'i' T1 .toneTwo$ = Get value... 'i' T2 .toneText$ = Get value... 'i' Feedback if .toneOne$ = "Correct" .feedbackText$ = .toneText$ .label$ = .toneOne$ endif endfor endif label END # Write out result Create Table with column names... Feedback 3 Text Set string value... 1 Text '.recognitionText$' Set string value... 2 Text '.feedbackText$' Set string value... 3 Text '.label$' # Clean up select Table ToneFeedback Remove # Show pitch tracks freqTop = 1.5 * sgc_ToneProt.upperRegisterInput call reset_viewport demo Paint rectangle... White 15 85 40 105 demo Select inner viewport... 20 80 40 100 demo Axes... 0 100 0 100 select Pitch SourcePitch demo Red demo Line width... 3 demo Draw... 0 0 0 'freqTop' 0 select Pitch 'sgc_ToneProt.currentTestWord$' demo Green demo Draw... 0 0 0 'freqTop' 0 demo Line width... 1 demo 12 call reset_viewport # Replace recorded sound with new sound if not fileReadable(sgc_ToneProt.currentSound$) select Sound 'sgc_ToneProt.currentSound$' Remove select Sound Source Copy... 'sgc_ToneProt.currentSound$' endif # Clean up select Sound Source plus Pitch SourcePitch plus Pitch 'sgc_ToneProt.currentTestWord$' Remove endproc #! praat # # # Draw the correct tone tracks # # Needs # include ToneScript.praat # procedure drawToneContour drawToneContour.pinyin$ drawToneContour.register # Clean up input if drawToneContour.pinyin$ <> "" drawToneContour.pinyin$ = replace_regex$(drawToneContour.pinyin$, "^\s*(.+)\s*$", "\1", 1) drawToneContour.pinyin$ = replace_regex$(drawToneContour.pinyin$, "5", "0", 0) endif # Generate reference example # Start with a range of 1 octave and a speed factor of 1 drawToneContour.toneRange = 1.0 drawToneContour.speedFactor = 1.0 call toneScript 'drawToneContour.pinyin$' 'drawToneContour.register' 1 1 CorrectPitch drawToneContour.freqTop = 1.5 * drawToneContour.register # Draw Pitch track select Pitch 'drawToneContour.pinyin$' demo Select outer viewport... 20 80 40 100 demo Axes... 0 100 0 100 demo Line width... 1 demo Green demo Draw... 0 0 0 'drawToneContour.freqTop' 0 demo Line width... 3 demo Green demo Draw... 0 0 0 'drawToneContour.freqTop' 0 demo Select outer viewport... 0 100 0 100 demo Axes... 0 100 0 100 # Clean up select Pitch 'drawToneContour.pinyin$' Remove endproc #! praat # # # Hum the correct tone tracks # # Needs # include ToneScript.praat # procedure humToneContour humToneContour.pinyin$ humToneContour.register # Clean up input if humToneContour.pinyin$ <> "" humToneContour.pinyin$ = replace_regex$(humToneContour.pinyin$, "^\s*(.+)\s*$", "\1", 1) humToneContour.pinyin$ = replace_regex$(humToneContour.pinyin$, "5", "0", 0) endif # Generate reference example # Start with a range of 1 octave and a speed factor of 1 humToneContour.toneRange = 1.0 humToneContour.speedFactor = 1.0 call toneScript 'humToneContour.pinyin$' 'humToneContour.register' 'humToneContour.toneRange' 'humToneContour.speedFactor' CorrectPitch # Hum Pitch track select Pitch 'humToneContour.pinyin$' Hum # Clean up select Pitch 'humToneContour.pinyin$' Remove endproc #! praat # # Construct all tone patterns and look for the one closest to the given one # procedure FreeToneRecognition .pinyin$ .test_word$ .exclude$ .upperRegister .freqRange .durScale # Clean up input if .pinyin$ <> "" .pinyin$ = replace_regex$(.pinyin$, "^\s*(.+)\s*$", "\1", 1) .pinyin$ = replace_regex$(.pinyin$, "5", "0", 0) endif .referenceFrequency = 300 .frequencyFactor = .referenceFrequency / .upperRegister .referenceExt$ = "pitch" # Bias Z-normalized value of the distance difference between smallest and correct .biasDistance = 0.6 # Debugging .keepIntermediates = 0 .debug = 0 # Generate reference tones call toneScript '.pinyin$' '.upperRegister' '.freqRange' '.durScale' Pitch # Convert input to Pitch if .test_word$ <> "" and .test_word$ <> "REUSEPITCH" Read from file... '.test_word$' Rename... Source endif if .test_word$ <> "REUSEPITCH" select Sound Source noprogress To Pitch (ac)... 0 60 15 yes 0.1 0.45 0.01 0.5 0.3 600 # To Pitch... 0.0 60.0 600.0 Formula... self*'.frequencyFactor'; Normalize Pitch Rename... SourcePitch endif select Pitch SourcePitch .countDistance = 0 .sumDistance = 0 .sumSqrDistance = 0 .correctDistance = -1 .smallestDistance=999999 sgc_ToneProt.choiceReference$ = "empty" select Table ToneList .listLength = Get number of rows for .i from 1 to .listLength select Table ToneList .inFile$ = Get value... '.i' Word if (.exclude$ = "" or rindex_regex(.inFile$, .exclude$) <= 0) and rindex_regex(.inFile$, "[\d]") > 0 referenceName$ = .inFile$ select Pitch '.inFile$' plus Pitch SourcePitch noprogress To DTW... 24 10 yes yes no restriction Rename... DTW'.inFile$' distance = Get distance (weighted) .countDistance = .countDistance + 1 .sumDistance = .sumDistance + distance .sumSqrDistance = .sumSqrDistance + distance^2 if .pinyin$ = .inFile$ .correctDistance = distance endif if .debug > 0 # printline 'distance' - '.inFile$' endif if distance < .smallestDistance .smallestDistance = distance sgc_ToneProt.choiceReference$ = "'.inFile$'" endif # Clean up select DTW DTW'.inFile$' if .keepIntermediates = 0 Remove endif endif endfor if .countDistance > 1 .meanDistance = .sumDistance / .countDistance .varDistance = (.sumSqrDistance - .sumDistance^2/.countDistance)/(.countDistance - 1) .stdDistance = sqrt(.varDistance) .diffDistance = .correctDistance - .smallestDistance .zDistance = .diffDistance/.stdDistance if .debug > 0 printline Match: '.pinyin$' <== 'sgc_ToneProt.choiceReference$' small='.smallestDistance' Z='.zDistance' endif if .zDistance < .biasDistance sgc_ToneProt.choiceReference$ = .pinyin$ .smallestDistance = .correctDistance endif endif # Clean up for .i from 1 to .listLength select Table ToneList .inFile$ = Get value... '.i' Word if (.exclude$ = "" or rindex_regex(.inFile$, .exclude$) <= 0) and rindex_regex(.inFile$, "[\d]") > 0 # Clean up select Pitch '.inFile$' if .keepIntermediates = 0 Remove endif endif endfor select Table ToneList if .test_word$ <> "" and .test_word$ <> "REUSEPITCH" plus Sound Source endif if .test_word$ <> "" and .test_word$ <> "REUSEPITCH" plus Pitch SourcePitch endif if .keepIntermediates = 0 Remove endif endproc #! praat # # SpeakGoodChinese: toneScript.praat generates synthetic tone contours # for Mandarin Chinese # Copyright (C) 2007 R.J.J.H. van Son # The SpeakGoodChinese team are: # Guangqin Chen, Zhonyan Chen, Stefan de Konink, Eveline van Hagen, # Rob van Son, Dennis Vierkant, David Weenink # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # # form Enter pinyin and tone 1 frequency # word toneScript.inputWord ba1ba1 # positive toneScript.upperRegister_(Hz) 300 # real toneScript.range_Factor 1 # real toneScript.durationScale 1 # optionmenu toneScript.generate 1 # option Pitch # option Sound # option CorrectPitch # option CorrectSound # endform # Get the rules of the tones # include ToneRules.praat #call toneScript 'toneScript.inputWord$' 'toneScript.upperRegister' 'toneScript.range_Factor' 'toneScript.durationScale' 'toneScript.generate$' procedure toneScript toneScript.inputWord$ toneScript.upperRegister toneScript.range_Factor toneScript.durationScale toneScript.generate$ # To supress the ToneList, change to 0 toneScript.createToneList = 1 if rindex_regex(toneScript.generate$, "Correct") > 0 toneScript.createToneList = 0 endif # Limit lowest tone toneScript.absoluteMinimum = 80 toneScript.prevTone = -1 toneScript.nextTone = -1 toneScript.point = 0 toneScript.lastFrequency = 0 # Clean up input if toneScript.inputWord$ <> "" toneScript.inputWord$ = replace_regex$(toneScript.inputWord$, "^\s*(.+)\s*$", "\1", 1) endif # Add a tone movement. The current time toneScript.point is 'toneScript.point' toneScript.delta = 0.0000001 if toneScript.durationScale <= 0 toneScript.durationScale = 1.0 endif toneScript.segmentDuration = 0.150 toneScript.fixedDuration = 0.12 # # Movements # start * ?Semit is a fall # start / ?Semit is a rise # 1/(12 semitones) toneScript.octave = 0.5 # 1/(9 semitones) toneScript.nineSemit = 0.594603557501361 # 1/(6 semitones) toneScript.sixSemit = 0.707106781186547 # 1/(3 semitones) down toneScript.threeSemit = 0.840896415253715 # 1/(2 semitones) down toneScript.twoSemit = 0.890898718140339 # 1/(1 semitones) down toneScript.oneSemit = 0.943874313 # 1/(4 semitones) down toneScript.fourSemit = toneScript.twoSemit * toneScript.twoSemit # 1/(5 semitones) down toneScript.fiveSemit = toneScript.threeSemit * toneScript.twoSemit toneScript.frequency_Range = toneScript.octave if toneScript.range_Factor > 0 toneScript.frequency_Range = toneScript.frequency_Range * toneScript.range_Factor endif # Previous end frequency toneScript.lastFrequency = 0 # Split input into syllables toneScript.margin = 0.25 # Get a list of items if toneScript.createToneList = 1 Create Table with column names... ToneList 36 Word for .i from 1 to 36 select Table ToneList Set string value... '.i' Word ------EMPTY endfor endif toneScript.syllableCount = length(replace_regex$(toneScript.inputWord$, "[^\d]+([\d]+)", "1", 0)) toneScript.wordNumber = 0 toneScript.lowerBound = 1 if toneScript.syllableCount = 1 toneScript.lowerBound = 0 endif if rindex(toneScript.generate$, "Correct") <= 0 for toneScript.first from toneScript.lowerBound to 6 toneScript.currentWord$ = replace_regex$(toneScript.inputWord$, "^([^\d]+)([\d]+)(.*)$", "\1'toneScript.first'\3", 1) for toneScript.second from 0 to 6 if (toneScript.first <> 5 and toneScript.second <> 5) and (toneScript.syllableCount > 1 or toneScript.second == 1) toneScript.currentWord$ = replace_regex$(toneScript.currentWord$, "^([^\d]+)([\d]+)([^\d]+)([\d]+)$", "\1'toneScript.first'\3'toneScript.second'", 1) # Write name in list toneScript.wordNumber = toneScript.wordNumber+1 if toneScript.createToneList = 1 select Table ToneList toneScript.listLength = Get number of rows toneScript.listLength = toneScript.listLength + 1 for toneScript.currLength from toneScript.listLength to toneScript.wordNumber Append row Set string value... 'toneScript.currLength' Word ------EMPTY endfor Set string value... 'toneScript.wordNumber' Word 'toneScript.currentWord$' endif # Actually, generate something call generateWord 'toneScript.generate$' 'toneScript.currentWord$' 'toneScript.upperRegister' endif endfor endfor else call generateWord 'toneScript.generate$' 'toneScript.inputWord$' 'toneScript.upperRegister' endif endproc procedure extractTone .syllable$ toneScript.toneSyllable = -1 .toneScript.currentToneText$ = replace_regex$(.syllable$, "^[^\d]+([\d]+)(.*)$", "\1", 0) toneScript.toneSyllable = extractNumber(.toneScript.currentToneText$, "") endproc procedure convertVoicing toneScript.voicingSyllable$ # Remove tones toneScript.voicingSyllable$ = replace_regex$(toneScript.voicingSyllable$, "^([^\d]+)[\d]+", "\1", 0) # Convert voiced consonants toneScript.voicingSyllable$ = replace_regex$(toneScript.voicingSyllable$, "(ng|[wrlmny])", "C", 0) # Convert unvoiced consonants toneScript.voicingSyllable$ = replace_regex$(toneScript.voicingSyllable$, "(sh|ch|zh|[fsxhktpgqdbzcj])", "U", 0) # Convert vowels toneScript.voicingSyllable$ = replace_regex$(toneScript.voicingSyllable$, "([aiuoe\XFC])", "V", 0) endproc procedure addToneMovement .syllable$ toneScript.topLine toneScript.prevTone toneScript.nextTone # Get tone toneScript.toneSyllable = -1 call extractTone '.syllable$' if toneScript.toneSyllable = 3 and toneScript.nextTone = 3 toneScript.toneSyllable = 2 endif # Get voicing pattern toneScript.voicingSyllable$ = "" call convertVoicing '.syllable$' # Account for tones in duration toneScript.toneFactor = 1 # Scale the duration of the current syllable call toneDuration toneScript.toneFactor = toneScript.toneFactor * toneScript.durationScale # Unvoiced part if rindex_regex(toneScript.voicingSyllable$, "U") = 1 toneScript.point = toneScript.point + toneScript.delta Add point... 'toneScript.point' 0 toneScript.point = toneScript.point + toneScript.segmentDuration * toneScript.toneFactor Add point... 'toneScript.point' 0 endif # Voiced part toneScript.voiceLength$ = replace_regex$(toneScript.voicingSyllable$, "U*([CV]+)U*", "\1", 0) toneScript.voicedLength = length(toneScript.voiceLength$) toneScript.voicedDuration = toneScript.toneFactor * (toneScript.segmentDuration*toneScript.voicedLength + toneScript.fixedDuration) toneScript.point = toneScript.point + toneScript.delta # Write contour of each tone # Note that tones are influenced by the previous (tone 0) and next (tone 3) # tones. Tone 6 is the Dutch intonation # sqrt(toneScript.frequency_Range) is the mid toneScript.point if toneScript.topLine * toneScript.frequency_Range < toneScript.absoluteMinimum toneScript.frequency_Range = toneScript.absoluteMinimum / toneScript.topLine endif call toneRules toneScript.lastFrequency = toneScript.endPoint endproc procedure wordToTones .wordInput$ toneScript.highPitch .currentRest$ = .wordInput$; toneScript.syllableCount = 0 .length = 2 * toneScript.margin # Split syllables while rindex_regex(.currentRest$, "^[^\d]+[\d]+") > 0 toneScript.syllableCount += 1 syllable'toneScript.syllableCount'$ = replace_regex$(.currentRest$, "^([^\d]+[\d]+)(.*)$", "\1", 1) toneScript.currentSyllable$ = syllable'toneScript.syllableCount'$ # Get the tone call extractTone 'toneScript.currentSyllable$' toneScript.toneSyllable'toneScript.syllableCount' = toneScript.toneSyllable toneScript.currentTone = toneScript.toneSyllable'toneScript.syllableCount' # Get the Voicing pattern call convertVoicing 'toneScript.currentSyllable$' voicingSyllable'toneScript.syllableCount'$ = toneScript.voicingSyllable$ currentVoicing$ = voicingSyllable'toneScript.syllableCount'$ # Calculate new .length # Account for tones in duration toneScript.toneFactor = 1 # Scale the duration of the current syllable call toneDuration toneScript.toneFactor = toneScript.toneFactor * toneScript.durationScale .length = .length + toneScript.toneFactor * (length(voicingSyllable'toneScript.syllableCount'$) * (toneScript.segmentDuration + toneScript.delta) + toneScript.fixedDuration) # Next round .currentRest$ = replace_regex$(.currentRest$, "^([^\d]+[\d]+)(.*)$", "\2", 1) # Safety valve if toneScript.syllableCount > 2000 exit endif endwhile # Create tone pattern Create PitchTier... '.wordInput$' 0 '.length' # Add start toneScript.margin toneScript.lastFrequency = 0 toneScript.point = 0 Add point... 'toneScript.point' 0 toneScript.point = toneScript.margin Add point... 'toneScript.point' 0 toneScript.lastTone = -1 toneScript.followTone = -1 for .i from 1 to toneScript.syllableCount toneScript.currentSyllable$ = syllable'.i'$ toneScript.currentTone = toneScript.toneSyllable'.i' toneScript.followTone = -1 if .i < toneScript.syllableCount .j = .i+1 toneScript.followTone = toneScript.toneSyllable'.j' endif call addToneMovement 'toneScript.currentSyllable$' 'toneScript.highPitch' 'toneScript.lastTone' 'toneScript.followTone' toneScript.lastTone = toneScript.currentTone endfor # Add end toneScript.margin toneScript.point = toneScript.point + toneScript.delta Add point... 'toneScript.point' 0 toneScript.point = toneScript.point + toneScript.margin Add point... 'toneScript.point' 0 endproc procedure generateWord toneScript.whatToGenerate$ toneScript.theWord$ toneScript.upperRegister call wordToTones 'toneScript.theWord$' 'toneScript.upperRegister' # Generate pitch select PitchTier 'toneScript.theWord$' noprogress To Pitch... 0.0125 60.0 600.0 Rename... theOrigWord Smooth... 10 Rename... 'toneScript.theWord$' select Pitch theOrigWord Remove # Generate sound if wanted select Pitch 'toneScript.theWord$' if rindex_regex(toneScript.whatToGenerate$, "Sound") > 0 noprogress To Sound (hum) endif # Clean up select PitchTier 'toneScript.theWord$' if rindex_regex(toneScript.whatToGenerate$, "Sound") > 0 plus Pitch 'toneScript.theWord$' endif Remove endproc # The rules for constructing the tone contours. # # This procedure works because in Praat, there is no namespace # separation. All variables behave as if they are global # (which they are). # # toneScript.toneSyllable is the tone number on the current syllable # 1-4, 0=neutral, 6=Dutch (garbage) intonation # # These procedures set the following pareameters # and use them to create a Pitch Tier: # # toneScript.toneFactor: Duration scale factor for current tone # toneRules.startPoint: Start of the tone # toneScript.endPoint: end of the tone # toneRules.lowestPoint: bottom of tone 3 # toneScript.point: The time of the next pitch value in the contour # ONLY USE AS: toneScript.point = toneScript.point + * toneScript.voicedDuration # # The following values are given by the calling routine # DO NOT ALTER THEM # # toneScript.toneSyllable: tone number on the current syllable # toneScript.nextTone: tone number of next syllable or -1 # toneScript.prevTone: tone number of previous syllable or -1 # toneScript.lastFrequency: end-frequency of the previous syllable # # toneScript.topLine: the frequency of the first tone # toneScript.frequency_Range: Range of tone four (1 toneScript.octave) # toneScript.voicedDuration: Duration of voiced part of syllable # # Procedure to scale the duration of the current syllable procedure toneDuration if toneScript.toneSyllable = 0 .zeroToneFactor = 0.5 if toneScript.prevTone = 2 .zeroToneFactor = 0.8 * .zeroToneFactor elsif toneScript.prevTone = 3 .zeroToneFactor = 1.1 * .zeroToneFactor elsif toneScript.prevTone = 4 .zeroToneFactor = 0.8 * .zeroToneFactor endif toneScript.toneFactor = .zeroToneFactor * toneScript.toneFactor elsif toneScript.toneSyllable = 2 toneScript.toneFactor = 0.8 elsif toneScript.toneSyllable = 3 toneScript.toneFactor = 1.1 elsif toneScript.toneSyllable = 4 toneScript.toneFactor = 0.8 endif # Next tone 0, then lengthen first syllable if toneScript.nextTone = 0 toneScript.toneFactor = toneScript.toneFactor * 1.2 endif endproc # DO NOT CHANGE toneScript.toneFactor BELOW THIS POINT # Rules to create a tone # # Do not mess with the 'Add point...' commands # unless you know what you are doing # The 'toneScript.point =' defines the time of the next pitch value # # start * ?Semit is a fall # start / ?Semit is a rise # procedure toneRules # # Tone toneRules.levels 1-5 # Defined relative to the topline and the frequency range toneRules.levelFive = toneScript.topLine toneRules.levelOne = toneScript.topLine * toneScript.frequency_Range toneRules.levelThree = toneScript.topLine * sqrt(toneScript.frequency_Range) toneRules.levelTwo = toneScript.topLine * sqrt(sqrt(toneScript.frequency_Range)) toneRules.levelFour = toneRules.levelOne / sqrt(sqrt(toneScript.frequency_Range)) # First tone if toneScript.toneSyllable = 1 # Just a straight line toneRules.startPoint = toneRules.levelFive toneScript.endPoint = toneRules.levelFive # Two first tones, make them a little different if toneScript.prevTone = 1 toneRules.startPoint = toneRules.startPoint * 0.999 toneScript.endPoint = toneScript.endPoint * 0.999 endif # Write toneScript.points Add point... 'toneScript.point' 'toneRules.startPoint' toneScript.point = toneScript.point + toneScript.voicedDuration Add point... 'toneScript.point' 'toneScript.endPoint' # Second tone elsif toneScript.toneSyllable = 2 # Start halfway of the range - 1 semitone toneRules.startPoint = toneRules.levelThree * toneScript.oneSemit # End 1 semitones above the first tone toneScript.endPoint = toneRules.levelFive / toneScript.oneSemit # Special case: 2 followed by 1, stop short of the top-line # ie, 5 semitones above the start if toneScript.nextTone = 1 toneScript.endPoint = toneRules.startPoint / toneScript.fiveSemit endif # Go lower if previous tone is 1 if toneScript.prevTone = 1 toneRules.startPoint = toneRules.startPoint * toneScript.oneSemit elsif toneScript.prevTone = 4 or toneScript.prevTone = 3 # Special case: 2 following 4 or 3 # Go 1 semitone up toneRules.startPoint = toneScript.lastFrequency / toneScript.oneSemit toneScript.endPoint = toneRules.levelFive elsif toneScript.prevTone = 2 # Two consecutive tone 2, start 1 semitone higher toneRules.startPoint = toneRules.startPoint / toneScript.oneSemit endif # Define a midtoneScript.point at 1/3 of the duration toneRules.midPoint = toneRules.startPoint # Write toneScript.points Add point... 'toneScript.point' 'toneRules.startPoint' # Next toneScript.point a 1/3th of duration toneScript.point = toneScript.point + (toneScript.voicedDuration)/3 Add point... 'toneScript.point' 'toneRules.midPoint' # Remaining duration toneScript.point = toneScript.point + (toneScript.voicedDuration)*2/3 Add point... 'toneScript.point' 'toneScript.endPoint' # Third tone elsif toneScript.toneSyllable = 3 # Halfway the range toneRules.startPoint = toneRules.levelThree toneRules.lowestPoint = toneRules.levelOne * toneScript.threeSemit # Protect pitch against "underflow" if toneRules.lowestPoint < toneScript.absoluteMinimum toneRules.lowestPoint = toneScript.absoluteMinimum endif # First syllable if toneScript.nextTone < 0 toneScript.endPoint = toneRules.startPoint # Anticipate rise in next tone elsif toneScript.nextTone = 1 or toneScript.nextTone = 4 toneRules.lowestPoint = toneRules.levelOne / toneScript.twoSemit toneScript.endPoint = toneRules.startPoint # Anticipate rise in next tone and stay low elsif toneScript.nextTone = 2 toneRules.lowestPoint = toneRules.levelOne / toneScript.twoSemit toneScript.endPoint = toneRules.lowestPoint # Last one was low, don't go so much lower elsif toneScript.prevTone = 4 toneRules.lowestPoint = toneRules.levelOne * toneScript.oneSemit # Anticipate rise in next tone and stay low elsif toneScript.nextTone = 0 toneRules.lowestPoint = toneRules.levelOne toneScript.endPoint = toneRules.lowestPoint / toneScript.sixSemit else toneScript.endPoint = toneRules.startPoint endif # Write toneScript.points Add point... 'toneScript.point' 'toneRules.startPoint' # Go 1/3 of the duration down toneScript.point = toneScript.point + (toneScript.voicedDuration)*2/6 Add point... 'toneScript.point' 'toneRules.lowestPoint' # Go half the duration low toneScript.point = toneScript.point + (toneScript.voicedDuration)*3/6 Add point... 'toneScript.point' 'toneRules.lowestPoint' # Return in 1/6th of the duration toneScript.point = toneScript.point + (toneScript.voicedDuration)*1/6 Add point... 'toneScript.point' 'toneScript.endPoint' # Fourth tone elsif toneScript.toneSyllable = 4 # Start higher than tone 1 (by 2 semitones) toneRules.startPoint = toneRules.levelFive / toneScript.twoSemit # Go down the full range toneScript.endPoint = toneRules.startPoint * toneScript.frequency_Range # SPECIAL: Fall in following neutral tone if toneScript.nextTone = 0 toneScript.endPoint = toneScript.endPoint / toneScript.threeSemit endif # Write toneScript.points Add point... 'toneScript.point' 'toneRules.startPoint' # A plateau for 1/3th toneScript.point = toneScript.point + toneScript.voicedDuration*1/3 Add point... 'toneScript.point' 'toneRules.startPoint' # Go down the rest toneScript.point = toneScript.point + toneScript.voicedDuration*2/3 Add point... 'toneScript.point' 'toneScript.endPoint' # Neutral tone elsif toneScript.toneSyllable = 0 if toneScript.lastFrequency > 0 toneRules.startPoint = toneScript.lastFrequency else toneRules.startPoint = toneRules.levelThree / toneScript.oneSemit endif if toneScript.prevTone = 1 toneRules.startPoint = toneScript.lastFrequency * toneScript.twoSemit elsif toneScript.prevTone = 2 toneRules.startPoint = toneScript.lastFrequency elsif toneScript.prevTone = 3 toneRules.startPoint = toneScript.lastFrequency / toneScript.oneSemit elsif toneScript.prevTone = 4 toneRules.startPoint = toneScript.lastFrequency * toneScript.oneSemit elsif toneScript.lastFrequency > 0 toneRules.startPoint = toneScript.lastFrequency * toneScript.oneSemit endif # Catch all errors if toneRules.startPoint <= 0 toneRules.startPoint = toneRules.levelThree / toneScript.oneSemit endif # Add spreading and some small or large de/inclination if toneScript.prevTone = 1 toneRules.midPoint = toneRules.startPoint * toneScript.frequency_Range / toneScript.oneSemit toneScript.endPoint = toneRules.midPoint * toneScript.oneSemit elsif toneScript.prevTone = 2 # toneRules.midPoint = toneRules.startPoint * toneScript.fiveSemit toneScript.endPoint = toneRules.midPoint * toneScript.twoSemit elsif toneScript.prevTone = 3 toneRules.midPoint = toneRules.startPoint / toneScript.twoSemit toneScript.endPoint = toneRules.midPoint elsif toneScript.prevTone = 4 toneRules.midPoint = toneRules.startPoint * toneScript.threeSemit toneScript.endPoint = toneRules.midPoint / toneScript.oneSemit else toneRules.midPoint = toneRules.startPoint * toneScript.oneSemit toneScript.endPoint = toneRules.midPoint endif # Add a very short break to force if toneScript.point = undefined toneScript.point = 0 endif Add point... 'toneScript.point' 0 toneScript.point = toneScript.point + 1/toneRules.startPoint Add point... 'toneScript.point' 0 toneScript.point = toneScript.point + toneScript.delta # Write toneScript.points first 2/3 then decaying 1/3 Add point... 'toneScript.point' 'toneRules.startPoint' toneScript.point = toneScript.point + (toneScript.voicedDuration - 1/toneRules.startPoint)*2/3 Add point... 'toneScript.point' 'toneRules.midPoint' toneScript.point = toneScript.point + (toneScript.voicedDuration - 1/toneRules.startPoint)*1/3 Add point... 'toneScript.point' 'toneScript.endPoint' # Dutch intonation else # Start halfway of the range toneRules.startPoint = toneRules.levelThree # Or continue from last Dutch "tone" if toneScript.prevTone = 6 toneRules.startPoint = toneScript.lastFrequency endif # Add declination toneScript.endPoint = toneRules.startPoint * toneScript.oneSemit # Write toneScript.points Add point... 'toneScript.point' 'toneRules.startPoint' toneScript.point = toneScript.point + toneScript.voicedDuration Add point... 'toneScript.point' 'toneScript.endPoint' endif endproc # Include the configuration page buttons and procedures # # SpeakGoodChinese 2.0 # # Praat script handling configuration page # # SpeakGoodChinese: Config.praat loads the code needed for the # settings and the Settings page of SpeakGoodChinese. # # Copyright (C) 2007-2010 R.J.J.H. van Son and 2010 the Netherlands Cancer Institute # The SpeakGoodChinese team are: # Guangqin Chen, Zhonyan Chen, Stefan de Koning, Eveline van Hagen, # Rob van Son, Dennis Vierkant, David Weenink # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # ############################################################### # # Button Drawing Routines # ############################################################### procedure DrawCredits .color$ .x .y .size .size *= 0.71 .lineheight = 2*.size call adjustFontSizeOnHeight 'defaultFont$' 24 '.lineheight' .currentFontSize = adjustFontSizeOnHeight.newFontSize demo Paint circle... {0.2,0.2,0.8} '.x' '.y' '.size' demo Colour... White demo Text special... '.x' centre '.y' half Times '.currentFontSize' 0 i demoShow() demo Colour... Black call set_font_size 'defaultFontSize' endproc procedure DrawDeleteList .color$ .x .y .size .y += 2*.size .leftX = .x - 10 .rightX = .x + 10 .botY = .y+1 .topY = .botY + 5 call set_font_size 12 demo Red .displayWordList$ = replace_regex$(wordlistName$, "[_]", " ", 0) # Adapt wide of text .maxWidth = (.rightX - .leftX) .currentFontSize = defaultFontSize call adjustFontSizeOnWidth 'defaultFont$' '.currentFontSize' '.maxWidth' '.displayWordList$' .currentFontSize = adjustFontSizeOnWidth.newFontSize if adjustFontSizeOnWidth.diff > 0 .rightX += adjustFontSizeOnWidth.diff/2 .leftX -= adjustFontSizeOnWidth.diff/2 endif call set_font_size '.currentFontSize' demo Paint rectangle... White '.leftX' '.rightX' '.botY' '.topY' demo Text... '.x' Centre '.botY' Bottom '.displayWordList$' demo Black demoShow() call set_font_size 'defaultFontSize' endproc procedure DrawLogging .color$ .x .y .size .size /= 2 .y += .size if .color$ = "Blue" .color$ = "{0.5,0.5,1}" else .color$ = "Blue" endif demo Paint circle... '.color$' '.x' '.y' '.size' endproc ############################################################### # # Obligatory button Drawing Routines # # These MUST be defined # ############################################################### procedure DrawReturn .color$ .x .y .size call DrawConfig '.color$' '.x' '.y' '.size' endproc # Set the correct button states after redrawing the window procedure setConfigMainPage # Handle logging buttons with forced button draw if fileReadable("'preferencesLogDir$'/logPerformance.txt") call Draw_button 'config$' +!Logging 'config.logPerformance' endif endproc ############################################################### # # Button Processing Routines # ############################################################### procedure processConfigShuffleLists .clickX .clickY .pressed$ .table$ = "Config" .label$ = "ShuffleLists" config.shuffleLists = not config.shuffleLists .displayButton = 2*config.shuffleLists call Draw_button '.table$' '.label$' '.displayButton' endproc procedure processConfigUseSoundExample .clickX .clickY .pressed$ .table$ = "Config" .label$ = "UseSoundExample" config.useSoundExample = not config.useSoundExample .displayButton = 2*config.useSoundExample call Draw_button '.table$' '.label$' '.displayButton' endproc procedure processConfigSynthesis .tts$ .clickX .clickY .pressed$ .table$ = "Config" .label$ = "Synthesis_'.tts$'" if speakCommandFile$ <> "" and fileReadable(speakCommandFile$) if config.synthesis$ = "" config.synthesis$ = .tts$ .displayButton = 2 else config.synthesis$ = "" .displayButton = 0 endif else config.synthesis$ = "_DISABLED_" .displayButton = -1 endif call Draw_button '.table$' '.label$' '.displayButton' endproc procedure processConfigStrict .clickX .clickY .pressed$ .table$ = "Config" .label$ = "Strict" config.strict = not config.strict if config.strict > 0 .displayButton = 2 else .displayButton = 0 endif call Draw_button '.table$' '.label$' '.displayButton' endproc procedure processConfigDisplayPinyin .clickX .clickY .pressed$ .table$ = "Config" .label$ = "DisplayPinyin" config.displayPinyin = not config.displayPinyin .displayButton = 2*config.displayPinyin call Draw_button '.table$' '.label$' '.displayButton' endproc procedure processConfigDisplayChar .clickX .clickY .pressed$ .table$ = "Config" .label$ = "DisplayChar" config.displayChar = not config.displayChar .displayButton = 2*config.displayChar call Draw_button 'table$' '.label$' '.displayButton' endproc procedure processConfigDisplayTrans .clickX .clickY .pressed$ .table$ = "Config" .label$ = "DisplayTrans" config.displayTrans = not config.displayTrans .displayButton = 2*config.displayTrans call Draw_button 'table$' '.label$' '.displayButton' endproc procedure processConfigDisplayNumbers .clickX .clickY .pressed$ .table$ = "Config" .label$ = "DisplayNumbers" config.displayNumbers = not config.displayNumbers .displayButton = 2*config.displayNumbers call Draw_button 'table$' '.label$' '.displayButton' endproc procedure processConfigLanguage .language$ .clickX .clickY .pressed$ .table$ = "Config" .label$ = "Language_'.language$'" call processLanguageCodes '.table$' '.label$' endproc procedure processConfigShowBackground .clickX .clickY .pressed$ .table$ = "Config" .label$ = "ShowBackground" config.showBackground = not config.showBackground .displayButton = 2*config.showBackground call Draw_button 'table$' '.label$' '.displayButton' endproc procedure processConfigInput .input$ .clickX .clickY .pressed$ .table$ = "Config" .label$ = "Input_'.input$'" call Draw_button '.table$' Input_'config.input$' 0 config.input$ = .input$ call Draw_button '.table$' Input_'config.input$' 2 endproc procedure processConfigRegister .register .clickX .clickY .pressed$ .table$ = "Config" .label$ = "Register_'.register'" call setRegisterFromLabel '.table$' '.label$' endproc procedure setRegisterFromLabel .table$ .label$ call Draw_button '.table$' Register_'config.register' 0 call Draw_button '.table$' '.label$' 2 # Someone might have to use more than 3 chars for the config.register code .numChars = length(.label$) - length("Register_") .registerText$ = right$(.label$, .numChars) config.register = '.registerText$' endproc procedure processConfigDeleteWordlist .clickX .clickY .pressed$ .table$ = "Config" .label$ = "DeleteWordlist" # Do not process undeletable word lists, only those stored in the # preferencesDirectory$ can be deleted if fileReadable("'sgc2wordlists$'/'wordlistName$'") or fileReadable("'sgc2wordlists$'/'wordlistName$'/wordlist.txt") or fileReadable("'sgc2wordlists$'/'wordlistName$'/wordlist.Table") call findLabel '.table$' !'.label$' if findLabel.row > 0 select Table '.table$' .alertText$ = Get value... 'findLabel.row' Text .confirmKey$ = Get value... 'findLabel.row' Key .popupText$ = Get value... 'findLabel.row' Helptext else exit Cannot find delete directive: '.table$' !'.label$' endif call write_text_popup 'defaultFont$' 14 '.popupText$' call Draw_button '.table$' '.label$' 2 alertText$ = .alertText$ call Draw_button '.table$' '.label$' 3 alertText$ = "" # Wait for confirmation demoWaitForInput() if demoInput(.confirmKey$) .deleteWordListDir$ = wordlistName$ call load_word_list "'localWordlistDir$'" 1 call removeWordlist '.deleteWordListDir$' call load_word_list "'localWordlistDir$'" 0 endif call Draw_button '.table$' '.label$' 0 call Draw_config_page endif endproc wordlistTag$ = "Wordlist name" procedure processConfigInstallWordlist .clickX .clickY .pressed$ .table$ = "Config" .label$ = "InstallWordlist" call Draw_button '.table$' '.label$' 1 if windows # Do not use the automatic sgc list option, ask for a wordlist NAME # Get help text call findLabel '.table$' '.label$' .row = findLabel.row select Table '.table$' .openDialogue$ = Get value... '.row' Helptext call convert_praat_to_latin1 '.openDialogue$' .openDialogue$ = convert_praat_to_latin1.text$ .wordlistButton$ = replace$(wordlistTag$, " ", "_", 0) .wordlistButton$ = replace_regex$(.wordlistButton$, "^.", "\l&", 0) beginPause(.openDialogue$) sentence (wordlistTag$, "") clicked = endPause ("Cancel", "Open", 2) .wordlist_Name$ = "" if clicked = 2 .wordlist_Name$ = '.wordlistButton$'$ endif call install_wordlists_by_name '.wordlist_Name$' else call sgc2wordlist 'homeDirectory$' call sgc2wordlist 'homeDirectory$'/Downloads call sgc2wordlist 'homeDirectory$'/Documents call sgc2wordlist 'homeDirectory$'/My Documents call sgc2wordlist 'homeDirectory$'/My Documents/Downloads call sgc2wordlist 'homeDirectory$'/Desktop call sgc2wordlist 'preferencesAppDir$' endif call load_word_list "'localWordlistDir$'" 0 call Draw_button '.table$' '.label$' 0 call Draw_config_page endproc procedure processConfigOpenWordlist .clickX .clickY .pressed$ .table$ = "Config" .label$ = "OpenWordlist" call Draw_button '.table$' '.label$' 1 # Get help text call findLabel '.table$' '.label$' .row = findLabel.row select Table '.table$' .openDialogue$ = Get value... '.row' Helptext call convert_praat_to_latin1 '.openDialogue$' .openDialogue$ = convert_praat_to_latin1.text$ .wordlist_Name$ = chooseReadFile$ (.openDialogue$) call install_wordlists_by_name '.wordlist_Name$' call load_word_list "'localWordlistDir$'" 0 call Draw_button '.table$' '.label$' 0 call Draw_config_page endproc procedure processConfigPerfSummary .clickX .clickY .pressed$ .table$ = "Config" .label$ = "PerfSummary" call Draw_button '.table$' '.label$' 1 call loadTable SummaryToneEvaluation call write_tabbed_table SummaryToneEvaluation Evaluation_'config.language$' demoWaitForInput() select Table SummaryToneEvaluation Remove call Draw_button '.table$' '.label$' 0 call Draw_config_page endproc procedure processConfigListPerf .clickX .clickY .pressed$ .table$ = "Config" .label$ = "ListPerf" call Draw_button '.table$' '.label$' 1 call write_tabbed_table 'initialiseSGC2.toneevaluation_table$' Evaluation_'config.language$' demoWaitForInput() call Draw_button '.table$' '.label$' 0 call Draw_config_page endproc procedure processConfigSavePerf .clickX .clickY .pressed$ .table$ = "Config" .label$ = "SavePerf" call Draw_button '.table$' '.label$' 1 # Get help text call findLabel '.table$' '.label$' .row = findLabel.row select Table '.table$' .openDialogue$ = Get value... '.row' Helptext call convert_praat_to_latin1 '.openDialogue$' .openDialogue$ = convert_praat_to_latin1.text$ .wordlist_Name$ = chooseWriteFile$ (.openDialogue$, "Performance.Table") if .wordlist_Name$ <> "" select Table 'initialiseSGC2.toneevaluation_table$' Write to table file... '.wordlist_Name$' endif call Draw_button '.table$' '.label$' 0 call Draw_config_page endproc procedure processConfigManual .clickX .clickY .pressed$ .table$ = "Config" .label$ = "Manual" call Draw_button '.table$' '.label$' 1 if fileReadable("ManPages/Demo_Application.man") Read from file... ManPages/Demo_Application.man else Go to manual page... Demo Application endif # Wait until the manual is put to the background demoWaitForInput() call Draw_button '.table$' '.label$' 0 demo Erase all call Draw_config_page endproc ############################################################### # # Obligatory button Processing Routines # # These MUST be defined # ############################################################### procedure processConfigReturn .clickX .clickY .pressed$ .table$ = "Config" .label$ = "Return" call Draw_button '.table$' '.label$' 1 call write_preferences "" endproc procedure processConfigRefresh .clickX .clickY .pressed$ .table$ = "Config" .label$ = "Refresh" call Draw_config_page endproc procedure processConfigCredits .clickX .clickY .pressed$ .table$ = "Config" .label$ = "Credits" call Draw_button '.table$' '.label$' 1 call write_text_table Credits_'config.language$' demoWaitForInput() call Draw_button '.table$' '.label$' 0 demo Erase all call Draw_config_page endproc procedure processConfigHelp .clickX .clickY .pressed$ .table$ = "Config" .label$ = "Help" call help_loop '.table$' Draw_config_page endproc ############################################################### # # Miscelaneous supporting code # ############################################################### procedure install_wordlists_by_name .wordlist_Name$ if .wordlist_Name$ <> "" if index(.wordlist_Name$, "wordlist.") .wordlist_Name$ = replace_regex$(.wordlist_Name$, "[/\\]wordlist\.([^/\\]+)$", "", 0) elsif index_regex(.wordlist_Name$, "(?i\.(wav|flac|iaf[fc]|mp3))") .wordlist_Name$ = replace_regex$(.wordlist_Name$, "[/\\][^/\\]+$", "", 0) endif if index_regex(.wordlist_Name$, "[/\\]") .sourceDir$ = left$(.wordlist_Name$, rindex_regex(.wordlist_Name$, "[/\\]") -1) .file$ = right$(.wordlist_Name$, length(.wordlist_Name$) - rindex_regex(.wordlist_Name$, "[/\\]")) call readWordlist "'.sourceDir$'" '.file$' else .start = 1 if index(.wordlist_Name$, ".") .start = 4 endif .extension1$ = ".sgc" .extension2$ = ".Table" .extension3$ = ".txt" .extension4$ = "" for .e from .start to 4 .currentExtension$ = .extension'.e'$ call readWordlist "'homeDirectory$'" '.wordlist_Name$''.currentExtension$' call readWordlist "'homeDirectory$'/Downloads" '.wordlist_Name$''.currentExtension$' call readWordlist "'homeDirectory$'/Documents" '.wordlist_Name$''.currentExtension$' call readWordlist "'homeDirectory$'/My Documents/Downloads" '.wordlist_Name$''.currentExtension$' call readWordlist "'homeDirectory$'/My Documents" '.wordlist_Name$''.currentExtension$' call readWordlist "'homeDirectory$'/Desktop" '.wordlist_Name$''.currentExtension$' call readWordlist "'preferencesAppDir$'" '.wordlist_Name$''.currentExtension$' endfor endif endif endproc # Word lists: It is a VERY good idea to make sure that word-lists # have unique names. procedure load_word_list .localdir$ .relnumber # Remove old word list if wordlist$ <> "" select Table 'wordlist$' Remove call wipeArea 'wipeWordlistArea$' wordlist$ = "" endif # Create Table that will recieve the wordlists and directories Create Table with column names... AllWordLists 0 Name Directory .currentWordlistRow = 0 # Start with the word lists in the distribution, unless the local directory exists! call CreateCreateWordlists select Table CreateWordlists .numLists = Get number of rows for .i to .numLists select Table CreateWordlists .currentName$ = Get value... '.i' Name if not (fileReadable("'.localdir$'/'.currentName$'") or fileReadable("'.localdir$'/'.currentName$'/wordlist.Table") or fileReadable("'.localdir$'/'.currentName$'/wordlist.txt")) .currentDirectory$ = "*call Create'.currentName$'" select Table AllWordLists Append row .currentWordlistRow = Get number of rows Set string value... '.currentWordlistRow' Name '.currentName$' .currentDirectory$ = "*call Create'.currentName$'" Set string value... '.currentWordlistRow' Directory '.currentDirectory$' endif endfor select Table CreateWordlists Remove # First the global word lists if fileReadable(globalwordlists$) or fileReadable("'globalwordlists$'/directory.txt") Create Strings as directory list... WordList 'globalwordlists$' .numLists = Get number of strings for .i to .numLists select Strings WordList .currentName$ = Get string... '.i' if .currentName$ <> "directory.txt" select Table AllWordLists Append row .currentWordlistRow = Get number of rows Set string value... '.currentWordlistRow' Name '.currentName$' .currentDirectory$ = globalwordlists$+"/"+.currentName$ Set string value... '.currentWordlistRow' Directory '.currentDirectory$' endif endfor select Strings WordList Remove endif # Now the preferences word lists if fileReadable(sgc2wordlists$) or fileReadable("'sgc2wordlists$'/directory.txt") Create Strings as directory list... WordList 'sgc2wordlists$' .numLists = Get number of strings for .i to .numLists select Strings WordList .currentName$ = Get string... '.i' if .currentName$ <> "directory.txt" select Table AllWordLists Append row .currentWordlistRow = Get number of rows Set string value... '.currentWordlistRow' Name '.currentName$' .currentDirectory$ = sgc2wordlists$+"/"+.currentName$ Set string value... '.currentWordlistRow' Directory '.currentDirectory$' endif endfor select Strings WordList Remove endif # Finally, the local word lists if fileReadable(.localdir$) or fileReadable("'.localdir$'/directory.txt") Create Strings as directory list... WordList '.localdir$' .numLists = Get number of strings for .i to .numLists select Strings WordList .currentName$ = Get string... '.i' if .currentName$ <> "directory.txt" select Table AllWordLists Append row .currentWordlistRow = Get number of rows Set string value... '.currentWordlistRow' Name '.currentName$' .currentDirectory$ = .localdir$+"/"+.currentName$ Set string value... '.currentWordlistRow' Directory '.currentDirectory$' endif endfor select Strings WordList Remove endif # Get the position of the current word list select Table AllWordLists .currentNumber = 1 .numLists = Get number of rows if wordlistName$ <> "" select Table AllWordLists .currentNumber = Search column... Name 'wordlistName$' endif wordlistNum = .currentNumber + .relnumber if wordlistNum > .numLists wordlistNum = 1 elsif wordlistNum < 1 and .numLists > 0 wordlistNum = .numLists endif select Table AllWordLists wordlistName$ = Get value... 'wordlistNum' Name .dirWordlistName$ = Get value... 'wordlistNum' Directory .dirString$ = replace_regex$(.dirWordlistName$, "[ ]", "&", 0) # Read in full tables if fileReadable("'.dirString$'/wordlist.Table") Read from file... '.dirString$'/wordlist.Table Rename... 'wordlistName$' # Praat wil change the name if it feels like it wordlist$ = selected$("Table") # Handle (legacy) simple word lists elsif fileReadable("'.dirString$'/wordlist.txt") Create Table with column names... "'wordlistName$'" 0 Pinyin Sound wordlist$ = selected$("Table") Read Strings from raw text file... '.dirString$'/wordlist.txt Rename... RawWordList .numWordStrings = Get number of strings for .i to .numWordStrings select Strings RawWordList .currentLine$ = Get string... '.i' .currentPinyin$ = extractWord$(.currentLine$, "") if length(.currentLine$) > length(.currentPinyin$)+1 .currentFile$ = right$(.currentLine$, length(.currentPinyin$)+1) elsif fileReadable("'.dirString$'/'.currentPinyin$'.spx") .currentFile$ = .currentPinyin$+".spx" elsif fileReadable("'.dirString$'/'.currentPinyin$'.flac") .currentFile$ = .currentPinyin$+".flac" elsif fileReadable("'.dirString$'/'.currentPinyin$'.wav") .currentFile$ = .currentPinyin$+".wav" elsif fileReadable("'.dirString$'/'.currentPinyin$'.mp3") .currentFile$ = .currentPinyin$+".mp3" else .currentFile$ = "-" endif select Table 'wordlist$' Append row Set string value... '.i' Pinyin '.currentPinyin$' Set string value... '.i' Sound '.currentFile$' endfor select Strings RawWordList Remove select Table 'wordlist$' elsif fileReadable(.dirString$) or fileReadable("'.dirString$'/directory.txt") Create Table with column names... "'wordlistName$'" 0 Pinyin Sound wordlist$ = selected$("Table") Create Strings as file list... RawWordList '.dirString$'/* .numWordStrings = Get number of strings .i = 0 for .j to .numWordStrings select Strings RawWordList .currentLine$ = Get string... '.j' .currentFile$ = extractWord$(.currentLine$, "") if index_regex(.currentFile$, "\.(spx|flac|wav|mp3)") .currentPinyin$ = left$(.currentFile$, index(.currentFile$, ".")-1) select Table 'wordlist$' Append row .i += 1 Set string value... '.i' Pinyin '.currentPinyin$' Set string value... '.i' Sound '.currentFile$' endif endfor select Strings RawWordList Remove select Table 'wordlist$' elsif startsWith(.dirString$, "*call ") .callProcedure$ = right$(.dirString$, length(.dirString$)-1) '.callProcedure$' wordlist$ = selected$("Table") endif # Can this wordlist be deleted? if fileReadable("'sgc2wordlists$'/'wordlistName$'") or fileReadable("'sgc2wordlists$'/'wordlistName$'/wordlist.txt") or fileReadable("'sgc2wordlists$'/'wordlistName$'/wordlist.Table") config.deleteWordlist = 0 else config.deleteWordlist = -1 endif # Add a Character and Translation column if missing if wordlist$ <> "" select Table 'wordlist$' numberOfWords = Get number of rows .characterColumn = Get column index... Character if not .characterColumn Append column... Character for .i to numberOfWords Set string value... '.i' Character - endfor endif .translationColumn = Get column index... Translation if not .translationColumn Append column... Translation for .i to numberOfWords Set string value... '.i' Translation - endfor endif endif # Remove all rows without Pinyin .numRows = Get number of rows for i to .numRows .rowNum = .numRows - i + 1 .pinyinValue$ = Get value... '.rowNum' Pinyin if not index_regex(.pinyinValue$, "[a-zA-Z0-9]") Remove row... '.rowNum' endif endfor numberOfWords = Get number of rows # Shuffle words if requested if config.shuffleLists Randomize rows endif # Clean up select Table AllWordLists Remove # There were no Word Lists label NOWORDLISTS if .numLists <= 0 wordlistName$ = "No Word Lists available" wordlistNum = 1 Create Table with column names... "'wordlistName$'" 0 Pinyin Character Translation Sound wordlist$ = selected$("Table") .i = 0 Append row .i += 1 Set string value... '.i' Pinyin ni3hao3 Set string value... '.i' Character - Set string value... '.i' Translation - Set string value... '.i' Sound - Append row .i += 1 Set string value... '.i' Pinyin xie4xie0 Set string value... '.i' Character - Set string value... '.i' Translation - Set string value... '.i' Sound - Append row .i += 1 Set string value... '.i' Pinyin zai4jian4 Set string value... '.i' Character - Set string value... '.i' Translation - Set string value... '.i' Sound - numberOfWords = Get number of rows endif call set_window_title 'buttons$' 'wordlistName$' endproc procedure display_word_list_name .xtext = 50 .ytext = 12 call reset_viewport .displayWordList$ = replace_regex$(wordlistName$, "[_]", " ", 0) call wipeArea 'wipeWordlistArea$' call adjustFontSizeOnHeight 'defaultFont$' 'defaultFontSize' 5 .currentFontSize = adjustFontSizeOnHeight.newFontSize demo Blue demo Text special... '.xtext' Centre '.ytext' Bottom Helvetica '.currentFontSize' 0 '.displayWordList$' demo Black demoShow() call set_font_size 'defaultFontSize' endproc procedure write_word_list # Draw the contour call draw_tone_contour # Write current Pinyin text call display_text Black # Write the current word list name call display_word_list_name endproc procedure start_logging if fileReadable("'preferencesLogDir$'/logPerformance.txt") .logDirectory$ < 'preferencesLogDir$'/logPerformance.txt .logDirectory$ = extractWord$(.logDirectory$, "") if .logDirectory$ = "" or not (fileReadable(.logDirectory$) or fileReadable("'.logDirectory$'/directory.txt") .logDirectory$ = "'preferencesLogDir$'" endif currentLogDirectory$ = "'.logDirectory$'/log'logtimeStamp$'" createDirectory(currentLogDirectory$) if not fileReadable("'currentLogDirectory$'/wordlist.Table") .headerLine$ = "Pinyin'tab$'Character'tab$'Sound'newline$'" .headerLine$ > 'currentLogDirectory$'/wordlist.Table endif # Flip switch config.logPerformance = 1 endif endproc procedure log_command .logtext$ if logging fileappend "'currentLogDirectory$'/logFile.txt" '.logtext$''newline$' endif endproc procedure log_performance .recordedSound$ .register .proficiency .pinyin$ .choice$ # Log files .currentDate$ = date$() .timeStamp$ = replace_regex$(.currentDate$, "[^a-zA-Z0-9\-_]", "-", 0) .choiceText$ = replace_regex$(.choice$, "[^a-zA-Z0-9\-_]", "-", 0) if config.logPerformance and fileReadable("'preferencesLogDir$'/logPerformance.txt") .outfilename$ = .pinyin$+"_"+.choice$+"_'.register'_"+.timeStamp$+".wav" .logtext$ = "# #+.pinyin$+tab$+.choice$+tab$+"'.register'Hz"+tab$+.currentDate$+tab$+.outfilename$+newline$ # Plain log text fileappend 'currentLogDirectory$'/logFile.txt '.logtext$' # A wordlist.Table fileappend 'currentLogDirectory$'/wordlist.Table '.pinyin$''tab$''.choice$''tab$''.outfilename$''newline$' # The recorded sound select Sound 'recordedSound$' Write to WAV file... 'currentLogDirectory$'/'.outfilename$' endif endproc procedure paint_logging_light select Table Config .row = Search column... Label !Logging if .row < 1 exit Button Table Config does not have a row with label !Logging endif # Get button values .leftX = Get value... '.row' LeftX .rightX = Get value... '.row' RightX .lowY = Get value... '.row' LowY .highY = Get value... '.row' HighY .buttonColor$ = Get value... '.row' Color .centerX = (.leftX + .rightX)/2 .centerY = (.lowY + .highY)/2 .radius = (.highY - .lowY )/(4*2) .wipeRadius = 1.1*.radius if config.logPerformance and fileReadable("'preferencesLogDir$'/logPerformance.txt") demo Paint circle... White '.centerX' '.centerY' '.wipeRadius' demo Paint circle... '.buttonColor$' '.centerX' '.centerY' '.radius' demoShow() else demo Paint circle... White '.centerX' '.centerY' '.wipeRadius' demoShow() endif endproc # Uninstall word lists procedure removeWordlist .deletedWordlistName$ .targetDir$ = "" if fileReadable("'sgc2wordlists$'/'.deletedWordlistName$'") or fileReadable("'sgc2wordlists$'/'.deletedWordlistName$'/wordlist.txt") or fileReadable("'sgc2wordlists$'/'.deletedWordlistName$'/wordlist.Table") .targetDir$ = "'sgc2wordlists$'/'.deletedWordlistName$'" endif if .targetDir$ <> "" Create Strings as file list... DeleteList '.targetDir$'/* .numdeleteFiles = Get number of strings for .i to .numdeleteFiles .file$ = Get string... '.i' deleteFile("'.targetDir$'/'.file$'") endfor filedelete '.targetDir$' if windows system rmdir "'.targetDir$'" /s /q endif # Remove deleted word list select Strings DeleteList plus Table 'wordlist$' Remove wordlist$ = "" endif endproc # Install word lists procedure sgc2wordlist .sourceDir$ if startsWith(.sourceDir$, "preferencesDirectory$") .sourceDir$ = replace$(.sourceDir$, "preferencesDirectory$", preferencesDirectory$) endif .targetDirectory$ = "'sgc2wordlists$'" if fileReadable(.sourceDir$) or fileReadable("'.sourceDir$'/directory.txt") Create Strings as file list... PackageList '.sourceDir$'/*.sgc .numFiles = Get number of strings for .i to .numFiles select Strings PackageList .file$ = Get string... '.i' call readWordlist '.sourceDir$' '.file$' endfor select Strings PackageList Remove endif endproc # Debuggin remarks!!! # fileReadable() does not work in Windows # The file paths / -> \\ must be performed on the filenames in Windows before the system_nocheck is given # And yet only the 7z decompression has been implemented windowsUnzipCommand$ = """C:\Program Files\7-Zip\7z"" x" procedure readWordlist .sourceDir$ .file$ # No use doing anything if the source does not exist if fileReadable("'.sourceDir$'/'.file$'") or fileReadable("'.sourceDir$'/'.file$'/wordlist.txt") or fileReadable("'.sourceDir$'/'.file$'/wordlist.Table") # What will be the target wordlist directory? .targetDirectory$ = "'sgc2wordlists$'" .dirname$ = left$(.file$, rindex(.file$, ".")-1) if .dirname$ = "" .dirname$ = .file$ endif .wordlistDirectory$ = .targetDirectory$+"/"+.dirname$ # Wordlist directory does not exist, neither locally nor in the preferences if not (fileReadable(.dirname$) or fileReadable("'.dirname$'/directory.txt") or fileReadable(.wordlistDirectory$) or fileReadable("'.wordlistDirectory$'/directory.txt")) .wasWordList = 0 # Move source to destination if index(.file$, ".sgc") or index(.file$, ".zip") # Create wordlist directory createDirectory(.wordlistDirectory$) .wasWordList = 1 if macintosh or unix system bash -rc -- 'cp "'.sourceDir$'/'.file$'" "'.wordlistDirectory$'/"' system cd ''.wordlistDirectory$'';bash -rc -- 'unzip "'.file$'"' elsif windows .winWordListDirectory$ = replace_regex$(.wordlistDirectory$, "/", "\\", 0) .winSourceDirectory$ = replace_regex$("'.sourceDir$'\'.file$'", "/", "\\", 0) system copy "'.winSourceDirectory$'" "'.winWordListDirectory$'" /q system chdir "'.winWordListDirectory$'" && 'windowsUnzipCommand$' "'.file$'" endif deleteFile("'.wordlistDirectory$'/'.file$'") elsif index_regex(.file$, "\.(Table|txt)") # Create wordlist directory createDirectory(.wordlistDirectory$) .wasWordList = 1 .extension$ = replace_regex$(.file$, "^.+\.(Table|txt)$", "\1", 0) if macintosh or unix system bash -rc -- 'cp "'.sourceDir$'/'.file$'" "'.wordlistDirectory$'/wordlist.'.extension$'"' elsif windows .winWordListDirectory$ = replace_regex$(.wordlistDirectory$, "/", "\\", 0) .winSourceDirectory$ = replace_regex$("'.sourceDir$'\'.file$'", "/", "\\", 0) system copy "'.winSourceDirectory$'" "'.winWordListDirectory$'\wordlist.'.extension$'" /q endif elsif fileReadable("'.sourceDir$'/'.file$'/wordlist.Table") or fileReadable("'.sourceDir$'/'.file$'/wordlist.txt") or fileReadable("'.sourceDir$'/'.file$'/LICENSE.txt") # Copy wordlist directory .wasWordList = 1 if macintosh or unix system bash -rc -- 'cp -r "'.sourceDir$'/'.file$'" "'.wordlistDirectory$'"' elsif windows createDirectory(.wordlistDirectory$) .winWordListDirectory$ = replace_regex$(.wordlistDirectory$, "/", "\\", 0) .winSourceDirectory$ = replace_regex$("'.sourceDir$'\'.file$'", "/", "\\", 0) system xcopy "'.winSourceDirectory$'" "'.winWordListDirectory$'" /s /e /q endif endif # Set current word list to read list if .wasWordList wordlistName$ = .dirname$ else .table$ = "Config" .label$ = "!NotAWordlist" # Get help text call findLabel '.table$' '.label$' .row = findLabel.row select Table '.table$' .helpText$ = Get value... '.row' Helptext .filetext$ = replace_regex$("'.sourceDir$'/'.file$'", "_", "\\_ ", 0) call write_text_popup 'defaultFont$' 14 '.helpText$' "'.filetext$'" # Wait for confirmation demoWaitForInput() endif endif endif endproc # Load tables in script format # CreateTables.praat # # Automatically created code! # Any changes will be lost when this file is regenerated. # Adapt the original Tables instead of this code. # To regenerate the original Tables, run a Praat script # with the following code: # #: include tables2scripts.praat #: call Create #: Write to table file... .Table # # Where is the name of the table. # Move the Table file to the desired location (eg, Data/) # # Tables and this code are licensed under the GNU GPL version 2 # or later. # procedure CreateBackground Create Table with column names... Background 6 ... font size align colour text # Fill table values # Row 1 Set string value... 1 font Helvetica Set string value... 1 size 56 Set string value... 1 align centre Set string value... 1 colour {1,1,1} Set string value... 1 text # Row 2 Set string value... 2 font Helvetica Set string value... 2 size 56 Set string value... 2 align centre Set string value... 2 colour {1,1,1} Set string value... 2 text # Row 3 Set string value... 3 font Helvetica Set string value... 3 size 56 Set string value... 3 align centre Set string value... 3 colour {1,1,1} Set string value... 3 text # Row 4 Set string value... 4 font Helvetica Set string value... 4 size 56 Set string value... 4 align centre Set string value... 4 colour {0.94,0.90,0.72} Set string value... 4 text SPEAK GOOD CHINESE 2.0 # Row 5 Set string value... 5 font Helvetica Set string value... 5 size 56 Set string value... 5 align centre Set string value... 5 colour {0.94,0.90,0.72} Set string value... 5 text shuō​ hǎo​ Zhōng​wén​ # Row 6 Set string value... 6 font Helvetica Set string value... 6 size 56 Set string value... 6 align centre Set string value... 6 colour {0.94,0.90,0.72} Set string value... 6 text 说好中文 endproc procedure CreateConfig Create Table with column names... Config 43 ... Label LeftX RightX LowY HighY Color Draw # Fill table values # Row 1 Set string value... 1 Label !Author Set string value... 1 LeftX 0 Set string value... 1 RightX 0 Set string value... 1 LowY 0 Set string value... 1 HighY 0 Set string value... 1 Color Black Set string value... 1 Draw DrawNull # Row 2 Set string value... 2 Label !Copyright Set string value... 2 LeftX 0 Set string value... 2 RightX 0 Set string value... 2 LowY 0 Set string value... 2 HighY 0 Set string value... 2 Color Black Set string value... 2 Draw DrawNull # Row 3 Set string value... 3 Label !License Set string value... 3 LeftX 0 Set string value... 3 RightX 0 Set string value... 3 LowY 0 Set string value... 3 HighY 0 Set string value... 3 Color Black Set string value... 3 Draw DrawNull # Row 4 Set string value... 4 Label !WindowTitle Set string value... 4 LeftX 0 Set string value... 4 RightX 0 Set string value... 4 LowY 0 Set string value... 4 HighY 0 Set string value... 4 Color Black Set string value... 4 Draw DrawNull # Row 5 Set string value... 5 Label !WindowTitle Set string value... 5 LeftX 0 Set string value... 5 RightX 0 Set string value... 5 LowY 0 Set string value... 5 HighY 0 Set string value... 5 Color Black Set string value... 5 Draw DrawNull # Row 6 Set string value... 6 Label Help Set string value... 6 LeftX 90 Set string value... 6 RightX 100 Set string value... 6 LowY 90 Set string value... 6 HighY 100 Set string value... 6 Color Black Set string value... 6 Draw DrawHelp # Row 7 Set string value... 7 Label Return Set string value... 7 LeftX 90 Set string value... 7 RightX 100 Set string value... 7 LowY 77.5 Set string value... 7 HighY 87.5 Set string value... 7 Color Black Set string value... 7 Draw DrawReturn # Row 8 Set string value... 8 Label $Language Set string value... 8 LeftX 0 Set string value... 8 RightX 15 Set string value... 8 LowY 95 Set string value... 8 HighY 100 Set string value... 8 Color Black Set string value... 8 Draw DrawNull # Row 9 Set string value... 9 Label Language_EN Set string value... 9 LeftX 0 Set string value... 9 RightX 15 Set string value... 9 LowY 90 Set string value... 9 HighY 95 Set string value... 9 Color Black Set string value... 9 Draw DrawNull # Row 10 Set string value... 10 Label Language_DE Set string value... 10 LeftX 0 Set string value... 10 RightX 15 Set string value... 10 LowY 84 Set string value... 10 HighY 89 Set string value... 10 Color Black Set string value... 10 Draw DrawNull # Row 11 Set string value... 11 Label Language_NL Set string value... 11 LeftX 0 Set string value... 11 RightX 15 Set string value... 11 LowY 79 Set string value... 11 HighY 83 Set string value... 11 Color Black Set string value... 11 Draw DrawNull # Row 12 Set string value... 12 Label $Register Set string value... 12 LeftX 20 Set string value... 12 RightX 35 Set string value... 12 LowY 95 Set string value... 12 HighY 100 Set string value... 12 Color Black Set string value... 12 Draw DrawNull # Row 13 Set string value... 13 Label Register_350 Set string value... 13 LeftX 20 Set string value... 13 RightX 35 Set string value... 13 LowY 90 Set string value... 13 HighY 95 Set string value... 13 Color Black Set string value... 13 Draw DrawNull # Row 14 Set string value... 14 Label Register_300 Set string value... 14 LeftX 20 Set string value... 14 RightX 35 Set string value... 14 LowY 84 Set string value... 14 HighY 89 Set string value... 14 Color Black Set string value... 14 Draw DrawNull # Row 15 Set string value... 15 Label Register_250 Set string value... 15 LeftX 20 Set string value... 15 RightX 35 Set string value... 15 LowY 78 Set string value... 15 HighY 83 Set string value... 15 Color Black Set string value... 15 Draw DrawNull # Row 16 Set string value... 16 Label Register_249 Set string value... 16 LeftX 20 Set string value... 16 RightX 35 Set string value... 16 LowY 72 Set string value... 16 HighY 77 Set string value... 16 Color Black Set string value... 16 Draw DrawNull # Row 17 Set string value... 17 Label Register_180 Set string value... 17 LeftX 20 Set string value... 17 RightX 35 Set string value... 17 LowY 66 Set string value... 17 HighY 71 Set string value... 17 Color Black Set string value... 17 Draw DrawNull # Row 18 Set string value... 18 Label Register_150 Set string value... 18 LeftX 20 Set string value... 18 RightX 35 Set string value... 18 LowY 60 Set string value... 18 HighY 65 Set string value... 18 Color Black Set string value... 18 Draw DrawNull # Row 19 Set string value... 19 Label Register_125 Set string value... 19 LeftX 20 Set string value... 19 RightX 35 Set string value... 19 LowY 54 Set string value... 19 HighY 59 Set string value... 19 Color Black Set string value... 19 Draw DrawNull # Row 20 Set string value... 20 Label $Recognition Set string value... 20 LeftX 18 Set string value... 20 RightX 37 Set string value... 20 LowY 49 Set string value... 20 HighY 54 Set string value... 20 Color Black Set string value... 20 Draw DrawNull # Row 21 Set string value... 21 Label Strict Set string value... 21 LeftX 20 Set string value... 21 RightX 35 Set string value... 21 LowY 44 Set string value... 21 HighY 49 Set string value... 21 Color Black Set string value... 21 Draw DrawNull # Row 22 Set string value... 22 Label $Display Set string value... 22 LeftX 40 Set string value... 22 RightX 55 Set string value... 22 LowY 95 Set string value... 22 HighY 100 Set string value... 22 Color Black Set string value... 22 Draw DrawNull # Row 23 Set string value... 23 Label DisplayNumbers Set string value... 23 LeftX 40 Set string value... 23 RightX 55 Set string value... 23 LowY 90 Set string value... 23 HighY 95 Set string value... 23 Color Black Set string value... 23 Draw DrawNull # Row 24 Set string value... 24 Label DisplayPinyin Set string value... 24 LeftX 40 Set string value... 24 RightX 55 Set string value... 24 LowY 84 Set string value... 24 HighY 89 Set string value... 24 Color Black Set string value... 24 Draw DrawNull # Row 25 Set string value... 25 Label DisplayChar Set string value... 25 LeftX 40 Set string value... 25 RightX 55 Set string value... 25 LowY 78 Set string value... 25 HighY 83 Set string value... 25 Color Black Set string value... 25 Draw DrawNull # Row 26 Set string value... 26 Label DisplayTrans Set string value... 26 LeftX 40 Set string value... 26 RightX 55 Set string value... 26 LowY 72 Set string value... 26 HighY 77 Set string value... 26 Color Black Set string value... 26 Draw DrawNull # Row 27 Set string value... 27 Label UseSoundExample Set string value... 27 LeftX 40 Set string value... 27 RightX 55 Set string value... 27 LowY 66 Set string value... 27 HighY 71 Set string value... 27 Color Black Set string value... 27 Draw DrawNull # Row 28 Set string value... 28 Label Synthesis_eSpeak Set string value... 28 LeftX 40 Set string value... 28 RightX 55 Set string value... 28 LowY 61 Set string value... 28 HighY 65 Set string value... 28 Color Black Set string value... 28 Draw DrawNull # Row 29 Set string value... 29 Label ShuffleLists Set string value... 29 LeftX 40 Set string value... 29 RightX 55 Set string value... 29 LowY 55 Set string value... 29 HighY 60 Set string value... 29 Color Black Set string value... 29 Draw DrawNull # Row 30 Set string value... 30 Label OpenWordlist Set string value... 30 LeftX 0 Set string value... 30 RightX 15 Set string value... 30 LowY 0 Set string value... 30 HighY 5 Set string value... 30 Color Black Set string value... 30 Draw DrawNull # Row 31 Set string value... 31 Label InstallWordlist Set string value... 31 LeftX 20 Set string value... 31 RightX 35 Set string value... 31 LowY 0 Set string value... 31 HighY 5 Set string value... 31 Color Black Set string value... 31 Draw DrawNull # Row 32 Set string value... 32 Label DeleteWordlist Set string value... 32 LeftX 40 Set string value... 32 RightX 55 Set string value... 32 LowY 0 Set string value... 32 HighY 5 Set string value... 32 Color Black Set string value... 32 Draw DrawDeleteList # Row 33 Set string value... 33 Label !DeleteWordlist Set string value... 33 LeftX -1 Set string value... 33 RightX -1 Set string value... 33 LowY -1 Set string value... 33 HighY -1 Set string value... 33 Color Red Set string value... 33 Draw DrawNull # Row 34 Set string value... 34 Label $Recording Set string value... 34 LeftX 60 Set string value... 34 RightX 75 Set string value... 34 LowY 95 Set string value... 34 HighY 100 Set string value... 34 Color Black Set string value... 34 Draw DrawNull # Row 35 Set string value... 35 Label Input_Microphone Set string value... 35 LeftX 60 Set string value... 35 RightX 75 Set string value... 35 LowY 90 Set string value... 35 HighY 95 Set string value... 35 Color Black Set string value... 35 Draw DrawNull # Row 36 Set string value... 36 Label Input_Line Set string value... 36 LeftX 60 Set string value... 36 RightX 75 Set string value... 36 LowY 84 Set string value... 36 HighY 89 Set string value... 36 Color Black Set string value... 36 Draw DrawNull # Row 37 Set string value... 37 Label Credits Set string value... 37 LeftX 90 Set string value... 37 RightX 100 Set string value... 37 LowY 65 Set string value... 37 HighY 75 Set string value... 37 Color Black Set string value... 37 Draw DrawCredits # Row 38 Set string value... 38 Label !Logging Set string value... 38 LeftX 90 Set string value... 38 RightX 100 Set string value... 38 LowY 0 Set string value... 38 HighY 5 Set string value... 38 Color Blue Set string value... 38 Draw DrawLogging # Row 39 Set string value... 39 Label !NotAWordlist Set string value... 39 LeftX -1 Set string value... 39 RightX -1 Set string value... 39 LowY -1 Set string value... 39 HighY -1 Set string value... 39 Color Red Set string value... 39 Draw DrawNull # Row 40 Set string value... 40 Label $Statistics Set string value... 40 LeftX 60 Set string value... 40 RightX 75 Set string value... 40 LowY 71 Set string value... 40 HighY 76 Set string value... 40 Color Black Set string value... 40 Draw DrawNull # Row 41 Set string value... 41 Label PerfSummary Set string value... 41 LeftX 60 Set string value... 41 RightX 75 Set string value... 41 LowY 66 Set string value... 41 HighY 71 Set string value... 41 Color Black Set string value... 41 Draw DrawNull # Row 42 Set string value... 42 Label ListPerf Set string value... 42 LeftX 60 Set string value... 42 RightX 75 Set string value... 42 LowY 60 Set string value... 42 HighY 65 Set string value... 42 Color Black Set string value... 42 Draw DrawNull # Row 43 Set string value... 43 Label SavePerf Set string value... 43 LeftX 60 Set string value... 43 RightX 75 Set string value... 43 LowY 54 Set string value... 43 HighY 59 Set string value... 43 Color Black Set string value... 43 Draw DrawNull endproc procedure CreateConfig_DE Create Table with column names... Config_DE 43 ... Label Text Key Helptext # Fill table values # Row 1 Set string value... 1 Label !Author Set string value... 1 Text Autor Set string value... 1 Key Set string value... 1 Helptext R.J.J.H. van Son, \U"bersetzung: Irene Jacobi # Row 2 Set string value... 2 Label !Copyright Set string value... 2 Text Copyright Set string value... 2 Key Set string value... 2 Helptext Copyright 2010 R.J.J.H. van Son \& the NKI # Row 3 Set string value... 3 Label !License Set string value... 3 Text License Set string value... 3 Key Set string value... 3 Helptext GNU GPL version 2 or later # Row 4 Set string value... 4 Label !WindowTitle Set string value... 4 Text SpeakGoodChinese: Einstellungen \a"ndern Set string value... 4 Key Set string value... 4 Helptext SpeakGoodChinese: Einstellungen \a"ndern # Row 5 Set string value... 5 Label Return Set string value... 5 Text Zur\u"ck Set string value... 5 Key Z Set string value... 5 Helptext Zur\u"ck zur Hauptseite # Row 6 Set string value... 6 Label $Language Set string value... 6 Text Sprache Set string value... 6 Key Set string value... 6 Helptext W\a"hle die gew\u"nschte Sprache # Row 7 Set string value... 7 Label Language_EN Set string value... 7 Text Englisch Set string value... 7 Key E Set string value... 7 Helptext Englische Version # Row 8 Set string value... 8 Label Language_DE Set string value... 8 Text Deutsch Set string value... 8 Key D Set string value... 8 Helptext Deutsche Version # Row 9 Set string value... 9 Label Language_NL Set string value... 9 Text Niederl\a"ndisch Set string value... 9 Key N Set string value... 9 Helptext Niederl\a"ndische Version # Row 10 Set string value... 10 Label ShowBackground Set string value... 10 Text Hintergrund Set string value... 10 Key g Set string value... 10 Helptext Zeige Hintergrund # Row 11 Set string value... 11 Label $Recording Set string value... 11 Text Aufnahme Set string value... 11 Key Set string value... 11 Helptext Einstellungen f\u"r die Aufnahmen # Row 12 Set string value... 12 Label Input_Microphone Set string value... 12 Text Mikrofon Set string value... 12 Key M Set string value... 12 Helptext Aufnahme \u"ber den Mikrofoneingang # Row 13 Set string value... 13 Label Input_Line Set string value... 13 Text Line input | Set string value... 13 Key |\+ Set string value... 13 Helptext Aufnahme \u"ber "Line input" # Row 14 Set string value... 14 Label Credits Set string value... 14 Text \u"ber SGC2 Set string value... 14 Key 2i Set string value... 14 Helptext Informationen zur SpeakGoodChinese 2 # Row 15 Set string value... 15 Label Help Set string value... 15 Text Hilfe Set string value... 15 Key ?/ Set string value... 15 Helptext Dr\u"cken Sie auf den Knopf \u"ber den Sie Informationen m\o"chten. Dr\u"cken Sie danach auf "Hilfe". # Row 16 Set string value... 16 Label $Register Set string value... 16 Text Ihre Stimme Set string value... 16 Key Set string value... 16 Helptext W\a"hle die Category die past bei Ihrer Stimme # Row 17 Set string value... 17 Label Register_350 Set string value... 17 Text Frau hoch Set string value... 17 Key F Set string value... 17 Helptext W\a"hle diesen Knopf wenn Sie eine Frau mit eine hohe Stimme sind # Row 18 Set string value... 18 Label Register_300 Set string value... 18 Text Frau mittel Set string value... 18 Key r Set string value... 18 Helptext W\a"hle diesen Knopf wenn Sie eine Frau mit eine mittel-hohe Stimme sind # Row 19 Set string value... 19 Label Register_250 Set string value... 19 Text Frau tief Set string value... 19 Key u Set string value... 19 Helptext W\a"hle diesen Knopf wenn Sie eine Frau mit eine tiefe Stimme sind # Row 20 Set string value... 20 Label Register_249 Set string value... 20 Text Man hoch Set string value... 20 Key h Set string value... 20 Helptext W\a"hle diesen Knopf wenn Sie ein Mann mit eine hohe Stimme sind # Row 21 Set string value... 21 Label Register_180 Set string value... 21 Text Man mittel Set string value... 21 Key a Set string value... 21 Helptext W\a"hle diesen Knopf wenn Sie ein Mann mit eine mittle-hohe Stimme sind # Row 22 Set string value... 22 Label Register_150 Set string value... 22 Text Man tief Set string value... 22 Key t Set string value... 22 Helptext W\a"hle diesen Knopf wenn Sie ein Mann mit eine tiefe Stimme sind # Row 23 Set string value... 23 Label Register_125 Set string value... 23 Text Man Xtr tief Set string value... 23 Key Set string value... 23 Helptext W\a"hle diesen Knopf wenn Sie ein Mann mit eine sehr tiefe Stimme sind # Row 24 Set string value... 24 Label $Display Set string value... 24 Text Wiedergabe Set string value... 24 Key Set string value... 24 Helptext Einstellungen der wiedergabe uzw # Row 25 Set string value... 25 Label DisplayNumbers Set string value... 25 Text Ton Zahlen Set string value... 25 Key u Set string value... 25 Helptext Wiedergabe Pinyin mit zahlen der T\o"ne (einn) oder symbole (aus) # Row 26 Set string value... 26 Label DisplayPinyin Set string value... 26 Text Pinyin Set string value... 26 Key P Set string value... 26 Helptext Wiedergabe Pinyin w\o"rte w\a"hrend der \U"bungen # Row 27 Set string value... 27 Label DisplayChar Set string value... 27 Text Characters Set string value... 27 Key C Set string value... 27 Helptext Wiedergabe Chinesische Characters wenn anwesend # Row 28 Set string value... 28 Label DisplayTrans Set string value... 28 Text \U"bersetzung Set string value... 28 Key b Set string value... 28 Helptext \U"bersetzung wenn anwesend # Row 29 Set string value... 29 Label ShuffleLists Set string value... 29 Text Shuffle Set string value... 29 Key S Set string value... 29 Helptext Shuffle W\o"rter in Wortlisten (ein) oder eine feste Reihenvolge (aus) # Row 30 Set string value... 30 Label UseSoundExample Set string value... 30 Text Audio Vorbild Set string value... 30 Key V Set string value... 30 Helptext Gebrauche echte Aufnahmen zum Vorbild wenn anwesend (ein) oder synthetische T\o"ne (aus) # Row 31 Set string value... 31 Label Synthesis_eSpeak Set string value... 31 Text Synthese Set string value... 31 Key y Set string value... 31 Helptext Gebrauche eine synthetische Stimme zum Vorbild (Sie brauche eSpeak: www.espeak.org) # Row 32 Set string value... 32 Label $Recognition Set string value... 32 Text Sprachkenntnisse Set string value... 32 Key Set string value... 32 Helptext Einstellung f\u"r fortgeschrittene Studenten # Row 33 Set string value... 33 Label Strict Set string value... 33 Text Fortgeschritten! Set string value... 33 Key !1 Set string value... 33 Helptext Sei preziese bei der Erkennung der T\o"ne, f\u"r fortgeschrittene Studenten und Muttersprachler # Row 34 Set string value... 34 Label OpenWordlist Set string value... 34 Text \O"fne Liste+ Set string value... 34 Key += Set string value... 34 Helptext W\a"hle und \o"fne eine wortliste # Row 35 Set string value... 35 Label InstallWordlist Set string value... 35 Text Installiere Listen Set string value... 35 Key r Set string value... 35 Helptext Installiere alle .sgc wortlisten in die Documents, Downloads, und Preferences Mappen # Row 36 Set string value... 36 Label DeleteWordlist Set string value... 36 Text L\o"ssche Liste X Set string value... 36 Key X Set string value... 36 Helptext L\o"ssche die Wortliste. Sie m\u"ssen die 'j' taste dr\u"cken um das L\o"sschen zu best\a"tigen. # Row 37 Set string value... 37 Label !DeleteWordlist Set string value... 37 Text Sicher? j/N Set string value... 37 Key j Set string value... 37 Helptext Sind Sie sicher? Best\a"tige diese Aktion mit der taste 'j' # Row 38 Set string value... 38 Label !Logging Set string value... 38 Text Log an Set string value... 38 Key L Set string value... 38 Helptext Starte das Protokollieren aller Aufnahmen (Logbuch) # Row 39 Set string value... 39 Label !NotAWordlist Set string value... 39 Text Falsch Set string value... 39 Key Set string value... 39 Helptext Keine g\u"ltige Wordliste: # Row 40 Set string value... 40 Label $Statistics Set string value... 40 Text \U"bersicht Set string value... 40 Key Set string value... 40 Helptext Gebe einen \U"berblick der Ergebnisse # Row 41 Set string value... 41 Label PerfSummary Set string value... 41 Text Zusamenfassung* Set string value... 41 Key *8 Set string value... 41 Helptext Zusamenfassung der Ergebnisse dieser Sitzung # Row 42 Set string value... 42 Label ListPerf Set string value... 42 Text Ergebnisse Set string value... 42 Key &7 Set string value... 42 Helptext Ergebnisse dieser Sitzung zeigen # Row 43 Set string value... 43 Label SavePerf Set string value... 43 Text Bewahre Set string value... 43 Key 9 Set string value... 43 Helptext Ergebnisse dieser Sitzung aufbewahren endproc procedure CreateConfig_EN Create Table with column names... Config_EN 42 ... Label Text Key Helptext # Fill table values # Row 1 Set string value... 1 Label !Author Set string value... 1 Text Author Set string value... 1 Key ! Set string value... 1 Helptext R.J.J.H. van Son # Row 2 Set string value... 2 Label !Copyright Set string value... 2 Text Copyright Set string value... 2 Key ! Set string value... 2 Helptext Copyright 2010 R.J.J.H. van Son \& the NKI # Row 3 Set string value... 3 Label !License Set string value... 3 Text License Set string value... 3 Key ! Set string value... 3 Helptext GNU GPL version 2 or later # Row 4 Set string value... 4 Label !WindowTitle Set string value... 4 Text SpeakGoodChinese: Change settings Set string value... 4 Key ! Set string value... 4 Helptext SpeakGoodChinese: Change settings # Row 5 Set string value... 5 Label Return Set string value... 5 Text Return Set string value... 5 Key R Set string value... 5 Helptext Go back to practise page # Row 6 Set string value... 6 Label $Language Set string value... 6 Text Language Set string value... 6 Key Set string value... 6 Helptext Select a language # Row 7 Set string value... 7 Label Language_EN Set string value... 7 Text English Set string value... 7 Key E Set string value... 7 Helptext English language version # Row 8 Set string value... 8 Label Language_NL Set string value... 8 Text Nederlands Set string value... 8 Key N Set string value... 8 Helptext Dutch language version # Row 9 Set string value... 9 Label $Register Set string value... 9 Text Your Voice Set string value... 9 Key Set string value... 9 Helptext Select the category that fits your voice # Row 10 Set string value... 10 Label Register_350 Set string value... 10 Text Woman High Set string value... 10 Key W Set string value... 10 Helptext Pick this if you are a female with a high voice # Row 11 Set string value... 11 Label Register_300 Set string value... 11 Text Woman Mid Set string value... 11 Key i Set string value... 11 Helptext Pick this if you are a female with a mid-range voice # Row 12 Set string value... 12 Label Register_250 Set string value... 12 Text Woman Low Set string value... 12 Key o Set string value... 12 Helptext Pick this if you are a female with a low voice # Row 13 Set string value... 13 Label Register_249 Set string value... 13 Text Man High Set string value... 13 Key M Set string value... 13 Helptext Pick this if you are a male with a high voice # Row 14 Set string value... 14 Label Register_180 Set string value... 14 Text Man Mid Set string value... 14 Key a Set string value... 14 Helptext Pick this if you are a male with a mid-range voice # Row 15 Set string value... 15 Label Register_150 Set string value... 15 Text Man Low Set string value... 15 Key L Set string value... 15 Helptext Pick this if you are a male with a low voice # Row 16 Set string value... 16 Label Register_125 Set string value... 16 Text Man Xtr Low Set string value... 16 Key Set string value... 16 Helptext Pick this if you are a male with a very low voice # Row 17 Set string value... 17 Label $Display Set string value... 17 Text View and Sound Set string value... 17 Key Set string value... 17 Helptext Settings for display and sound # Row 18 Set string value... 18 Label DisplayNumbers Set string value... 18 Text Tone Numbers Set string value... 18 Key u Set string value... 18 Helptext Display pinyin with tone numbers (on) or tone symbols (off) # Row 19 Set string value... 19 Label DisplayPinyin Set string value... 19 Text Pinyin Set string value... 19 Key P Set string value... 19 Helptext Display pinyin word while practicing # Row 20 Set string value... 20 Label DisplayChar Set string value... 20 Text Characters Set string value... 20 Key C Set string value... 20 Helptext Display chinese characters if they are available # Row 21 Set string value... 21 Label DisplayTrans Set string value... 21 Text Translation Set string value... 21 Key T Set string value... 21 Helptext Display translation if available # Row 22 Set string value... 22 Label ShuffleLists Set string value... 22 Text Shuffle Set string value... 22 Key S Set string value... 22 Helptext Shuffle words in word lists (on) or use a fixed order (off) # Row 23 Set string value... 23 Label UseSoundExample Set string value... 23 Text Real example Set string value... 23 Key x Set string value... 23 Helptext Use a real sound recording (on) if available or synthesized tones (off) as examples # Row 24 Set string value... 24 Label Synthesis_eSpeak Set string value... 24 Text Synthesis Set string value... 24 Key y Set string value... 24 Helptext Use a synthetic voice as example (you need eSpeak: www.espeak.org) # Row 25 Set string value... 25 Label $Recognition Set string value... 25 Text Proficiency Set string value... 25 Key Set string value... 25 Helptext Set to recognize advanced or native speakers # Row 26 Set string value... 26 Label Strict Set string value... 26 Text Advanced! Set string value... 26 Key !1 Set string value... 26 Helptext Be very precise in pronunciation checking, for advanced students or native speakers # Row 27 Set string value... 27 Label OpenWordlist Set string value... 27 Text Open List+ Set string value... 27 Key += Set string value... 27 Helptext Select and read a wordlist # Row 28 Set string value... 28 Label InstallWordlist Set string value... 28 Text Install Lists Set string value... 28 Key t Set string value... 28 Helptext Install all .sgc wordlist packages found in the Documents, Downloads, and Preferences directories # Row 29 Set string value... 29 Label DeleteWordlist Set string value... 29 Text Delete List Set string value... 29 Key D Set string value... 29 Helptext Permanently delete the word list. You have to confirm this by typing 'y' # Row 30 Set string value... 30 Label !DeleteWordlist Set string value... 30 Text Realy y/N Set string value... 30 Key y Set string value... 30 Helptext Are you sure you want to proceed? Confirm this option by typing 'y' # Row 31 Set string value... 31 Label ShowBackground Set string value... 31 Text Background Set string value... 31 Key B Set string value... 31 Helptext Show background # Row 32 Set string value... 32 Label $Recording Set string value... 32 Text Recording Set string value... 32 Key Set string value... 32 Helptext Settings for recording speech # Row 33 Set string value... 33 Label Input_Microphone Set string value... 33 Text Microphone Set string value... 33 Key h Set string value... 33 Helptext Use the build in microphone for recording # Row 34 Set string value... 34 Label Input_Line Set string value... 34 Text Line input | Set string value... 34 Key |\+ Set string value... 34 Helptext Use the line input for recording # Row 35 Set string value... 35 Label Credits Set string value... 35 Text About SGC2 Set string value... 35 Key 2 Set string value... 35 Helptext Information about SpeakGoodChinese # Row 36 Set string value... 36 Label !Logging Set string value... 36 Text Keep Logs Set string value... 36 Key K Set string value... 36 Helptext A hidden button active when keeping a log of recordings # Row 37 Set string value... 37 Label Help Set string value... 37 Text Help Set string value... 37 Key ?/ Set string value... 37 Helptext Press on the button you want information on, "Help" to continue # Row 38 Set string value... 38 Label !NotAWordlist Set string value... 38 Text Wrong Set string value... 38 Key Set string value... 38 Helptext Not a valid word list: # Row 39 Set string value... 39 Label $Statistics Set string value... 39 Text Overview Set string value... 39 Key Set string value... 39 Helptext Give overview of performance measures # Row 40 Set string value... 40 Label PerfSummary Set string value... 40 Text Summary* Set string value... 40 Key *8 Set string value... 40 Helptext Summary of performance during this session # Row 41 Set string value... 41 Label ListPerf Set string value... 41 Text Performance Set string value... 41 Key &7 Set string value... 41 Helptext Show performance during this session # Row 42 Set string value... 42 Label SavePerf Set string value... 42 Text Save Set string value... 42 Key 9 Set string value... 42 Helptext Save performance during this session to file endproc procedure CreateConfig_NL Create Table with column names... Config_NL 42 ... Label Text Key Helptext # Fill table values # Row 1 Set string value... 1 Label !Author Set string value... 1 Text Auteur Set string value... 1 Key ! Set string value... 1 Helptext R.J.J.H. van Son # Row 2 Set string value... 2 Label !Copyright Set string value... 2 Text Copyright Set string value... 2 Key ! Set string value... 2 Helptext Copyright 2010 R.J.J.H. van Son \& the NKI # Row 3 Set string value... 3 Label !License Set string value... 3 Text Licentie Set string value... 3 Key ! Set string value... 3 Helptext GNU GPL version 2 or later # Row 4 Set string value... 4 Label !WindowTitle Set string value... 4 Text SpeakGoodChinese: Instellingen aanpassen Set string value... 4 Key ! Set string value... 4 Helptext SpeakGoodChinese: Instellingen aanpassen # Row 5 Set string value... 5 Label Return Set string value... 5 Text Terug Set string value... 5 Key T Set string value... 5 Helptext Ga terug naar de oefen pagina # Row 6 Set string value... 6 Label $Language Set string value... 6 Text Taal Set string value... 6 Key Set string value... 6 Helptext Selecteer de gewenste taal # Row 7 Set string value... 7 Label Language_EN Set string value... 7 Text English Set string value... 7 Key E Set string value... 7 Helptext Gebruik Engels # Row 8 Set string value... 8 Label Language_NL Set string value... 8 Text Nederlands Set string value... 8 Key N Set string value... 8 Helptext Gebruik Nederlands # Row 9 Set string value... 9 Label $Register Set string value... 9 Text Uw Stem Set string value... 9 Key Set string value... 9 Helptext Kies de categorie die past bij uw stem # Row 10 Set string value... 10 Label Register_350 Set string value... 10 Text Vrouw Hoog Set string value... 10 Key V Set string value... 10 Helptext Kies dit als u een vrouw bent met een hoge stem # Row 11 Set string value... 11 Label Register_300 Set string value... 11 Text Vrouw Mid Set string value... 11 Key r Set string value... 11 Helptext Kies dit als u een vrouw bent met een middel-hoge stem # Row 12 Set string value... 12 Label Register_250 Set string value... 12 Text Vrouw Laag Set string value... 12 Key o Set string value... 12 Helptext Kies dit als u een vrouw bent met een lage stem # Row 13 Set string value... 13 Label Register_249 Set string value... 13 Text Man Hoog Set string value... 13 Key M Set string value... 13 Helptext Kies dit als u een man bent met een hoge stem # Row 14 Set string value... 14 Label Register_180 Set string value... 14 Text Man Mid Set string value... 14 Key a Set string value... 14 Helptext Kies dit als u een man bent met een middel-lage stem # Row 15 Set string value... 15 Label Register_150 Set string value... 15 Text Man Laag Set string value... 15 Key n Set string value... 15 Helptext Kies dit als u een man bent met een lage stem # Row 16 Set string value... 16 Label Register_125 Set string value... 16 Text Man Xtr Laag Set string value... 16 Key Set string value... 16 Helptext Kies dit als u een man bent met een zeer lage stem # Row 17 Set string value... 17 Label $Display Set string value... 17 Text Beeld en Geluid Set string value... 17 Key Set string value... 17 Helptext Instellingen voor beeld en geluid # Row 18 Set string value... 18 Label DisplayNumbers Set string value... 18 Text Toon Cijfers Set string value... 18 Key C Set string value... 18 Helptext Laat toon nummers (aan) of toon symbolen (uit) zien # Row 19 Set string value... 19 Label DisplayPinyin Set string value... 19 Text Pinyin Set string value... 19 Key P Set string value... 19 Helptext Laat pinyin zien # Row 20 Set string value... 20 Label DisplayChar Set string value... 20 Text Karakters Set string value... 20 Key K Set string value... 20 Helptext Laat Chinese karakters zien als ze beschikbaar zijn # Row 21 Set string value... 21 Label DisplayTrans Set string value... 21 Text Vertaling Set string value... 21 Key g Set string value... 21 Helptext Geef vertaling al die beschikbaar is # Row 22 Set string value... 22 Label ShuffleLists Set string value... 22 Text Woorden mixen Set string value... 22 Key x Set string value... 22 Helptext Gebruik elke keer een andere volgorde van de woorden # Row 23 Set string value... 23 Label UseSoundExample Set string value... 23 Text Spraakvoorbeeld Set string value... 23 Key S Set string value... 23 Helptext Laat echte spraakopnamen (aan) of kunstmatige tonen (uit) horen als voorbeeld # Row 24 Set string value... 24 Label Synthesis_eSpeak Set string value... 24 Text Synthese Set string value... 24 Key y Set string value... 24 Helptext Gebruik een synthetische stem als voorbeeld (eSpeak is hiervoor nodig: www.espeak.org) # Row 25 Set string value... 25 Label $Recognition Set string value... 25 Text Taalniveau Set string value... 25 Key Set string value... 25 Helptext Stel de herkenner in op gevorderde of moedertaal sprekers # Row 26 Set string value... 26 Label Strict Set string value... 26 Text Gevorderd! Set string value... 26 Key !1 Set string value... 26 Helptext Extra preciese uitspraakcontrolle voor gevorderde studenten of moedertaal sprekers # Row 27 Set string value... 27 Label OpenWordlist Set string value... 27 Text Open Lijst+ Set string value... 27 Key += Set string value... 27 Helptext Selecteer en lees een woordlijst # Row 28 Set string value... 28 Label InstallWordlist Set string value... 28 Text Installeer Lijsten Set string value... 28 Key I Set string value... 28 Helptext Installeer alle .sgc woordpaketten uit de Downloads, Documents en Preferences mappen # Row 29 Set string value... 29 Label DeleteWordlist Set string value... 29 Text Verwijder Lijst Set string value... 29 Key d Set string value... 29 Helptext Verwijder de getoonde woordlijst permanent, u moet dit bevestigen door een 'j' te typen # Row 30 Set string value... 30 Label !DeleteWordlist Set string value... 30 Text Heel zeker j/N Set string value... 30 Key j Set string value... 30 Helptext Bent u zeker dat u door wilt gaan? Bevestig door een 'j' te typen # Row 31 Set string value... 31 Label ShowBackground Set string value... 31 Text Achtergrond Set string value... 31 Key & Set string value... 31 Helptext Toon achtergrond # Row 32 Set string value... 32 Label $Recording Set string value... 32 Text Opname Set string value... 32 Key Set string value... 32 Helptext Instellingen voor de opname van spraak # Row 33 Set string value... 33 Label Input_Microphone Set string value... 33 Text Microfoon Set string value... 33 Key f Set string value... 33 Helptext Gebruik de ingebouwde microfoon voor spraakopnamen # Row 34 Set string value... 34 Label Input_Line Set string value... 34 Text Lijn ingang | Set string value... 34 Key |\+ Set string value... 34 Helptext Gebruik de lijn-ingang voor de spraakopnamen # Row 35 Set string value... 35 Label Credits Set string value... 35 Text Over SGC2 Set string value... 35 Key 2 Set string value... 35 Helptext Informatie over SpeakGoodChinese # Row 36 Set string value... 36 Label !Logging Set string value... 36 Text Logboek Set string value... 36 Key L Set string value... 36 Helptext Verborgen knop die acief is als er een logboek van spraak bijgehouden wordt # Row 37 Set string value... 37 Label Help Set string value... 37 Text Help Set string value... 37 Key ?/ Set string value... 37 Helptext klik op de knop waar u informatie over wilt hebben, "Help" als u verder wilt # Row 38 Set string value... 38 Label !NotAWordlist Set string value... 38 Text Fout Set string value... 38 Key Set string value... 38 Helptext Geen geldige woordlijst: # Row 39 Set string value... 39 Label $Statistics Set string value... 39 Text Overzicht Set string value... 39 Key Set string value... 39 Helptext Geef een overzicht van de resultaten # Row 40 Set string value... 40 Label PerfSummary Set string value... 40 Text Samenvatting* Set string value... 40 Key *8 Set string value... 40 Helptext Samenvatting van de resultaten van deze sessie # Row 41 Set string value... 41 Label ListPerf Set string value... 41 Text Resultaten Set string value... 41 Key &7 Set string value... 41 Helptext Toon de resultaten van deze sessie # Row 42 Set string value... 42 Label SavePerf Set string value... 42 Text Bewaar Set string value... 42 Key 9 Set string value... 42 Helptext Schrijf de resultaten van deze sessie naar een bestand endproc procedure CreateCredits_DE Create Table with column names... Credits_DE 40 ... font size text # Fill table values # Row 1 Set string value... 1 font Helvetica Set string value... 1 size 12 Set string value... 1 text # Row 2 Set string value... 2 font Helvetica Set string value... 2 size 16 Set string value... 2 text SpeakGoodChinese version 2.0 # Row 3 Set string value... 3 font Helvetica Set string value... 3 size 10 Set string value... 3 text %%Dedicated to the memory of Guanqin Chen% # Row 4 Set string value... 4 font Helvetica Set string value... 4 size 12 Set string value... 4 text # Row 5 Set string value... 5 font Helvetica Set string value... 5 size 12 Set string value... 5 text For more information, visit our website: http://www.speakgoodchinese.org # Row 6 Set string value... 6 font Helvetica Set string value... 6 size 12 Set string value... 6 text Based on Praat 'praatVersion$' (http://www.praat.org) # Row 7 Set string value... 7 font Helvetica Set string value... 7 size 12 Set string value... 7 text # Row 8 Set string value... 8 font Helvetica Set string value... 8 size 12 Set string value... 8 text SpeakGoodChinese was supported by grant 6046 from the Digitale Universiteit # Row 9 Set string value... 9 font Helvetica Set string value... 9 size 12 Set string value... 9 text The SpeakGoodChinese Team # Row 10 Set string value... 10 font Helvetica Set string value... 10 size 12 Set string value... 10 text * ##Guanqin Chen# (HRO) - Founder and project manager, Language and Teaching # Row 11 Set string value... 11 font Helvetica Set string value... 11 size 12 Set string value... 11 text * ##Zongyan Chen# (HvA) - Language and Teaching # Row 12 Set string value... 12 font Helvetica Set string value... 12 size 12 Set string value... 12 text * ##Eveline van Hagen# (Fontys) - Language and Teaching # Row 13 Set string value... 13 font Helvetica Set string value... 13 size 12 Set string value... 13 text * ##Stefan de Konink# (UvA) - Lead programmer, User Interface # Row 14 Set string value... 14 font Helvetica Set string value... 14 size 12 Set string value... 14 text * ##Lifeng Liu# (HRO) - Language assistant # Row 15 Set string value... 15 font Helvetica Set string value... 15 size 12 Set string value... 15 text * ##Rob van Son# (UvA) - Coordinator technical work, Speech technology, GUI # Row 16 Set string value... 16 font Helvetica Set string value... 16 size 12 Set string value... 16 text * ##Dennis Vierkant# (UT) - User Interface and Language # Row 17 Set string value... 17 font Helvetica Set string value... 17 size 12 Set string value... 17 text * ##David Weenink# (UvA) - Praat programming, Algorithms We would like to thank # Row 18 Set string value... 18 font Helvetica Set string value... 18 size 12 Set string value... 18 text # Row 19 Set string value... 19 font Helvetica Set string value... 19 size 12 Set string value... 19 text We would like to thank Paul Boersma (UvA) for his extensive help with integrating SGC in Praat, # Row 20 Set string value... 20 font Helvetica Set string value... 20 size 12 Set string value... 20 text and Tristian van Berkom for additional help with the localization code. # Row 21 Set string value... 21 font Helvetica Set string value... 21 size 12 Set string value... 21 text J.E. Raaijmakers, R. van Rijsselt and S. Verhagen for feedback on the GUI and Praat library # Row 22 Set string value... 22 font Helvetica Set string value... 22 size 12 Set string value... 22 text integration on Windows. We are very grateful for all the practical, organisational, and # Row 23 Set string value... 23 font Helvetica Set string value... 23 size 12 Set string value... 23 text financial support from the staff and board of the Digitale Universiteit. # Row 24 Set string value... 24 font Helvetica Set string value... 24 size 12 Set string value... 24 text # Row 25 Set string value... 25 font Helvetica Set string value... 25 size 12 Set string value... 25 text Copyrights \co 2007-'dateYear$' by Hogeschool Rotterdam, Rob van Son (ACLC/UvA/NKI) - R.J.J.H.vanSon@gmail.com # Row 26 Set string value... 26 font Helvetica Set string value... 26 size 12 Set string value... 26 text # Row 27 Set string value... 27 font Courier Set string value... 27 size 12 Set string value... 27 text This program is free software: you can redistribute it and/or modify # Row 28 Set string value... 28 font Courier Set string value... 28 size 12 Set string value... 28 text it under the terms of the GNU General Public License as published by # Row 29 Set string value... 29 font Courier Set string value... 29 size 12 Set string value... 29 text the Free Software Foundation, either version 2 of the License, or # Row 30 Set string value... 30 font Courier Set string value... 30 size 12 Set string value... 30 text (at your option) any later version. # Row 31 Set string value... 31 font Courier Set string value... 31 size 12 Set string value... 31 text # Row 32 Set string value... 32 font Courier Set string value... 32 size 12 Set string value... 32 text This program is distributed in the hope that it will be useful, # Row 33 Set string value... 33 font Courier Set string value... 33 size 12 Set string value... 33 text but WITHOUT ANY WARRANTY; without even the implied warranty of # Row 34 Set string value... 34 font Courier Set string value... 34 size 12 Set string value... 34 text MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # Row 35 Set string value... 35 font Courier Set string value... 35 size 12 Set string value... 35 text GNU General Public License for more details. # Row 36 Set string value... 36 font Courier Set string value... 36 size 12 Set string value... 36 text # Row 37 Set string value... 37 font Courier Set string value... 37 size 12 Set string value... 37 text You should have received a copy of the GNU General Public License # Row 38 Set string value... 38 font Courier Set string value... 38 size 12 Set string value... 38 text along with this program. If not, see . # Row 39 Set string value... 39 font Courier Set string value... 39 size 12 Set string value... 39 text # Row 40 Set string value... 40 font Helvetica Set string value... 40 size 8 Set string value... 40 text %%V: 'build_SHA$'% endproc procedure CreateCredits_EN Create Table with column names... Credits_EN 40 ... font size text # Fill table values # Row 1 Set string value... 1 font Helvetica Set string value... 1 size 12 Set string value... 1 text # Row 2 Set string value... 2 font Helvetica Set string value... 2 size 16 Set string value... 2 text SpeakGoodChinese version 2.0 # Row 3 Set string value... 3 font Helvetica Set string value... 3 size 10 Set string value... 3 text %%Dedicated to the memory of Guanqin Chen% # Row 4 Set string value... 4 font Helvetica Set string value... 4 size 12 Set string value... 4 text # Row 5 Set string value... 5 font Helvetica Set string value... 5 size 12 Set string value... 5 text For more information, visit our website: http://www.speakgoodchinese.org # Row 6 Set string value... 6 font Helvetica Set string value... 6 size 12 Set string value... 6 text Based on Praat 'praatVersion$' (http://www.praat.org) # Row 7 Set string value... 7 font Helvetica Set string value... 7 size 12 Set string value... 7 text # Row 8 Set string value... 8 font Helvetica Set string value... 8 size 12 Set string value... 8 text SpeakGoodChinese was supported by grant 6046 from the Digitale Universiteit # Row 9 Set string value... 9 font Helvetica Set string value... 9 size 12 Set string value... 9 text The SpeakGoodChinese Team # Row 10 Set string value... 10 font Helvetica Set string value... 10 size 12 Set string value... 10 text * ##Guanqin Chen# (HRO) - Founder and project manager, Language and Teaching # Row 11 Set string value... 11 font Helvetica Set string value... 11 size 12 Set string value... 11 text * ##Zongyan Chen# (HvA) - Language and Teaching # Row 12 Set string value... 12 font Helvetica Set string value... 12 size 12 Set string value... 12 text * ##Eveline van Hagen# (Fontys) - Language and Teaching # Row 13 Set string value... 13 font Helvetica Set string value... 13 size 12 Set string value... 13 text * ##Stefan de Konink# (UvA) - Lead programmer, User Interface # Row 14 Set string value... 14 font Helvetica Set string value... 14 size 12 Set string value... 14 text * ##Lifeng Liu# (HRO) - Language assistant # Row 15 Set string value... 15 font Helvetica Set string value... 15 size 12 Set string value... 15 text * ##Rob van Son# (UvA) - Coordinator technical work, Speech technology, GUI # Row 16 Set string value... 16 font Helvetica Set string value... 16 size 12 Set string value... 16 text * ##Dennis Vierkant# (UT) - User Interface and Language # Row 17 Set string value... 17 font Helvetica Set string value... 17 size 12 Set string value... 17 text * ##David Weenink# (UvA) - Praat programming, Algorithms We would like to thank # Row 18 Set string value... 18 font Helvetica Set string value... 18 size 12 Set string value... 18 text # Row 19 Set string value... 19 font Helvetica Set string value... 19 size 12 Set string value... 19 text We would like to thank Paul Boersma (UvA) for his extensive help with integrating SGC in Praat, # Row 20 Set string value... 20 font Helvetica Set string value... 20 size 12 Set string value... 20 text and Tristian van Berkom for additional help with the localization code. # Row 21 Set string value... 21 font Helvetica Set string value... 21 size 12 Set string value... 21 text J.E. Raaijmakers, R. van Rijsselt and S. Verhagen for feedback on the GUI and Praat library # Row 22 Set string value... 22 font Helvetica Set string value... 22 size 12 Set string value... 22 text integration on Windows. We are very grateful for all the practical, organisational, and # Row 23 Set string value... 23 font Helvetica Set string value... 23 size 12 Set string value... 23 text financial support from the staff and board of the Digitale Universiteit. # Row 24 Set string value... 24 font Helvetica Set string value... 24 size 12 Set string value... 24 text # Row 25 Set string value... 25 font Helvetica Set string value... 25 size 12 Set string value... 25 text Copyrights \co 2007-'dateYear$' by Hogeschool Rotterdam, Rob van Son (ACLC/UvA/NKI) - R.J.J.H.vanSon@gmail.com # Row 26 Set string value... 26 font Helvetica Set string value... 26 size 12 Set string value... 26 text # Row 27 Set string value... 27 font Courier Set string value... 27 size 12 Set string value... 27 text This program is free software: you can redistribute it and/or modify # Row 28 Set string value... 28 font Courier Set string value... 28 size 12 Set string value... 28 text it under the terms of the GNU General Public License as published by # Row 29 Set string value... 29 font Courier Set string value... 29 size 12 Set string value... 29 text the Free Software Foundation, either version 2 of the License, or # Row 30 Set string value... 30 font Courier Set string value... 30 size 12 Set string value... 30 text (at your option) any later version. # Row 31 Set string value... 31 font Courier Set string value... 31 size 12 Set string value... 31 text # Row 32 Set string value... 32 font Courier Set string value... 32 size 12 Set string value... 32 text This program is distributed in the hope that it will be useful, # Row 33 Set string value... 33 font Courier Set string value... 33 size 12 Set string value... 33 text but WITHOUT ANY WARRANTY; without even the implied warranty of # Row 34 Set string value... 34 font Courier Set string value... 34 size 12 Set string value... 34 text MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # Row 35 Set string value... 35 font Courier Set string value... 35 size 12 Set string value... 35 text GNU General Public License for more details. # Row 36 Set string value... 36 font Courier Set string value... 36 size 12 Set string value... 36 text # Row 37 Set string value... 37 font Courier Set string value... 37 size 12 Set string value... 37 text You should have received a copy of the GNU General Public License # Row 38 Set string value... 38 font Courier Set string value... 38 size 12 Set string value... 38 text along with this program. If not, see . # Row 39 Set string value... 39 font Courier Set string value... 39 size 12 Set string value... 39 text # Row 40 Set string value... 40 font Helvetica Set string value... 40 size 8 Set string value... 40 text %%V: 'build_SHA$'% endproc procedure CreateCredits_NL Create Table with column names... Credits_NL 40 ... font size text # Fill table values # Row 1 Set string value... 1 font Helvetica Set string value... 1 size 12 Set string value... 1 text # Row 2 Set string value... 2 font Helvetica Set string value... 2 size 16 Set string value... 2 text SpeakGoodChinese version 2.0 # Row 3 Set string value... 3 font Helvetica Set string value... 3 size 10 Set string value... 3 text %%Dedicated to the memory of Guanqin Chen% # Row 4 Set string value... 4 font Helvetica Set string value... 4 size 12 Set string value... 4 text # Row 5 Set string value... 5 font Helvetica Set string value... 5 size 12 Set string value... 5 text For more information, visit our website: http://www.speakgoodchinese.org # Row 6 Set string value... 6 font Helvetica Set string value... 6 size 12 Set string value... 6 text Based on Praat 'praatVersion$' (http://www.praat.org) # Row 7 Set string value... 7 font Helvetica Set string value... 7 size 12 Set string value... 7 text # Row 8 Set string value... 8 font Helvetica Set string value... 8 size 12 Set string value... 8 text SpeakGoodChinese was supported by grant 6046 from the Digitale Universiteit # Row 9 Set string value... 9 font Helvetica Set string value... 9 size 12 Set string value... 9 text The SpeakGoodChinese Team # Row 10 Set string value... 10 font Helvetica Set string value... 10 size 12 Set string value... 10 text * ##Guanqin Chen# (HRO) - Founder and project manager, Language and Teaching # Row 11 Set string value... 11 font Helvetica Set string value... 11 size 12 Set string value... 11 text * ##Zongyan Chen# (HvA) - Language and Teaching # Row 12 Set string value... 12 font Helvetica Set string value... 12 size 12 Set string value... 12 text * ##Eveline van Hagen# (Fontys) - Language and Teaching # Row 13 Set string value... 13 font Helvetica Set string value... 13 size 12 Set string value... 13 text * ##Stefan de Konink# (UvA) - Lead programmer, User Interface # Row 14 Set string value... 14 font Helvetica Set string value... 14 size 12 Set string value... 14 text * ##Lifeng Liu# (HRO) - Language assistant # Row 15 Set string value... 15 font Helvetica Set string value... 15 size 12 Set string value... 15 text * ##Rob van Son# (UvA) - Coordinator technical work, Speech technology, GUI # Row 16 Set string value... 16 font Helvetica Set string value... 16 size 12 Set string value... 16 text * ##Dennis Vierkant# (UT) - User Interface and Language # Row 17 Set string value... 17 font Helvetica Set string value... 17 size 12 Set string value... 17 text * ##David Weenink# (UvA) - Praat programming, Algorithms We would like to thank # Row 18 Set string value... 18 font Helvetica Set string value... 18 size 12 Set string value... 18 text # Row 19 Set string value... 19 font Helvetica Set string value... 19 size 12 Set string value... 19 text We would like to thank Paul Boersma (UvA) for his extensive help with integrating SGC in Praat, # Row 20 Set string value... 20 font Helvetica Set string value... 20 size 12 Set string value... 20 text and Tristian van Berkom for additional help with the localization code. # Row 21 Set string value... 21 font Helvetica Set string value... 21 size 12 Set string value... 21 text J.E. Raaijmakers, R. van Rijsselt and S. Verhagen for feedback on the GUI and Praat library # Row 22 Set string value... 22 font Helvetica Set string value... 22 size 12 Set string value... 22 text integration on Windows. We are very grateful for all the practical, organisational, and # Row 23 Set string value... 23 font Helvetica Set string value... 23 size 12 Set string value... 23 text financial support from the staff and board of the Digitale Universiteit. # Row 24 Set string value... 24 font Helvetica Set string value... 24 size 12 Set string value... 24 text # Row 25 Set string value... 25 font Helvetica Set string value... 25 size 12 Set string value... 25 text Copyrights \co 2007-'dateYear$' by Hogeschool Rotterdam, Rob van Son (ACLC/UvA/NKI) - R.J.J.H.vanSon@gmail.com # Row 26 Set string value... 26 font Helvetica Set string value... 26 size 12 Set string value... 26 text # Row 27 Set string value... 27 font Courier Set string value... 27 size 12 Set string value... 27 text This program is free software: you can redistribute it and/or modify # Row 28 Set string value... 28 font Courier Set string value... 28 size 12 Set string value... 28 text it under the terms of the GNU General Public License as published by # Row 29 Set string value... 29 font Courier Set string value... 29 size 12 Set string value... 29 text the Free Software Foundation, either version 2 of the License, or # Row 30 Set string value... 30 font Courier Set string value... 30 size 12 Set string value... 30 text (at your option) any later version. # Row 31 Set string value... 31 font Courier Set string value... 31 size 12 Set string value... 31 text # Row 32 Set string value... 32 font Courier Set string value... 32 size 12 Set string value... 32 text This program is distributed in the hope that it will be useful, # Row 33 Set string value... 33 font Courier Set string value... 33 size 12 Set string value... 33 text but WITHOUT ANY WARRANTY; without even the implied warranty of # Row 34 Set string value... 34 font Courier Set string value... 34 size 12 Set string value... 34 text MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # Row 35 Set string value... 35 font Courier Set string value... 35 size 12 Set string value... 35 text GNU General Public License for more details. # Row 36 Set string value... 36 font Courier Set string value... 36 size 12 Set string value... 36 text # Row 37 Set string value... 37 font Courier Set string value... 37 size 12 Set string value... 37 text You should have received a copy of the GNU General Public License # Row 38 Set string value... 38 font Courier Set string value... 38 size 12 Set string value... 38 text along with this program. If not, see . # Row 39 Set string value... 39 font Courier Set string value... 39 size 12 Set string value... 39 text # Row 40 Set string value... 40 font Helvetica Set string value... 40 size 8 Set string value... 40 text %%V: 'build_SHA$'% endproc procedure CreateEvaluation_DE Create Table with column names... Evaluation_DE 11 ... Label Text # Fill table values # Row 1 Set string value... 1 Label Total Set string value... 1 Text Total # Row 2 Set string value... 2 Label Correct Set string value... 2 Text Richtig # Row 3 Set string value... 3 Label Problematic Set string value... 3 Text Anmerkungen # Row 4 Set string value... 4 Label Tones Set string value... 4 Text T\o"ne # Row 5 Set string value... 5 Label Wrong Set string value... 5 Text Falsch # Row 6 Set string value... 6 Label High Set string value... 6 Text Hoch # Row 7 Set string value... 7 Label Low Set string value... 7 Text Niedrich # Row 8 Set string value... 8 Label Wide Set string value... 8 Text Weidl\a"ufig # Row 9 Set string value... 9 Label Narrow Set string value... 9 Text Flach # Row 10 Set string value... 10 Label Unknown Set string value... 10 Text Unbekannt # Row 11 Set string value... 11 Label Commented Set string value... 11 Text Comm. endproc procedure CreateEvaluation_EN Create Table with column names... Evaluation_EN 11 ... Label Text # Fill table values # Row 1 Set string value... 1 Label Total Set string value... 1 Text Total # Row 2 Set string value... 2 Label Correct Set string value... 2 Text Correct # Row 3 Set string value... 3 Label Problematic Set string value... 3 Text Problematic # Row 4 Set string value... 4 Label Tones Set string value... 4 Text Tones # Row 5 Set string value... 5 Label Wrong Set string value... 5 Text Wrong # Row 6 Set string value... 6 Label High Set string value... 6 Text High # Row 7 Set string value... 7 Label Low Set string value... 7 Text Low # Row 8 Set string value... 8 Label Wide Set string value... 8 Text Wide # Row 9 Set string value... 9 Label Narrow Set string value... 9 Text Narrow # Row 10 Set string value... 10 Label Unknown Set string value... 10 Text Unknown # Row 11 Set string value... 11 Label Commented Set string value... 11 Text Comm. endproc procedure CreateEvaluation_NL Create Table with column names... Evaluation_NL 11 ... Label Text # Fill table values # Row 1 Set string value... 1 Label Total Set string value... 1 Text Totaal # Row 2 Set string value... 2 Label Correct Set string value... 2 Text Goed # Row 3 Set string value... 3 Label Problematic Set string value... 3 Text Aanmerkingen # Row 4 Set string value... 4 Label Tones Set string value... 4 Text Tonen # Row 5 Set string value... 5 Label Wrong Set string value... 5 Text Fout # Row 6 Set string value... 6 Label High Set string value... 6 Text Hoog # Row 7 Set string value... 7 Label Low Set string value... 7 Text Laag # Row 8 Set string value... 8 Label Wide Set string value... 8 Text Overdreven # Row 9 Set string value... 9 Label Narrow Set string value... 9 Text Vlak # Row 10 Set string value... 10 Label Unknown Set string value... 10 Text Onbekend # Row 11 Set string value... 11 Label Commented Set string value... 11 Text Opmerk. endproc procedure CreateMainPage Create Table with column names... MainPage 17 ... Label LeftX RightX LowY HighY Color Draw # Fill table values # Row 1 Set string value... 1 Label !Author Set string value... 1 LeftX 0 Set string value... 1 RightX 0 Set string value... 1 LowY 0 Set string value... 1 HighY 0 Set string value... 1 Color Black Set string value... 1 Draw DrawNull # Row 2 Set string value... 2 Label !Copyright Set string value... 2 LeftX 0 Set string value... 2 RightX 0 Set string value... 2 LowY 0 Set string value... 2 HighY 0 Set string value... 2 Color Black Set string value... 2 Draw DrawNull # Row 3 Set string value... 3 Label !License Set string value... 3 LeftX 0 Set string value... 3 RightX 0 Set string value... 3 LowY 0 Set string value... 3 HighY 0 Set string value... 3 Color Black Set string value... 3 Draw DrawNull # Row 4 Set string value... 4 Label !WindowTitle Set string value... 4 LeftX 0 Set string value... 4 RightX 0 Set string value... 4 LowY 0 Set string value... 4 HighY 0 Set string value... 4 Color Black Set string value... 4 Draw DrawNull # Row 5 Set string value... 5 Label !WindowTitle Set string value... 5 LeftX 0 Set string value... 5 RightX 0 Set string value... 5 LowY 0 Set string value... 5 HighY 0 Set string value... 5 Color Black Set string value... 5 Draw DrawNull # Row 6 Set string value... 6 Label Record Set string value... 6 LeftX 15 Set string value... 6 RightX 25 Set string value... 6 LowY 0 Set string value... 6 HighY 10 Set string value... 6 Color Red Set string value... 6 Draw DrawRecord # Row 7 Set string value... 7 Label Play Set string value... 7 LeftX 30 Set string value... 7 RightX 40 Set string value... 7 LowY 0 Set string value... 7 HighY 10 Set string value... 7 Color Red Set string value... 7 Draw DrawPlay # Row 8 Set string value... 8 Label Example Set string value... 8 LeftX 45 Set string value... 8 RightX 55 Set string value... 8 LowY 0 Set string value... 8 HighY 10 Set string value... 8 Color Black Set string value... 8 Draw DrawPlay # Row 9 Set string value... 9 Label Previous Set string value... 9 LeftX 60 Set string value... 9 RightX 70 Set string value... 9 LowY 0 Set string value... 9 HighY 10 Set string value... 9 Color Black Set string value... 9 Draw DrawPrevious # Row 10 Set string value... 10 Label Next Set string value... 10 LeftX 75 Set string value... 10 RightX 85 Set string value... 10 LowY 0 Set string value... 10 HighY 10 Set string value... 10 Color Black Set string value... 10 Draw DrawNext # Row 11 Set string value... 11 Label Quit Set string value... 11 LeftX 90 Set string value... 11 RightX 100 Set string value... 11 LowY 90 Set string value... 11 HighY 100 Set string value... 11 Color Red Set string value... 11 Draw DrawQuit # Row 12 Set string value... 12 Label Config Set string value... 12 LeftX 90 Set string value... 12 RightX 100 Set string value... 12 LowY 77.5 Set string value... 12 HighY 87.5 Set string value... 12 Color Black Set string value... 12 Draw DrawConfig # Row 13 Set string value... 13 Label $WordlistCaption Set string value... 13 LeftX 88 Set string value... 13 RightX 102 Set string value... 13 LowY 70 Set string value... 13 HighY 75 Set string value... 13 Color Black Set string value... 13 Draw DrawNull # Row 14 Set string value... 14 Label WordlistUp Set string value... 14 LeftX 90 Set string value... 14 RightX 100 Set string value... 14 LowY 65 Set string value... 14 HighY 70 Set string value... 14 Color Black Set string value... 14 Draw DrawWordListUp # Row 15 Set string value... 15 Label WordlistDown Set string value... 15 LeftX 90 Set string value... 15 RightX 100 Set string value... 15 LowY 59 Set string value... 15 HighY 64 Set string value... 15 Color Black Set string value... 15 Draw DrawWordListDown # Row 16 Set string value... 16 Label Refresh Set string value... 16 LeftX 0 Set string value... 16 RightX 10 Set string value... 16 LowY 80 Set string value... 16 HighY 90 Set string value... 16 Color Black Set string value... 16 Draw DrawRefresh # Row 17 Set string value... 17 Label Help Set string value... 17 LeftX 0 Set string value... 17 RightX 10 Set string value... 17 LowY 67.5 Set string value... 17 HighY 77.5 Set string value... 17 Color Black Set string value... 17 Draw DrawHelp endproc procedure CreateMainPage_DE Create Table with column names... MainPage_DE 16 ... Label Text Key Helptext # Fill table values # Row 1 Set string value... 1 Label !Author Set string value... 1 Text Autor Set string value... 1 Key Set string value... 1 Helptext R.J.J.H. van Son, \U"bersetzung: Irene Jacobi # Row 2 Set string value... 2 Label !Copyright Set string value... 2 Text Copyright Set string value... 2 Key Set string value... 2 Helptext Copyright 2010 R.J.J.H. van Son \& the NKI # Row 3 Set string value... 3 Label !License Set string value... 3 Text License Set string value... 3 Key Set string value... 3 Helptext GNU GPL version 2 or later # Row 4 Set string value... 4 Label !WindowTitle Set string value... 4 Text Speak Good Chinese: \u"ben sie ihre T\o"ne mit Set string value... 4 Key Set string value... 4 Helptext Speak Good Chinese: \u"ben sie ihre T\o"ne mit # Row 5 Set string value... 5 Label Record Set string value... 5 Text Aufnahme Set string value... 5 Key A Set string value... 5 Helptext Machen Sie eine Sprachaufnahme. Sie haben 4 Sekunden bevor die Aufnahme beginnt; achten Sie auf das rote Licht. # Row 6 Set string value... 6 Label Play Set string value... 6 Text Wiedergabe Set string value... 6 Key W Set string value... 6 Helptext Abspielen der Aufnahme # Row 7 Set string value... 7 Label Example Set string value... 7 Text Vorbild Set string value... 7 Key V Set string value... 7 Helptext Vorbild abspielen # Row 8 Set string value... 8 Label Quit Set string value... 8 Text Ende Set string value... 8 Key E Set string value... 8 Helptext Das Programm beenden # Row 9 Set string value... 9 Label Config Set string value... 9 Text Einstellungen Set string value... 9 Key g Set string value... 9 Helptext Zur Seite "Einstellungen" # Row 10 Set string value... 10 Label Refresh Set string value... 10 Text Aktualisieren Set string value... 10 Key u Set string value... 10 Helptext Der aktuelle Bildschirm wird abgebildet. Mit der Leertaste kann der Bildschirm aktualisiert werden. # Row 11 Set string value... 11 Label Help Set string value... 11 Text Hilfe Set string value... 11 Key ?/ Set string value... 11 Helptext Dr\u"cken Sie auf den Knopf \u"ber den Sie Informationen m\o"chten. Dr\u"cken Sie danach auf "Hilfe". # Row 12 Set string value... 12 Label $WordlistCaption Set string value... 12 Text Wordliste Set string value... 12 Key Set string value... 12 Helptext \A"ndere Wordliste # Row 13 Set string value... 13 Label WordlistUp Set string value... 13 Text -vorige Set string value... 13 Key \-_ Set string value... 13 Helptext Zur voriger Liste # Row 14 Set string value... 14 Label WordlistDown Set string value... 14 Text +n\a"chste Set string value... 14 Key += Set string value... 14 Helptext Zur n\a"chster Liste # Row 15 Set string value... 15 Label Previous Set string value... 15 Text Set string value... 16 Key \>\. Set string value... 16 Helptext zum n\a"chsten Abschnitt endproc procedure CreateMainPage_EN Create Table with column names... MainPage_EN 16 ... Label Text Key Helptext # Fill table values # Row 1 Set string value... 1 Label !Author Set string value... 1 Text Author Set string value... 1 Key ! Set string value... 1 Helptext R.J.J.H. van Son # Row 2 Set string value... 2 Label !Copyright Set string value... 2 Text Copyright Set string value... 2 Key ! Set string value... 2 Helptext Copyright 2010 R.J.J.H. van Son \& the NKI # Row 3 Set string value... 3 Label !License Set string value... 3 Text License Set string value... 3 Key ! Set string value... 3 Helptext GNU GPL version 2 or later # Row 4 Set string value... 4 Label !WindowTitle Set string value... 4 Text Speak Good Chinese: Practise your tones with Set string value... 4 Key ! Set string value... 4 Helptext Speak Good Chinese: Practise your tones with # Row 5 Set string value... 5 Label Record Set string value... 5 Text Record Set string value... 5 Key R Set string value... 5 Helptext Record your pronunciation. You have 4 seconds, watch the recording "light" # Row 6 Set string value... 6 Label Play Set string value... 6 Text Play Set string value... 6 Key P Set string value... 6 Helptext Play back of your recorded pronunciation # Row 7 Set string value... 7 Label Example Set string value... 7 Text Example Set string value... 7 Key E Set string value... 7 Helptext Play example tone pronunciation # Row 8 Set string value... 8 Label Previous Set string value... 8 Text < Previous Set string value... 8 Key <, Set string value... 8 Helptext Previous word # Row 9 Set string value... 9 Label Next Set string value... 9 Text Next > Set string value... 9 Key >. Set string value... 9 Helptext Next word # Row 10 Set string value... 10 Label Quit Set string value... 10 Text Quit Set string value... 10 Key Q Set string value... 10 Helptext Quit SpeakGoodChinese # Row 11 Set string value... 11 Label Config Set string value... 11 Text Settings Set string value... 11 Key S Set string value... 11 Helptext Go to settings page # Row 12 Set string value... 12 Label $WordlistCaption Set string value... 12 Text Word List Set string value... 12 Key Set string value... 12 Helptext Change word list # Row 13 Set string value... 13 Label WordlistUp Set string value... 13 Text Previous- Set string value... 13 Key v\-_ Set string value... 13 Helptext Previous word list # Row 14 Set string value... 14 Label WordlistDown Set string value... 14 Text Next+ Set string value... 14 Key N+= Set string value... 14 Helptext Next word list # Row 15 Set string value... 15 Label Refresh Set string value... 15 Text Refresh Set string value... 15 Key h Set string value... 15 Helptext Redraw the current screen, the space-bar always refreshes screen # Row 16 Set string value... 16 Label Help Set string value... 16 Text Help Set string value... 16 Key ?/ Set string value... 16 Helptext Press on the button you want information on, "Help" to continue endproc procedure CreateMainPage_NL Create Table with column names... MainPage_NL 16 ... Label Text Key Helptext # Fill table values # Row 1 Set string value... 1 Label !Author Set string value... 1 Text Auteur Set string value... 1 Key ! Set string value... 1 Helptext R.J.J.H. van Son # Row 2 Set string value... 2 Label !Copyright Set string value... 2 Text Copyright Set string value... 2 Key ! Set string value... 2 Helptext Copyright 2010 R.J.J.H. van Son \& the NKI # Row 3 Set string value... 3 Label !License Set string value... 3 Text Licentie Set string value... 3 Key ! Set string value... 3 Helptext GNU GPL version 2 or later # Row 4 Set string value... 4 Label !WindowTitle Set string value... 4 Text SpeakGoodChinese: Tonen oefenen met Set string value... 4 Key ! Set string value... 4 Helptext SpeakGoodChinese: Tonen oefenen met # Row 5 Set string value... 5 Label Record Set string value... 5 Text Opnemen Set string value... 5 Key O Set string value... 5 Helptext Neem je uitspraak op. Je hebt 4 seconden, let op het rode "lampje" # Row 6 Set string value... 6 Label Play Set string value... 6 Text Afspelen Set string value... 6 Key A Set string value... 6 Helptext Speel je opgenomen uitspraak af # Row 7 Set string value... 7 Label Example Set string value... 7 Text Voorbeeld Set string value... 7 Key V Set string value... 7 Helptext Speel een voorbeeld van deze toon af # Row 8 Set string value... 8 Label Previous Set string value... 8 Text < Terug Set string value... 8 Key <, Set string value... 8 Helptext Vorige woord # Row 9 Set string value... 9 Label Next Set string value... 9 Text Vooruit > Set string value... 9 Key >. Set string value... 9 Helptext Volgende woord # Row 10 Set string value... 10 Label Quit Set string value... 10 Text Stop Set string value... 10 Key S Set string value... 10 Helptext Stop SpeakGoodChinese # Row 11 Set string value... 11 Label Config Set string value... 11 Text Instellingen Set string value... 11 Key I Set string value... 11 Helptext Ga naar de pagina met instellingen # Row 12 Set string value... 12 Label $WordlistCaption Set string value... 12 Text Woordenlijst Set string value... 12 Key Set string value... 12 Helptext Andere woordenlijst # Row 13 Set string value... 13 Label WordlistUp Set string value... 13 Text Vorige Set string value... 13 Key g\-_ Set string value... 13 Helptext Vorige woordenlijst # Row 14 Set string value... 14 Label WordlistDown Set string value... 14 Text Volgende Set string value... 14 Key l+= Set string value... 14 Helptext Volgende woordenlijst # Row 15 Set string value... 15 Label Refresh Set string value... 15 Text Ververs Set string value... 15 Key r Set string value... 15 Helptext Ververs de huidige pagina, de spatiebalk ververst altijd de pagina # Row 16 Set string value... 16 Label Help Set string value... 16 Text Help Set string value... 16 Key ?/ Set string value... 16 Helptext Druk op de knop waar u informatie over wilt hebben, "Help" als u verder wilt endproc procedure CreateToneFeedback_DE Create Table with column names... ToneFeedback_DE 36 ... T1 T2 Feedback # Fill table values # Row 1 Set string value... 1 T1 !Author Set string value... 1 T2 Author Set string value... 1 Feedback R.J.J.H. van Son # Row 2 Set string value... 2 T1 !Copyright Set string value... 2 T2 Copyright Set string value... 2 Feedback 2007-2010 R.J.J.H. van Son and 2010 the Netherlands Cancer Institute # Row 3 Set string value... 3 T1 !License Set string value... 3 T2 License Set string value... 3 Feedback GNU GPL version 2 or later # Row 4 Set string value... 4 T1 Correct Set string value... 4 T2 - Set string value... 4 Feedback Richtig # Row 5 Set string value... 5 T1 Wrong Set string value... 5 T2 - Set string value... 5 Feedback Falsch # Row 6 Set string value... 6 T1 NoSound Set string value... 6 T2 - Set string value... 6 Feedback Kein Ton aufgezeichnet # Row 7 Set string value... 7 T1 Low Set string value... 7 T2 - Set string value... 7 Feedback Ihre T\o"ne waren zu niedrig, um erkennt zu werden (ist ihre Stimme richtig eingestellt?) # Row 8 Set string value... 8 T1 High Set string value... 8 T2 - Set string value... 8 Feedback Ihre T\o"ne waren zu hoch, aber vielleicht zu erkennen (ist ihre Stimme richtig eingestellt?) # Row 9 Set string value... 9 T1 Narrow Set string value... 9 T2 - Set string value... 9 Feedback Ihre Tonbewegungen waren zu flach, um erkennt werden # Row 10 Set string value... 10 T1 Wide Set string value... 10 T2 - Set string value... 10 Feedback Ihre Tonbewegungen waren zu weidl\a"ufig, aber vielleicht erkennbar # Row 11 Set string value... 11 T1 6 Set string value... 11 T2 - Set string value... 11 Feedback kein erkennbarer Ton # Row 12 Set string value... 12 T1 1 Set string value... 12 T2 - Set string value... 12 Feedback Der erster Ton ist hoch und flach # Row 13 Set string value... 13 T1 2 Set string value... 13 T2 - Set string value... 13 Feedback Der zweiter Ton beginnt mittel-hoch und geht nach oben # Row 14 Set string value... 14 T1 3 Set string value... 14 T2 - Set string value... 14 Feedback Der dritter Ton beginnt mittel-hoch geht nach unten und dann nach oben # Row 15 Set string value... 15 T1 4 Set string value... 15 T2 - Set string value... 15 Feedback Der vierter Ton beginnt hoch und geht den ganzen Weg # Row 16 Set string value... 16 T1 0 Set string value... 16 T2 - Set string value... 16 Feedback Der neutraler Ton geht weiter, wo der voriger Ton aufh\o"rt # Row 17 Set string value... 17 T1 1 Set string value... 17 T2 1 Set string value... 17 Feedback Halten Sie die T\o"ne hoch und flach # Row 18 Set string value... 18 T1 1 Set string value... 18 T2 2 Set string value... 18 Feedback Der zweiter Ton beginnt mittel-hoch und geht nach oben # Row 19 Set string value... 19 T1 1 Set string value... 19 T2 3 Set string value... 19 Feedback Der dritter Ton beginnt mittel-hoch geht nach unten und dann nach oben # Row 20 Set string value... 20 T1 1 Set string value... 20 T2 4 Set string value... 20 Feedback Der vierter Ton beginnt hoch und geht gans nach unten # Row 21 Set string value... 21 T1 1 Set string value... 21 T2 0 Set string value... 21 Feedback Der neutraler Ton weiter, wo der voriger Ton aufh\o"rt # Row 22 Set string value... 22 T1 2 Set string value... 22 T2 1 Set string value... 22 Feedback Halten Sie den ersten Ton hoch und flach # Row 23 Set string value... 23 T1 2 Set string value... 23 T2 2 Set string value... 23 Feedback Der zweiter Ton beginnt mittel-hoch und geht nach oben # Row 24 Set string value... 24 T1 2 Set string value... 24 T2 3 Set string value... 24 Feedback Der dritter Ton beginnt mittel-hoch geht nach unten und dann nach oben # Row 25 Set string value... 25 T1 2 Set string value... 25 T2 4 Set string value... 25 Feedback Der vierter Ton beginnt hoch und geht gans nach unten # Row 26 Set string value... 26 T1 2 Set string value... 26 T2 0 Set string value... 26 Feedback Der neutraler Ton weiter, wo der voriger Ton aufh\o"rt # Row 27 Set string value... 27 T1 3 Set string value... 27 T2 1 Set string value... 27 Feedback Halten Sie den ersten Ton hoch und flach # Row 28 Set string value... 28 T1 3 Set string value... 28 T2 2 Set string value... 28 Feedback Der zweiter Ton beginnt mittel-hoch und geht nach oben # Row 29 Set string value... 29 T1 3 Set string value... 29 T2 3 Set string value... 29 Feedback Sprechen wie eine 2-3 Kombination # Row 30 Set string value... 30 T1 3 Set string value... 30 T2 4 Set string value... 30 Feedback Der vierte Ton beginnt hoch und geht gans nach unten # Row 31 Set string value... 31 T1 3 Set string value... 31 T2 0 Set string value... 31 Feedback Der neutraler Ton weiter, wo der voriger Ton aufh\o"rt # Row 32 Set string value... 32 T1 4 Set string value... 32 T2 1 Set string value... 32 Feedback Halten Sie den ersten Ton hoch und flach # Row 33 Set string value... 33 T1 4 Set string value... 33 T2 2 Set string value... 33 Feedback Der zweiter Ton beginnt mittel-hoch und geht nach oben # Row 34 Set string value... 34 T1 4 Set string value... 34 T2 3 Set string value... 34 Feedback Der dritter Ton beginnt mittel-hoch geht nach unten und dann nach oben # Row 35 Set string value... 35 T1 4 Set string value... 35 T2 4 Set string value... 35 Feedback Der vierter Ton beginnt hoch und geht ganz nach unten, # Row 36 Set string value... 36 T1 4 Set string value... 36 T2 0 Set string value... 36 Feedback Der neutraler Ton weiter, wo der voriger Ton aufh\o"rt endproc procedure CreateToneFeedback_EN Create Table with column names... ToneFeedback_EN 36 ... T1 T2 Feedback # Fill table values # Row 1 Set string value... 1 T1 !Author Set string value... 1 T2 Author Set string value... 1 Feedback R.J.J.H. van Son # Row 2 Set string value... 2 T1 !Copyright Set string value... 2 T2 Copyright Set string value... 2 Feedback 2007-2010 R.J.J.H. van Son and 2010 the Netherlands Cancer Institute # Row 3 Set string value... 3 T1 !License Set string value... 3 T2 License Set string value... 3 Feedback GNU GPL version 2 or later # Row 4 Set string value... 4 T1 Correct Set string value... 4 T2 - Set string value... 4 Feedback Correct # Row 5 Set string value... 5 T1 Wrong Set string value... 5 T2 - Set string value... 5 Feedback Wrong # Row 6 Set string value... 6 T1 NoSound Set string value... 6 T2 - Set string value... 6 Feedback No sound recorded # Row 7 Set string value... 7 T1 Low Set string value... 7 T2 - Set string value... 7 Feedback Your tones were too low to be recognized (is you voice setting correct?) # Row 8 Set string value... 8 T1 High Set string value... 8 T2 - Set string value... 8 Feedback Your tones were too high but might be recognizable (is you voice setting correct?) # Row 9 Set string value... 9 T1 Narrow Set string value... 9 T2 - Set string value... 9 Feedback Your tone movements were too flat to be recognized # Row 10 Set string value... 10 T1 Wide Set string value... 10 T2 - Set string value... 10 Feedback Your tone movements were too wide but might be recognizable # Row 11 Set string value... 11 T1 6 Set string value... 11 T2 - Set string value... 11 Feedback Not a recognizable tone # Row 12 Set string value... 12 T1 1 Set string value... 12 T2 - Set string value... 12 Feedback The first tone is high and flat # Row 13 Set string value... 13 T1 2 Set string value... 13 T2 - Set string value... 13 Feedback The second tone starts mid-range and goes up # Row 14 Set string value... 14 T1 3 Set string value... 14 T2 - Set string value... 14 Feedback The third tone starts mid-range goes down and then up # Row 15 Set string value... 15 T1 4 Set string value... 15 T2 - Set string value... 15 Feedback The fourth tone starts high and goes down all the way # Row 16 Set string value... 16 T1 0 Set string value... 16 T2 - Set string value... 16 Feedback The neutral tone continues where the previous tone stops # Row 17 Set string value... 17 T1 1 Set string value... 17 T2 1 Set string value... 17 Feedback Keep the tones high and flat # Row 18 Set string value... 18 T1 1 Set string value... 18 T2 2 Set string value... 18 Feedback The second tone starts mid-range and goes up # Row 19 Set string value... 19 T1 1 Set string value... 19 T2 3 Set string value... 19 Feedback The third tone starts mid-range goes down and then up # Row 20 Set string value... 20 T1 1 Set string value... 20 T2 4 Set string value... 20 Feedback The fourth tone starts high and goes down all the way # Row 21 Set string value... 21 T1 1 Set string value... 21 T2 0 Set string value... 21 Feedback The neutral tone continues where the previous tone stops # Row 22 Set string value... 22 T1 2 Set string value... 22 T2 1 Set string value... 22 Feedback Keep the first tone high and flat # Row 23 Set string value... 23 T1 2 Set string value... 23 T2 2 Set string value... 23 Feedback The second tone starts mid-range and goes up # Row 24 Set string value... 24 T1 2 Set string value... 24 T2 3 Set string value... 24 Feedback The third tone starts mid-range goes down and then up # Row 25 Set string value... 25 T1 2 Set string value... 25 T2 4 Set string value... 25 Feedback The fourth tone starts high and goes down all the way # Row 26 Set string value... 26 T1 2 Set string value... 26 T2 0 Set string value... 26 Feedback The neutral tone continues where the previous tone stops # Row 27 Set string value... 27 T1 3 Set string value... 27 T2 1 Set string value... 27 Feedback Keep the first tone high and flat # Row 28 Set string value... 28 T1 3 Set string value... 28 T2 2 Set string value... 28 Feedback The second tone starts mid-range and goes up # Row 29 Set string value... 29 T1 3 Set string value... 29 T2 3 Set string value... 29 Feedback Pronounce as a 2-3 combination # Row 30 Set string value... 30 T1 3 Set string value... 30 T2 4 Set string value... 30 Feedback The fourth tone starts high and goes down all the way # Row 31 Set string value... 31 T1 3 Set string value... 31 T2 0 Set string value... 31 Feedback The neutral tone continues where the previous tone stops # Row 32 Set string value... 32 T1 4 Set string value... 32 T2 1 Set string value... 32 Feedback Keep the first tone high and flat # Row 33 Set string value... 33 T1 4 Set string value... 33 T2 2 Set string value... 33 Feedback The second tone starts mid-range and goes up # Row 34 Set string value... 34 T1 4 Set string value... 34 T2 3 Set string value... 34 Feedback The third tone starts mid-range goes down and then up # Row 35 Set string value... 35 T1 4 Set string value... 35 T2 4 Set string value... 35 Feedback The fourth tone starts high and goes down all the way # Row 36 Set string value... 36 T1 4 Set string value... 36 T2 0 Set string value... 36 Feedback The neutral tone continues where the previous tone stops endproc procedure CreateToneFeedback_NL Create Table with column names... ToneFeedback_NL 36 ... T1 T2 Feedback # Fill table values # Row 1 Set string value... 1 T1 !Author Set string value... 1 T2 Auteur Set string value... 1 Feedback R.J.J.H. van Son # Row 2 Set string value... 2 T1 !Copyright Set string value... 2 T2 Copyright Set string value... 2 Feedback 2007-2010 R.J.J.H. van Son and 2010 the Netherlands Cancer Institute # Row 3 Set string value... 3 T1 !License Set string value... 3 T2 License Set string value... 3 Feedback GNU GPL version 2 or later # Row 4 Set string value... 4 T1 Correct Set string value... 4 T2 - Set string value... 4 Feedback Goed # Row 5 Set string value... 5 T1 Wrong Set string value... 5 T2 - Set string value... 5 Feedback Fout # Row 6 Set string value... 6 T1 NoSound Set string value... 6 T2 - Set string value... 6 Feedback Geen geluid opgenomen # Row 7 Set string value... 7 T1 Low Set string value... 7 T2 - Set string value... 7 Feedback Uw tonen waren te laag uitgesproken om herkend te worden (is uw stem juist ingesteld?) # Row 8 Set string value... 8 T1 High Set string value... 8 T2 - Set string value... 8 Feedback Uw tonen waren te hoog uitgesproken maar misschien toch herkenbaar (is uw stem juist ingesteld?) # Row 9 Set string value... 9 T1 Narrow Set string value... 9 T2 - Set string value... 9 Feedback Uw toonbewegingen ware te vlak om herkend te worden # Row 10 Set string value... 10 T1 Wide Set string value... 10 T2 - Set string value... 10 Feedback Uw toonbewegingen waren overdreven maar misschien toch herkenbaar # Row 11 Set string value... 11 T1 6 Set string value... 11 T2 - Set string value... 11 Feedback Geen herkenbare toon # Row 12 Set string value... 12 T1 1 Set string value... 12 T2 - Set string value... 12 Feedback De eerste toon is hoog en vlak # Row 13 Set string value... 13 T1 2 Set string value... 13 T2 - Set string value... 13 Feedback De tweede toon begint in het midden en gaat omhoog # Row 14 Set string value... 14 T1 3 Set string value... 14 T2 - Set string value... 14 Feedback De derde toon begin in het midden, gaat helemaal omlaag en dan omhoog # Row 15 Set string value... 15 T1 4 Set string value... 15 T2 - Set string value... 15 Feedback De vierde toon begint hoog en gaat helemaal naar beneden # Row 16 Set string value... 16 T1 0 Set string value... 16 T2 - Set string value... 16 Feedback De neutrale toon gaat ongeveer verder waar de vorige toon stopt # Row 17 Set string value... 17 T1 1 Set string value... 17 T2 1 Set string value... 17 Feedback Houd de tonen hoog en vlak # Row 18 Set string value... 18 T1 1 Set string value... 18 T2 2 Set string value... 18 Feedback De tweede toon begint in het midden en gaat omhoog # Row 19 Set string value... 19 T1 1 Set string value... 19 T2 3 Set string value... 19 Feedback De derde toon begin in het midden, gaat helemaal omlaag en dan omhoog # Row 20 Set string value... 20 T1 1 Set string value... 20 T2 4 Set string value... 20 Feedback De vierde toon begint hoog en gaat helemaal naar beneden # Row 21 Set string value... 21 T1 1 Set string value... 21 T2 0 Set string value... 21 Feedback De neutrale toon gaat ongeveer verder waar de vorige toon stopt # Row 22 Set string value... 22 T1 2 Set string value... 22 T2 1 Set string value... 22 Feedback De eerste toon is hoog en vlak # Row 23 Set string value... 23 T1 2 Set string value... 23 T2 2 Set string value... 23 Feedback De tweede toon begint in het midden en gaat omhoog # Row 24 Set string value... 24 T1 2 Set string value... 24 T2 3 Set string value... 24 Feedback De derde toon begin in het midden, gaat helemaal omlaag en dan omhoog # Row 25 Set string value... 25 T1 2 Set string value... 25 T2 4 Set string value... 25 Feedback De vierde toon begint hoog en gaat helemaal naar beneden # Row 26 Set string value... 26 T1 2 Set string value... 26 T2 0 Set string value... 26 Feedback De neutrale toon gaat ongeveer verder waar de vorige toon stopt # Row 27 Set string value... 27 T1 3 Set string value... 27 T2 1 Set string value... 27 Feedback Houd de tonen hoog en vlak # Row 28 Set string value... 28 T1 3 Set string value... 28 T2 2 Set string value... 28 Feedback De tweede toon begint in het midden en gaat omhoog # Row 29 Set string value... 29 T1 3 Set string value... 29 T2 3 Set string value... 29 Feedback Spreek twee derde tonen uit als een tweede toon gevolgd door een derde # Row 30 Set string value... 30 T1 3 Set string value... 30 T2 4 Set string value... 30 Feedback De vierde toon begint hoog en gaat helemaal naar beneden # Row 31 Set string value... 31 T1 3 Set string value... 31 T2 0 Set string value... 31 Feedback De neutrale toon gaat ongeveer verder waar de vorige toon stopt # Row 32 Set string value... 32 T1 4 Set string value... 32 T2 1 Set string value... 32 Feedback Houd de tonen hoog en vlak # Row 33 Set string value... 33 T1 4 Set string value... 33 T2 2 Set string value... 33 Feedback De tweede toon begint in het midden en gaat omhoog # Row 34 Set string value... 34 T1 4 Set string value... 34 T2 3 Set string value... 34 Feedback De derde toon begin in het midden, gaat helemaal omlaag en dan omhoog # Row 35 Set string value... 35 T1 4 Set string value... 35 T2 4 Set string value... 35 Feedback De vierde toon begint hoog en gaat helemaal naar beneden # Row 36 Set string value... 36 T1 4 Set string value... 36 T2 0 Set string value... 36 Feedback De neutrale toon gaat ongeveer verder waar de vorige toon stopt endproc procedure CreateCreateTables Create Table with column names... CreateTables 18 ... Name # Fill table values # Row 1 Set string value... 1 Name Background # Row 2 Set string value... 2 Name Config # Row 3 Set string value... 3 Name Config_DE # Row 4 Set string value... 4 Name Config_EN # Row 5 Set string value... 5 Name Config_NL # Row 6 Set string value... 6 Name Credits_DE # Row 7 Set string value... 7 Name Credits_EN # Row 8 Set string value... 8 Name Credits_NL # Row 9 Set string value... 9 Name Evaluation_DE # Row 10 Set string value... 10 Name Evaluation_EN # Row 11 Set string value... 11 Name Evaluation_NL # Row 12 Set string value... 12 Name MainPage # Row 13 Set string value... 13 Name MainPage_DE # Row 14 Set string value... 14 Name MainPage_EN # Row 15 Set string value... 15 Name MainPage_NL # Row 16 Set string value... 16 Name ToneFeedback_DE # Row 17 Set string value... 17 Name ToneFeedback_EN # Row 18 Set string value... 18 Name ToneFeedback_NL endproc # CreateWordlists.praat # # Automatically created code! # Any changes will be lost when this file is regenerated. # Adapt the original Tables instead of this code. # To regenerate the original Tables, run a Praat script # with the following code: # #: include tables2scripts.praat #: call Create #: Write to table file... .Table # # Where is the name of the table. # Move the Table file to the desired location (eg, Data/) # # Tables and this code are licensed under the GNU GPL version 2 # or later. # procedure CreateChinees_een_Makkie_chapters_1_+_2 Create Table with column names... Chinees_een_Makkie_chapters_1_+_2 25 ... Pinyin Character Sound # Fill table values # Row 1 Set string value... 1 Pinyin ni3hao3 Set string value... 1 Character - Set string value... 1 Sound - # Row 2 Set string value... 2 Pinyin ni3 Set string value... 2 Character - Set string value... 2 Sound - # Row 3 Set string value... 3 Pinyin hao3 Set string value... 3 Character - Set string value... 3 Sound - # Row 4 Set string value... 4 Pinyin wo3 Set string value... 4 Character - Set string value... 4 Sound - # Row 5 Set string value... 5 Pinyin jiao4 Set string value... 5 Character - Set string value... 5 Sound - # Row 6 Set string value... 6 Pinyin shi4 Set string value... 6 Character - Set string value... 6 Sound - # Row 7 Set string value... 7 Pinyin he2lan2 Set string value... 7 Character - Set string value... 7 Sound - # Row 8 Set string value... 8 Pinyin ren2 Set string value... 8 Character - Set string value... 8 Sound - # Row 9 Set string value... 9 Pinyin hen3 Set string value... 9 Character - Set string value... 9 Sound - # Row 10 Set string value... 10 Pinyin ma0 Set string value... 10 Character - Set string value... 10 Sound - # Row 11 Set string value... 11 Pinyin ye3 Set string value... 11 Character - Set string value... 11 Sound - # Row 12 Set string value... 12 Pinyin xie4xie0 Set string value... 12 Character 谢谢 Set string value... 12 Sound - # Row 13 Set string value... 13 Pinyin zai4jian4 Set string value... 13 Character - Set string value... 13 Sound - # Row 14 Set string value... 14 Pinyin ne0 Set string value... 14 Character - Set string value... 14 Sound - # Row 15 Set string value... 15 Pinyin zhong1guo2 Set string value... 15 Character - Set string value... 15 Sound - # Row 16 Set string value... 16 Pinyin de2guo2 Set string value... 16 Character - Set string value... 16 Sound - # Row 17 Set string value... 17 Pinyin fa3guo2 Set string value... 17 Character - Set string value... 17 Sound - # Row 18 Set string value... 18 Pinyin ming2tian1 Set string value... 18 Character - Set string value... 18 Sound - # Row 19 Set string value... 19 Pinyin xia4wu3 Set string value... 19 Character - Set string value... 19 Sound - # Row 20 Set string value... 20 Pinyin wan3an1 Set string value... 20 Character - Set string value... 20 Sound - # Row 21 Set string value... 21 Pinyin jian4 Set string value... 21 Character - Set string value... 21 Sound - # Row 22 Set string value... 22 Pinyin shen2me0 Set string value... 22 Character - Set string value... 22 Sound - # Row 23 Set string value... 23 Pinyin zhu4 Set string value... 23 Character - Set string value... 23 Sound - # Row 24 Set string value... 24 Pinyin zai4 Set string value... 24 Character - Set string value... 24 Sound - # Row 25 Set string value... 25 Pinyin nar3 Set string value... 25 Character - Set string value... 25 Sound - endproc procedure CreateChinese_for_Today_chapters_1_+_2 Create Table with column names... Chinese_for_Today_chapters_1_+_2 52 ... Pinyin Character Sound # Fill table values # Row 1 Set string value... 1 Pinyin huan1ying2 Set string value... 1 Character - Set string value... 1 Sound - # Row 2 Set string value... 2 Pinyin nin2 Set string value... 2 Character - Set string value... 2 Sound - # Row 3 Set string value... 3 Pinyin hao3 Set string value... 3 Character - Set string value... 3 Sound - # Row 4 Set string value... 4 Pinyin nin2hao3 Set string value... 4 Character - Set string value... 4 Sound - # Row 5 Set string value... 5 Pinyin hua2qiao2 Set string value... 5 Character - Set string value... 5 Sound - # Row 6 Set string value... 6 Pinyin ni3 Set string value... 6 Character - Set string value... 6 Sound - # Row 7 Set string value... 7 Pinyin qing3wen4 Set string value... 7 Character - Set string value... 7 Sound - # Row 8 Set string value... 8 Pinyin shi4 Set string value... 8 Character - Set string value... 8 Sound - # Row 9 Set string value... 9 Pinyin xian1sheng0 Set string value... 9 Character - Set string value... 9 Sound - # Row 10 Set string value... 10 Pinyin ma0 Set string value... 10 Character - Set string value... 10 Sound - # Row 11 Set string value... 11 Pinyin wo3 Set string value... 11 Character - Set string value... 11 Sound - # Row 12 Set string value... 12 Pinyin bu4 Set string value... 12 Character - Set string value... 12 Sound - # Row 13 Set string value... 13 Pinyin mei2 Set string value... 13 Character - Set string value... 13 Sound - # Row 14 Set string value... 14 Pinyin guan1xi0 Set string value... 14 Character - Set string value... 14 Sound - # Row 15 Set string value... 15 Pinyin zia4jian4 Set string value... 15 Character - Set string value... 15 Sound - # Row 16 Set string value... 16 Pinyin dui4 Set string value... 16 Character - Set string value... 16 Sound - # Row 17 Set string value... 17 Pinyin de0 Set string value... 17 Character - Set string value... 17 Sound - # Row 18 Set string value... 18 Pinyin jiao4 Set string value... 18 Character - Set string value... 18 Sound - # Row 19 Set string value... 19 Pinyin xie4xie0 Set string value... 19 Character - Set string value... 19 Sound - # Row 20 Set string value... 20 Pinyin xiao3jie0 Set string value... 20 Character - Set string value... 20 Sound - # Row 21 Set string value... 21 Pinyin lv3you2 Set string value... 21 Character - Set string value... 21 Sound - # Row 22 Set string value... 22 Pinyin na4me0 Set string value... 22 Character - Set string value... 22 Sound - # Row 23 Set string value... 23 Pinyin yi2ding4 Set string value... 23 Character - Set string value... 23 Sound - # Row 24 Set string value... 24 Pinyin jie4shao4 Set string value... 24 Character - Set string value... 24 Sound - # Row 25 Set string value... 25 Pinyin qing3 Set string value... 25 Character - Set string value... 25 Sound - # Row 26 Set string value... 26 Pinyin jin4 Set string value... 26 Character - Set string value... 26 Sound - # Row 27 Set string value... 27 Pinyin qing3jin4 Set string value... 27 Character - Set string value... 27 Sound - # Row 28 Set string value... 28 Pinyin a4 Set string value... 28 Character - Set string value... 28 Sound - # Row 29 Set string value... 29 Pinyin lao3 Set string value... 29 Character - Set string value... 29 Sound - # Row 30 Set string value... 30 Pinyin zuo4 Set string value... 30 Character - Set string value... 30 Sound - # Row 31 Set string value... 31 Pinyin chou1yan1 Set string value... 31 Character - Set string value... 31 Sound - # Row 32 Set string value... 32 Pinyin hui4 Set string value... 32 Character - Set string value... 32 Sound - # Row 33 Set string value... 33 Pinyin lai2 Set string value... 33 Character - Set string value... 33 Sound - # Row 34 Set string value... 34 Pinyin yi2xia4 Set string value... 34 Character - Set string value... 34 Sound - # Row 35 Set string value... 35 Pinyin zhe4 Set string value... 35 Character - Set string value... 35 Sound - # Row 36 Set string value... 36 Pinyin tai4tai0 Set string value... 36 Character - Set string value... 36 Sound - # Row 37 Set string value... 37 Pinyin bo2bo0 Set string value... 37 Character - Set string value... 37 Sound - # Row 38 Set string value... 38 Pinyin nv3er2 Set string value... 38 Character - Set string value... 38 Sound - # Row 39 Set string value... 39 Pinyin na4 Set string value... 39 Character - Set string value... 39 Sound - # Row 40 Set string value... 40 Pinyin er2zi0 Set string value... 40 Character - Set string value... 40 Sound - # Row 41 Set string value... 41 Pinyin men0 Set string value... 41 Character - Set string value... 41 Sound - # Row 42 Set string value... 42 Pinyin ni3men0 Set string value... 42 Character - Set string value... 42 Sound - # Row 43 Set string value... 43 Pinyin he1 Set string value... 43 Character - Set string value... 43 Sound - # Row 44 Set string value... 44 Pinyin cha2 Set string value... 44 Character - Set string value... 44 Sound - # Row 45 Set string value... 45 Pinyin ye2ye0 Set string value... 45 Character - Set string value... 45 Sound - # Row 46 Set string value... 46 Pinyin nai3nai0 Set string value... 46 Character - Set string value... 46 Sound - # Row 47 Set string value... 47 Pinyin shu1shu0 Set string value... 47 Character - Set string value... 47 Sound - # Row 48 Set string value... 48 Pinyin pi2jiu3 Set string value... 48 Character - Set string value... 48 Sound - # Row 49 Set string value... 49 Pinyin ka1fei1 Set string value... 49 Character - Set string value... 49 Sound - # Row 50 Set string value... 50 Pinyin a0 Set string value... 50 Character - Set string value... 50 Sound - # Row 51 Set string value... 51 Pinyin a2 Set string value... 51 Character - Set string value... 51 Sound - # Row 52 Set string value... 52 Pinyin ha1 Set string value... 52 Character - Set string value... 52 Sound - endproc procedure CreateColloquial_Chinese_chapters_1_+_2 Create Table with column names... Colloquial_Chinese_chapters_1_+_2 74 ... Pinyin Character Sound # Fill table values # Row 1 Set string value... 1 Pinyin chu1 Set string value... 1 Character - Set string value... 1 Sound - # Row 2 Set string value... 2 Pinyin ci4 Set string value... 2 Character - Set string value... 2 Sound - # Row 3 Set string value... 3 Pinyin jian4mian4 Set string value... 3 Character - Set string value... 3 Sound - # Row 4 Set string value... 4 Pinyin ni3 Set string value... 4 Character - Set string value... 4 Sound - # Row 5 Set string value... 5 Pinyin shi4 Set string value... 5 Character - Set string value... 5 Sound - # Row 6 Set string value... 6 Pinyin xian1sheng0 Set string value... 6 Character - Set string value... 6 Sound - # Row 7 Set string value... 7 Pinyin ma0 Set string value... 7 Character - Set string value... 7 Sound - # Row 8 Set string value... 8 Pinyin shi4de0 Set string value... 8 Character - Set string value... 8 Sound - # Row 9 Set string value... 9 Pinyin wo3 Set string value... 9 Character - Set string value... 9 Sound - # Row 10 Set string value... 10 Pinyin hao3 Set string value... 10 Character - Set string value... 10 Sound - # Row 11 Set string value... 11 Pinyin ni3hao3 Set string value... 11 Character - Set string value... 11 Sound - # Row 12 Set string value... 12 Pinyin hen3 Set string value... 12 Character - Set string value... 12 Sound - # Row 13 Set string value... 13 Pinyin gao1xing4 Set string value... 13 Character - Set string value... 13 Sound - # Row 14 Set string value... 14 Pinyin jian4dao4 Set string value... 14 Character - Set string value... 14 Sound - # Row 15 Set string value... 15 Pinyin ye3 Set string value... 15 Character - Set string value... 15 Sound - # Row 16 Set string value... 16 Pinyin jiao4 Set string value... 16 Character - Set string value... 16 Sound - # Row 17 Set string value... 17 Pinyin lao3 Set string value... 17 Character - Set string value... 17 Sound - # Row 18 Set string value... 18 Pinyin ba0 Set string value... 18 Character - Set string value... 18 Sound - # Row 19 Set string value... 19 Pinyin hao3de0 Set string value... 19 Character - Set string value... 19 Sound - # Row 20 Set string value... 20 Pinyin qing3 Set string value... 20 Character - Set string value... 20 Sound - # Row 21 Set string value... 21 Pinyin huan1ying2 Set string value... 21 Character - Set string value... 21 Sound - # Row 22 Set string value... 22 Pinyin lai2 Set string value... 22 Character - Set string value... 22 Sound - # Row 23 Set string value... 23 Pinyin zhong1guo2 Set string value... 23 Character - Set string value... 23 Sound - # Row 24 Set string value... 24 Pinyin ni3de0 Set string value... 24 Character - Set string value... 24 Sound - # Row 25 Set string value... 25 Pinyin yi1lu4 Set string value... 25 Character - Set string value... 25 Sound - # Row 26 Set string value... 26 Pinyin shun4li4 Set string value... 26 Character - Set string value... 26 Sound - # Row 27 Set string value... 27 Pinyin xie4xie0 Set string value... 27 Character - Set string value... 27 Sound - # Row 28 Set string value... 28 Pinyin lei4 Set string value... 28 Character - Set string value... 28 Sound - # Row 29 Set string value... 29 Pinyin you3 Set string value... 29 Character - Set string value... 29 Sound - # Row 30 Set string value... 30 Pinyin yi1dian3 Set string value... 30 Character - Set string value... 30 Sound - # Row 31 Set string value... 31 Pinyin xiang3 Set string value... 31 Character - Set string value... 31 Sound - # Row 32 Set string value... 32 Pinyin he1 Set string value... 32 Character - Set string value... 32 Sound - # Row 33 Set string value... 33 Pinyin yi1 Set string value... 33 Character - Set string value... 33 Sound - # Row 34 Set string value... 34 Pinyin yi1bei1 Set string value... 34 Character - Set string value... 34 Sound - # Row 35 Set string value... 35 Pinyin ka1fei1 Set string value... 35 Character - Set string value... 35 Sound - # Row 36 Set string value... 36 Pinyin tai4 Set string value... 36 Character - Set string value... 36 Sound - # Row 37 Set string value... 37 Pinyin le0 Set string value... 37 Character - Set string value... 37 Sound - # Row 38 Set string value... 38 Pinyin zhe4 Set string value... 38 Character - Set string value... 38 Sound - # Row 39 Set string value... 39 Pinyin bu4 Set string value... 39 Character - Set string value... 39 Sound - # Row 40 Set string value... 40 Pinyin ke4qi0 Set string value... 40 Character - Set string value... 40 Sound - # Row 41 Set string value... 41 Pinyin xing4ming2 Set string value... 41 Character - Set string value... 41 Sound - # Row 42 Set string value... 42 Pinyin guo2ji2 Set string value... 42 Character - Set string value... 42 Sound - # Row 43 Set string value... 43 Pinyin he2 Set string value... 43 Character - Set string value... 43 Sound - # Row 44 Set string value... 44 Pinyin nian2ling2 Set string value... 44 Character - Set string value... 44 Sound - # Row 45 Set string value... 45 Pinyin hui4 Set string value... 45 Character - Set string value... 45 Sound - # Row 46 Set string value... 46 Pinyin shuo1 Set string value... 46 Character - Set string value... 46 Sound - # Row 47 Set string value... 47 Pinyin zhong1wen2 Set string value... 47 Character - Set string value... 47 Sound - # Row 48 Set string value... 48 Pinyin xiao3 Set string value... 48 Character - Set string value... 48 Sound - # Row 49 Set string value... 49 Pinyin shen2me0 Set string value... 49 Character - Set string value... 49 Sound - # Row 50 Set string value... 50 Pinyin ying1guo2 Set string value... 50 Character - Set string value... 50 Sound - # Row 51 Set string value... 51 Pinyin ren2 Set string value... 51 Character - Set string value... 51 Sound - # Row 52 Set string value... 52 Pinyin na3 Set string value... 52 Character - Set string value... 52 Sound - # Row 53 Set string value... 53 Pinyin guo2 Set string value... 53 Character - Set string value... 53 Sound - # Row 54 Set string value... 54 Pinyin cai1 Set string value... 54 Character - Set string value... 54 Sound - # Row 55 Set string value... 55 Pinyin zhi1dao0 Set string value... 55 Character - Set string value... 55 Sound - # Row 56 Set string value... 56 Pinyin mei3guo2 Set string value... 56 Character - Set string value... 56 Sound - # Row 57 Set string value... 57 Pinyin na3li0 Set string value... 57 Character - Set string value... 57 Sound - # Row 58 Set string value... 58 Pinyin Bei3jing1 Set string value... 58 Character - Set string value... 58 Sound - # Row 59 Set string value... 59 Pinyin jin1nian2 Set string value... 59 Character - Set string value... 59 Sound - # Row 60 Set string value... 60 Pinyin duo1 Set string value... 60 Character - Set string value... 60 Sound - # Row 61 Set string value... 61 Pinyin da4 Set string value... 61 Character - Set string value... 61 Sound - # Row 62 Set string value... 62 Pinyin le0 Set string value... 62 Character - Set string value... 62 Sound - # Row 63 Set string value... 63 Pinyin sui4 Set string value... 63 Character - Set string value... 63 Sound - # Row 64 Set string value... 64 Pinyin zhen1de0 Set string value... 64 Character - Set string value... 64 Sound - # Row 65 Set string value... 65 Pinyin zhi3you3 Set string value... 65 Character - Set string value... 65 Sound - # Row 66 Set string value... 66 Pinyin zuo3you4 Set string value... 66 Character - Set string value... 66 Sound - # Row 67 Set string value... 67 Pinyin guo4jiang3 Set string value... 67 Character - Set string value... 67 Sound - # Row 68 Set string value... 68 Pinyin zhen1 Set string value... 68 Character - Set string value... 68 Sound - # Row 69 Set string value... 69 Pinyin nian2qing1 Set string value... 69 Character - Set string value... 69 Sound - # Row 70 Set string value... 70 Pinyin zhe4me0 Set string value... 70 Character - Set string value... 70 Sound - # Row 71 Set string value... 71 Pinyin ying1gai1 Set string value... 71 Character - Set string value... 71 Sound - # Row 72 Set string value... 72 Pinyin dui4 Set string value... 72 Character - Set string value... 72 Sound - # Row 73 Set string value... 73 Pinyin ren4shi0 Set string value... 73 Character - Set string value... 73 Sound - # Row 74 Set string value... 74 Pinyin zai4jian4 Set string value... 74 Character - Set string value... 74 Sound - endproc procedure CreateContemporary_Chinese_chapters_1_+_2 Create Table with column names... Contemporary_Chinese_chapters_1_+_2 30 ... Pinyin Character Sound # Fill table values # Row 1 Set string value... 1 Pinyin ming2zi4 Set string value... 1 Character - Set string value... 1 Sound - # Row 2 Set string value... 2 Pinyin guo2 Set string value... 2 Character - Set string value... 2 Sound - # Row 3 Set string value... 3 Pinyin dou1 Set string value... 3 Character - Set string value... 3 Sound - # Row 4 Set string value... 4 Pinyin shuo1 Set string value... 4 Character - Set string value... 4 Sound - # Row 5 Set string value... 5 Pinyin han4yu3 Set string value... 5 Character - Set string value... 5 Sound - # Row 6 Set string value... 6 Pinyin zhong1guo2 Set string value... 6 Character - Set string value... 6 Sound - # Row 7 Set string value... 7 Pinyin na3 Set string value... 7 Character - Set string value... 7 Sound - # Row 8 Set string value... 8 Pinyin lao3shi1 Set string value... 8 Character - Set string value... 8 Sound - # Row 9 Set string value... 9 Pinyin ying1yu3 Set string value... 9 Character - Set string value... 9 Sound - # Row 10 Set string value... 10 Pinyin fa3yu3 Set string value... 10 Character - Set string value... 10 Sound - # Row 11 Set string value... 11 Pinyin hai2shi4 Set string value... 11 Character - Set string value... 11 Sound - # Row 12 Set string value... 12 Pinyin xing4 Set string value... 12 Character - Set string value... 12 Sound - # Row 13 Set string value... 13 Pinyin tong2xue2 Set string value... 13 Character - Set string value... 13 Sound - # Row 14 Set string value... 14 Pinyin zhi3 Set string value... 14 Character - Set string value... 14 Sound - # Row 15 Set string value... 15 Pinyin yi1dian3 Set string value... 15 Character - Set string value... 15 Sound - # Row 16 Set string value... 16 Pinyin peng2you3 Set string value... 16 Character - Set string value... 16 Sound - # Row 17 Set string value... 17 Pinyin qing3 Set string value... 17 Character - Set string value... 17 Sound - # Row 18 Set string value... 18 Pinyin xue2xi2 Set string value... 18 Character - Set string value... 18 Sound - # Row 19 Set string value... 19 Pinyin zai4 Set string value... 19 Character - Set string value... 19 Sound - # Row 20 Set string value... 20 Pinyin dian4hua4 Set string value... 20 Character - Set string value... 20 Sound - # Row 21 Set string value... 21 Pinyin dian4zi3 Set string value... 21 Character - Set string value... 21 Sound - # Row 22 Set string value... 22 Pinyin you2jian4 Set string value... 22 Character - Set string value... 22 Sound - # Row 23 Set string value... 23 Pinyin zen3me0 Set string value... 23 Character - Set string value... 23 Sound - # Row 24 Set string value... 24 Pinyin da4xue2 Set string value... 24 Character - Set string value... 24 Sound - # Row 25 Set string value... 25 Pinyin ke3yi3 Set string value... 25 Character - Set string value... 25 Sound - # Row 26 Set string value... 26 Pinyin dong1fang1 Set string value... 26 Character - Set string value... 26 Sound - # Row 27 Set string value... 27 Pinyin xue2yuan4 Set string value... 27 Character - Set string value... 27 Sound - # Row 28 Set string value... 28 Pinyin zhe4 Set string value... 28 Character - Set string value... 28 Sound - # Row 29 Set string value... 29 Pinyin gong1zuo4 Set string value... 29 Character - Set string value... 29 Sound - # Row 30 Set string value... 30 Pinyin xi3huan1 Set string value... 30 Character - Set string value... 30 Sound - endproc procedure CreateExamples_of_tone_combinations Create Table with column names... Examples_of_tone_combinations 62 ... Pinyin Character Sound Translation # Fill table values # Row 1 Set string value... 1 Pinyin chi1 Set string value... 1 Character 吃 Set string value... 1 Sound - Set string value... 1 Translation to eat # Row 2 Set string value... 2 Pinyin ta1 Set string value... 2 Character 他 Set string value... 2 Sound - Set string value... 2 Translation he, she, it # Row 3 Set string value... 3 Pinyin jin1tian1 Set string value... 3 Character 今天 Set string value... 3 Sound - Set string value... 3 Translation today # Row 4 Set string value... 4 Pinyin can1ting1 Set string value... 4 Character 餐厅 Set string value... 4 Sound - Set string value... 4 Translation restaurant # Row 5 Set string value... 5 Pinyin huan1ying2 Set string value... 5 Character 欢迎 Set string value... 5 Sound - Set string value... 5 Translation to welcome # Row 6 Set string value... 6 Pinyin zhong1guo2 Set string value... 6 Character 中国 Set string value... 6 Sound - Set string value... 6 Translation China # Row 7 Set string value... 7 Pinyin duo1shao3 Set string value... 7 Character 多少 Set string value... 7 Sound - Set string value... 7 Translation how many # Row 8 Set string value... 8 Pinyin zhi3you3 Set string value... 8 Character 只有 Set string value... 8 Sound - Set string value... 8 Translation only # Row 9 Set string value... 9 Pinyin sheng1ri4 Set string value... 9 Character 生日 Set string value... 9 Sound - Set string value... 9 Translation birthday # Row 10 Set string value... 10 Pinyin gao1xing4 Set string value... 10 Character 高兴 Set string value... 10 Sound - Set string value... 10 Translation happy # Row 11 Set string value... 11 Pinyin ma1ma0 Set string value... 11 Character 妈妈 Set string value... 11 Sound - Set string value... 11 Translation mama # Row 12 Set string value... 12 Pinyin ge1ge0 Set string value... 12 Character 哥哥 Set string value... 12 Sound - Set string value... 12 Translation older brother # Row 13 Set string value... 13 Pinyin ren2 Set string value... 13 Character 人 Set string value... 13 Sound - Set string value... 13 Translation person # Row 14 Set string value... 14 Pinyin qian2 Set string value... 14 Character 前 Set string value... 14 Sound - Set string value... 14 Translation front # Row 15 Set string value... 15 Pinyin shi2jian1 Set string value... 15 Character 时间 Set string value... 15 Sound - Set string value... 15 Translation time # Row 16 Set string value... 16 Pinyin jie2hun1 Set string value... 16 Character 结婚 Set string value... 16 Sound - Set string value... 16 Translation to marry # Row 17 Set string value... 17 Pinyin chang2cheng2 Set string value... 17 Character 长城 Set string value... 17 Sound - Set string value... 17 Translation the Great Wall # Row 18 Set string value... 18 Pinyin xue2xi2 Set string value... 18 Character 学习 Set string value... 18 Sound - Set string value... 18 Translation to study # Row 19 Set string value... 19 Pinyin mei2you3 Set string value... 19 Character 没有 Set string value... 19 Sound - Set string value... 19 Translation haven't # Row 20 Set string value... 20 Pinyin you2yong3 Set string value... 20 Character 游泳 Set string value... 20 Sound - Set string value... 20 Translation to swim # Row 21 Set string value... 21 Pinyin fo2jiao4 Set string value... 21 Character 佛教 Set string value... 21 Sound - Set string value... 21 Translation Buddhism # Row 22 Set string value... 22 Pinyin hai2shi4 Set string value... 22 Character 还是 Set string value... 22 Sound - Set string value... 22 Translation or # Row 23 Set string value... 23 Pinyin shen2me0 Set string value... 23 Character 什么 Set string value... 23 Sound - Set string value... 23 Translation what # Row 24 Set string value... 24 Pinyin peng2you0 Set string value... 24 Character 朋友 Set string value... 24 Sound - Set string value... 24 Translation friend # Row 25 Set string value... 25 Pinyin wo3 Set string value... 25 Character 我 Set string value... 25 Sound - Set string value... 25 Translation I, me # Row 26 Set string value... 26 Pinyin xiang3 Set string value... 26 Character 享 Set string value... 26 Sound - Set string value... 26 Translation to enjoy # Row 27 Set string value... 27 Pinyin xiang3 Set string value... 27 Character 想 Set string value... 27 Sound - Set string value... 27 Translation to think # Row 28 Set string value... 28 Pinyin xi3huan0 Set string value... 28 Character 喜欢 Set string value... 28 Sound - Set string value... 28 Translation to like # Row 29 Set string value... 29 Pinyin yi3jing1 Set string value... 29 Character 已经 Set string value... 29 Sound - Set string value... 29 Translation already # Row 30 Set string value... 30 Pinyin lv3xing2 Set string value... 30 Character 旅行 Set string value... 30 Sound - Set string value... 30 Translation to travel # Row 31 Set string value... 31 Pinyin qi3chuang2 Set string value... 31 Character 起床 Set string value... 31 Sound - Set string value... 31 Translation to get up # Row 32 Set string value... 32 Pinyin ni3hao3 Set string value... 32 Character 你好 Set string value... 32 Sound - Set string value... 32 Translation hello # Row 33 Set string value... 33 Pinyin zhi3you3 Set string value... 33 Character 只有 Set string value... 33 Sound - Set string value... 33 Translation only # Row 34 Set string value... 34 Pinyin mei3li4 Set string value... 34 Character 美丽 Set string value... 34 Sound - Set string value... 34 Translation beautiful # Row 35 Set string value... 35 Pinyin nv3shi4 Set string value... 35 Character 女士 Set string value... 35 Sound - Set string value... 35 Translation lady # Row 36 Set string value... 36 Pinyin xiao3jie0 Set string value... 36 Character 小姐 Set string value... 36 Sound - Set string value... 36 Translation miss # Row 37 Set string value... 37 Pinyin na3li3 Set string value... 37 Character 哪里 Set string value... 37 Sound - Set string value... 37 Translation where # Row 38 Set string value... 38 Pinyin yi1 Set string value... 38 Character 一 Set string value... 38 Sound - Set string value... 38 Translation one # Row 39 Set string value... 39 Pinyin er4 Set string value... 39 Character 二 Set string value... 39 Sound - Set string value... 39 Translation two # Row 40 Set string value... 40 Pinyin san1 Set string value... 40 Character 三 Set string value... 40 Sound - Set string value... 40 Translation three # Row 41 Set string value... 41 Pinyin si4 Set string value... 41 Character 四 Set string value... 41 Sound - Set string value... 41 Translation four # Row 42 Set string value... 42 Pinyin wu3 Set string value... 42 Character 五 Set string value... 42 Sound - Set string value... 42 Translation five # Row 43 Set string value... 43 Pinyin liu4 Set string value... 43 Character 六 Set string value... 43 Sound - Set string value... 43 Translation six # Row 44 Set string value... 44 Pinyin qi1 Set string value... 44 Character 七 Set string value... 44 Sound - Set string value... 44 Translation seven # Row 45 Set string value... 45 Pinyin ba1 Set string value... 45 Character 八 Set string value... 45 Sound - Set string value... 45 Translation eight # Row 46 Set string value... 46 Pinyin jiu3 Set string value... 46 Character 九 Set string value... 46 Sound - Set string value... 46 Translation nine # Row 47 Set string value... 47 Pinyin shi2 Set string value... 47 Character 十 Set string value... 47 Sound - Set string value... 47 Translation ten # Row 48 Set string value... 48 Pinyin bai3 Set string value... 48 Character 百 Set string value... 48 Sound - Set string value... 48 Translation hundred # Row 49 Set string value... 49 Pinyin qian1 Set string value... 49 Character 千 Set string value... 49 Sound - Set string value... 49 Translation thousand # Row 50 Set string value... 50 Pinyin shi4 Set string value... 50 Character 是 Set string value... 50 Sound - Set string value... 50 Translation is # Row 51 Set string value... 51 Pinyin tui4xiu1 Set string value... 51 Character 退休 Set string value... 51 Sound - Set string value... 51 Translation retirement # Row 52 Set string value... 52 Pinyin hou4tian1 Set string value... 52 Character 后天 Set string value... 52 Sound - Set string value... 52 Translation day after tomorrow # Row 53 Set string value... 53 Pinyin shang4xue2 Set string value... 53 Character 上学 Set string value... 53 Sound - Set string value... 53 Translation to attend school # Row 54 Set string value... 54 Pinyin ji4jie2 Set string value... 54 Character 季节 Set string value... 54 Sound - Set string value... 54 Translation time # Row 55 Set string value... 55 Pinyin zi4ji3 Set string value... 55 Character 自己 Set string value... 55 Sound - Set string value... 55 Translation self # Row 56 Set string value... 56 Pinyin xia4wu3 Set string value... 56 Character 下午 Set string value... 56 Sound - Set string value... 56 Translation afternoon # Row 57 Set string value... 57 Pinyin dian4hua4 Set string value... 57 Character 电话 Set string value... 57 Sound - Set string value... 57 Translation telephone # Row 58 Set string value... 58 Pinyin zai4jian4 Set string value... 58 Character 再见 Set string value... 58 Sound - Set string value... 58 Translation goodbye # Row 59 Set string value... 59 Pinyin xie4xie0 Set string value... 59 Character 谢谢 Set string value... 59 Sound - Set string value... 59 Translation thanks # Row 60 Set string value... 60 Pinyin mei4mei0 Set string value... 60 Character 妹妹 Set string value... 60 Sound - Set string value... 60 Translation younger sister # Row 61 Set string value... 61 Pinyin ma0 Set string value... 61 Character 吗 Set string value... 61 Sound - Set string value... 61 Translation (question tag) # Row 62 Set string value... 62 Pinyin ne0 Set string value... 62 Character 呢 Set string value... 62 Sound - Set string value... 62 Translation (question particle) endproc procedure CreateCreateWordlists Create Table with column names... CreateWordlists 5 ... Name # Fill table values # Row 1 Set string value... 1 Name Chinees_een_Makkie_chapters_1_+_2 # Row 2 Set string value... 2 Name Chinese_for_Today_chapters_1_+_2 # Row 3 Set string value... 3 Name Colloquial_Chinese_chapters_1_+_2 # Row 4 Set string value... 4 Name Contemporary_Chinese_chapters_1_+_2 # Row 5 Set string value... 5 Name Examples_of_tone_combinations endproc # Start instruction loop while demoWaitForInput() .label$ = "" .clickX = -1 .clickY = -1 .pressed$ = "" if demoClicked() .clickX = demoX() .clickY = demoY() call buttonClicked 'buttons$' '.clickX' '.clickY' .label$ = buttonClicked.label$ elsif demoKeyPressed() .pressed$ = demoKey$() call keyPressed 'buttons$' '.pressed$' .label$ = keyPressed.label$ endif # You cannot select a text field if startsWith(.label$, "$") .label$ = "" endif # Do things if .label$ != "" # Push button down call Draw_button 'buttons$' '.label$' 1 call process_label '.label$' '.clickX' '.clickY' '.pressed$' # push button up call Draw_button 'buttons$' '.label$' 0 endif endwhile call end_program ######################################################## # # Definitions of procedures # ######################################################## # # Do what is asked procedure process_label .label$ .clickX .clickY .pressed$ # Log raw commands to replay in file call log_command 'buttons$' '.label$' '.clickX' '.clickY' '.pressed$' # Prcoess the command if .label$ <> "" and not startsWith(.label$,"!") .label$ = replace$(.label$, "_", " ", 0) call process'buttons$''.label$' '.clickX' '.clickY' '.pressed$' endif endproc # Intialize buttons procedure init_buttons noerase = 1 call Draw_all_buttons 'buttons$' noerase = 0 endproc # Draw all buttons noerase = 0 procedure Draw_all_buttons .table$ .varPrefix$ = replace_regex$(.table$, "^(.)", "\l\1", 0) select Table '.table$' .numRows = Get number of rows for .row to .numRows .label$ = Get value... '.row' Label if not startsWith(.label$, "!") .pressed = 0 # Determine the "pressed" state of a button # A variable with the same name as the button will act as a # "pressed state" .variableName$ = .varPrefix$+"."+(replace_regex$(.label$, "^(.)", "\l\1", 0)) # Simple boolean vairables if index(.variableName$, "_") <= 0 and variableExists(.variableName$) # True: Pressed if '.variableName$' > 0 .pressed = 2 # <0: Grayed out elsif '.variableName$' < 0 .pressed = -1 endif # Complex buttons with an variableName+'_'+value structure # varableName$ -> name of button, e.g., "language" elsif index(.variableName$, "_") .generalVar$ = left$(.variableName$, rindex(.variableName$, "_") - 1) .currentVariableName$ = .generalVar$ # Is it a string? if variableExists(.generalVar$+"$") .currentVariableName$ = .generalVar$ + "$" endif # Remove one level of indirection if variableExists(.currentVariableName$) if index(.currentVariableName$, "$") .currentVariableName$ = '.currentVariableName$' else .currentValue = '.currentVariableName$' .currentVariableName$ = "'.currentValue'" endif # Remove next level of indirection .currentContent$ = "'.currentVariableName$'" if .currentContent$ = "_DISABLED_" .pressed = -1 endif # Reconstruct label from current values .currentLabelValue$ = .generalVar$ + "_" + .currentContent$ # Set PRESSED from label if .variableName$ = .currentLabelValue$ .pressed = 2 endif endif endif # You did erase everything before you started here? So do not do that again call Draw_button_internal 0 '.table$' '.label$' '.pressed' endif endfor endproc # Draw a button from a predefined button table # Normally, erase the area around a button procedure Draw_button .table$ .label$ .push call Draw_button_internal 1 '.table$' '.label$' '.push' endproc # Use this function if you want to control erasing procedure Draw_button_internal .erase_button_area .table$ .label$ .push # Scale rounding of rounded rectangles .wc = 1 .mm = demo Horizontal wc to mm... '.wc' # Allow to overide ! skip directive .forceDraw = 0 if startsWith(.label$, "+") .label$ = right$(.label$, length(.label$)-1) .forceDraw = 1 endif select Table '.table$' .row = Search column... Label '.label$' if .row < 1 exit Button Table '.table$' does not have a row with label '.label$' endif # Perspective shift sizes .shiftDown = 0 .shiftX = 0 .shiftY = 0 if buttonbevel <> 0 .shiftDown = 0.05 .shiftX = 0.30 .shiftY = 0.50 endif # Set drawing parameters .topBackGroundColorUp$ = "{0.93,0.93,0.93}" .topLineColorUp$ = "Black" .topLineWidthUp = 1.5 .topBackGroundColorDown$ = "{0.89,0.89,0.94}" .topLineColorDown$ = "{0.3,0.3,0.3}" .topLineWidthDown = 1.5 .topBackGroundColorDisabled$ = "{0.85,0.85,0.85}" .topLineColorDisabled$ = "{0.70,0.70,0.70}" .topLineWidthDisabled = 1.5 .flankBackGroundColorUp$ = "{0.6,0.6,0.6}" .flankLineColorUp$ = "{0.2,0.2,0.2}" .flankLineWidthUp = 1.5 .flankBackGroundColorDown$ = "{0.75,0.75,0.75}" .flankLineColorDown$ = .flankLineColorUp$ .flankLineWidthDown = 1.5 .buttonFontSize = defaultFontSize # Get button values .leftX = Get value... '.row' LeftX .rightX = Get value... '.row' RightX .lowY = Get value... '.row' LowY .highY = Get value... '.row' HighY .buttonText$ = Get value... '.row' Text .buttonColor$ = Get value... '.row' Color .buttonDraw$ = Get value... '.row' Draw .buttonKey$ = Get value... '.row' Key .rotation = 0 if index_regex(.buttonText$, "^![0-9\.]+!") .rotation = extractNumber(.buttonText$, "!") .buttonText$ = replace_regex$(.buttonText$, "^![0-9\.]+!", "", 0) endif goto NOBUTTON startsWith(.label$, "!") and not .forceDraw # Replace button text with ALERT if .push = 3 .buttonText$ = alertText$ endif # Adapt font size to button size .maxWidth = (.rightX - .leftX) - 2 .maxHeight = (.highY - .lowY) - 1 if .rotation = 0 # Adapt size of button to length of text if necessary call adjustFontSizeOnWidth 'defaultFont$' '.buttonFontSize' '.maxWidth' '.buttonText$' .buttonFontSize = adjustFontSizeOnWidth.newFontSize if adjustFontSizeOnWidth.diff > 0 .rightX += adjustFontSizeOnWidth.diff/2 .leftX -= adjustFontSizeOnWidth.diff/2 endif call set_font_size '.buttonFontSize' # Adapt size of button to length of text call adjustFontSizeOnHeight 'defaultFont$' '.buttonFontSize' '.maxHeight' if adjustFontSizeOnHeight.diff > 0 .lowY -= adjustFontSizeOnHeight.diff/2 .highY += adjustFontSizeOnHeight.diff/2 endif .buttonFontSize = adjustFontSizeOnHeight.newFontSize else # With non-horizontal text, only change font size call adjustRotatedFontSizeOnBox 'defaultFont$' '.buttonFontSize' '.maxWidth' '.maxHeight' '.rotation' '.buttonText$' .buttonFontSize = adjustRotatedFontSizeOnBox.newFontSize endif # Reset and erase button area call reset_viewport demo Line width... 'defaultLineWidth' .shiftLeftX = .leftX - .shiftX .shiftRightX = .rightX .shiftLowY = .lowY - .shiftY .shiftHighY = .highY if .erase_button_area # Make erase area minutely larger .eraseLeft = .shiftLeftX - 0.01 .eraseRight = .shiftRightX + 0.01 .eraseBottom = .shiftLowY - 0.01 .eraseTop = .shiftHighY + 0.01 demo Paint rectangle... White .eraseLeft .eraseRight .eraseBottom .eraseTop endif # If label starts with "$", it is a text field. Then do not draw the button if not startsWith(.label$, "$") # Give some depth to button: Draw flank outline if .shiftDown or .shiftX or .shiftY if .push <= 0 demo Paint rounded rectangle... '.flankBackGroundColorUp$' .shiftLeftX .shiftRightX .shiftLowY .shiftHighY '.mm' demo Colour... '.flankLineColorUp$' demo Line width... '.flankLineWidthUp' else demo Paint rounded rectangle... '.flankBackGroundColorDown$' .shiftLeftX .shiftRightX .shiftLowY .shiftHighY '.mm' demo Colour... '.flankLineColorDown$' demo Line width... '.flankLineWidthDown' endif demo Draw rounded rectangle... .shiftLeftX .shiftRightX .shiftLowY .shiftHighY '.mm' endif # Button Down will shift the top perspective # Draw the button top if .push = 0 demo Paint rounded rectangle... '.topBackGroundColorUp$' '.leftX' '.rightX' '.lowY' '.highY' '.mm' demo Colour... '.topLineColorUp$' demo Line width... '.topLineWidthUp' elsif .push < 0 demo Paint rounded rectangle... '.topBackGroundColorDisabled$' '.leftX' '.rightX' '.lowY' '.highY' '.mm' demo Colour... '.topLineColorDisabled$' demo Line width... '.topLineWidthDisabled' else # Button Down .leftX -= .shiftDown .rightX -= .shiftDown .lowY -= .shiftDown .highY -= .shiftDown demo Paint rounded rectangle... '.topBackGroundColorDown$' .leftX .rightX .lowY .highY '.mm' demo Colour... '.topLineColorDown$' demo Line width... '.topLineWidthDown' endif demo Draw rounded rectangle... '.leftX' '.rightX' '.lowY' '.highY' '.mm' endif # The button text and symbol .horWC = demo Horizontal mm to wc... 10.0 .verWC = demo Vertical mm to wc... 10.0 if .verWC > 0 .verCoeff = .horWC / .verWC else .verCoeff = 1 endif .centerX = (.leftX + .rightX)/2 .centerY = .lowY + 0.6*(.highY-.lowY) .radius = min(.verCoeff * (.highY - .lowY ), (.rightX - .leftX))/3 .buttonKey$ = replace$(.buttonKey$, "\", "\\", 0) .buttonKey$ = replace$(.buttonKey$, """", "\""""", 0) .newText$ = replace_regex$(.buttonText$, "['.buttonKey$']", "#%&", 1) if .newText$ = "" .newText$ = .buttonText$ endif if .push = 1 or .push = -1 demo Grey if .buttonColor$ = "Red" .buttonColor$ = "Pink" elsif .buttonColor$ = "Blue" .buttonColor$ = "{0.5,0.5,1}" else .buttonColor$ = "Grey" endif elsif .push >= 2 .buttonColor$ = "Maroon" else demo Colour... Black endif call '.buttonDraw$' '.buttonColor$' '.centerX' '.centerY' '.radius' call set_font_size '.buttonFontSize' demo Colour... '.buttonColor$' if .rotation = 0 .anchorY = .lowY .verticalAlignment$ = "Bottom" else .anchorY = .lowY + 0.5*(.highY-.lowY) .verticalAlignment$ = "Half" endif demo Text special... '.centerX' Centre '.anchorY' '.verticalAlignment$' 'defaultFont$' '.buttonFontSize' '.rotation' '.newText$' demoShow() # Reset call set_font_size 'defaultFontSize' demo Black demo Line width... 'defaultLineWidth' label NOBUTTON endproc procedure set_window_title .table$ .addedText$ select Table '.table$' .row = Search column... Label !WindowTitle if .row < 1 exit Button Table '.table$' does not have a row with label !WindowTitle endif .windowText$ = Get value... '.row' Text call convert_praat_to_latin1 '.windowText$' .windowText$ = convert_praat_to_latin1.text$ demoWindowTitle(.windowText$+ .addedText$) endproc # Handle language setting procedure processLanguageCodes .table$ .label$ .table$ = "Config" call Draw_button 'config$' Language_'config.language$' 0 call Draw_button 'config$' '.label$' 2 # Someone might have to use more than 2 chars for the language code .numChars = length(.label$) - length("Language_") .lang$ = right$(.label$, .numChars) # Load new tables call set_language '.lang$' endproc # Set the language procedure set_language .lang$ .redraw_config = 0 # Remove old tables if buttons$ <> "" select Table 'buttons$' Remove .redraw_config = 1 endif if config$ <> "" select Table 'config$' Remove .redraw_config = 1 endif # Set language config.language$ = .lang$ # Load buttons tables call loadTable 'buttonsTableName$' buttons$ = selected$("Table") Append column... Text Append column... Key Append column... Helptext .numLabels = Get number of rows call loadTable 'buttonsTableName$'_'config.language$' .buttonsLang$ = selected$("Table") for .row to .numLabels select Table 'buttons$' .label$ = Get value... '.row' Label call findLabel '.buttonsLang$' '.label$' if findLabel.row > 0 select Table '.buttonsLang$' .valueText$ = Get value... 'findLabel.row' Text .valueKey$ = Get value... 'findLabel.row' Key .valueHelp$ = Get value... 'findLabel.row' Helptext select Table 'buttons$' Set string value... '.row' Text '.valueText$' Set string value... '.row' Key '.valueKey$' Set string value... '.row' Helptext '.valueHelp$' elsif index(.label$, "_") # Load alternative language table .startChar = rindex(.label$, "_") .otherLanguage$ = right$(.label$, length(.label$) - .startChar) call loadTable 'buttonsTableName$'_'.otherLanguage$' .otherbuttonsLang$ = selected$("Table") call findLabel '.otherbuttonsLang$' '.label$' if findLabel.row > 0 select Table '.buttonsLang$' .valueText$ = Get value... 'findLabel.row' Text .valueKey$ = Get value... 'findLabel.row' Key .valueHelp$ = Get value... 'findLabel.row' Helptext select Table 'buttons$' Set string value... '.row' Text '.valueText$' Set string value... '.row' Key '.valueKey$' Set string value... '.row' Helptext '.valueHelp$' else exit Cannot find Label: '.otherbuttonsLang$' '.label$' endif select Table '.otherbuttonsLang$' Remove else exit Cannot find Label: '.buttonsLang$' '.label$' endif endfor select Table '.buttonsLang$' Remove # Load configuration table call loadTable 'configTableName$' config$ = selected$("Table") Append column... Text Append column... Key Append column... Helptext .numLabels = Get number of rows call loadTable 'configTableName$'_'config.language$' .configLang$ = selected$("Table") for .row to .numLabels select Table 'config$' .label$ = Get value... '.row' Label call findLabel '.configLang$' '.label$' if findLabel.row > 0 select Table '.configLang$' .valueText$ = Get value... 'findLabel.row' Text .valueKey$ = Get value... 'findLabel.row' Key .valueHelp$ = Get value... 'findLabel.row' Helptext select Table 'config$' Set string value... '.row' Text '.valueText$' Set string value... '.row' Key '.valueKey$' Set string value... '.row' Helptext '.valueHelp$' elsif index(.label$, "_") .startChar = rindex(.label$, "_") .otherLanguage$ = right$(.label$, length(.label$) - .startChar) call loadTable 'configTableName$'_'.otherLanguage$' .otherconfigLang$ = selected$("Table") call findLabel '.otherconfigLang$' '.label$' if findLabel.row > 0 select Table '.otherconfigLang$' .valueText$ = Get value... 'findLabel.row' Text .valueKey$ = Get value... 'findLabel.row' Key .valueHelp$ = Get value... 'findLabel.row' Helptext select Table 'config$' Set string value... '.row' Text '.valueText$' Set string value... '.row' Key '.valueKey$' Set string value... '.row' Helptext '.valueHelp$' else exit Cannot find Label: '.otherconfigLang$' '.label$' endif select Table '.otherconfigLang$' Remove else exit Cannot find Label: '.configLang$' '.label$' endif endfor select Table '.configLang$' Remove # Make language change visible if .redraw_config call Draw_config_page endif endproc ############################################################### # # Button Drawing Routines # ############################################################### # A stub for buttons that do not have a drawing routine (yet) procedure DrawNull .color$ .x .y .size endproc procedure DrawHelp .color$ .x .y .size .currentFontSize = 24 .y -= .size .maxHeight = 2*.size call adjustFontSizeOnHeight 'defaultFont$' '.currentFontSize' '.maxHeight' .currentFontSize = adjustFontSizeOnHeight.currentFontSize call set_font_size '.currentFontSize' demo Colour... '.color$' demo Text... '.x' Centre '.y' Bottom ? call set_font_size 'defaultFontSize' endproc ############################################################### # # Button Processing Routines # ############################################################### # Search row in table on label procedure findKey .table$ .label$ .row = 0 select Table '.table$' .to$ = selected$("Table") .to$ = "Table_"+.to$ .numRows = Get number of rows for .i to .numRows .currentKey$ = '.to$'$[.i, "Key"] if .label$ = .currentKey$ .row = .i goto KEYFOUND endif endfor label KEYFOUND if .row <= 0 and index(.label$, "_") <= 0 printline "'.label$'" is not a key in '.table$' endif endproc procedure findLabel .table$ .label$ .row = 0 select Table '.table$' .to$ = selected$("Table") .to$ = "Table_"+.to$ .numRows = Get number of rows for .i to .numRows .currentKey$ = '.to$'$[.i, "Label"] if .label$ = .currentKey$ .row = .i goto LABELFOUND endif endfor label LABELFOUND if .row <= 0 and index(.label$, "_") <= 0 exit "'.label$'" is not a key in '.table$' endif endproc # Get the label procedure buttonClicked table$ .x .y .label$ = "" select Table 'table$' .bo$ = selected$("Table") .bo$ = "Table_"+.bo$ .numRows = Get number of rows for .i to .numRows if .label$ = "" .leftX = '.bo$'[.i, "LeftX"] .rightX = '.bo$'[.i, "RightX"] .lowY = '.bo$'[.i, "LowY"] .highY = '.bo$'[.i, "HighY"] if .x > .leftX and .x < .rightX and .y > .lowY and .y < .highY .label$ = '.bo$'$[.i, "Label"] endif endif endfor endproc procedure keyPressed table$ .pressed$ .label$ = "" # Magic if .pressed$ = "" and not demoShiftKeyPressed() .label$ = "Refresh" endif .lowerPressed$ = replace_regex$(.pressed$, ".", "\L&", 0) .upperPressed$ = replace_regex$(.pressed$, ".", "\U&", 0) select Table 'table$' .bo$ = selected$("Table") .bo$ = "Table_"+.bo$ .numRows = Get number of rows for .i to .numRows if .label$ = "" .key$ = '.bo$'$[.i, "Key"] if index(.key$, .lowerPressed$) or index(.key$, .upperPressed$) .label$ = '.bo$'$[.i, "Label"] endif endif endfor endproc procedure play_sound .sound$ if .sound$ <> "" select Sound '.sound$' Play endif endproc procedure record_sound if recordedSound$ != "" select Sound 'recordedSound$' Remove recordedSound$ = "" endif # There is a very nasty delay before the first recording starts, do a dummy record if not variableExists("recordingInitialized") noprogress nowarn Record Sound (fixed time)... 'config.input$' 0.99 0.5 'samplingFrequency' 0.1 Remove recordingInitialized = 1 endif # Recording light demo Paint circle... Red 5 95 2 demoShow() # In Windows interaction between demoWaitForInput and Record Sound blocks drawing the feedback if windows and endsWith(build_SHA$, " XP") # Display a pause window to flush the graphics buffer beginPause ("DESTROY WINDOW ") comment (" ") endPause ("DESTROY WINDOW ", 1) #call init_window demo Paint circle... Red 5 95 2 demoShow() endif noprogress nowarn Record Sound (fixed time)... 'config.input$' 0.99 0.5 'samplingFrequency' 'recordingTime' demo Paint circle... White 5 95 2.5 call wipeArea 'wipeFeedbackArea$' # Feedback on recording level .extremum = Get absolute extremum... 0 0 None .radius = 2 * .extremum .blue = 0 .green = 0 .red = 0 if .extremum >= 0.95 .red = 1 elsif .extremum >= 0.49 .green = 1 else .green = .extremum / 0.5 endif .color$ = "{'.red','.green','.blue'}" demo Colour... '.color$' demo Line width... 1 demo Draw circle... 5 95 '.radius' # Reset demoShow() demo Colour... Black demo Line width... 'defaultLineWidth' # Process sound Rename... Tmp Resample... 10000 50 Rename... Pronunciation recordedSound$ = selected$("Sound") select Sound Tmp Remove select Sound 'recordedSound$' # Cut out real sound from silences/noise call sound_detection 'recordedSound$' 'soundMargin' select Sound 'recordedSound$' endproc # Select real sound from recording # Uses some global variable procedure sound_detection .sound$ .margin select Sound '.sound$' .soundlength = Get total duration .internalSilence = 2*.margin # Silence and remove noise, DANGEROUS To TextGrid (silences)... 'minimumPitch' 0 'noiseThresshold' '.internalSilence' 0.1 silent sounding Rename... Input'.sound$' select TextGrid Input'.sound$' .numberofIntervals = Get number of intervals... 1 # Remove buzzing and other obnoxious sounds (if switched on) for .i from 1 to .numberofIntervals select TextGrid Input'.sound$' .value$ = Get label of interval... 1 '.i' .begintime = Get starting point... 1 '.i' .endtime = Get end point... 1 '.i' # Remove noise if .value$ = "silent" select Sound '.sound$' Set part to zero... '.begintime' '.endtime' at nearest zero crossing endif endfor # Select target sound .maximumIntensity = -1 .counter = 1 for i from 1 to .numberofIntervals select TextGrid Input'.sound$' .value$ = Get label of interval... 1 'i' .begintime = Get starting point... 1 'i' .endtime = Get end point... 1 'i' if .value$ != "silent" if .begintime > .margin .begintime -= .margin else .begintime = 0 endif if .endtime + .margin < .soundlength .endtime += .margin else .endtime = .soundlength endif select Sound '.sound$' Extract part... '.begintime' '.endtime' Rectangular 1.0 no Rename... Tmp'.sound$' Subtract mean .newIntensity = Get intensity (dB) if .newIntensity > .maximumIntensity if .maximumIntensity > 0 select Sound New'.sound$' Remove endif select Sound Tmp'.sound$' Rename... New'.sound$' .maximumIntensity = .newIntensity else select Sound Tmp'.sound$' Remove endif # endif endfor if .maximumIntensity > minimumIntensity select Sound '.sound$' Remove select Sound New'.sound$' Rename... '.sound$' elsif .maximumIntensity > -1 select Sound New'.sound$' Remove endif select TextGrid Input'.sound$' Remove endproc procedure end_program call write_preferences "" demo Erase all select all Remove exit endproc ###################################################### # # Configuration Page # ###################################################### procedure config_page demo Erase all demoWindowTitle("Speak Good Chinese: Change settings") .label$ = "" call Draw_config_page while (.label$ <> "Return") and demoWaitForInput() .clickX = -1 .clickY = -1 .pressed$ = "" .label$ = "" if demoClicked() .clickX = demoX() .clickY = demoY() call buttonClicked 'config$' '.clickX' '.clickY' .label$ = buttonClicked.label$ elsif demoKeyPressed() .pressed$ = demoKey$() call keyPressed 'config$' '.pressed$' .label$ = keyPressed.label$ endif # You cannot select a text field if startsWith(.label$, "$") .label$ = "" endif # Do things if .label$ != "" # Handle push button in process_config call process_config '.label$' '.clickX' '.clickY' '.pressed$' endif if .label$ = "Return" goto GOBACK endif endwhile # Go back label GOBACK call init_window endproc procedure Draw_config_page demo Erase all # Draw background if config.showBackground call draw_background Background endif # Draw buttons call Draw_all_buttons 'config$' call set_window_title 'config$' # Set correct buttons (alert) call setConfigMainPage endproc # Do what is asked procedure process_config .label$ .clickX .clickY .pressed$ if .label$ = "!Logging" config.logPerformance = not config.logPerformance .displayButton = config.logPerformance call Draw_button 'config$' +'.label$' '.displayButton' if config.logPerformance call start_logging endif elsif .label$ <> "" and not startsWith(.label$,"!") .label$ = replace$(.label$, "_", " ", 0) call process'config$''.label$' '.clickX' '.clickY' '.pressed$' endif endproc ############################################################### # # Presenting help texts # ############################################################### # Process Help procedure help_loop .table$ .redrawProc$ # General Help text call write_help_title '.table$' .label$ = "" call Draw_button '.table$' Help 2 .redrawScreen = 0 while (.label$ <> "Help") and demoWaitForInput() .label$ = "" if demoClicked() .clickX = demoX() .clickY = demoY() call buttonClicked '.table$' '.clickX' '.clickY' .label$ = buttonClicked.label$ elsif demoKeyPressed() .pressed$ = demoKey$() call keyPressed '.table$' '.pressed$' .label$ = keyPressed.label$ endif if .label$ != "" and .label$ <> "Help" # Redraw screen if .redrawScreen demo Erase all call '.redrawProc$' else .redrawScreen = 1 endif call Draw_button '.table$' Help 2 call write_help_title '.table$' # Handle push button in process_config call write_help_text '.table$' '.label$' endif endwhile # Reset button call Draw_button '.table$' Help 0 demo Erase all call '.redrawProc$' endproc # Write help text procedure write_help_text .table$ .label$ call findLabel '.table$' '.label$' .row = findLabel.row select Table '.table$' # Get text if .row <= 0 call findLabel '.table$' Help .row = findLabel.row select Table '.table$' endif .helpText$ = Get value... '.row' Helptext .helpKey$ = Get value... '.row' Key .helpKey$ = replace$(.helpKey$, "\", "", 0) .helpKey$ = replace$(.helpKey$, "_", "\_ ", 0) if index_regex(.helpKey$, "\S") .helpText$ = .helpText$+" ("+.helpKey$+")" endif # Get button values .leftX = Get value... '.row' LeftX .rightX = Get value... '.row' RightX .lowY = Get value... '.row' LowY .highY = Get value... '.row' HighY # PopUp dimensions .currentHelpFontSize = defaultFontSize call set_font_size '.currentHelpFontSize' .helpTextSize = demo Text width (wc)... '.helpText$' .helpTextSize += 4 if .leftX > 50 .htXleft = 20 .htXright = .htXleft + .helpTextSize + 5 .xstart = .leftX else .htXright = 80 .htXleft = .htXright - .helpTextSize - 5 .xstart = .rightX endif if .lowY > 50 .htYlow = 40 .htYhigh = .htYlow + 7 .ystart = .lowY .yend = .htYhigh else .htYhigh = 60 .htYlow = .htYhigh - 7 .ystart = .highY .yend = .htYlow endif # Adapt font size to horizontal dimensions .maxWidth = 90 call adjustFontSizeOnWidth 'defaultFont$' '.currentHelpFontSize' '.maxWidth' '.helpText$' .currentHelpFontSize = adjustFontSizeOnWidth.newFontSize if .htXleft < 0 or .htXright > 100 .htXleft = 0 .htXright = .htXleft + adjustFontSizeOnWidth.textWidth + 5 endif call set_font_size '.currentHelpFontSize' # Adapt vertical dimensions to font height call points_to_wc '.currentHelpFontSize' .lineHeight = points_to_wc.wc if .lineHeight > .htYhigh - .htYlow - 4 .htYhigh = .htYlow + .lineHeight + 4 endif # Determine arrow endpoints .xend = .htXleft if abs(.htXleft - .xstart) > abs(.htXright - .xstart) .xend = .htXright endif if abs((.htXleft+.htXright)/2 - .xstart) < min(abs(.htXright - .xstart),abs(.htXleft - .xstart)) .xend = (.htXleft+.htXright)/2 endif .xtext = .htXleft + 2 .ytext = .htYlow + 1 # Draw pop-up .mm2wc = demo Horizontal mm to wc... 1 .lineWidth = 2/.mm2wc demo Line width... '.lineWidth' demo Arrow size... '.lineWidth' demo Colour... 'sgc2.popUp_bordercolor$' demo Paint rectangle... 'sgc2.popUp_backgroundcolor$' '.htXleft' '.htXright' '.htYlow' '.htYhigh' demo Draw rectangle... '.htXleft' '.htXright' '.htYlow' '.htYhigh' demo Draw arrow... '.xstart' '.ystart' '.xend' '.yend' demo Line width... 'defaultLineWidth' demo Arrow size... 1 demo Black demo Text... '.xtext' Left '.ytext' Bottom '.helpText$' demoShow() call set_font_size 'defaultFontSize' endproc procedure write_help_title .table$ # Set help text title # General Help text call findLabel '.table$' Help .row = findLabel.row select Table '.table$' .helpTitle$ = Get value... '.row' Helptext .helpKey$ = Get value... '.row' Key .helpKey$ = replace$(.helpKey$, "\", "", 0) .helpKey$ = replace$(.helpKey$, "_", "\_ ", 0) .helpTitle$ = .helpTitle$+" ("+.helpKey$+")" call reset_viewport .helpTitleFontSize = 14 # Adapt size of button to length of text .maxWidth = 80 call adjustFontSizeOnWidth 'defaultFont$' '.helpTitleFontSize' '.maxWidth' '.helpTitle$' .helpTitleFontSize = adjustFontSizeOnWidth.newFontSize call set_font_size '.helpTitleFontSize' .helpTop = 100 demo Select inner viewport... 0 100 0 100 demo Axes... 0 100 0 100 demo Text... 50 Centre '.helpTop' Top '.helpTitle$' call set_font_size 'defaultFontSize' call reset_viewport endproc ############################################################### # # Miscelaneous procedures # ############################################################### procedure printPageToPrinter call print_window demo Print... 'printerName$' 'printerPresets$' call init_window endproc procedure getOpenFile .openDialogue$ call convert_praat_to_latin1 '.openDialogue$' .openDialogue$ = convert_praat_to_latin1.text$ .filename$ = chooseReadFile$ (.openDialogue$) if .filename$ <> "" and fileReadable(.filename$) Read from file... '.filename$' call log_fileOpen '.filename$' # Get only the filename .startName = rindex_regex(.filename$, "[/\\:]") + 1 .nameLength = rindex(.filename$, ".") - .startName currentSoundName$ = mid$(.filename$, .startName, .nameLength) else Create Sound from formula... Speech Mono 0 1 44100 0 endif recordedSound$ = selected$("Sound") currentStartTime = 0 currentEndTime = Get total duration # Reset selected window selectedStartTime = currentStartTime selectedEndTime = currentEndTime endproc procedure points_to_wc .points .mm = .points * 0.3527777778 .wc = demo Vertical mm to wc... '.mm' endproc procedure reset_viewport .low = viewportMargin .high = 100 - viewportMargin demo Select inner viewport... '.low' '.high' '.low' '.high' demo Axes... 0 100 0 100 endproc procedure set_font_size .fontSize call reset_viewport demo Font size... '.fontSize' call reset_viewport endproc procedure wipeArea .areaCommand$ call reset_viewport '.areaCommand$' endproc procedure adjustFontSizeOnWidth .font$ .currentFontSize .maxWidth .text$ demo '.font$' call set_font_size '.currentFontSize' .textWidth = demo Text width (wc)... '.text$' while .textWidth > .maxWidth and .currentFontSize > 2 .currentFontSize -= 0.5 call set_font_size '.currentFontSize' .textWidth = demo Text width (wc)... '.text$' endwhile .diff = .textWidth - .maxWidth .newFontSize = .currentFontSize demo 'defaultFont$' endproc procedure adjustRotatedFontSizeOnBox .font$ .currentFontSize .maxWidth .maxHeight .rotation .text$ demo '.font$' .radians = .rotation/360 * 2 * pi .horWC = demo Horizontal mm to wc... 10.0 .verWC = demo Vertical mm to wc... 10.0 if .horWC > 0 .verCoeff = .verWC / .horWC else .verCoeff = 1 endif call set_font_size '.currentFontSize' .textLength = demo Text width (wc)... '.text$' while (.textLength * .verCoeff * sin(.radians) > .maxHeight or .textLength * cos(.radians) > .maxWidth) and .currentFontSize > 2 .currentFontSize -= 0.5 call set_font_size '.currentFontSize' .textLength = demo Text width (wc)... '.text$' endwhile .diff = .textLength - .maxHeight .newFontSize = .currentFontSize demo 'defaultFont$' endproc procedure adjustFontSizeOnHeight .font$ .currentFontSize .maxHeight demo '.font$' call points_to_wc '.currentFontSize' .lineHeight = points_to_wc.wc while .lineHeight > .maxHeight and .currentFontSize > 2 .currentFontSize -= 0.5 call points_to_wc '.currentFontSize' .lineHeight = points_to_wc.wc endwhile .diff = .lineHeight - .maxHeight .newFontSize = .currentFontSize demo 'defaultFont$' endproc # Load a table with button info etc. # Load local tables if present. Else load # build-in scripted tables procedure loadTable .tableName$ # Search for the table in local, preference, and global directories if fileReadable("'localTableDir$'/'.tableName$'.Table") Read from file... 'localTableDir$'/'.tableName$'.Table elsif fileReadable("'preferencesTableDir$'/'.tableName$'.Table") Read from file... 'preferencesTableDir$'/'.tableName$'.Table elsif fileReadable("'globaltablelists$'/'.tableName$'.Table") Read from file... 'globaltablelists$'/'.tableName$'.Table # Load them from script else call Create'.tableName$' endif endproc # Create a pop-up window with text from a Text Table procedure write_text_table .table$ .xleft = 10 .xright = 90 .ylow = 20 .yhigh = 85 .lineHeight = 2.5 # Get table with text and longest line call loadTable '.table$' .instructionText = selected() .numLines = Get number of rows .instructionFontSize = 14 .referenceText$ = "" .maxlenght = 0 .maxLine = 0 .maxFontSize = 0 .maxWidth = 0 for .l to .numLines select '.instructionText' .currentText$ = Get value... '.l' text # Expand variables, eg, 'praatVersion$' call expand_praat_variables '.currentText$' .currentText$ = expand_praat_variables.text$ .font$ = Get value... '.l' font .fontSize = Get value... '.l' size call set_font_size '.fontSize' .textWidth = demo Text width (wc)... '.currentText$' if .fontSize > .maxFontSize .maxFontSize = .fontSize endif if .textWidth > .maxWidth .maxWidth = .textWidth .instructionFontSize = .fontSize .maxLine = .l endif endfor select '.instructionText' .referenceText$ = Get value... '.maxLine' text .maxLineFont$ = Get value... '.maxLine' font .instructionFontSize = Get value... '.maxLine' size call set_font_size '.maxFontSize' # Adapt size of button to length of text .maxWidth = (.xright - .xleft) - 4 .origFontSize = .instructionFontSize call adjustFontSizeOnWidth 'defaultFont$' '.instructionFontSize' '.maxWidth' '.referenceText$' call adjustFontSizeOnHeight 'defaultFont$' '.maxFontSize' '.lineHeight' .instructionFontSize = min(adjustFontSizeOnWidth.newFontSize, adjustFontSizeOnHeight.newFontSize) if adjustFontSizeOnWidth.diff > 0 .xright += adjustFontSizeOnWidth.diff/4 .xleft -= 3*adjustFontSizeOnWidth.diff/4 endif call set_font_size '.instructionFontSize' .fontSizeFactor = .instructionFontSize / .origFontSize .numRows = Get number of rows # Calculate length from number of lines. .dy = .lineHeight .midY = .yhigh - (.yhigh - .ylow)/2 .yhigh = .midY + (.numRows+1) * .dy / 2 .ylow = .yhigh - (.numRows+1) * .dy .textleft = .xleft + 2 demo Line width... 8 demo Colour... 'sgc2.popUp_bordercolor$' demo Paint rectangle... 'sgc2.popUp_backgroundcolor$' '.xleft' '.xright' '.ylow' '.yhigh' demo Draw rectangle... '.xleft' '.xright' '.ylow' '.yhigh' demo Line width... 'defaultLineWidth' demo Black .ytext = .yhigh - 2 - .dy for .i to .numRows select '.instructionText' .font$ = Get value... '.i' font .fontSize = Get value... '.i' size .font$ = extractWord$(.font$, "") # Scale font .fontSize = floor(.fontSize*.fontSizeFactor) if .fontSize < 4 .fontSize = 4 endif .line$ = Get value... '.i' text # Expand variables, eg, 'praatVersion$' call expand_praat_variables '.line$' .line$ = expand_praat_variables.text$ # Display text demo Text special... '.textleft' Left '.ytext' Bottom '.font$' '.fontSize' 0 '.line$' .ytext -= .dy endfor demoShow() call set_font_size 'defaultFontSize' select '.instructionText' Remove endproc # Create a pop-up window with text from an existing Table object procedure write_tabbed_table .table$ .labelTextTable$ .xleft = 0 .xright = 100 .ylow = 20 .yhigh = 85 .lineHeight = 2.5 # Get table with text and longest line call loadTable '.labelTextTable$' .labelText$ = selected$("Table") select Table '.table$' .tabbedText = selected() .numLines = Get number of rows .numCols = Get number of columns .font$ = defaultFont$ .fontSize = defaultFontSize # Standard width .widthCanvas = .xright - .xleft .dx = (.widthCanvas - 4) / (.numCols) # Get longest entry demo '.font$' call set_font_size '.fontSize' .maxWidth = 0 for .i from 0 to .numLines .xtext = .xleft + .dx / 2 for .j to .numCols select '.tabbedText' .currentLabel$ = Get column label... '.j' if .i > 0 .line$ = Get value... '.i' '.currentLabel$' else .line$ = .currentLabel$ select Table '.labelText$' call findLabel '.labelText$' '.line$' select Table '.labelText$' .line$ = Get value... 'findLabel.row' Text endif # Expand variables, eg, 'praatVersion$' call expand_praat_variables '.line$' .line$ = expand_praat_variables.text$ .textWidth = demo Text width (wc)... '.line$' if .textWidth > .maxWidth .maxWidth = .textWidth endif endfor endfor if .dx > 1.2 * .maxWidth .widthCanvas = 1.2 * .maxWidth * .numCols + 4 .xleft = 50 - .widthCanvas / 2 .xright = 50 + .widthCanvas / 2 .dx = (.widthCanvas - 4) / (.numCols) else .maxWidth = .dx - 1 endif # Calculate length from number of lines. .dy = .lineHeight + 0.5 .midY = .yhigh - (.yhigh - .ylow)/2 .yhigh = .midY + (.numLines+2) * .dy / 2 .ylow = .yhigh - (.numLines+2) * .dy .textleft = .xleft + 2 demo Line width... 8 demo Colour... 'sgc2.popUp_bordercolor$' demo Paint rectangle... 'sgc2.popUp_backgroundcolor$' '.xleft' '.xright' '.ylow' '.yhigh' demo Draw rectangle... '.xleft' '.xright' '.ylow' '.yhigh' demo Line width... 'defaultLineWidth' demo Black .ytext = .yhigh - 2 - .dy # First the column names, then the items for .i from 0 to .numLines .xtext = .textleft + .dx / 2 for .j to .numCols select '.tabbedText' .currentLabel$ = Get column label... '.j' if .i > 0 .line$ = Get value... '.i' '.currentLabel$' else .line$ = .currentLabel$ select Table '.labelText$' call findLabel '.labelText$' '.line$' select Table '.labelText$' .line$ = Get value... 'findLabel.row' Text endif # Expand variables, eg, 'praatVersion$' call expand_praat_variables '.line$' .line$ = expand_praat_variables.text$ call adjustFontSizeOnWidth '.font$' '.fontSize' '.maxWidth' '.line$' .currentFontSize = adjustFontSizeOnWidth.newFontSize # Display text demo Text special... '.xtext' Centre '.ytext' Bottom '.font$' '.currentFontSize' 0 '.line$' .xtext += .dx endfor .ytext -= .dy endfor demoShow() call set_font_size 'defaultFontSize' select Table '.labelText$' Remove endproc # Create a pop-up window with a given text procedure write_text_popup .font$ .size .text$ .xleft = 10 .xright = 90 .ylow = 20 .yhigh = 85 .lineHeight = 3 # Adapt size of button to length of text .maxWidth = (.xright - .xleft) - 4 call adjustFontSizeOnWidth 'defaultFont$' '.size' '.maxWidth' '.text$' call adjustFontSizeOnHeight 'defaultFont$' '.size' '.lineHeight' .popupFontSize = min(adjustFontSizeOnWidth.newFontSize, adjustFontSizeOnHeight.newFontSize) if adjustFontSizeOnWidth.diff > 0 .xright += adjustFontSizeOnWidth.diff/4 .xleft -= 3*adjustFontSizeOnWidth.diff/4 else .xleft = ((.xright + .xleft) - adjustFontSizeOnWidth.textWidth)/2 - 2 .xright = ((.xright + .xleft) + adjustFontSizeOnWidth.textWidth)/2 + 2 endif .numRows = 1 # Calculate length from number of lines. .dy = .lineHeight .midY = .yhigh - (.yhigh - .ylow)/2 .yhigh = .midY + (.numRows+1) * .dy / 2 .ylow = .yhigh - (.numRows+1) * .dy .textleft = .xleft + 2 .xmid = (.textleft + .xright - 2)/2 demo Line width... 8 demo Colour... 'sgc2.popUp_bordercolor$' demo Paint rectangle... 'sgc2.popUp_backgroundcolor$' '.xleft' '.xright' '.ylow' '.yhigh' demo Draw rectangle... '.xleft' '.xright' '.ylow' '.yhigh' demo Line width... 'defaultLineWidth' demo Black .ytext = .yhigh - 2 - .dy # Write text demo Text special... '.xmid' Centre '.ytext' Bottom '.font$' '.popupFontSize' 0 '.text$' demoShow() demo 'defaultFont$' call set_font_size 'defaultFontSize' endproc # Write the background from a Text Table procedure draw_background .table$ .xleft = 0 .xright = 100 .ylow = 0 .yhigh = 100 .lineHeight = 5 .defaultColour$ = "{0.9,0.9,0.9}" .defaultAlign$ = "centre" # Get table with text and longest line call loadTable '.table$' .backgroundText = selected() .numLines = Get number of rows .backgroundFontSize = 28 .referenceText$ = "" .maxlenght = 0 .maxLine = 0 .maxFontSize = 0 .maxWidth = 0 .textLines = 0 for .l to .numLines select '.backgroundText' .currentText$ = Get value... '.l' text # Expand variables, eg, 'praatVersion$' call expand_praat_variables '.currentText$' .currentText$ = expand_praat_variables.text$ .font$ = Get value... '.l' font .fontSize = Get value... '.l' size if .fontSize > .maxFontSize .maxFontSize = .fontSize endif if not startsWith(.font$, "!") call set_font_size '.fontSize' .textWidth = demo Text width (wc)... '.currentText$' if .textWidth > .maxWidth .maxWidth = .textWidth .backgroundFontSize = .fontSize .maxLine = .l endif .textLines += 1 endif endfor if .maxLine > 0 select '.backgroundText' .referenceText$ = Get value... '.maxLine' text .maxLineFont$ = Get value... '.maxLine' font .backgroundFontSize = Get value... '.maxLine' size .backgroundFontColour$ = Get value... '.maxLine' colour call set_font_size '.maxFontSize' else .maxFontSize = .backgroundFontSize endif # Adapt size of button to length of text .maxWidth = (.xright - .xleft) - 4 .origFontSize = .backgroundFontSize call adjustFontSizeOnWidth 'defaultFont$' '.backgroundFontSize' '.maxWidth' '.referenceText$' .fontSizeFactor = adjustFontSizeOnWidth.newFontSize / .backgroundFontSize .backgroundFontSize = adjustFontSizeOnWidth.newFontSize call set_font_size '.backgroundFontSize' call adjustFontSizeOnHeight 'defaultFont$' '.backgroundFontSize' '.lineHeight' .lineHeight /= adjustFontSizeOnHeight.newFontSize / .backgroundFontSize if adjustFontSizeOnHeight.newFontSize >= .origFontSize and (.textLines+1) * .lineHeight > (.yhigh - .ylow - 4) .lineHeight = (.yhigh - .ylow - 4)/(.textLines + 1) call adjustFontSizeOnHeight 'defaultFont$' '.maxFontSize' '.lineHeight' .fontSizeFactor = adjustFontSizeOnHeight.newFontSize / .backgroundFontSize endif .numRows = Get number of rows # Calculate length from number of lines. .dy = .lineHeight .midY = .yhigh - (.yhigh - .ylow)/2 .yhigh = .midY + (.textLines+1) * .dy / 2 .ylow = .yhigh - (.textLines+1) * .dy .textleft = .xleft + 2 .textright = .xright - 2 .textmid = (.xright - .xleft)/2 demo Black .ytext = .yhigh - 2 - .dy for .i to .numRows select '.backgroundText' .font$ = Get value... '.i' font .fontSize = Get value... '.i' size .fontColour$ = Get value... '.i' colour .fontColour$ = replace_regex$(.fontColour$, "^[\- ]$", ".defaultColour$", 1) .fontAlign$ = Get value... '.i' align .fontAlign$ = replace_regex$(.fontAlign$, "^[\- ]$", ".defaultAlign$", 1) .line$ = Get value... '.i' text # Expand variables, eg, 'praatVersion$' call expand_praat_variables '.line$' .line$ = expand_praat_variables.text$ # Scale font .fontSize = floor(.fontSize*.fontSizeFactor) if not startsWith(.font$, "!") .font$ = extractWord$(.font$, "") if .fontAlign$ = "centre" .xtext = .textmid elsif .fontAlign$ = "right" .xtext = .textright else .xtext = .textleft endif if .fontSize < 4 .fontSize = 4 endif # Clean up text demo Colour... '.fontColour$' demo Text special... '.xtext' '.fontAlign$' '.ytext' Bottom '.font$' '.fontSize' 0 '.line$' .ytext -= .dy elsif .font$ = "!demo command" demo Colour... '.fontColour$' .line$ = replace_regex$(.line$, "\{FONTSIZE\$\}", "'.fontSize'", 0) .line$ = replace_regex$(.line$, "\{XTEXT\$\}", "'.xtext'", 0) .line$ = replace_regex$(.line$, "\{YTEXT\$\}", "'.ytext'", 0) .line$ = replace_regex$(.line$, "\{DY\$\}", "'.dy'", 0) .line$ = replace_regex$(.line$, "\{[^\}]*\}", "", 0) while index(.line$, "[[") .nextBracketOpen = index(.line$, "[[") .nextBracketOpen += 2 .nextBracketClose = index(.line$, "]]") .bracketLength = .nextBracketClose - .nextBracketOpen .result$ = "" if .bracketLength > 0 .expression$ = mid$(.line$, .nextBracketOpen, .bracketLength) .expression$ = replace_regex$(.expression$, "\s", "", 0) if length(.expression$) > 0 # Test expression for security, only allow explicitely defined functions .allowedStrings$ = "e|pi|not|and|or|div|mod|abs|round|floor|ceiling" .allowedStrings$ = .allowedStrings$ + "|sqrt|min|max|imin|imax|sin|cos|tan|arcsin|arccos|arctan|arctan2|sinc|sincpi" .allowedStrings$ = .allowedStrings$ + "|exp|ln|log10|log2|sinh|cosh|tanh|arcsinh|arccosh|arctanh" .allowedStrings$ = .allowedStrings$ + "|sigmoid|invSigmoid|erf|erfc|randomUniform|randomInteger|randomGauss|randomPoisson" .allowedStrings$ = .allowedStrings$ + "|lnGamma|gaussP|gaussQ|invGaussQ|chiSquareP|chiSquareQ" .allowedStrings$ = .allowedStrings$ + "|invChiSquareP|invChiSquareQ|studentP|studentQ|invStudentP|invStudentQ" .allowedStrings$ = .allowedStrings$ + "|beta|besselI|besselK" .testExpression$ = replace_regex$(.expression$, "(^|\W)('.allowedStrings$')(?=$|\W)", "\1\3", 0) .testExpression$ = replace_regex$(.testExpression$, "[0-9\.,\-+/*^()<>= ]", "", 0) if .testExpression$ = "" .calc = '.expression$' .result$ = "'.calc'" endif endif endif # Replace expression by result .lastLeft = .nextBracketOpen - 3 .newLine$ = left$(.line$, .lastLeft) .newLine$ = .newLine$ + .result$ .numCopy = length(.line$) - .nextBracketClose - 1 .newLine$ = .newLine$ + right$(.line$, .numCopy) .line$ = .newLine$ endwhile demo '.line$' endif endfor demo Black demoShow() call set_font_size 'defaultFontSize' select '.backgroundText' Remove endproc procedure convert_praat_to_utf8 .text$ .text$ = replace_regex$(.text$, "\\a""", "\xc3\xa4", 0) .text$ = replace_regex$(.text$, "\\A""", "\xc3\x84", 0) .text$ = replace_regex$(.text$, "\\o""", "\xc3\xb6", 0) .text$ = replace_regex$(.text$, "\\O""", "\xc3\x96", 0) .text$ = replace_regex$(.text$, "\\u""", "\xc3\xbc", 0) .text$ = replace_regex$(.text$, "\\U""", "\xc3\x9c", 0) .text$ = replace_regex$(.text$, "\\i""", "\xc3\xaf", 0) .text$ = replace_regex$(.text$, "\\I""", "\xc3\x8f", 0) .text$ = replace_regex$(.text$, "\\e""", "\xc3\xab", 0) .text$ = replace_regex$(.text$, "\\E""", "\xc3\x8b", 0) .text$ = replace_regex$(.text$, "\\y""", "\xc3\xbf", 0) .text$ = replace_regex$(.text$, "\\e'", "\xc3\xa9", 0) .text$ = replace_regex$(.text$, "\\E'", "\xc3\x89", 0) .text$ = replace_regex$(.text$, "\\ss", "\xc3\x9f", 0) endproc procedure convert_praat_to_latin1 .text$ .text$ = replace_regex$(.text$, "\\a""", "\xe4", 0) .text$ = replace_regex$(.text$, "\\A""", "\xc4", 0) .text$ = replace_regex$(.text$, "\\o""", "\xf6", 0) .text$ = replace_regex$(.text$, "\\O""", "\xd6", 0) .text$ = replace_regex$(.text$, "\\u""", "\xfc", 0) .text$ = replace_regex$(.text$, "\\U""", "\xdc", 0) .text$ = replace_regex$(.text$, "\\i""", "\xef", 0) .text$ = replace_regex$(.text$, "\\I""", "\xcf", 0) .text$ = replace_regex$(.text$, "\\e""", "\xeb", 0) .text$ = replace_regex$(.text$, "\\E""", "\xcb", 0) .text$ = replace_regex$(.text$, "\\y""", "\xff", 0) .text$ = replace_regex$(.text$, "\\Y""", "Y", 0) .text$ = replace_regex$(.text$, "\\e'", "\xe9", 0) .text$ = replace_regex$(.text$, "\\E'", "\xc9", 0) .text$ = replace_regex$(.text$, "\\ss", "\xdf", 0) endproc # Expand 'variable$' into the value of variable$. # Eg, 'praatVersion$' becomes 5.1.45 or whatever is the current version # Single quotes can be protected by \' procedure expand_praat_variables .text$ if index(.text$, "'") .tempText$ = replace_regex$(.text$, "(^|[^\\])'([\w\$\.]+)'", "\1""+\2+""", 0) .tempText$ = replace_regex$(.tempText$, "[\\]'", "'", 0) .tempText$ = """"+.tempText$+"""" # Check whether all the variables actually exist. Ignore any variable that does not exist .checkVars$ = .tempText$ while length(.checkVars$) > 0 and index(.checkVars$, "+") .start = index(.checkVars$, "+") .checkVars$ = right$(.checkVars$, length(.checkVars$) - .start) .end = index(.checkVars$, "+") if .end .variable$ = left$(.checkVars$, .end - 1) if not variableExists(.variable$) .tempText$ = replace$(.tempText$, """+'.variable$'+""", "'"+.variable$+"'", 0) endif .checkVars$ = right$(.checkVars$, length(.checkVars$) - .end) else .checkVars$ = "" endif endwhile .text$ = '.tempText$' endif endproc # Get a time stamp in normalized format procedure getTimeStamp .currentDateTime$ = date$() .string$ = replace_regex$(.currentDateTime$, "[A-Z][a-z]+\s+([A-Z][a-z]+)\s+(\d+)\s+(\d+)\W(\d+)\W(\d+)\s+(\d+)$", "\6-\1-\2T\3-\4-\5", 0) endproc