Debian Codegraph @

artsynth/Art_Speaker_to_VocalTract.cpp

raw
1 /* Art_Speaker_to_VocalTract.cpp
2 *
3 * Copyright (C) 1992-2005,2008,2011,2015-2017,2019 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 2 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 "Delta.h"
20 #include "Speaker_to_Delta.h"
21 #include "Art_Speaker_Delta.h"
22 #include "Art_Speaker_to_VocalTract.h"
23
24 autoVocalTract Art_Speaker_to_VocalTract (Art art, Speaker speaker) {
25 autoDelta delta = Speaker_to_Delta (speaker);
26 Art_Speaker_intoDelta (art, speaker, delta.get());
27 double area [300];
28 constexpr double sectionLength = 0.001; // one millimetre
29 integer numberOfSections = 0;
30 for (integer isection = 1; isection <= 27; isection ++) {
31 Delta_Tube tube = & delta -> tubes [37 + isection];
32 integer numberOfConstantSections = Melder_iround (tube -> Dxeq / sectionLength);
33 double constantArea = tube -> Dyeq * tube -> Dzeq;
34 for (integer jsection = 1; jsection <= numberOfConstantSections; jsection ++)
35 area [++ numberOfSections] = constantArea;
36 }
37 autoVocalTract thee = VocalTract_create (numberOfSections, sectionLength);
38 for (integer isection = 1; isection <= numberOfSections; isection ++)
39 thy z [1] [isection] = area [isection];
40 return thee;
41 }
42
43 /* End of file Art_Speaker_to_VocalTract.cpp */