-
Notifications
You must be signed in to change notification settings - Fork 0
/
create-textgrid-forall-DIME
76 lines (56 loc) · 3.93 KB
/
create-textgrid-forall-DIME
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
########## ELLA LAB ##########
### script writer: Tina Yeh (WTY), updated 28-07-2021 ##
### purpose: to create textgrids according to wav files in one folders with 3 tiers
### tier 1: parent's ID
### tier 2: Infant's ID
### tier 3: silence and sounding parts
##############################
# create textgrid in one folder
form Creator
comment Name of Tier 1
sentence Name_of_first_tier parent
comment Name of Tier 2
sentence Name_of_second_tier infant
comment Had you already begun the TextGrid creation?
comment If so, in wich number of the sound list do you
comment want to start today?
integer nfile 1
comment Do you want to make Textgrids for all files in one click?
boolean pause_for_correction 0
endform
folder$ = chooseDirectory$ ("Elige la carpeta cuyos archivos quieres ver/modificar:")
#Create a list
Create Strings as file list... listawav 'folder$'/*.wav
#select files from the listawav
select Strings listawav
nstrings = Get number of strings
#loop for create textgrids with tiers
for i from nfile to nstrings
select Strings listawav
#Llevo el .wav que toca a objetos
nombresonido$ = Get string... i
Read from file... 'folder$'/'nombresonido$'
#create Textgrids
base$ = nombresonido$ - ".wav"
nombregrid$ = base$ + ".TextGrid"
To TextGrid (silences): 100, 0, -25, 0.1, 0.1, "silent", "sounding"
# Save as text file... 'folder$'/'nombregrid$'
# Read from file... 'folder$'/'nombregrid$'
select TextGrid 'base$'
Insert interval tier: 1, name_of_first_tier$
Insert interval tier: 2, name_of_second_tier$
#pause to see the selected files
if pause_for_correction = 1
pause Corrige el TextGrid 'base$' ('i' de 'nstrings') y clica "Continuar" el TextGrid se guardará automáticamente.
endif
#save textgrids
select TextGrid 'base$'
Save as text file... 'folder$'/'nombregrid$'
#remove all
select all
minus Strings listawav
Remove
endfor
select all
Remove
exit Finished