-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcorrect_textgrids_long_file.praat
84 lines (60 loc) · 1.71 KB
/
correct_textgrids_long_file.praat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Author: Lucas Annear
# This script facilitates working with a long speech file by
# keeping a save button visible to quickly save a file to the same file
# location.
# The script takes the path containing the textgrid/wav file pair as input
# and then allows the user to adjust boundaries as needed and save progress
# as desired while keeping the file open.
## Directions:
# click "run" in this script window and then copy
# the complete file path for the textgrid you want to correct
# into the file path field and delete any quotation marks
# around the file path. Then click "OK" to open the file
# and work on it.
call start
procedure start
#get the path
form Correct Textgrids
comment paste file path:
sentence file_path
endform
call open_file
endproc
procedure open_file
textGridName$ = "'file_path$'"
# file name minus extension
fileName$ = "'file_path$'" - ".TextGrid"
# open file
if fileReadable (textGridName$)
Read from file... 'fileName$'.wav
Read from file... 'fileName$'.TextGrid
objName$ = selected$ ("TextGrid")
plus Sound 'objName$'
Edit
editor TextGrid 'objName$'
repeat
beginPause: "How do things look?"
comment: "Adjust boundaries as necessary"
clicked = endPause: "Save file", "Exit and save file", 1
if clicked = 2
call save_TextGrid
Close
endeditor
select TextGrid 'objName$'
plus Sound 'objName$'
Remove
exitScript ()
else
call save_TextGrid
endif
until clicked = 2
else
endif
endproc
##########
## Sub Procedures
##########
procedure save_TextGrid
Save whole TextGrid as text file... 'fileName$'.TextGrid
endproc
##########