Skip to content

Commit e9911ac

Browse files
author
cesine
committed
added howtos for various tools to work with audio, or video data (slow down, extract phonetic features, cue subtitles, find words in context) for budding linguists
1 parent c5bff12 commit e9911ac

23 files changed

+1900
-0
lines changed
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
File type = "ooTextFile"
2+
Object class = "Strings"
3+
4+
numberOfStrings = 16
5+
strings []:
6+
strings [1] = "Blue"
7+
strings [2] = "Teal"
8+
strings [3] = "Magenta"
9+
strings [4] = "Black"
10+
strings [5] = "Red"
11+
strings [6] = "Maroon"
12+
strings [7] = "Green"
13+
strings [8] = "Yellow"
14+
strings [9] = "Cyan"
15+
strings [10] = "Red"
16+
strings [11] = "Blue"
17+
strings [12] = "Lime"
18+
strings [13] = "Grey"
19+
strings [14] = "Green"
20+
strings [15] = "Red"
21+
strings [16] = "Purple"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
# Draw formant chart from segments in the sound files of a specified directory
2+
# Sound files must be .aif or .wav
3+
# TextGrid files must be .textgrid
4+
#
5+
# This script is distributed under the GNU General Public License.
6+
# Copyright Mietta Lennes 13.3.2002
7+
# Edited by Gina Cook
8+
# v4 changed graph labels
9+
# v5 relativized version of 4 using f1 plotted against f2-f1
10+
# v6 changed formant tracking method per male and female
11+
# v7 Nov 2010 added specific colors for specific segments
12+
13+
14+
form Draw a vowel chart from the centre points of selected segments, open the textgrid, wav, segments and wave files you want
15+
comment Give the name of the pair:
16+
text filename vowels-english-canada-female
17+
choice MaleFemale 2
18+
button Male
19+
button Female
20+
comment Which tier of the TextGrid files should be used for analysis?
21+
integer Tier 1
22+
#comment Which segments should be analysed?
23+
#sentence Segment_label a
24+
#comment Where would you like to save the results?
25+
#text resultfile results.txt
26+
comment Formant analysis options
27+
positive Time_step 0.01
28+
integer Max_number_of_formants 5
29+
#positive Maximum_formant_(Hz) 4500 (=adult male4500, 5500= adult female)
30+
positive Window_length_(s) 0.025
31+
positive Preemphasis_from_(Hz) 50
32+
choice Picture 1
33+
button Erase the Picture window before drawing
34+
button Overlay the old picture
35+
choice Debug 1
36+
button Print vowel label
37+
button Print vowel times
38+
endform
39+
40+
if maleFemale = 1
41+
maximum_formant = 4500
42+
else if maleFemale = 2
43+
maximum_formant = 5500
44+
endif
45+
46+
# Prepare the Picture window and draw a chart grid for formant analysis:
47+
if picture = 1
48+
Erase all
49+
endif
50+
Viewport... 0 6 0 6
51+
Font size... 12
52+
Line width... 1
53+
Viewport... 0 6 0 6
54+
# To Change the Axes: Xmin Xmax Ymin Ymax
55+
# For pure F1,F2 head oriented towards the left:
56+
Axes... 3000 600 1000 100
57+
# For relativized as F1 against F2-F1, head oriented towards the left
58+
# Axes... 2300 250 900 200
59+
Text top... yes Vowel Space
60+
Text bottom... yes Front --------- F_2 (Hz) --------- Back
61+
Text left... yes Low --------- F_1 (Hz) --------- High
62+
Font size... 12
63+
Marks bottom every... 1 500 yes yes yes
64+
Marks left every... 1 100 yes yes yes
65+
Plain line
66+
67+
token = 0
68+
# this is a "safety margin" (in seconds) for formant analysis, in case the vowel segment is very short:
69+
margin = 0.02
70+
71+
72+
#Can uncomment if you want to know whether the pair were opened
73+
#printline Opened Sound and TextGrid... 'filename$'
74+
call Measurements
75+
76+
#printline 'filename$'
77+
#printline The (F1,F2) formant points of 'token' tokens of segment "'segment_label$'" were plotted on the chart.
78+
79+
80+
81+
82+
83+
#----------------------
84+
procedure Measurements
85+
86+
87+
88+
#make a string for colors and for segments
89+
#depends on: load the colors.strings file
90+
# select Strings colors
91+
# numberOfColors = Get number of strings
92+
# color$ = Get string... 1
93+
select Strings segments
94+
numberOfSegments = Get number of strings
95+
#segment_label$ = Get string... 1
96+
97+
for segIndex to numberOfSegments
98+
select Strings segments
99+
segment_label$ = Get string... segIndex
100+
101+
select Strings colors
102+
color$ = Get string... segIndex
103+
'color$'
104+
#printline 'segment_label$' is 'color$'
105+
106+
107+
# look at the TextGrid object
108+
select TextGrid 'filename$'
109+
numberOfIntervals = Get number of intervals... tier
110+
filestart = Get starting time
111+
fileend = Get finishing time
112+
113+
for interval to numberOfIntervals
114+
115+
select TextGrid 'filename$'
116+
label$ = Get label of interval... tier interval
117+
if label$ = segment_label$
118+
token = token + 1
119+
segstart = Get starting point... tier interval
120+
segend = Get end point... tier interval
121+
122+
# Create a window for analyses (possibly adding the "safety margin"):
123+
if (segstart - margin) > filestart
124+
windowstart = segstart - margin
125+
else
126+
windowstart = filestart
127+
endif
128+
if (segend + margin) < fileend
129+
windowend = segend + margin
130+
else
131+
windowend = fileend
132+
endif
133+
segduration = segend - segstart
134+
135+
select Sound 'filename$'
136+
Extract part... windowstart windowend Rectangular 1 yes
137+
Rename... window
138+
139+
# measure F1 and F2
140+
select Sound window
141+
To Formant (burg)... time_step max_number_of_formants maximum_formant window_length preemphasis_from
142+
Rename... formants
143+
# Note: the Track command only makes sense if you have a continuous vowel segment that
144+
# you think should have a fixed number of formants.
145+
# added by gina, tried to create tracks for male vs female (lowered values by 200hz) it works, but not sure if its accurate.
146+
if maleFemale = 1
147+
Track... 3 350 1450 2550 3650 4750 1 1 1
148+
else if maleFemale = 2
149+
Track... 3 550 1650 2750 3850 4950 1 1 1
150+
endif
151+
Rename... formanttracks
152+
measurepoint = (segstart + segend) / 2
153+
vowF1 = Get value at time... 1 measurepoint Hertz Linear
154+
vowF2 = Get value at time... 2 measurepoint Hertz Linear
155+
Viewport... 0 6 0 6
156+
157+
158+
159+
Draw circle... vowF2 vowF1 50
160+
# if you want a vowel symbol drawn in the middle of each vowel circle, leave the next line untouched:
161+
#if to print the vowel label or the vowel times (in order to go back in the text grid and see why the formant measurements are so far off from the expected vowel quality
162+
if debug = 1
163+
Text... vowF2 Centre vowF1 Half 'segment_label$'
164+
else if debug = 2
165+
Text... vowF2 Centre vowF1 Half 'segstart'
166+
endif
167+
168+
# remove the Sound object of the analysed segment
169+
select Sound window
170+
Remove
171+
# now we have to remove the original Formant object
172+
select Formant formants
173+
Remove
174+
# and also the second Formant object that was created by the Track command
175+
select Formant formanttracks
176+
Remove
177+
endif
178+
179+
endfor
180+
181+
#to loop through the segments
182+
endfor
183+
184+
endproc
185+
186+
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
File type = "ooTextFile"
2+
Object class = "Strings"
3+
4+
numberOfStrings = 16
5+
strings []:
6+
strings [1] = "i"
7+
strings [2] = "I"
8+
strings [3] = "y"
9+
strings [4] = "Y"
10+
strings [5] = "e"
11+
strings [6] = "E"
12+
strings [7] = "\oe"
13+
strings [8] = "\OE"
14+
strings [9] = "\ae"
15+
strings [10] = "a"
16+
strings [11] = "A"
17+
strings [12] = "\sw"
18+
strings [13] = "U"
19+
strings [14] = "u"
20+
strings [15] = "O"
21+
strings [16] = "o"
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
File type = "ooTextFile"
2+
Object class = "TextGrid"
3+
4+
xmin = 0
5+
xmax = 13.834965986394558
6+
tiers? <exists>
7+
size = 1
8+
item []:
9+
item [1]:
10+
class = "IntervalTier"
11+
name = "vowels"
12+
xmin = 0
13+
xmax = 13.834965986394558
14+
intervals: size = 21
15+
intervals [1]:
16+
xmin = 0
17+
xmax = 0.24575679414388266
18+
text = ""
19+
intervals [2]:
20+
xmin = 0.24575679414388266
21+
xmax = 0.4074878025042913
22+
text = "i"
23+
intervals [3]:
24+
xmin = 0.4074878025042913
25+
xmax = 1.158754421984899
26+
text = ""
27+
intervals [4]:
28+
xmin = 1.158754421984899
29+
xmax = 1.2978778700368636
30+
text = "I"
31+
intervals [5]:
32+
xmin = 1.2978778700368636
33+
xmax = 2.26737899891527
34+
text = ""
35+
intervals [6]:
36+
xmin = 2.26737899891527
37+
xmax = 2.4951936451003616
38+
text = "e"
39+
intervals [7]:
40+
xmin = 2.4951936451003616
41+
xmax = 3.366454238525789
42+
text = ""
43+
intervals [8]:
44+
xmin = 3.366454238525789
45+
xmax = 3.5612270657985388
46+
text = "E"
47+
intervals [9]:
48+
xmin = 3.5612270657985388
49+
xmax = 4.438558910342519
50+
text = ""
51+
intervals [10]:
52+
xmin = 4.438558910342519
53+
xmax = 4.6715906858295595
54+
text = "\ae"
55+
intervals [11]:
56+
xmin = 4.6715906858295595
57+
xmax = 5.8584722022891596
58+
text = ""
59+
intervals [12]:
60+
xmin = 5.8584722022891596
61+
xmax = 5.959336702126834
62+
text = "\sw"
63+
intervals [13]:
64+
xmin = 5.959336702126834
65+
xmax = 7.5618495196416795
66+
text = ""
67+
intervals [14]:
68+
xmin = 7.5618495196416795
69+
xmax = 7.779229907222874
70+
text = "a"
71+
intervals [15]:
72+
xmin = 7.779229907222874
73+
xmax = 9.018282716701961
74+
text = ""
75+
intervals [16]:
76+
xmin = 9.018282716701961
77+
xmax = 9.26000970769225
78+
text = "o"
79+
intervals [17]:
80+
xmin = 9.26000970769225
81+
xmax = 10.424283663843408
82+
text = ""
83+
intervals [18]:
84+
xmin = 10.424283663843408
85+
xmax = 10.519931034379132
86+
text = "U"
87+
intervals [19]:
88+
xmin = 10.519931034379132
89+
xmax = 11.901585378111484
90+
text = ""
91+
intervals [20]:
92+
xmin = 11.901585378111484
93+
xmax = 12.061577343371242
94+
text = "u"
95+
intervals [21]:
96+
xmin = 12.061577343371242
97+
xmax = 13.834965986394558
98+
text = ""
Binary file not shown.

0 commit comments

Comments
 (0)