forked from stylerw/styler_praat_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
textgrid_revisor.praat
45 lines (42 loc) · 1.31 KB
/
textgrid_revisor.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
# Grid Revision Assistant
# Will Styler - 2016
#
# This script will just open all files in a folder with their grids, allowing you to make changes and review the work
#
directory$ = chooseDirectory$ ("Choose the directory containing sound files for gridding")
directory$ = "'directory$'" + "/"
file_type$ = ".wav"
Create Strings as file list... list 'directory$'*'file_type$'
number_files = Get number of strings
label restart
for ifile to number_files
select Strings list
sound$ = Get string... ifile
Read from file... 'directory$''sound$'
soundname$ = selected$ ("Sound", 1)
gridfile$ = "'directory$''soundname$'.TextGrid"
badfile$ = "'directory$''soundname$'.isBad"
if fileReadable (gridfile$)
selectObject: "Sound 'soundname$'"
Read from file... 'directory$''soundname$'.TextGrid
selectObject: "Sound 'soundname$'"
plusObject: "TextGrid 'soundname$'"
Edit
editor TextGrid 'soundname$'
beginPause ("After reviewing and adjusting, click OK.")
skipstat = endPause ("OK", 1)
endeditor
selectObject: "TextGrid 'soundname$'"
if skipstat == 1
Save as text file: "'directory$''soundname$'.TextGrid"
endif
lastsound$ = soundname$
endif
selectObject: "Sound 'soundname$'"
plusObject: "TextGrid 'soundname$'"
Remove
lastsound$ = soundname$
endif
endfor
select Strings list
Remove