Debian Codegraph @

fon/Matrix_and_Pitch.cpp

raw symbols SCIP
1 /* Matrix_and_Pitch.cpp
2 *
3 * Copyright (C) 1992-2005,2011,2012,2015-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 "Matrix_and_Pitch.h"cxx . . $ `<file>/fon/Matrix_and_Pitch.h`/
20
21 autoMatrixcxx . . $ autoMatrix# Pitch_to_Matrixcxx . . $ Pitch_to_Matrix(4a909a4be7425015). (Pitchcxx . . $ Pitch# me) {
22 try {
23 autoMatrixcxx . . $ autoMatrix# you = 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., 1.0, 1.0, 1, 1.0, 1.0);
24 for (integercxx . . $ integer# i = 1; i <= mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx.; i ++) {
25 const double value = mycxx . . $ `melder/melder.h:44:9`! framescxx . . $ structPitch#frames. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i]. candidatescxx . . $ structPitch_Frame#candidates. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1]. frequencycxx . . $ structPitch_Candidate#frequency.;
26 yourcxx . . $ `melder/melder.h:46:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i] =
27 Pitch_util_frequencyIsVoicedcxx . . $ Pitch_util_frequencyIsVoiced(828b76dce88fac). (value, mycxx . . $ `melder/melder.h:44:9`! ceilingcxx . . $ structPitch#ceiling.) ? mycxx . . $ `melder/melder.h:44:9`! framescxx . . $ structPitch#frames. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i]. candidatescxx . . $ structPitch_Frame#candidates. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1]. frequencycxx . . $ structPitch_Candidate#frequency. : 0.0;
28 }
29 return youcxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
30 } catch (MelderErrorcxx . . $ MelderError#) {
31 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not converted to Matrix.");
32 }
33 }
34
35 autoPitchcxx . . $ autoPitch# Matrix_to_Pitchcxx . . $ Matrix_to_Pitch(706e61a64f376c4a). (Matrixcxx . . $ Matrix# me) {
36 try {
37 autoPitchcxx . . $ autoPitch# you = Pitch_createcxx . . $ Pitch_create(15f7ea67007465c5). (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., 5000.0, 2);
38 for (integercxx . . $ integer# i = 1; i <= mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx.; i ++) {
39 const Pitch_Framecxx . . $ Pitch_Frame# frame = & yourcxx . . $ `melder/melder.h:46:9`! framescxx . . $ structPitch#frames. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i];
40 if (mycxx . . $ `melder/melder.h:44:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i] == 0.0) {
41 Pitch_Frame_initcxx . . $ Pitch_Frame_init(dff4ec8b4c81c245). (frame, 1);
42 frame -> candidatescxx . . $ structPitch_Frame#candidates. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1]. frequencycxx . . $ structPitch_Candidate#frequency. = 0.0; // voiceless candidate always present
43 frame -> candidatescxx . . $ structPitch_Frame#candidates. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1]. strengthcxx . . $ structPitch_Candidate#strength. = 0.4;
44 } else {
45 Pitch_Frame_initcxx . . $ Pitch_Frame_init(dff4ec8b4c81c245). (frame, 2);
46 frame -> intensitycxx . . $ structPitch_Frame#intensity. = 1;
47 frame -> candidatescxx . . $ structPitch_Frame#candidates. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1]. frequencycxx . . $ structPitch_Candidate#frequency. = mycxx . . $ `melder/melder.h:44:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i];
48 frame -> candidatescxx . . $ structPitch_Frame#candidates. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1]. strengthcxx . . $ structPitch_Candidate#strength. = 0.9;
49 frame -> candidatescxx . . $ structPitch_Frame#candidates. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).2]. frequencycxx . . $ structPitch_Candidate#frequency. = 0.0; // voiceless candidate always present
50 frame -> candidatescxx . . $ structPitch_Frame#candidates. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).2]. strengthcxx . . $ structPitch_Candidate#strength. = 0.4;
51 }
52 }
53 return youcxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
54 } catch (MelderErrorcxx . . $ MelderError#) {
55 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not converted to Pitch.");
56 }
57 }
58
59 void Pitch_formulacxx . . $ Pitch_formula(c6d7dbb5c31319a6). (Pitchcxx . . $ Pitch# me, conststring32cxx . . $ conststring32# formula, Interpretercxx . . $ Interpreter# interpreter) {
60 try {
61 autoMatrixcxx . . $ autoMatrix# m = 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., 1.0, mycxx . . $ `melder/melder.h:44:9`! maxnCandidatescxx . . $ structPitch#maxnCandidates., mycxx . . $ `melder/melder.h:44:9`! maxnCandidatescxx . . $ structPitch#maxnCandidates., 1.0, 1.0);
62 for (integercxx . . $ integer# iframe = 1; iframe <= mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx.; iframe ++) {
63 const Pitch_Framecxx . . $ Pitch_Frame# frame = & mycxx . . $ `melder/melder.h:44:9`! framescxx . . $ structPitch#frames. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).iframe];
64 for (integercxx . . $ integer# icand = 1; icand <= frame -> nCandidatescxx . . $ structPitch_Frame#nCandidates.; icand ++)
65 m ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).icand] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).iframe] = frame -> candidatescxx . . $ structPitch_Frame#candidates. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).icand]. frequencycxx . . $ structPitch_Candidate#frequency.;
66 }
67 Matrix_formulacxx . . $ Matrix_formula(3b405620ba9cc26e). (m.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), formula, interpreter, nullptr);
68 for (integercxx . . $ integer# iframe = 1; iframe <= mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx.; iframe ++) {
69 const Pitch_Framecxx . . $ Pitch_Frame# frame = & mycxx . . $ `melder/melder.h:44:9`! framescxx . . $ structPitch#frames. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).iframe];
70 for (integercxx . . $ integer# icand = 1; icand <= frame -> nCandidatescxx . . $ structPitch_Frame#nCandidates.; icand ++)
71 frame -> candidatescxx . . $ structPitch_Frame#candidates. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).icand]. frequencycxx . . $ structPitch_Candidate#frequency. = m ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).icand] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).iframe];
72 }
73 } catch (MelderErrorcxx . . $ MelderError#) {
74 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": formula not completed.");
75 }
76 }
77
78 /* End of file Matrix_and_Pitch.cpp */