Debian Codegraph @

dwtools/manual_KlattGrid.cpp

raw symbols SCIP
1 /* manual_KlattGrid.cpp
2 *
3 * Copyright (C) 2009-2014,2023,2025 David Weenink
4 *
5 * This code is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or (at
8 * your option) any later version.
9 *
10 * This code is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this work. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #include "ManPagesM.h"
20
21 void manual_KlattGrid (ManPages me);
22 void manual_KlattGrid (ManPages me)
23 {
24 MAN_PAGES_BEGIN
25 R"~~~(
26 ################################################################################
27 "KlattGrid"
28 © David Weenink 2014-01-17
29
30 A KlattGrid represents the source-filter model as a function of time.
31 It consists of a number of tiers that model aspects of the source and the filter,
32 and the interaction between source and filter. The KlattGrid implements a superset
33 of the speech synthesizer described in figure 14 by @@Klatt & Klatt (1990)@.
34
35 The following drawing represents a cascade synthesizer with six oral formants, one nasal formant,
36 one nasal antiformant, one tracheal formant, one tracheal antiformant and six frication formants.
37 {- 7.0x6.5
38 Create KlattGrid: "kg", 0, 1, 6, 1, 1, 6, 1, 1, 1
39 Draw synthesizer: "Cascade"
40 Remove
41 }
42 In the next picture a parallel synthesizer branch is used instead of the cascade one.
43 {- 7.0x6.5
44 Create KlattGrid: "kg", 0, 1, 6, 1, 1, 6, 1, 1, 1
45 Draw synthesizer: "Parallel"
46 Remove
47 }
48 All parameters in the synthesizer are represented by separate tiers.
49
50 The source
51 ==========
52 The source is modelled by the following tiers:
53
54 ##Pitch
55 : models fundamental frequency (in Hertz).
56
57 ##Flutter
58 : models a kind of “random” variation of the pitch (with a number between zero and one).
59
60 ##Voicing amplitude
61 : models the maximum amplitude of the glottal flow (in dB SPL).
62
63 ##Open phase
64 : models the open phase of the glottis (with a number between zero and one).
65 If the tier is empty, a default of 0.7 will be used.
66
67 ##Power1#, ##Power2#
68 : model the shape of the glottal flow function %flow(%t)=%t^^%power1^\-m%t^^%power2^ for 0 \<_ %t \<_ 1.
69 To make glottal closure possible, %power2 has to be larger than %power1.
70 If the power1 tier is empty, a default value of 3 will be used.
71 If the power2 tier is empty, a default of 4 will be used.
72
73 ##Collision phase
74 : models the last part of the flow function with an exponential decay function instead of a polynomial one.
75 More information about #Power1, #Power2, ##Open phase# and ##Collision phase#
76 can be found in the @@PointProcess: To Sound (phonation)...@ manual.
77
78 ##Spectral tilt
79 : models the extra number of dB the voicing spectrum should be down at 3000 Hertz.
80
81 ##Aspiration amplitude
82 : models the (maximum) amplitude of the noise generated at the glottis (in dB SPL).
83
84 ##Breathiness amplitude
85 : models the maximum breathiness noise amplitude during the open phase of the glottis (in dB SPL).
86 The amplitude of the breathiness noise is modulated by the glottal flow.
87
88 ##Double pulsing
89 : models diplophonia (by a fraction between zero and one). Whenever this parameter is greater than zero,
90 alternate pulses are modified. A pulse is modified with this %%single% parameter in %%two% ways: it is %%delayed
91 in time% and its amplitude is %%attenuated%. If the double pulsing value is a maximum and equals one, the time of
92 closure of the first peak coincides with the opening time of the second one.
93
94 The vocal tract filter
95 ======================
96 The filter is modelled by a number of @@FormantGrid@'s. For parallel synthesis the formant grids that normally
97 only contain formant frequency and formant bandwidth tiers, have been extended with amplitude tiers.
98 Amplitudes values are in dB. The following formant grids can be used:
99
100 ##Oral formants
101 : represent the “standard” oral resonances of the vocal tract.
102
103 ##Nasal formants
104 : model resonances in the nasal tract. Because the shape of the nasal tract does not vary much
105 during the course of an utterance, nasal formants tend to be constant.
106
107 ##Nasal antiformants
108 : model dips in the spectrum caused by leakage to the nasal tract.
109
110 Interaction between source and filter
111 =====================================
112 The interaction between source and filter is modelled by two formant grids.
113
114 ##Tracheal formants
115 : model one aspect of the coupling of the trachea with the vocal tract transfer function, namely, by the
116 introduction of extra formants (and antiformants) that sometimes distort vowel spectra to a varying degrees.
117 According to @@Klatt & Klatt (1990)@, the other effect of tracheal formants is increased losses
118 at glottal termination which primarily affect first-formant bandwidths.
119
120 ##Tracheal antiformants
121 : model dips in the spectrum caused by the trachea.
122
123 ##Delta formants
124 : The values in this grid model the number of hertz that the oral formants and/or bandwidths change during the open phase
125 of the glottis. @@Klatt & Klatt (1990)@ distinguish four types of source-filter interactions: an F1 ripple in the
126 source waveform, a non-linear interaction between the first formant and the fundamental frequency, a truncation of
127 the first formant and tracheal formants and antiformants.
128
129 The frication section
130 =====================
131 The frication section is modelled with a frication formant grid, with formant frequencies, bandwidths and (separate)
132 amplitudes (dB), a frication by-pass tier (dB) and an amplitude tier (dB SPL) that governs the frication noise source.
133
134 A minimal synthesizer
135 =====================
136 The following script produces a minimal voiced sound. The first line creates the standard KlattGrid."
137 The next two lines define a pitch point, in Hz, and the voicing amplitude, in dB. The last line
138 creates the sound.
139 {;
140 Create KlattGrid: "kg", 0, 1, 6, 1, 1, 6, 1, 1, 1
141 Add pitch point: 0.5, 100
142 Add voicing amplitude point: 0.5, 90
143 To Sound
144 }
145 The following script will produce raw frication noise. Because we do not specify formant amplitudes,
146 we turn off the formants in the parallel section.
147 {;
148 Create KlattGrid: "kg", 0, 1, 6, 1, 1, 6, 1, 1, 1
149 Add frication amplitude point: 0.5 ,80
150 Add frication bypass point: 0.5, 0
151 To Sound (special): 0, 0, 44100, "yes", "no", "yes", "yes", "yes", "yes",
152 ... "Powers in tiers", "yes", "yes", "yes",
153 ... "Cascade", 1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, "yes"
154 }
155 Changes
156 =======
157 In Praat versions before 5.1.05 the values for the %%oral / nasal / tracheal formant amplitudes% and
158 %%frication bypass amplitude% had to be given in dB SPL;
159 now they are in real dB's, i.e.
160 0 dB means no change in amplitude. You can calculate new values from old values as:
161 `new_value = old_value + 20*log10(2e-5)`.
162 This means that you have to subtract approximately 94 dB from the old values.
163
164 ################################################################################
165 "Create KlattGrid..."
166 © David Weenink 2008-12-24
167
168 A command to create a multitier @@KlattGrid@ speech synthesizer.
169
170 ################################################################################
171 "Create KlattGrid from vowel..."
172 © David Weenink 2023-08-01
173
174 Create a new @@KlattGrid@ from the specifications for a vowel.
175
176 Settings
177 ========
178
179 ##Name#
180 : defines the name that the newly created KlattGrid will get in the list of objects.
181
182 ##Duration (s)#
183 : defines the duration of the KlattGrid. The created KlattGrid will have a start time of 0 seconds
184 and an end time of %%duration% seconds.
185
186 ##Pitch (Hz)#
187 : defines the value of the pitch point that will be added at the start of the Klattgrid.
188
189 ##F1 (Hz)#, ##F2 (Hz)#, ##F3 (Hz), F4 (Hz)##
190 : define the frequencies in hertz of the first four formants. If a frequency is not positive the formant is not used.
191
192 ##B1 (Hz)#, ##B2 (Hz)#, ##B3 (Hz)#
193 : define the bandwidths in hertz of the first three formants
194
195 ##Bandwidth fraction#
196 : defines the bandwidths of the fourth and higher formants as a fraction of
197 the formant's frequency (i.e. it is the inverse of the formant's %%quality factor%).
198 For example if F4 equals 2800 Hz and the "Bandwidth fraction" was chosen as 0.05 then its
199 bandwidth will be 0.05*2800 = 140 Hz. The quality factor of this fourth formant is 20.
200
201 ##Formant frequency interval (Hz)#
202 : defines the distances between the following formants in hertz. For example, if this values is chosen
203 as 1100 Hz and if F4 happens to be 3000 Hz then F5 will be 4100 Hz, F6 will be 5200 Hz, F7 will be 6300 Hz, and so on.
204 If the value is not positive these formants will not be created at all. You would typically choose this value
205 as 1000 or 1100 Hz for an average male or female voice, respectively.
206
207 Examples
208 ========
209 The following script creates a vowel sound with many formants which will sound like the vowel [a].
210 The formant frequencies will be: F1 = 800 Hz, F2 = 1200 Hz, F3 = 2300 Hz, F4 = 2800 Hz. The frequencies of the higher
211 formants will be at intervals of 1000 Hz, starting from F4. Therefore, F5 = 3800 Hz, F6 = 4800 Hz, F7 = 5800 Hz,
212 and so on. The bandwidths will be B1 = 80 Hz, B2 = 80 Hz, B3 = 100 Hz.
213 The bandwidths of the fourth and higher formants will be 0.05 times their frequency. Therefore, B4 = 140 Hz,
214 B5 = 190 Hz, B6 = 240 Hz, B7 = 290 Hz, and so on.
215 {;
216 Create KlattGrid from vowel: "a", 0.3, 125, 800, 80, 1200, 80, 2300, 100, 2800, 0.05, 1000
217 To Sound
218 }
219 The following script will create a two formant sound which also sounds like [a].
220 The formant frequencies will be 800 Hz and 1200 Hz.
221 {;
222 Create KlattGrid from vowel: "a", 0.3, 125, 800, 80, 1200, 80, 0, 100, 0, 0.1, 0
223 To Sound
224 }
225 The following script will create a formant sound which also sounds like [a].
226 The formant frequencies will be 800 Hz, 1200 Hz, 2200 Hz, 3200 Hz, 4200, and so on, with 1000 Hz separation).
227 {;
228 Create KlattGrid from vowel: "a", 0.3, 125, 800, 80, 1200, 80, 0, 100, 0, 0.05, 1000
229 To Sound
230 }
231 Because all the frequency points of the corresponding tiers in this KlattGrid are defined at
232 the start time of the grid, i.e. at time 0.0 seconds, it is easy
233 to change the characteristics of the vowel sound by adding new points. For example, given one of the [a] sounds above
234 which were all synthesized with constant pitch we can have a falling pitch with:
235 {;
236 Create KlattGrid from vowel: "a", 0.3, 125, 800, 80, 1200, 80, 2300, 100, 2800, 0.05, 1000
237 Add pitch point: 0.3, 100.0
238 To Sound
239 }
240 An [au] diphthong is also easily made by a simple extension with two oral formant frequency points:
241 {;
242 Create KlattGrid from vowel: "au", 0.3, 125, 800, 80, 1200, 80, 2300, 100, 2800, 0.05, 1000
243 Add pitch point: 0.3, 100.0
244 Add oral formant frequency point: 1, 0.3, 300
245 Add oral formant frequency point: 2, 0.3, 600
246 To Sound
247 }
248 Formant frequencies and bandwidths for 16 Swedish vowels are presented by
249 @@Hawks & Miller (1995)@ in their table 1. They further give equations for bandwidths as a function
250 of formant frequency.
251 @@Fleisher et al. (2015)@ present in their table 1 values for the first 5 formant frequencies
252 and bandwidths of the German vowels /a/, /i/ and /\hs/ for speech mode and for singing mode.
253 In general their bandwidths are lower than as predicted by the Hawks and Miller equations.
254
255 ################################################################################
256 "KlattGrid: To Sound (phonation)..."
257 © David Weenink 2009-01-22
258
259 A command to synthesize a Sound from the selected @@KlattGrid@.
260
261 Settings
262 ========
263 ##Sampling frequency (Hz)
264 : the @@sampling frequency@ of the resulting sound.
265
266 ##Voicing
267 : switches voicing on or off.
268
269 ##Flutter
270 : switches the flutter tier on or off. This will, of course, only have effect if at least one flutter point has been defined in the flutter tier.
271
272 ##Double pulsing
273 : switches the double pulsing tier on or off.
274
275 ##Collision phase
276 : switches the collision phase tier on or off.
277
278 ##Spectral tilt
279 : switches the spectral tilt tier on or off.
280
281 ##Flow function
282 : determines what flow function will be used. The flow function is determined by two parameters, %power1 and %power2, as %flow(%t)=%x^^%power1^\-m%x^^%power2^.
283 If the option "Powers in tier" is chosen the power1 and power2 tiers will be used for the values of %power1 and %power2.
284 The other choices switch the two tiers off and instead fixed values will be used for %power1 and %power2.
285
286 ##Flow derivative
287 : determines whether the flow or the flow derivative is used for phonation.
288
289 ##Aspiration
290 : determines whether aspiration is included in the synthesis.
291
292 ##Breathiness
293 : determines whether breathiness is included in the synthesis.
294
295 ################################################################################
296 "KlattGrid: Play special..."
297 © David Weenink 2009-04-21, Paul Boersma 2023
298
299 A command to play part of a @@KlattGrid@.
300
301 Settings
302 ========
303
304 ##Time range (s)
305 : determines the part of the sound’s time domain that you want to hear.
306 If both arguments equal zero, the complete sound will be played.
307
308 ##Scale peak
309 : determines whether the peak value of the sound will be set to 0.99. In this way the sound will always play well.
310
311 ##Voicing
312 : switches voicing on or off.
313
314 ##Flutter
315 : switches the flutter tier on or off. This will, of course, only have effect if at least one flutter point has been defined in the flutter tier.
316
317 ##Double pulsing
318 : switches the double pulsing tier on or off.
319
320 ##Collision phase
321 : switches the collision phase tier on or off.
322
323 ##Spectral tilt
324 : switches the spectral tilt tier on or off.
325
326 ##Flow function
327 : determines what flow function will be used. The flow function is determined by two parameters, %power1 and %power2, as %flow(%t)=%x^^%power1^\-m%x^^%power2^.
328 If the option "Powers in tier" is chosen the power1 and power2 tiers will be used for the values of %power1 and %power2.
329 The other choices switch the two tiers off and instead fixed values will be used for %power1 and %power2.
330
331 ##Flow derivative
332 : determines whether the flow or the flow derivative is used for phonation.
333
334 ##Aspiration
335 : determines whether aspiration is included in the synthesis.
336
337 ##Breathiness
338 : determines whether breathiness is included in the synthesis.
339
340 ##Model
341 : switches on either the cascade or the parallel section of the synthesizer.
342
343 ##Oral formant range#, ##Nasal formant range# ...
344 : selects the formants to use in the synthesis. Choosing the end of a range smaller than the start of the range switches off the formants.
345
346 ##Frication bypass
347 : switches the frication bypass of the frication section on or off.
348 The complete frication section can be turned off by also switching off the frication formants.
349
350 ################################################################################
351 "KlattGrid: To Sound (special)..."
352 © David Weenink 2009-04-15, Paul Boersma 2023
353
354 A command to synthesize a Sound from the selected @@KlattGrid@.
355
356 Settings
357 ========
358
359 ##Time range (s)
360 : determines the part of the time domain that you want to save as a sound.
361 If both arguments equal zero, the complete sound will be created.
362
363 ##Sampling frequency (Hz)
364 : determines the @@sampling frequency@ of the resulting sound.
365
366 ##Scale peak
367 : determines whether the peak value of the sound will be set to 0.99. In this way the sound will always play well and can be saved to a file with minimal loss of resolution.
368
369 ##Voicing
370 : switches voicing on or off.
371
372 ##Flutter
373 : switches the flutter tier on or off. This will, of course, only have effect if at least one flutter point has been defined in the flutter tier.
374
375 ##Double pulsing
376 : switches the double pulsing tier on or off.
377
378 ##Collision phase
379 : switches the collision phase tier on or off.
380
381 ##Spectral tilt
382 : switches the spectral tilt tier on or off.
383
384 ##Flow function
385 : determines what flow function will be used. The flow function is determined by two parameters, %power1 and %power2, as %flow(%t)=%x^^%power1^\-m%x^^%power2^.
386 If the option "Powers in tier" is chosen the power1 and power2 tiers will be used for the values of %power1 and %power2.
387 The other choices switch the two tiers off and instead fixed values will be used for %power1 and %power2.
388
389 ##Flow derivative
390 : determines whether the flow or the flow derivative is used for phonation.
391
392 ##Aspiration
393 : determines whether aspiration is included in the synthesis.
394
395 ##Breathiness
396 : determines whether breathiness is included in the synthesis.
397
398 ##Model
399 : switches on either the cascade or the parallel section of the synthesizer.
400
401 ##Oral formant range#, ##Nasal formant range# ...
402 : selects the formants to use in the synthesis. Choosing the end of a range smaller than the start of the range switches off the formants.
403
404 ##Frication bypass
405 : switches the frication bypass of the frication section on or off.
406 The complete frication section can be turned off by also switching off the frication formants.
407
408 ################################################################################
409 "KlattGrid: Extract oral formant grid (open phases)..."
410 © David Weenink 2009-04-21
411
412 Extracts the oral formant grid as used in the synthesis, i.e. the resulting grid contains
413 the informantion from the oral formant grid and the delta formant grid combined during the open phase of the glottis.
414
415 ################################################################################
416 "KlattTable"
417 © David Weenink 2016-06-01
418
419 The parameters for the Klatt synthesizer in table format. You can convert it to a @@KlattGrid@, which is easier to view and edit.
420
421 ################################################################################
422 "Sound: To KlattGrid (simple)..."
423 © David Weenink 2009-04-15
424
425 Create a @@KlattGrid@ from a @@Sound@.
426
427 Algorithm
428 =========
429 Oral formants are determined by the method of @@Sound: To Formant (burg)...@, and transformed to a @@FormantGrid@.
430 Pitch is determined by the method of @@Sound: To Pitch...@, and transformed to a @@PitchTier@.
431 Intensity is determined by the method of @@Sound: To Intensity...@, and transformed to an @@IntensityTier@.
432
433 Next, a KlattGrid is created whose time domain conforms to the sound. Its pitch tier, normal formant grid
434 and voicing amplitude are replaced by the results from the analyses.
435
436 ################################################################################
437 "Sound & KlattGrid: Filter by vocal tract..."
438 © David Weenink 2009-01-08
439
440 Filters the selected sound with the vocal tract part of the selected @@KlattGrid@.
441 During this filtering the delta formants and bandwidths are %not used.
442
443 ################################################################################
444 )~~~"
445 MAN_PAGES_END
446 }
447
448 /* End of file manual_KlattGrid.cpp */