-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMake_Duration_Continuum_v1.txt
128 lines (101 loc) · 3.39 KB
/
Make_Duration_Continuum_v1.txt
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#####################################
# Duration continuum (using a form)
# version 1
#
# Matthew Winn
# 11/27/2021
#
### creates a continuum of duration differences
# for a specified segment within the sound
# important! ensure that the sounds all have the same time boundaries!
# because after you set the boundaries once,
# it uses those boundaries to act on all the remaining sounds
#
###
form Input Enter specifications for Duration Continuum
comment shortest duration (ms):
real shortdurms 65
comment longest duration (ms):
real longdurms 195
comment how many steps in the continuum?
integer steps 5
comment enter minimum pitch
real minpitch 70
comment enter maximum pitch
real maxpitch 300
comment enter duration name prefix
word durPrefix _dur_
endform
clearinfo
# convert inputs to seconds
shortdur = shortdurms/1000
longdur = longdurms/1000
# create simple header for info window
print Step 'tab$' Duration 'tab$' 'newline$'
# generate continuum values
call calc_continuum_steps steps shortdur longdur dur_ 1
# user selects the sounds to manipulate
pause select all sounds to be used for this operation
numberOfSelectedSounds = numberOfSelected ("Sound")
for thisSelectedSound to numberOfSelectedSounds
sound'thisSelectedSound' = selected("Sound",thisSelectedSound)
endfor
call user_sets_landmarks
# loop through the sounds and generate the different outputs
for thisSound from 1 to numberOfSelectedSounds
select sound'thisSound'
name$ = selected$("Sound")
call make_duration_continuum 'name$' start end shortdur longdur steps 'durPrefix$'
endfor
##################################
# PROCEDURES
procedure calc_continuum_steps .steps .low .high .prefix$ printvalues
for thisStep from 1 to .steps
temp = (('thisStep'-1)*('.high'-'.low')/('.steps'-1))+'.low'
'.prefix$''thisStep' = temp
check = '.prefix$''thisStep'
if printvalues = 1
print '.prefix$''thisStep''tab$''check:2' 'newline$'
endif
endfor
endproc
procedure user_sets_landmarks
# choose time landmarks from the first of the selected sounds
select sound1
firstName$ = selected$("Sound")
Edit
editor Sound 'firstName$'
# prompts user to click on vowel beginning and end, create variables with values at points clicked
pause Click Get start of segment to be manipulated, click Continue when done
Move cursor to nearest zero crossing
start = Get cursor
pause Click Get end of segment to be manipulated, click Continue when done
Move cursor to nearest zero crossing
end = Get cursor
Close
endeditor
endproc
procedure make_duration_continuum .name$ .start .end .shortdur .longdur .steps .suffix$
select Sound '.name$'
.endTime = Get end time
To Manipulation... 0.01 minpitch maxpitch
Extract duration tier
for thisStep from 1 to .steps
ratio = (dur_'thisStep')/(.end - .start)
select DurationTier '.name$'
Remove points between... 0 .endTime
Add point... (.start-0.0001) 1
Add point... .start ratio
Add point... .end ratio
Add point... (.end+0.0001) 1
select Manipulation '.name$'
plus DurationTier '.name$'
Replace duration tier
select Manipulation '.name$'
Get resynthesis (overlap-add)
Rename... '.name$''.suffix$''thisStep'
endfor
select Manipulation '.name$'
plus DurationTier '.name$'
Remove
endproc