Debian Codegraph @

fon/VocalTract.cpp

raw symbols SCIP
1 /* VocalTract.cpp
2 *
3 * Copyright (C) 1992-2008,2011,2012,2015-2020,2022,2026 Paul Boersma
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.
13 * See the GNU 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 "VocalTract.h"cxx . . $ `<file>/fon/VocalTract.h`/
20
21 Thing_implementcxx . . $ `sys/Thing.h:65:9`! (VocalTract, Vector, 2);
22
23 void structVocalTractcxx . . $ structVocalTract# :: v1_infocxx . . $ structVocalTract#v1_info(49f6e7a06ebc5aa8). () {
24 structDaatacxx . . $ structDaata# :: v1_infocxx . . $ structThing#v1_info(49f6e7a06ebc5aa8). ();
25 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"Vocal tract length: ", Melder_singlecxx . . $ Melder_single(f05d861d9dbec9b2). (xmaxcxx . . $ structFunction#xmax.), U" metres");
26 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"Number of sections: ", nxcxx . . $ structSampled#nx.);
27 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"Section length: ", Melder_singlecxx . . $ Melder_single(f05d861d9dbec9b2). (dxcxx . . $ structSampled#dx.), U" metres");
28 }
29
30 autoVocalTractcxx . . $ autoVocalTract# VocalTract_createcxx . . $ VocalTract_create(a5d85e6da9521b1d). (integercxx . . $ integer# nx, double dx) {
31 try {
32 autoVocalTractcxx . . $ autoVocalTract# me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (VocalTract);
33 Matrix_initcxx . . $ Matrix_init(9dd6c49f9830a091). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 0.0, nx * dx, nx, dx, 0.5 * dx, 1.0, 1.0, 1, 1.0, 1.0);
34 return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
35 } catch (MelderErrorcxx . . $ MelderError#) {
36 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"VocalTract not created.");
37 }
38 }
39
40 namespace theVocalTractcxx . . $ theVocalTract/ {
41 constexpr double minimumWidthcxx . . $ theVocalTract/minimumWidth. { 0.0001 };
42 structcxx . . $ theVocalTract/$anonymous_type_d91798b9b808db8a_0# { conststring32cxx . . $ conststring32# phonecxx . . $ theVocalTract/$anonymous_type_d91798b9b808db8a_0#phone.; int numberOfSectionscxx . . $ theVocalTract/$anonymous_type_d91798b9b808db8a_0#numberOfSections.; double areacxx . . $ theVocalTract/$anonymous_type_d91798b9b808db8a_0#area. [40]; }
43 datacxx . . $ theVocalTract/data. [] = {
44 { U"a", 34, { 1.7, 1.2, 1.6, 3.39, 2.1, 1.4, 1, 0.8, 0.8, 0.8, 1, 1.4,
45 2.1, 2.9, 3.09, 2.1, 2.5, 4, 5.3, 6.16, 7, 7.6, 8.15, 8.5, 8.6,
46 8.4, 8, 7.5, 6.9, 6, 5.1, 5, 5.5, 7.9 } },
47 { U"e", 33, { 2.3, 1.95, 1.73, 1.7, 5.3, 6.3, 6.8, 7.55, 8.2, 9.1, 9.7,
48 10.1, 10.2, 10, 8, 7.2, 7.5, 6.4, 5.4, 4.9, 4.35, 3.9, 3.5, 3.1,
49 2.7, 2.4, 2.2, 2.5, 3.4, 5, 6.7, 8.5, 10 } },
50 { U"i", 35, { 3, 2.9, 2.75, 2.58, 2.7, 6.35, 7.8, 8.9, 9.6, 10.15, 10.55,
51 10.9, 11.15, 11.3, 11.2, 10.8, 8, 7.8, 7, 4.5, 2.8, 1.9, 1.3,
52 0.9, 0.65, 0.55, 0.5, 0.55, 0.7, 0.95, 1.3, 2, 3, 5, 8 } },
53 { U"o", 37, { 2.6, 2.05, 1.56, 1.3, 5.2, 4.54, 3.49, 2.6, 2.1, 1.8, 1.6, 1.4,
54 1.29, 1.19, 1.22, 2.6, 2.9, 2.2, 2.6, 3.6, 4.55, 5.55, 6.4, 7.15,
55 8, 8.9, 9.6, 10.5, 11.8, 14.6, 14.5, 12.9, 10.4, 5, 3.4, 3.4, 4 } },
56 { U"u", 40, { 2.5, 2.5, 2.5, 2.4, 5, 8.1, 8.9, 8.9, 8.4, 7.5, 5.8, 3.9, 2.3, 1.6, 1.2,
57 1.05, 1.1, 1.4, 2.2, 2, 1.3, 2, 2.2, 2.3, 2.8, 3.7, 5, 6.2, 7.9,
58 10.9, 12.9, 13.15, 13, 12.5, 9.9, 3.9, 1.8, 0.32, 0.4, 0.6 } },
59 { U"y1", 37, { 3, 2.9, 2.75, 2.58, 2.7, 6.35, 7.8, 8.9, 9.6, 10.15, 10.55,
60 10.9, 11.15, 11.3, 11.2, 10.8, 8, 7.8, 7, 4.5, 2.8, 1.9, 1.3,
61 0.9, 0.65, 0.55, 0.5, 0.55, 0.7, 0.95, 1.3, 2, 3, 1.8, 0.32,
62 0.4, 0.6 } },
63 { U"y2", 38, { 3, 2.9, 2.75, 2.58, 2.7, 6.35, 7.8, 8.9, 9.6, 10.15, 10.55,
64 10.9, 11.15, 11.3, 11.2, 10.8, 8, 7.8, 7, 4.5, 2.8, 1.9, 1.3,
65 0.9, 0.65, 0.55, 0.5, 0.55, 0.7, 0.95, 1.3, 2, 3, 4, 1.8, 0.32,
66 0.4, 0.6 } },
67 { U"y3", 39, { 3, 2.9, 2.75, 2.58, 2.7, 6.35, 7.8, 8.9, 9.6, 10.15, 10.55,
68 10.9, 11.15, 11.3, 11.2, 10.8, 8, 7.8, 7, 4.5, 2.8, 1.9, 1.3,
69 0.9, 0.65, 0.55, 0.5, 0.55, 0.7, 0.95, 1.3, 2, 3, 4, 4, 1.8, 0.32,
70 0.4, 0.6 } },
71 { U"jery", 38, { 3.2, 3.2, 3.2, 3.2, 10.5, 10.5, 13, 13, 10.5, 10.5, 10.5, 10.5, 10.5,
72 8, 6.5, 6.5, 5, 4, 2, 2.6, 1.6, 1.3, 1, 1, 1.3, 1.6, 2, 2, 2.6, 3.2, 5,
73 8, 8, 8, 6.5,
74 2, 6.5, 6.5 } },
75 { U"p", 39, { 3.5, 3.2, 2.9, 2.6, 6.9, 6.65, 5.8, 4.9, 4, 3.14, 2.5, 1.84,
76 1.25, 0.83, 0.6, 0.53,
77 0.5, 0.6, 0.85, 1, 1.6, 2.05, 2.55, 3.08, 3.67, 4.15, 4.8, 5.5, 6.3,
78 7.4, 12, 12.98, 12.9, 11.4, 6.6, 2, 0.45, 0.1, minimumWidthcxx . . $ theVocalTract/minimumWidth. } },
79 { U"t", 36, { 2.8, 2.7, 2.4, 2.6, 6.45, 6.01, 5.31, 4.85, 4.55, 4.32, 4.18, 4.1,
80 4.04, 3.97, 3.85, 3.7, 3.4, 3.05, 2.91, 3.1, 3.55, 3.9, 4.1, 4, 3.8,
81 3.3, 2.55, 1.8, 1, 0.45, 0.1, minimumWidthcxx . . $ theVocalTract/minimumWidth., 0.8, 2.5, 6, 9 } },
82 { U"k", 38, { 2.4, 2.7, 3, 3.3, 7, 9.38, 9.25, 8.62, 7.8, 6.7, 5.4, 4, 2.8, 1.9, 1.35,
83 0.9, 0.55, 0.3, 0.19, 0.07, minimumWidthcxx . . $ theVocalTract/minimumWidth., 0.12, 0.17, 0.3, 0.5, 0.9,
84 1.4, 2.2, 3.3, 5, 9, 11.25, 10.9, 7.3, 4.3, 3.5, 3.7, 6 } },
85 { U"x", 40, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
86 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 } },
87 { U"pa", 39, { 1.7, 1.2, 1.6, 3.39, 2.1, 1.4, 1, 0.8, 0.8, 0.8, 1, 1.4,
88 2.1, 2.9, 3.09, 2.1, 2.5, 4, 5.3, 6.16, 7, 7.6, 8.15, 8.5, 8.6,
89 8.4, 8, 7.5, 6.9, 6, 5.1, 5, 5.5, 7.9, 6.6, 2, 0.45, 0.1,
90 minimumWidthcxx . . $ theVocalTract/minimumWidth. } },
91 { U"ta", 34, { 1.7, 1.2, 1.6, 3.39, 2.1, 1.4, 1, 0.8, 0.8, 0.8, 1, 1.4,
92 2.1, 2.9, 3.09, 2.1, 2.5, 4, 5.3, 6.16, 7, 7.6, 8.15, 8.5, 8.6,
93 8.5, 6, 2, 0.45, minimumWidthcxx . . $ theVocalTract/minimumWidth., 0.8, 2.5, 5.5, 7.9 } },
94 { U"ka", 34, { 1.7, 1.2, 1.6, 3.39, 2.1, 1.4, 1, 0.8, 0.8, 0.8, 1, 1.4,
95 2.1, 2.9, 3.09, 2.1, 0.3, minimumWidthcxx . . $ theVocalTract/minimumWidth.,
96 0.3, 2, 5, 7.6, 8.15, 8.5, 8.6,
97 8.4, 8, 7.5, 6.9, 6, 5.1, 5, 5.5, 7.9 } },
98 { U"pi", 39, { 3, 2.9, 2.75, 2.58, 2.7, 6.35, 7.8, 8.9, 9.6, 10.15, 10.55,
99 10.9, 11.15, 11.3, 11.2, 10.8, 8, 7.8, 7, 4.5, 2.8, 1.9, 1.3,
100 0.9, 0.65, 0.55, 0.5, 0.55, 0.7, 0.95, 1.3, 2, 3, 5,
101 6.6, 2, 0.45, 0.1, minimumWidthcxx . . $ theVocalTract/minimumWidth. } },
102 { U"ti", 35, { 3, 2.9, 2.75, 2.58, 2.7, 6.35, 7.8, 8.9, 9.6, 10.15, 10.55,
103 10.9, 11.15, 11.3, 11.2, 10.8, 8, 7.8, 7, 4.5, 2.8, 1.9, 1.3,
104 0.9, 0.65, 0.55, 0.5, 0.5, 0.5, 0.3, 0.1, minimumWidthcxx . . $ theVocalTract/minimumWidth.,
105 0.8, 2.5, 8 } },
106 { U"ki", 35, { 3, 2.9, 2.75, 2.58, 2.7, 6.35, 7.8, 8.9, 9.6, 10.15, 10.55,
107 10.9, 11.15, 11.3, 11.2, 10.8, 8, 6, 2, 0.3, minimumWidthcxx . . $ theVocalTract/minimumWidth., 0.3, 1.3,
108 0.9, 0.65, 0.55, 0.5, 0.55, 0.7, 0.95, 1.3, 2, 3, 5, 8 } },
109 { U"pu", 40, { 2.5, 2.5, 2.5, 2.4, 5, 8.1, 8.9, 8.9, 8.4, 7.5, 5.8, 3.9, 2.3, 1.6, 1.2,
110 1.05, 1.1, 1.4, 2.2, 2, 1.3, 2, 2.2, 2.3, 2.8, 3.7, 5, 6.2, 7.9,
111 10.9, 12.9, 13.15, 13, 12.5, 9.9, 6.6, 2, 0.45, 0.1, minimumWidthcxx . . $ theVocalTract/minimumWidth. } },
112 { U"tu", 40, { 2.5, 2.5, 2.5, 2.4, 5, 8.1, 8.9, 8.9, 8.4, 7.5, 5.8, 3.9, 2.3, 1.6, 1.2,
113 1.05, 1.1, 1.4, 2.2, 2, 1.3, 2, 2.2, 2.3, 2.8, 3.7, 5, 6.2, 7.9,
114 10.9, 9, 3, 0.4, minimumWidthcxx . . $ theVocalTract/minimumWidth., 0.8, 2.5, 1.8, 0.32, 0.4, 0.6 } },
115 { U"ku", 40, { 2.5, 2.5, 2.5, 2.4, 5, 8.1, 8.9, 8.9, 8.4, 7.5, 5.8, 3.9, 2.3, 1.6, 1.2,
116 1.05, 1.1, 1.4, 1.2, 0.3, minimumWidthcxx . . $ theVocalTract/minimumWidth., 0.3, 2.2, 2.3, 2.8, 3.7, 5, 6.2, 7.9,
117 10.9, 12.9, 13.15, 13, 12.5, 9.9, 3.9, 1.8, 0.32, 0.4, 0.6 } },
118 { nullptr, 0, { 0 } } };
119 }
120
121 autoVocalTractcxx . . $ autoVocalTract# VocalTract_createFromPhonecxx . . $ VocalTract_createFromPhone(67c8bcc88ae7f944). (conststring32cxx . . $ conststring32# phone) {
122 try {
123 int i = 0;
124 for (;; i ++) {
125 if (! theVocalTractcxx . . $ theVocalTract/::datacxx . . $ theVocalTract/data. [i]. phonecxx . . $ theVocalTract/$anonymous_type_d91798b9b808db8a_0#phone.)
126 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Unknown phone ", phone);
127 if (Melder_equcxx . . $ `melder/melder_str32.h:124:9`! (theVocalTractcxx . . $ theVocalTract/::datacxx . . $ theVocalTract/data. [i]. phonecxx . . $ theVocalTract/$anonymous_type_d91798b9b808db8a_0#phone., phone))
128 break;
129 }
130 autoVocalTractcxx . . $ autoVocalTract# me = VocalTract_createcxx . . $ VocalTract_create(a5d85e6da9521b1d). (theVocalTractcxx . . $ theVocalTract/::datacxx . . $ theVocalTract/data. [i]. numberOfSectionscxx . . $ theVocalTract/$anonymous_type_d91798b9b808db8a_0#numberOfSections., 0.005);
131 for (int isection = 1; isection <= mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx.; isection ++)
132 mycxx . . $ `melder/melder.h:44:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).isection] = theVocalTractcxx . . $ theVocalTract/::datacxx . . $ theVocalTract/data. [i]. areacxx . . $ theVocalTract/$anonymous_type_d91798b9b808db8a_0#area. [isection - 1] * 0.0001;
133 return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
134 } catch (MelderErrorcxx . . $ MelderError#) {
135 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"VocalTract not created from phone.");
136 }
137 }
138
139 void VocalTract_drawcxx . . $ VocalTract_draw(2be2293e3a354610). (VocalTractcxx . . $ VocalTract# me, Graphicscxx . . $ Graphics# g) {
140 Matrix_drawRowscxx . . $ Matrix_drawRows(13c691ba74eecb49). (me, g, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
141 }
142
143 autoMatrixcxx . . $ autoMatrix# VocalTract_to_Matrixcxx . . $ VocalTract_to_Matrix(3229dd416b527a4f). (VocalTractcxx . . $ VocalTract# me) {
144 try {
145 autoMatrixcxx . . $ autoMatrix# thee = Matrix_createcxx . . $ Matrix_create(494a3ae9ff7e3b60). (mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin., mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax., mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx., mycxx . . $ `melder/melder.h:44:9`! dxcxx . . $ structSampled#dx., mycxx . . $ `melder/melder.h:44:9`! x1cxx . . $ structSampled#x1., mycxx . . $ `melder/melder.h:44:9`! ymincxx . . $ structSampledXY#ymin., mycxx . . $ `melder/melder.h:44:9`! ymaxcxx . . $ structSampledXY#ymax., mycxx . . $ `melder/melder.h:44:9`! nycxx . . $ structSampledXY#ny., mycxx . . $ `melder/melder.h:44:9`! dycxx . . $ structSampledXY#dy., mycxx . . $ `melder/melder.h:44:9`! y1cxx . . $ structSampledXY#y1.);
146 thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z..allcxx . . $ automatrix#all(2114117ba8ed4224).() <<=cxx . . $ `operator<<=`(a7d93ba40fe22fe0). mycxx . . $ `melder/melder.h:44:9`! zcxx . . $ structMatrix#z..allcxx . . $ automatrix#all(2114117ba8ed4224).();
147 return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
148 } catch (MelderErrorcxx . . $ MelderError#) {
149 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not converted to Matrix.");
150 }
151 }
152
153 autoVocalTractcxx . . $ autoVocalTract# Matrix_to_VocalTractcxx . . $ Matrix_to_VocalTract(8b56bd8c92de2e32). (Matrixcxx . . $ Matrix# me) {
154 try {
155 autoVocalTractcxx . . $ autoVocalTract# thee = VocalTract_createcxx . . $ VocalTract_create(a5d85e6da9521b1d). (mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx., mycxx . . $ `melder/melder.h:44:9`! dxcxx . . $ structSampled#dx.);
156 thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z..allcxx . . $ automatrix#all(2114117ba8ed4224).() <<=cxx . . $ `operator<<=`(88779db6ac139909). mycxx . . $ `melder/melder.h:44:9`! zcxx . . $ structMatrix#z..rowcxx . . $ automatrix#row(2d545b3cb3f8e666). (1);
157 return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
158 } catch (MelderErrorcxx . . $ MelderError#) {
159 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not converted to VocalTract.");
160 }
161 }
162
163 /* End of file VocalTract.cpp */