1 # The rules for constructing the tone contours.
3 # This procedure works because in Praat, there is no namespace
4 # separation. All variables behave as if they are global
7 # toneSyllable is the tone number on the current syllable
8 # 1-4, 0=neutral, 6=Dutch (garbage) intonation
10 # These procedures set the following pareameters
11 # and use them to create a Pitch Tier:
13 # toneFactor: Duration scale factor for current tone
14 # startPoint: Start of the tone
15 # endPoint: end of the tone
16 # lowestPoint: bottom of tone 3
17 # point: The time of the next pitch value in the contour
18 # ONLY USE AS: point = point + <fraction> * voicedDuration
20 # The following values are given by the calling routine
23 # toneSyllable: tone number on the current syllable
24 # nextTone: tone number of next syllable or -1
25 # prevTone: tone number of previous syllable or -1
26 # lastFrequency: end-frequency of the previous syllable
28 # topLine: the frequency of the first tone
29 # frequency_Range: Range of tone four (1 octave)
30 # voicedDuration: Duration of voiced part of syllable
33 # Procedure to scale the duration of the current syllable
34 procedure toneDuration
38 zeroToneFactor = 0.8 * zeroToneFactor
40 zeroToneFactor = 1.1 * zeroToneFactor
42 zeroToneFactor = 0.8 * zeroToneFactor
44 toneFactor = zeroToneFactor * toneFactor
45 elsif toneSyllable = 2
47 elsif toneSyllable = 3
49 elsif toneSyllable = 4
53 # Next tone 0, then lengthen first syllable
55 toneFactor = toneFactor * 1.2
59 # DO NOT CHANGE toneFactor BELOW THIS POINT
61 # Rules to create a tone
63 # Do not mess with the 'Add point...' commands
64 # unless you know what you are doing
65 # The 'point =' defines the time of the next pitch value
67 # start * ?Semit is a fall
68 # start / ?Semit is a rise
73 # Just a straight line
77 # Two first tones, make them a little different
79 startPoint = startPoint * 0.999
80 endPoint = endPoint * 0.999
84 Add point... 'point' 'startPoint'
85 point = point + voicedDuration
86 Add point... 'point' 'endPoint'
88 elsif toneSyllable = 2
89 # Start halfway of the range - 1 semitone
90 startPoint = topLine * sqrt(frequency_Range) * oneSemit
91 # End 1 semitones above the first tone
92 endPoint = topLine / oneSemit
93 # Special case: 2 followed by 1, stop short of the top-line
94 # ie, 5 semitones above the start
96 endPoint = startPoint / fiveSemit
98 # Go lower if previous tone is 1
100 startPoint = startPoint * oneSemit
101 elsif prevTone = 4 or prevTone = 3
102 # Special case: 2 following 4 or 3
104 startPoint = lastFrequency / oneSemit
107 # Two consecutive tone 2, start 1 semitone higher
108 startPoint = startPoint / oneSemit
110 # Define a midpoint at 1/3 of the duration
111 midPoint = startPoint
114 Add point... 'point' 'startPoint'
115 # Next point a 1/3th of duration
116 point = point + (voicedDuration)/3
117 Add point... 'point' 'midPoint'
119 point = point + (voicedDuration)*2/3
120 Add point... 'point' 'endPoint'
122 elsif toneSyllable = 3
124 startPoint = topLine * sqrt(frequency_Range)
125 lowestPoint = topLine * frequency_Range * threeSemit
126 # Protect pitch against "underflow"
127 if lowestPoint < absoluteMinimum
128 lowestPoint = absoluteMinimum
132 endPoint = startPoint
133 # Anticipate rise in next tone
134 elsif nextTone = 1 or nextTone = 4
135 lowestPoint = topLine * frequency_Range / twoSemit
136 endPoint = startPoint
137 # Anticipate rise in next tone and stay low
139 lowestPoint = topLine * frequency_Range / twoSemit
140 endPoint = lowestPoint
141 # Last one was low, don't go so much lower
143 lowestPoint = topLine * frequency_Range * oneSemit
144 # Anticipate rise in next tone and stay low
146 lowestPoint = topLine * frequency_Range
147 endPoint = lowestPoint / sixSemit
149 endPoint = startPoint
153 Add point... 'point' 'startPoint'
154 # Go 1/3 of the duration down
155 point = point + (voicedDuration)*2/6
156 Add point... 'point' 'lowestPoint'
157 # Go half the duration low
158 point = point + (voicedDuration)*3/6
159 Add point... 'point' 'lowestPoint'
160 # Return in 1/6th of the duration
161 point = point + (voicedDuration)*1/6
162 Add point... 'point' 'endPoint'
164 elsif toneSyllable = 4
165 # Start higher than tone 1 (by 2 semitones)
166 startPoint = topLine / twoSemit
167 # Go down the full range
168 endPoint = startPoint * frequency_Range
171 # SPECIAL: Fall in following neutral tone
173 endPoint = endPoint / threeSemit
177 Add point... 'point' 'startPoint'
178 # A plateau for 1/3th
179 point = point + voicedDuration*1/3
180 Add point... 'point' 'startPoint'
182 point = point + voicedDuration*2/3
183 Add point... 'point' 'endPoint'
185 elsif toneSyllable = 0
187 startPoint = lastFrequency
189 startPoint = topLine * sqrt(frequency_Range) / oneSemit
193 startPoint = lastFrequency * twoSemit
195 startPoint = lastFrequency
197 startPoint = lastFrequency / oneSemit
199 startPoint = lastFrequency * oneSemit
200 elsif lastFrequency > 0
201 startPoint = lastFrequency * oneSemit
203 # Add spreading and some small or large de/inclination
205 midPoint = startPoint * frequency_Range / oneSemit
206 endPoint = midPoint * oneSemit
209 midPoint = startPoint * fiveSemit
210 endPoint = midPoint * twoSemit
212 midPoint = startPoint / twoSemit
215 midPoint = startPoint * threeSemit
216 endPoint = midPoint / oneSemit
218 midPoint = startPoint * oneSemit
219 endPoint = midPoint * oneSemit
223 startPoint = topLine * sqrt(frequency_Range) * oneSemit
226 # Add a very short break to force
231 Add point... 'point' 0
232 point = point + 1/startPoint
233 Add point... 'point' 0
234 point = point + delta
236 # Write points first 2/3 then decaying 1/3
237 Add point... 'point' 'startPoint'
238 point = point + (voicedDuration - 1/startPoint)*2/3
239 Add point... 'point' 'midPoint'
240 point = point + (voicedDuration - 1/startPoint)*1/3
241 Add point... 'point' 'endPoint'
244 # Start halfway of the range
245 startPoint = topLine * sqrt(frequency_Range)
246 # Or continue from last Dutch "tone"
248 startPoint = lastFrequency
251 endPoint = startPoint * oneSemit
254 Add point... 'point' 'startPoint'
255 point = point + voicedDuration
256 Add point... 'point' 'endPoint'