4 # Intializing Praat script
6 # SpeakGoodChinese: InitializeSGC2.praat defines and sets the global variables
7 # and loads general SGC2 code
9 # Copyright (C) 2007-2010 R.J.J.H. van Son and 2010 the Netherlands Cancer Institute
10 # The SpeakGoodChinese team are:
11 # Guangqin Chen, Zhonyan Chen, Stefan de Koning, Eveline van Hagen,
12 # Rob van Son, Dennis Vierkant, David Weenink
14 # This program is free software; you can redistribute it and/or modify
15 # it under the terms of the GNU General Public License as published by
16 # the Free Software Foundation; either version 2 of the License, or
17 # (at your option) any later version.
19 # This program is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU General Public License for more details.
24 # You should have received a copy of the GNU General Public License
25 # along with this program; if not, write to the Free Software
26 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
29 # Do not store these variables as preferences
30 sgc.nonPreferences$ = " config.savePerf config.openPerf config.clearSummary config.audioName "
32 # Information for logging
33 currentDate$ = date$()
34 dateYear$ = right$(currentDate$, length(currentDate$) - rindex(currentDate$, " "))
35 logtimeStamp$ = replace_regex$(currentDate$, "[^a-zA-Z0-9\-_]", "-", 0)
36 currentLogDirectory$ = ""
37 feedbackTablePrefix$ = "Feedback"
38 feedbackTableName$ = ""
39 evaluationTablePrefix$ = "Evaluation"
40 evaluationTableName$ = ""
41 performanceTableName$ = "Performance"
46 yFeedback = yWordlist + 5
47 yPinyin = yFeedback + 10
48 yContour = yPinyin + 15
49 wipeContourArea$ = "demo Paint rectangle... White 20 80 'yContour' 100"
50 wipePinyinArea$ = "demo Paint rectangle... White 20 80 'yPinyin' 'yContour'"
51 wipeFeedbackArea$ = "demo Paint rectangle... White 0 100 'yFeedback' 'yPinyin'"
52 wipeWordlistArea$ = "demo Paint rectangle... White 20 80 'yWordlist' 'yFeedback'"
54 # Pop-Up window colors
55 sgc2.popUp_bordercolor$ = "{0.5,0.5,1}"
56 sgc2.popUp_backgroundcolor$ = "{0.9,0.9,1}"
58 # Initialize parameters
61 sgc.currentWordlist = -1
66 sgc.customLanguage$ = ""
75 sgc.failedAttempts = 0
77 config.deleteWordlist = -1
78 config.displayNumbers = 1
79 config.displayPinyin = 1
80 config.displayChar = 0
81 config.displayTrans = 1
82 config.useSoundExample = 1
83 config.synthesis$ = "_DISABLED_"
84 config.input$ = "Microphone"
85 config.showBackground = 1
86 sgc2.noiseThresshold = -30
91 config.clearSummary = 0
92 config.audioName$ = ""
95 mainPage.saveAudio$ = ""
98 sgc_ToneProt.minimumPitch = 40
99 sgc_ToneProt.maximumPitch = 600
101 # Platform dependent settings
102 if macintosh or windows
103 config.displayChar = 1
104 config.displayNumbers = 0
106 if windows and endsWith(build_SHA$, " XP")
107 config.displayChar = 0
108 config.displayNumbers = 0
111 config.displayChar = 0
112 config.displayNumbers = 1
116 samplingFrequency = 44100
118 samplingFrequency = 44100
120 samplingFrequency = 44100
125 config.language$ = "EN"
126 config.register = 249
127 preferencesAppFile$ = preferencesAppDir$+"/sgc2rc.txt"
128 preferencesLogDir$ = "'preferencesAppDir$'/log"
129 preferencesTableDir$ = "'preferencesAppDir$'/GUI"
130 sgc2wordlists$ = "'preferencesAppDir$'/wordlists"
131 localWordlistDir$ = sgc2wordlists$
133 # Global word lists must be installed BY THE ADMINISTRATOR
134 # This means, create the directory 'globalwordlists$' and
135 # fill it with wordlist directories containing wordlist.Table
136 # and audio files. They can be copied from a local directory.
137 globalwordlists$ = ""
138 globaltablelists$ = ""
141 globalwordlists$ = "/etc/'sgc2.demoAppName$'/wordlists"
142 globaltablelists$ = "/etc/'sgc2.demoAppName$'/GUI"
143 globalTTSdir$ = "/etc/'sgc2.demoAppName$'/TTS"
145 globalwordlists$ = "/Library/Preferences/'sgc2.demoAppName$'/wordlists"
146 globaltablelists$ = "/Library/Preferences/'sgc2.demoAppName$'/GUI"
147 globalTTSdir$ = "/Library/Preferences/'sgc2.demoAppName$'/TTS"
149 globalwordlists$ = "C:/Documents and Settings/All Users/Application Data/'sgc2.demoAppName$'/wordlists"
150 globaltablelists$ = "C:/Documents and Settings/All Users/Application Data/'sgc2.demoAppName$'/GUI"
151 globalTTSdir$ = "C:/Documents and Settings/All Users/Application Data/'sgc2.demoAppName$'/TTS"
153 sgc2.synthesizer = -1
154 # Define a Praat TTS command that will set sgc2.synthesizer
155 sgc2.normalTTScommand$ = "call create_default_TTS Mandarin f4 10000 0.01 50 100 95 no IPA"
156 sgc2.advancedTTScommand$ = "call create_default_TTS Mandarin f4 10000 0.01 50 70 125 no IPA"
157 sgc.alignedTextGrid = -1
159 ##############################################################
161 config.shuffleLists = 1
162 config.adaptiveLists = 0
164 defaultFont$ = "Helvetica"
167 # Set up directories if they do not exist already
168 call set_up_directories
170 # Get saved preferences
171 call read_preferences ""
174 speakCommandDir$ = "'preferencesAppDir$'/TTS"
175 speakCommandFile$ = ""
177 sgc.recordCommandFile$ = ""
178 sgc.playCommandFile$ = ""
180 sgc.scratchAudioDir$ = "'preferencesAppDir$'\audio\"
182 sgc.scratchAudioDir$ = "/tmp/SpeakGoodChinese/"
184 sgc.useAlternativeRecorder = 0
186 sgc.useAlternativePlayer = 0
189 # Set inital language
190 call set_language 'config.language$'
193 call load_word_list "'localWordlistDir$'" 0
195 # Set up evaluation table
196 initialiseSGC2.toneevaluation_table$ = ""
197 call initialize_toneevaluation_tables
202 ###############################################################
204 # Obligatory procedures
206 ###############################################################
207 # Initialize Demo Window
208 procedure init_window
210 demo Line width... 'defaultLineWidth'
212 call set_font_size 'defaultFontSize'
215 # If there is no recorded sound, try to read stored recording
216 if recordedSound$ = "" and sgc.saveAudio$ <> ""
218 select sgc.currentWordlist
219 if sgc.currentWord > 0 and sgc.currentWord <= sgc.numberOfWords
220 call readPinyin 'sgc.currentWord'
221 sgc.pinyin$ = readPinyin.pinyin$
222 .outputName$ = "'sgc.saveAudio$'/'sgc.pinyin$'.wav"
223 if fileReadable(.outputName$)
224 sgc.recordedSound = Read from file: .outputName$
225 recordedSound$ = selected$("Sound")
227 # See feedback on earl;ier recorded words
228 if fileReadable("'sgc.saveAudio$'/TestSpeakGoodChinese2.txt")
229 call write_feedback Feedback
231 select Table Feedback
234 # Set config.audioName
235 .tmp$ = replace_regex$(sgc.saveAudio$, "[^/\\]+[/\\]?$", "", 0)
236 config.audioName$ = replace$(sgc.saveAudio$, .tmp$, "", 0)
242 # Set mainPage.saveAudio$ grade
243 call set_grade_display 'sgc.pinyin$'
247 .windowTitle$ = replace$(wordlistName$, "_", " ", 0)
248 call set_window_title 'buttons$' '.windowTitle$'
249 # Display the word-list
251 # Wipe screen and draw background
252 call wipeArea 'wipeContourArea$'
253 if config.showBackground
254 call draw_background Background
256 # Define buttons in a table
262 call draw_tone_contour
264 call paint_saveAudio_light
267 sgc.failedAttempts = 0
270 # Make sure all Preferences directories are available
271 procedure set_up_directories
272 .dirPath$ = "'preferencesAppDir$'"
273 createDirectory(.dirPath$)
274 .dirPath$ > '.dirPath$'/directory.txt
275 createDirectory("'.dirPath$'/wordlists")
276 .dirPath$ > '.dirPath$'/wordlists/directory.txt
277 createDirectory("'.dirPath$'/pitchmodels")
278 .dirPath$ > '.dirPath$'/pitchmodels/directory.txt
279 createDirectory("'.dirPath$'/log")
280 .dirPath$ > '.dirPath$'/log/directory.txt
281 createDirectory("'.dirPath$'/TTS")
282 .dirPath$ > '.dirPath$'/TTS/directory.txt
286 # Retrieve and store setting between sessions
288 procedure read_preferences .preferencesFile$
289 if not fileReadable(.preferencesFile$)
290 .preferencesFile$ = preferencesAppFile$
292 if fileReadable(.preferencesFile$)
293 Read from file... 'preferencesAppFile$'
294 .preferenceTable$ = selected$("Table")
295 .numPrefKeys = Get number of rows
296 for .row to .numPrefKeys
297 .variableName$ = Get value... '.row' Key
298 if variableExists(.variableName$)
299 .variableValue = Get value... '.row' Value
300 if .variableValue <> undefined
301 '.variableName$' = '.variableValue'
303 elsif variableExists(.variableName$+"$")
304 .variableValue$ = Get value... '.row' Value
305 .variableName$ = .variableName$+"$"
306 '.variableName$' = "'.variableValue$'"
310 select Table '.preferenceTable$'
315 procedure write_preferences .preferencesFile$
316 Create Table with column names... Preferences 0 Key Value
317 if index_regex(.preferencesFile$, "[a-zA-Z0-9]") <= 0
318 .preferencesFile$ = preferencesAppFile$
322 for .tableNum from 1 to 2
328 .varPrefix$ = replace_regex$(.table$, "^(.)", "\l\1", 0)
330 select Table '.table$'
331 .numTableRows = Get number of rows
332 for .tablerow to .numTableRows
333 select Table '.table$'
334 .label$ = Get value... '.tablerow' Label
335 .variableName$ = .varPrefix$+"."+(replace_regex$(.label$, "^(.)", "\l\1", 0))
336 .keyName$ = .variableName$
338 if sgc.nonPreferences$ <> "" and index(sgc.nonPreferences$, " '.variableName$' ")
340 elsif variableExists(.variableName$)
341 .value = '.variableName$'
343 elsif variableExists(.variableName$ + "$")
344 .variableName$ = .variableName$ + "$"
345 .value$ = '.variableName$'
346 elsif index(.variableName$, "_") > 0
347 .variableName$ = left$(.variableName$, rindex(.variableName$, "_") - 1)
348 .keyName$ = .variableName$
349 select Table Preferences
350 .prefRow = Search column... Key '.keyName$'
352 if variableExists(.variableName$)
353 .value = '.variableName$'
355 elsif variableExists(.variableName$ + "$")
356 .variableName$ = .variableName$ + "$"
357 .value$ = '.variableName$'
363 select Table Preferences
366 Set string value... '.row' Key '.keyName$'
367 Set string value... '.row' Value '.value$'
372 # Some extra settings
373 select Table Preferences
376 Set string value... '.row' Key wordlistDir
377 Set string value... '.row' Value 'localWordlistDir$'
379 select Table Preferences
382 Set string value... '.row' Key wordlistName
383 Set string value... '.row' Value 'wordlistName$'
385 select Table Preferences
386 Write to table file... '.preferencesFile$'
391 ###############################################################
393 # TTS (speech synthesis). Place commands in user info
396 # speakCommandDir$ = "'preferencesAppDir$'/TTS"
397 # speakCommandFile$ = ""
399 # Make sure sgc2.synthesizer is set!
400 procedure create_default_TTS .language$ .voice$ .samplefreq .gap .pitch_adj .pitch_range .words_per_minute .use_data$ .espeak_phones$
401 sgc2.synthesizer = Create SpeechSynthesizer... '.language$' '.voice$'
402 Set speech output settings... .samplefreq .gap .pitch_adj .pitch_range .words_per_minute '.use_data$' '.espeak_phones$'
406 if sgc2.synthesizer > 0
407 select sgc2.synthesizer
409 sgc2.synthesizer = -1
411 # Note, the TTScommand must set sgc2.synthesizer!
412 if config.strict$ = "'sgc.highestLevel'"
413 'sgc2.advancedTTScommand$'
415 'sgc2.normalTTScommand$'
419 .ttscommand$ = "speak"
423 .ttscommand$ = "espeak"
427 .ttscommand$ = "C:/Program Files/eSpeak/command_line/espeak.exe"
431 # Global TTS command has precedence
432 if fileReadable("'globalTTSdir$'/TTS_'.osName$'_command.txt")
433 speakCommandFile$ = "'globalTTSdir$'/TTS_'.osName$'_command.txt"
434 if config.synthesis$ = "_DISABLED_"
436 config.synthesis$ = "eSpeak"
440 # Local TTS command, if there is no global one
441 # Command does not exist yet, create it if eSpeak is installed
442 # Make sure to quote the path!
443 if speakCommandFile$ = ""
444 # Autodetect synthesizer command
445 # if not fileReadable("'speakCommandDir$'/TTS_'.osName$'_eSpeak_command.txt")
446 # .command_path$ = ""
448 # system_nocheck PATH=${PATH}:/opt/local/bin; bash -c -- 'which '.ttscommand$' > "'speakCommandDir$'/command_path.txt"'
449 # .command_path$ < 'speakCommandDir$'/command_path.txt
451 # system_nocheck PATH=${PATH};bash -c -- 'which '.ttscommand$' > "'speakCommandDir$'/command_path.txt"'
452 # .command_path$ < 'speakCommandDir$'/command_path.txt
454 # if fileReadable(.ttscommand$)
455 # .command_path$ = .ttscommand$
458 # # Remove any newlines
459 # .command_path$ = replace$(.command_path$, "'newline$'", "", 0)
461 # # Command path found
462 # if sgc2.synthesizer <= 0 and .command_path$ <> "" and fileReadable(.command_path$)
463 # deleteFile("'speakCommandDir$'/TTS_'.osName$'_eSpeak_command.txt")
464 # fileappend "'speakCommandDir$'/TTS_'.osName$'_eSpeak_command.txt"
465 # ...'.quote$''.ttscommand$''.quote$' -v zh+f4 -s 100 'newline$'
466 # speakCommandFile$ = "'speakCommandDir$'/TTS_'.osName$'_eSpeak_command.txt"
469 # if fileReadable("'speakCommandDir$'/TTS_'.osName$'_eSpeak_command.txt")
470 speakCommandFile$ = "'speakCommandDir$'/TTS_'.osName$'_eSpeak_command.txt"
472 deleteFile("'speakCommandDir$'/command_path.txt")
475 # Close off (other TTS maybe a later option)
476 if sgc2.synthesizer > 0 or (speakCommandFile$ <> "" and fileReadable(speakCommandFile$))
477 config.synthesis$ = "eSpeak"
481 # Alternative audio recorder
482 procedure set_up_recorder
493 # Global TTS command has precedence
494 sgc.useAlternativeRecorder = 0
495 if fileReadable("'globalTTSdir$'/TTS_'.osName$'_record_command.txt")
496 createDirectory(sgc.scratchAudioDir$)
497 sgc.recordCommandFile$ = "'globalTTSdir$'/TTS_'.osName$'_record_command.txt"
498 sgc.useAlternativeRecorder = 1
499 elsif fileReadable("'speakCommandDir$'/TTS_'.osName$'_record_command.txt")
500 createDirectory(sgc.scratchAudioDir$)
501 sgc.recordCommandFile$ = "'speakCommandDir$'/TTS_'.osName$'_record_command.txt"
502 sgc.useAlternativeRecorder = 1
506 # Alternative audio player
507 procedure set_up_player
518 # Global TTS command has precedence
519 sgc.useAlternativePlayer = 0
520 if fileReadable("'globalTTSdir$'/TTS_'.osName$'_play_command.txt")
521 createDirectory(sgc.scratchAudioDir$)
522 sgc.playCommandFile$ = "'globalTTSdir$'/TTS_'.osName$'_play_command.txt"
523 sgc.useAlternativePlayer = 1
524 elsif fileReadable("'speakCommandDir$'/TTS_'.osName$'_play_command.txt")
525 createDirectory(sgc.scratchAudioDir$)
526 sgc.playCommandFile$ = "'speakCommandDir$'/TTS_'.osName$'_play_command.txt"
527 sgc.useAlternativePlayer = 1
531 ###############################################################
536 # initialiseSGC2.toneevaluation_table$ = ""
537 procedure initialize_toneevaluation_tables
539 if initialiseSGC2.toneevaluation_table$ != ""
540 select sgc2.performanceTable
543 initialiseSGC2.toneevaluation_table$ = ""
544 # Get the name of the table
545 call get_evaluation_table_labels 'config.language$'
546 performanceTableName$ = eval.performance$
548 if sgc.savePerf$ <> "" and fileReadable(sgc.savePerf$)
549 sgc2.performanceTable = Read Table from tab-separated file: sgc.savePerf$
550 Rename: performanceTableName$
551 # Check to make sure all columns are initialized, but only if Pinyin exists!
552 select sgc2.performanceTable
553 .column = Get column index: eval.pinyin$
555 select sgc2.performanceTable
557 sgc2.performanceTable = Create Table with column names... "'performanceTableName$'" 0 'eval.pinyin$' 'eval.correct$' 'eval.wrong$' 'eval.total$' 'eval.high$' 'eval.low$' 'eval.wide$' 'eval.narrow$' 'eval.unknown$' 'eval.commented$' 'eval.level$' 'eval.time$'
559 .columnNameList$ = "'eval.correct$' 'eval.wrong$' 'eval.total$' 'eval.high$' 'eval.low$' 'eval.wide$' 'eval.narrow$' 'eval.unknown$' 'eval.commented$' 'eval.level$' 'eval.time$'"
560 while index_regex(.columnNameList$, "\S")
561 .columnNameList$ = replace_regex$(.columnNameList$, "^\s+", "", 1)
562 .columnHeader$ = extractWord$(.columnNameList$, "")
563 .columnNameList$ = replace_regex$(.columnNameList$, "^\s*'.columnHeader$'\s*", "", 1)
565 select sgc2.performanceTable
566 .column = Get column index: .columnHeader$
568 select sgc2.performanceTable
569 Append column: .columnHeader$
575 sgc2.performanceTable = Create Table with column names... "'performanceTableName$'" 0 'eval.pinyin$' 'eval.correct$' 'eval.wrong$' 'eval.total$' 'eval.high$' 'eval.low$' 'eval.wide$' 'eval.narrow$' 'eval.unknown$' 'eval.commented$' 'eval.level$' 'eval.time$'
577 initialiseSGC2.toneevaluation_table$ = performanceTableName$
578 call get_toneevaluation_row 'eval.total$'
581 procedure get_toneevaluation_row .pinyin$
582 select sgc2.performanceTable
583 .row = Search column... "'eval.pinyin$'" '.pinyin$'
586 .row = Get number of rows
587 Set string value... '.row' "'eval.pinyin$'" '.pinyin$'
588 Set numeric value... '.row' 'eval.correct$' 0
589 Set numeric value... '.row' 'eval.wrong$' 0
590 Set numeric value... '.row' 'eval.total$' 0
591 Set numeric value... '.row' 'eval.high$' 0
592 Set numeric value... '.row' 'eval.low$' 0
593 Set numeric value... '.row' 'eval.wide$' 0
594 Set numeric value... '.row' 'eval.narrow$' 0
595 Set numeric value... '.row' 'eval.unknown$' 0
596 Set numeric value... '.row' 'eval.commented$' 0
597 Set numeric value... '.row' 'eval.level$' 0
598 Set numeric value... '.row' 'eval.time$' 0
599 Sort rows... 'eval.pinyin$'
600 .row = Search column... "'eval.pinyin$'" '.pinyin$'
604 procedure increment_toneevaluation_in_row .row .column$
605 select sgc2.performanceTable
606 .tmp = Get value... '.row' '.column$'
611 Set numeric value... '.row' '.column$' '.tmp'
614 Set string value: .row, eval.level$, config.strict$
618 Set string value: .row, eval.time$, .dateTime$
622 # Update existing performance file with toneevaluation
623 procedure update_toneevaluation_file
624 if sgc.savePerf$ <> "" and fileReadable(sgc.savePerf$) and initialiseSGC2.toneevaluation_table$ <> ""
625 select sgc2.performanceTable
626 Write to table file... 'sgc.savePerf$'
630 procedure increment_toneevaluation_value .pinyin$ .column$
631 call get_toneevaluation_row '.pinyin$'
632 .row = get_toneevaluation_row.row
633 call increment_toneevaluation_in_row '.row' '.column$'
635 call get_toneevaluation_row 'eval.total$'
636 .row = get_toneevaluation_row.row
637 call increment_toneevaluation_in_row '.row' '.column$'
640 procedure add_feedback_to_toneevaluation .table$
641 select Table '.table$'
642 .line1$ = Get value... 1 Text
643 .line2$ = Get value... 2 Text
644 .label$ = Get value... 3 Text
646 .label$ = "'eval.unknown$'"
649 .tones$ = replace_regex$(left$(.line1$, rindex(.line1$, ":")), "[^0-9]", "", 0)
650 .recognized$ = replace_regex$(right$(.line1$, length(.line1$)-rindex(.line1$, ":")), "[^0-9]", "", 0)
653 call increment_toneevaluation_value 'sgc.pinyin$' 'eval.total$'
654 if .tones$ = .recognized$
655 call increment_toneevaluation_value 'sgc.pinyin$' 'eval.correct$'
658 call increment_toneevaluation_value 'sgc.pinyin$' 'eval.wrong$'
661 if index_regex(.label$, "(Correct|Wrong)") <= 0
662 if .label$ = "Correct"
663 .label$ = eval.correct$
665 .label$ = eval.wrong$
667 call increment_toneevaluation_value 'sgc.pinyin$' '.label$'
668 call increment_toneevaluation_value 'sgc.pinyin$' 'eval.commented$'
672 # Update performance table when SaveAudio is on
674 call update_toneevaluation_file
678 procedure setGrade .grade$
679 select sgc.currentWordlist
680 if recordedSound$ <> "" and sgc.pinyin$ <> ""
681 call get_toneevaluation_row 'sgc.pinyin$'
682 .row = get_toneevaluation_row.row
683 select sgc2.performanceTable
684 .col = Get column index... Grade
686 Insert column... 2 Grade
689 Set numeric value: .row, "Grade", '.grade$'
690 .numRows = Get number of rows
693 for .r from 2 to .numRows
694 .tmp = Get value: .r, "Grade"
702 .meanGrade = .sumGrade / .sumN
704 Set numeric value: 1, "Grade", .meanGrade
706 # Store current performance table
707 call update_toneevaluation_file
711 # Set mainPage.saveAudio$ to Grade
712 procedure set_grade_display .pinyin$
713 mainPage.saveAudio$ = ""
714 select sgc2.performanceTable
716 .col = Get column index: "Grade"
717 if .pinyin$ <> "" and .col > 0
718 call get_toneevaluation_row '.pinyin$'
719 .row = get_toneevaluation_row.row
721 .grade$ = Get value: .row, "Grade"
722 if index_regex(.grade$, "[0-9]") <= 0
728 mainPage.saveAudio$ = .grade$
732 ###############################################################
734 # Miscelaneous procedures
736 ###############################################################
739 procedure synthesize_sound .pinyin$
741 if speakCommandFile$ <> "" and fileReadable(speakCommandFile$)
742 .command$ < 'speakCommandFile$'
743 .command$ = replace$(.command$, "'newline$'", " ", 0)
745 system_nocheck PATH=${PATH}:/usr/local/bin:/opt/local/bin; bash -rc -- ''.command$' "'.pinyin$'"'
747 system_nocheck bash -rc -- ''.command$' "'.pinyin$'"'
749 system_nocheck call '.command$' "'.pinyin$'"'
751 elsif sgc2.synthesizer > 0
752 select sgc2.synthesizer
753 Play text... '.pinyin$'
757 procedure align_recordedSound .pinyin$
758 if 0 and sgc2.synthesizer > 0 and recordedSound$ <> ""
759 select Sound 'recordedSound$'
760 .recordedTextGrid = To TextGrid... pinyin
761 Set interval text... 1 1 '.pinyin$'
762 select sgc2.synthesizer
763 plus Sound 'recordedSound$'
764 plus .recordedTextGrid
765 sgc.alignedTextGrid = nowarn noprogress To TextGrid (align,trim)... 1 1 1 -35 0.1 0.1 0.08
766 Rename... AlignedTextGrid
767 select .recordedTextGrid