-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathsave_interval_data_to_text_file.praat
33 lines (28 loc) · 1.18 KB
/
save_interval_data_to_text_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
# This script will save the label information from a user-specified interval tier
# of a selected TextGrid object to a text file.
# The lines in the text file will have the format:
# starting point of seg1 - space - segment label - line break.
# The segments will be ordered according to time points.
#
# This script is distributed under the GNU General Public License.
# Copyright 17.3.2002 Mietta Lennes
form Make text file from an IntervalTier in the selected TextGrid object
comment Which tier do you want to convert to text?
integer Tier 1
comment Where do you want to save the text file?
text path ../../ICSLP/lauseet2/uusi/C0.phn
endform
overwrite = 0
numberOfIntervals = Get number of intervals... tier
for interval from 1 to numberOfIntervals
start = Get starting point... tier interval
label$ = Get label of interval... tier interval
if fileReadable (path$) and overwrite = 0 and interval = 1
pause There already is a text file 'path$'. Do you want to continue and overwrite it?
overwrite = 1
filedelete 'path$'
endif
textline$ = "'start' 'label$''newline$'"
fileappend 'path$' 'textline$'
endfor
echo Created a text file 'path$' for the segments and labels in tier 'tier'.