-
Notifications
You must be signed in to change notification settings - Fork 0
/
004_make_syllable_boundary_table.praat
47 lines (43 loc) · 1.17 KB
/
004_make_syllable_boundary_table.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
#! /usr/bin/env praat
form Read values from point tier
sentence rootdir stimuli/stimuli-tg
sentence outfile params/cv-boundary-times.tsv
endform
# handle path sep
if endsWith(rootdir$, "/") = 0
rootdir$ = rootdir$ + "/"
endif
# create output file (clobbers existing)
writeFileLine: outfile$,
..."talker", tab$, "consonant", tab$, "cv_transition_time"
subdir_list = Create Strings as directory list: "subdirs", rootdir$
n_subdirs = Get number of strings
# loop over talker directories
for nd to n_subdirs
selectObject: subdir_list
subdir$ = Get string: nd
# handle path sep
if endsWith(subdir$, "/") = 0
subdir$ = subdir$ + "/"
endif
tg_list = Create Strings as file list: "stims", rootdir$ + subdir$ + "*.TextGrid"
n_textgrids = Get number of strings
# loop over TextGrids
for ntg to n_textgrids
selectObject: tg_list
tg_fname$ = Get string: ntg
tg_path$ = rootdir$ + subdir$ + tg_fname$
tg = Read from file: tg_path$
time = Get time of point: 1, 1
appendFileLine: outfile$,
...subdir$ - "/", tab$,
...tg_fname$ - ".TextGrid", tab$,
...string$(time)
selectObject: tg
Remove
endfor
selectObject: tg_list
Remove
endfor
selectObject: subdir_list
Remove