-
Notifications
You must be signed in to change notification settings - Fork 0
/
CheckAndEdit
58 lines (38 loc) · 1.31 KB
/
CheckAndEdit
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
## Inspired by Praat script by Kevin Ryan 9/05
form Select directory, file type, and tiers
sentence tg_directory /Users/masato/Box/cloze_experiments/filter/batch2/working
sentence wav_directory /Users/masato/Box/cloze_experiments/filter/batch2/wav
sentence Filename_initial_substring_(optional)
sentence Tier(s) words
endform
strings = Create Strings as file list: "list", tg_directory$ + "/" + filename_initial_substring$ + "*.TextGrid"
file_count = Get number of strings
# Read wavs
for k from 1 to file_count
select Strings list
current$ = Get string: k
Read from file: tg_directory$ + "/" + current$
short$ = selected$ ("TextGrid")
## Below: look for grid, if found, open it, otherwise make new one
## This section inspired by code by Jen Hay
full$ = wav_directory$ + "/" + short$ + ".wav"
full_t$ = tg_directory$ + "/" + short$ + ".TextGrid"
Read from file: full$
Rename: short$
selectObject: "Sound " + short$
plusObject: "TextGrid " + short$
Edit
editor: "TextGrid " + short$
pause Annotate tiers, then press continue...
endeditor
minusObject: "Sound " + short$
Write to text file: full_t$
select all
minusObject: "Strings list"
Remove
# writeInfoLine: file_count - k, " files left"
endfor
select Strings list
Remove
clearinfo
echo Done. 'file_count' files annotated.