-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshimmer.praat
executable file
·42 lines (35 loc) · 1.03 KB
/
shimmer.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
form
text soundfile
text textgridfile
integer pitch_min
integer pitch_max
real padding_perc_start
real padding_perc_end
endform
# load wav
obj_id_sound = Read from file: soundfile$
obj_id_textgrid = Read from file: textgridfile$
# extract voice part
selectObject: obj_id_sound
plusObject: obj_id_textgrid
Extract intervals where: 1, "no", "is equal to", "voice"
obj_id_sound = Concatenate
# remove padding (if <> 0)
selectObject: obj_id_sound
if padding_perc_start > 0 or padding_perc_end > 0
duration = Get total duration
analyze_begin = duration * padding_perc_start
analyze_end = duration - (duration * padding_perc_end)
obj_id_sound = Extract part: analyze_begin, analyze_end, "rectangular", 1, "no"
endif
# calculate
selectObject: obj_id_sound
obj_id_pitch = To Pitch: 0, pitch_min, pitch_max
selectObject: obj_id_sound
plusObject: obj_id_pitch
obj_id_pp = To PointProcess (cc)
selectObject: obj_id_pp
plusObject: obj_id_sound
shim = Get shimmer (local): 0, 0, 0.0001, 0.02, 1.3, 1.6
# output
writeInfoLine: shim