Debian Codegraph @

fon/VoiceAnalysis.cpp

raw symbols SCIP
1 /* VoiceAnalysis.cpp
2 *
3 * Copyright (C) 1992-2007,2011,2012,2015-2020,2025,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 "VoiceAnalysis.h"cxx . . $ `<file>/fon/VoiceAnalysis.h`/
20 #include "AmplitudeTier.h"cxx . . $ `<file>/fon/AmplitudeTier.h`/
21 #include "H1minusH2Tier.h"cxx . . $ `<file>/fon/H1minusH2Tier.h`/
22
23 double PointProcess_getJitter_localcxx . . $ PointProcess_getJitter_local(64734cf3de218d2b). (PointProcesscxx . . $ PointProcess# me, double tmin, double tmax,
24 double pmin, double pmax, double maximumPeriodFactor)
25 {
26 Function_unidirectionalAutowindowcxx . . $ Function_unidirectionalAutowindow(88b7840c59a57eaf). (me, & tmin, & tmax);
27 const MelderIntegerRangecxx . . $ MelderIntegerRange# pointNumbers = PointProcess_getWindowPointscxx . . $ PointProcess_getWindowPoints(7cc368e5a055f865). (me, tmin, tmax);
28 /* mutable adjust */ integercxx . . $ integer# numberOfPeriods = pointNumbers.sizecxx . . $ MelderIntegerRange#size(57a65ae535d7db84).() - 1;
29 if (numberOfPeriods < 2)
30 return undefinedcxx . . $ undefined.;
31 longdoublecxx . . $ longdouble# sum = 0.0;
32 for (integercxx . . $ integer# i = pointNumbers.firstcxx . . $ MelderIntegerRange#first. + 1; i < pointNumbers.lastcxx . . $ MelderIntegerRange#last.; i ++) {
33 const double p1 = mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i] - mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i - 1], p2 = mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i + 1] - mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i];
34 const double intervalFactor = ( p1 > p2 ? p1 / p2 : p2 / p1 );
35 if (pmin == pmax || (p1 >= pmin && p1 <= pmax && p2 >= pmin && p2 <= pmax && intervalFactor <= maximumPeriodFactor)) {
36 sum += fabscxx . . $ fabs(fee4f1d22bc8e617). (p1 - p2);
37 } else {
38 numberOfPeriods --;
39 }
40 }
41 if (numberOfPeriods < 2)
42 return undefinedcxx . . $ undefined.;
43 return double (sum / (numberOfPeriods - 1)) / PointProcess_getMeanPeriodcxx . . $ PointProcess_getMeanPeriod(64734cf3de218d2b). (me, tmin, tmax, pmin, pmax, maximumPeriodFactor);
44 }
45
46 double PointProcess_getJitter_local_absolutecxx . . $ PointProcess_getJitter_local_absolute(64734cf3de218d2b). (PointProcesscxx . . $ PointProcess# me, double tmin, double tmax,
47 double pmin, double pmax, double maximumPeriodFactor)
48 {
49 Function_unidirectionalAutowindowcxx . . $ Function_unidirectionalAutowindow(88b7840c59a57eaf). (me, & tmin, & tmax);
50 const MelderIntegerRangecxx . . $ MelderIntegerRange# pointNumbers = PointProcess_getWindowPointscxx . . $ PointProcess_getWindowPoints(7cc368e5a055f865). (me, tmin, tmax);
51 /* mutable adjust */ integercxx . . $ integer# numberOfPeriods = pointNumbers.sizecxx . . $ MelderIntegerRange#size(57a65ae535d7db84).() - 1;
52 if (numberOfPeriods < 2)
53 return undefinedcxx . . $ undefined.;
54 longdoublecxx . . $ longdouble# sum = 0.0;
55 for (integercxx . . $ integer# i = pointNumbers.firstcxx . . $ MelderIntegerRange#first. + 1; i < pointNumbers.lastcxx . . $ MelderIntegerRange#last.; i ++) {
56 const double p1 = mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i] - mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i - 1];
57 const double p2 = mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i + 1] - mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i];
58 const double intervalFactor = ( p1 > p2 ? p1 / p2 : p2 / p1 );
59 if (pmin == pmax || (p1 >= pmin && p1 <= pmax && p2 >= pmin && p2 <= pmax && intervalFactor <= maximumPeriodFactor)) {
60 sum += fabscxx . . $ fabs(fee4f1d22bc8e617). (p1 - p2);
61 } else {
62 numberOfPeriods --;
63 }
64 }
65 if (numberOfPeriods < 2)
66 return undefinedcxx . . $ undefined.;
67 return double (sum / (numberOfPeriods - 1));
68 }
69
70 double PointProcess_getJitter_rapcxx . . $ PointProcess_getJitter_rap(64734cf3de218d2b). (PointProcesscxx . . $ PointProcess# me, double tmin, double tmax,
71 double pmin, double pmax, double maximumPeriodFactor)
72 {
73 Function_unidirectionalAutowindowcxx . . $ Function_unidirectionalAutowindow(88b7840c59a57eaf). (me, & tmin, & tmax);
74 const MelderIntegerRangecxx . . $ MelderIntegerRange# pointNumbers = PointProcess_getWindowPointscxx . . $ PointProcess_getWindowPoints(7cc368e5a055f865). (me, tmin, tmax);
75 /* mutable adjust */ integercxx . . $ integer# numberOfPeriods = pointNumbers.sizecxx . . $ MelderIntegerRange#size(57a65ae535d7db84).() - 1;
76 if (numberOfPeriods < 3)
77 return undefinedcxx . . $ undefined.;
78 longdoublecxx . . $ longdouble# sum = 0.0;
79 for (integercxx . . $ integer# i = pointNumbers.firstcxx . . $ MelderIntegerRange#first. + 2; i < pointNumbers.lastcxx . . $ MelderIntegerRange#last.; i ++) {
80 const double p1 = mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i - 1] - mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i - 2];
81 const double p2 = mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i] - mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i - 1];
82 const double p3 = mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i + 1] - mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i];
83 const double intervalFactor1 = ( p1 > p2 ? p1 / p2 : p2 / p1 );
84 const double intervalFactor2 = ( p2 > p3 ? p2 / p3 : p3 / p2 );
85 if (pmin == pmax || (p1 >= pmin && p1 <= pmax && p2 >= pmin && p2 <= pmax && p3 >= pmin && p3 <= pmax
86 && intervalFactor1 <= maximumPeriodFactor && intervalFactor2 <= maximumPeriodFactor))
87 {
88 sum += fabscxx . . $ fabs(fee4f1d22bc8e617). (p2 - (p1 + p2 + p3) / 3.0);
89 } else {
90 numberOfPeriods --;
91 }
92 }
93 if (numberOfPeriods < 3)
94 return undefinedcxx . . $ undefined.;
95 return double (sum / (numberOfPeriods - 2)) / PointProcess_getMeanPeriodcxx . . $ PointProcess_getMeanPeriod(64734cf3de218d2b). (me, tmin, tmax, pmin, pmax, maximumPeriodFactor);
96 }
97
98 double PointProcess_getJitter_ppq5cxx . . $ PointProcess_getJitter_ppq5(64734cf3de218d2b). (PointProcesscxx . . $ PointProcess# me, double tmin, double tmax,
99 double pmin, double pmax, double maximumPeriodFactor)
100 {
101 Function_unidirectionalAutowindowcxx . . $ Function_unidirectionalAutowindow(88b7840c59a57eaf). (me, & tmin, & tmax);
102 const MelderIntegerRangecxx . . $ MelderIntegerRange# pointNumbers = PointProcess_getWindowPointscxx . . $ PointProcess_getWindowPoints(7cc368e5a055f865). (me, tmin, tmax);
103 /* mutable adjust */ integercxx . . $ integer# numberOfPeriods = pointNumbers.sizecxx . . $ MelderIntegerRange#size(57a65ae535d7db84).() - 1;
104 if (numberOfPeriods < 5)
105 return undefinedcxx . . $ undefined.;
106 longdoublecxx . . $ longdouble# sum = 0.0;
107 for (integercxx . . $ integer# i = pointNumbers.firstcxx . . $ MelderIntegerRange#first. + 5; i <= pointNumbers.lastcxx . . $ MelderIntegerRange#last.; i ++) {
108 const double p1 = mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i - 4] - mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i - 5];
109 const double p2 = mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i - 3] - mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i - 4];
110 const double p3 = mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i - 2] - mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i - 3];
111 const double p4 = mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i - 1] - mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i - 2];
112 const double p5 = mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i] - mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i - 1];
113 const double f1 = ( p1 > p2 ? p1 / p2 : p2 / p1 );
114 const double f2 = ( p2 > p3 ? p2 / p3 : p3 / p2 );
115 const double f3 = ( p3 > p4 ? p3 / p4 : p4 / p3 );
116 const double f4 = ( p4 > p5 ? p4 / p5 : p5 / p4 );
117 if (pmin == pmax || (p1 >= pmin && p1 <= pmax && p2 >= pmin && p2 <= pmax && p3 >= pmin && p3 <= pmax &&
118 p4 >= pmin && p4 <= pmax && p5 >= pmin && p5 <= pmax &&
119 f1 <= maximumPeriodFactor && f2 <= maximumPeriodFactor && f3 <= maximumPeriodFactor && f4 <= maximumPeriodFactor))
120 {
121 sum += fabscxx . . $ fabs(fee4f1d22bc8e617). (p3 - (p1 + p2 + p3 + p4 + p5) / 5.0);
122 } else {
123 numberOfPeriods --;
124 }
125 }
126 if (numberOfPeriods < 5)
127 return undefinedcxx . . $ undefined.;
128 return double (sum / (numberOfPeriods - 4)) / PointProcess_getMeanPeriodcxx . . $ PointProcess_getMeanPeriod(64734cf3de218d2b). (me, tmin, tmax, pmin, pmax, maximumPeriodFactor);
129 }
130
131 double PointProcess_getJitter_ddpcxx . . $ PointProcess_getJitter_ddp(64734cf3de218d2b). (PointProcesscxx . . $ PointProcess# me, double tmin, double tmax,
132 double pmin, double pmax, double maximumPeriodFactor)
133 {
134 const double rap = PointProcess_getJitter_rapcxx . . $ PointProcess_getJitter_rap(64734cf3de218d2b). (me, tmin, tmax, pmin, pmax, maximumPeriodFactor);
135 return ( isdefinedcxx . . $ isdefined(f8197d536af80c96). (rap) ? 3.0 * rap : undefinedcxx . . $ undefined. );
136 }
137
138 double PointProcess_Sound_getShimmer_localcxx . . $ PointProcess_Sound_getShimmer_local(cb5a0e73a83580a8). (PointProcesscxx . . $ PointProcess# me, Soundcxx . . $ Sound# thee, double tmin, double tmax,
139 double pmin, double pmax, double maximumPeriodFactor, double maximumAmplitudeFactor)
140 {
141 try {
142 Function_unidirectionalAutowindowcxx . . $ Function_unidirectionalAutowindow(88b7840c59a57eaf). (me, & tmin, & tmax);
143 autoAmplitudeTiercxx . . $ autoAmplitudeTier# peaks = PointProcess_Sound_to_AmplitudeTier_periodcxx . . $ PointProcess_Sound_to_AmplitudeTier_period(9e66b0897b9222d1). (me, thee, tmin, tmax, pmin, pmax, maximumPeriodFactor);
144 return AmplitudeTier_getShimmer_local_ucxx . . $ AmplitudeTier_getShimmer_local_u(d64bef74a2b42548). (peaks.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), pmin, pmax, maximumAmplitudeFactor);
145 } catch (MelderErrorcxx . . $ MelderError#) {
146 if (Melder_hasErrorcxx . . $ Melder_hasError(2df281243f91fe91). (U"Too few pulses between ")) {
147 Melder_clearErrorcxx . . $ Melder_clearError(49f6e7a06ebc5aa8). ();
148 return undefinedcxx . . $ undefined.;
149 } else {
150 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U" & ", thee, U": shimmer (local) not computed.");
151 }
152 }
153 }
154
155 double PointProcess_Sound_getShimmer_local_dBcxx . . $ PointProcess_Sound_getShimmer_local_dB(cb5a0e73a83580a8). (PointProcesscxx . . $ PointProcess# me, Soundcxx . . $ Sound# thee, double tmin, double tmax,
156 double pmin, double pmax, double maximumPeriodFactor, double maximumAmplitudeFactor)
157 {
158 try {
159 Function_unidirectionalAutowindowcxx . . $ Function_unidirectionalAutowindow(88b7840c59a57eaf). (me, & tmin, & tmax);
160 autoAmplitudeTiercxx . . $ autoAmplitudeTier# peaks = PointProcess_Sound_to_AmplitudeTier_periodcxx . . $ PointProcess_Sound_to_AmplitudeTier_period(9e66b0897b9222d1). (me, thee, tmin, tmax, pmin, pmax, maximumPeriodFactor);
161 return AmplitudeTier_getShimmer_local_dB_ucxx . . $ AmplitudeTier_getShimmer_local_dB_u(d64bef74a2b42548). (peaks.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), pmin, pmax, maximumAmplitudeFactor);
162 } catch (MelderErrorcxx . . $ MelderError#) {
163 if (Melder_hasErrorcxx . . $ Melder_hasError(2df281243f91fe91). (U"Too few pulses between ")) {
164 Melder_clearErrorcxx . . $ Melder_clearError(49f6e7a06ebc5aa8). ();
165 return undefinedcxx . . $ undefined.;
166 } else {
167 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U" & ", thee, U": shimmer (local, dB) not computed.");
168 }
169 }
170 }
171
172 double PointProcess_Sound_getShimmer_apq3cxx . . $ PointProcess_Sound_getShimmer_apq3(cb5a0e73a83580a8). (PointProcesscxx . . $ PointProcess# me, Soundcxx . . $ Sound# thee, double tmin, double tmax,
173 double pmin, double pmax, double maximumPeriodFactor, double maximumAmplitudeFactor)
174 {
175 try {
176 Function_unidirectionalAutowindowcxx . . $ Function_unidirectionalAutowindow(88b7840c59a57eaf). (me, & tmin, & tmax);
177 autoAmplitudeTiercxx . . $ autoAmplitudeTier# peaks = PointProcess_Sound_to_AmplitudeTier_periodcxx . . $ PointProcess_Sound_to_AmplitudeTier_period(9e66b0897b9222d1). (me, thee, tmin, tmax, pmin, pmax, maximumPeriodFactor);
178 return AmplitudeTier_getShimmer_apq3_ucxx . . $ AmplitudeTier_getShimmer_apq3_u(d64bef74a2b42548). (peaks.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), pmin, pmax, maximumAmplitudeFactor);
179 } catch (MelderErrorcxx . . $ MelderError#) {
180 if (Melder_hasErrorcxx . . $ Melder_hasError(2df281243f91fe91). (U"Too few pulses between ")) {
181 Melder_clearErrorcxx . . $ Melder_clearError(49f6e7a06ebc5aa8). ();
182 return undefinedcxx . . $ undefined.;
183 } else {
184 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U" & ", thee, U": shimmer (apq3) not computed.");
185 }
186 }
187 }
188
189 double PointProcess_Sound_getShimmer_apq5cxx . . $ PointProcess_Sound_getShimmer_apq5(cb5a0e73a83580a8). (PointProcesscxx . . $ PointProcess# me, Soundcxx . . $ Sound# thee, double tmin, double tmax,
190 double pmin, double pmax, double maximumPeriodFactor, double maximumAmplitudeFactor)
191 {
192 try {
193 Function_unidirectionalAutowindowcxx . . $ Function_unidirectionalAutowindow(88b7840c59a57eaf). (me, & tmin, & tmax);
194 autoAmplitudeTiercxx . . $ autoAmplitudeTier# peaks = PointProcess_Sound_to_AmplitudeTier_periodcxx . . $ PointProcess_Sound_to_AmplitudeTier_period(9e66b0897b9222d1). (me, thee, tmin, tmax, pmin, pmax, maximumPeriodFactor);
195 return AmplitudeTier_getShimmer_apq5_ucxx . . $ AmplitudeTier_getShimmer_apq5_u(d64bef74a2b42548). (peaks.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), pmin, pmax, maximumAmplitudeFactor);
196 } catch (MelderErrorcxx . . $ MelderError#) {
197 if (Melder_hasErrorcxx . . $ Melder_hasError(2df281243f91fe91). (U"Too few pulses between ")) {
198 Melder_clearErrorcxx . . $ Melder_clearError(49f6e7a06ebc5aa8). ();
199 return undefinedcxx . . $ undefined.;
200 } else {
201 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U" & ", thee, U": shimmer (apq5) not computed.");
202 }
203 }
204 }
205
206 double PointProcess_Sound_getShimmer_apq11cxx . . $ PointProcess_Sound_getShimmer_apq11(cb5a0e73a83580a8). (PointProcesscxx . . $ PointProcess# me, Soundcxx . . $ Sound# thee, double tmin, double tmax,
207 double pmin, double pmax, double maximumPeriodFactor, double maximumAmplitudeFactor)
208 {
209 try {
210 Function_unidirectionalAutowindowcxx . . $ Function_unidirectionalAutowindow(88b7840c59a57eaf). (me, & tmin, & tmax);
211 autoAmplitudeTiercxx . . $ autoAmplitudeTier# peaks = PointProcess_Sound_to_AmplitudeTier_periodcxx . . $ PointProcess_Sound_to_AmplitudeTier_period(9e66b0897b9222d1). (me, thee, tmin, tmax, pmin, pmax, maximumPeriodFactor);
212 return AmplitudeTier_getShimmer_apq11_ucxx . . $ AmplitudeTier_getShimmer_apq11_u(d64bef74a2b42548). (peaks.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), pmin, pmax, maximumAmplitudeFactor);
213 } catch (MelderErrorcxx . . $ MelderError#) {
214 if (Melder_hasErrorcxx . . $ Melder_hasError(2df281243f91fe91). (U"Too few pulses between ")) {
215 Melder_clearErrorcxx . . $ Melder_clearError(49f6e7a06ebc5aa8). ();
216 return undefinedcxx . . $ undefined.;
217 } else {
218 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U" & ", thee, U": shimmer (apq11) not computed.");
219 }
220 }
221 }
222
223 double PointProcess_Sound_getShimmer_ddacxx . . $ PointProcess_Sound_getShimmer_dda(cb5a0e73a83580a8). (PointProcesscxx . . $ PointProcess# me, Soundcxx . . $ Sound# thee, double tmin, double tmax,
224 double pmin, double pmax, double maximumPeriodFactor, double maximumAmplitudeFactor)
225 {
226 try {
227 Function_unidirectionalAutowindowcxx . . $ Function_unidirectionalAutowindow(88b7840c59a57eaf). (me, & tmin, & tmax);
228 autoAmplitudeTiercxx . . $ autoAmplitudeTier# peaks = PointProcess_Sound_to_AmplitudeTier_periodcxx . . $ PointProcess_Sound_to_AmplitudeTier_period(9e66b0897b9222d1). (me, thee, tmin, tmax, pmin, pmax, maximumPeriodFactor);
229 const double apq3 = AmplitudeTier_getShimmer_apq3_ucxx . . $ AmplitudeTier_getShimmer_apq3_u(d64bef74a2b42548). (peaks.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), pmin, pmax, maximumAmplitudeFactor);
230 return ( isdefinedcxx . . $ isdefined(f8197d536af80c96). (apq3) ? 3.0 * apq3 : undefinedcxx . . $ undefined. );
231 } catch (MelderErrorcxx . . $ MelderError#) {
232 if (Melder_hasErrorcxx . . $ Melder_hasError(2df281243f91fe91). (U"Too few pulses between ")) {
233 Melder_clearErrorcxx . . $ Melder_clearError(49f6e7a06ebc5aa8). ();
234 return undefinedcxx . . $ undefined.;
235 } else {
236 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U" & ", thee, U": shimmer (dda) not computed.");
237 }
238 }
239 }
240
241 void PointProcess_Sound_getShimmer_multicxx . . $ PointProcess_Sound_getShimmer_multi(c8de293d41ce2932). (PointProcesscxx . . $ PointProcess# me, Soundcxx . . $ Sound# thee, double tmin, double tmax,
242 double pmin, double pmax, double maximumPeriodFactor, double maximumAmplitudeFactor,
243 double *local, double *local_dB, double *apq3, double *apq5, double *apq11, double *dda)
244 {
245 try {
246 Function_unidirectionalAutowindowcxx . . $ Function_unidirectionalAutowindow(88b7840c59a57eaf). (me, & tmin, & tmax);
247 autoAmplitudeTiercxx . . $ autoAmplitudeTier# peaks = PointProcess_Sound_to_AmplitudeTier_periodcxx . . $ PointProcess_Sound_to_AmplitudeTier_period(9e66b0897b9222d1). (me, thee, tmin, tmax, pmin, pmax, maximumPeriodFactor);
248 if (local) *local = AmplitudeTier_getShimmer_local_ucxx . . $ AmplitudeTier_getShimmer_local_u(d64bef74a2b42548). (peaks.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), pmin, pmax, maximumAmplitudeFactor);
249 if (local_dB) *local_dB = AmplitudeTier_getShimmer_local_dB_ucxx . . $ AmplitudeTier_getShimmer_local_dB_u(d64bef74a2b42548). (peaks.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), pmin, pmax, maximumAmplitudeFactor);
250 if (apq3) *apq3 = AmplitudeTier_getShimmer_apq3_ucxx . . $ AmplitudeTier_getShimmer_apq3_u(d64bef74a2b42548). (peaks.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), pmin, pmax, maximumAmplitudeFactor);
251 if (apq5) *apq5 = AmplitudeTier_getShimmer_apq5_ucxx . . $ AmplitudeTier_getShimmer_apq5_u(d64bef74a2b42548). (peaks.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), pmin, pmax, maximumAmplitudeFactor);
252 if (apq11) *apq11 = AmplitudeTier_getShimmer_apq11_ucxx . . $ AmplitudeTier_getShimmer_apq11_u(d64bef74a2b42548). (peaks.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), pmin, pmax, maximumAmplitudeFactor);
253 if (dda) *dda = 3.0 * AmplitudeTier_getShimmer_apq3_ucxx . . $ AmplitudeTier_getShimmer_apq3_u(d64bef74a2b42548). (peaks.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), pmin, pmax, maximumAmplitudeFactor);
254 } catch (MelderErrorcxx . . $ MelderError#) {
255 if (Melder_hasErrorcxx . . $ Melder_hasError(2df281243f91fe91). (U"Too few pulses between ")) {
256 Melder_clearErrorcxx . . $ Melder_clearError(49f6e7a06ebc5aa8). ();
257 if (local) *local = undefinedcxx . . $ undefined.;
258 if (local_dB) *local_dB = undefinedcxx . . $ undefined.;
259 if (apq3) *apq3 = undefinedcxx . . $ undefined.;
260 if (apq5) *apq5 = undefinedcxx . . $ undefined.;
261 if (apq11) *apq11 = undefinedcxx . . $ undefined.;
262 if (dda) *dda = undefinedcxx . . $ undefined.;
263 } else {
264 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U" & ", thee, U": shimmer measures not computed.");
265 }
266 }
267 }
268
269 void Sound_Pitch_PointProcess_voiceReportcxx . . $ Sound_Pitch_PointProcess_voiceReport(87b866c777fb5caa). (Soundcxx . . $ Sound# sound, Pitchcxx . . $ Pitch# pitch, PointProcesscxx . . $ PointProcess# pulses, double tmin, double tmax,
270 double floor, double ceiling, double maximumPeriodFactor, double maximumAmplitudeFactor, double silenceThreshold, double voicingThreshold)
271 {
272 try {
273 Function_unidirectionalAutowindowcxx . . $ Function_unidirectionalAutowindow(88b7840c59a57eaf). (sound, & tmin, & tmax);
274 /*
275 Time domain. Should be preceded by something like "Time range of SELECTION:" or so.
276 */
277 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" From ", Melder_fixedcxx . . $ Melder_fixed(5b9062840a6ade99). (tmin, 6), U" to ", Melder_fixedcxx . . $ Melder_fixed(5b9062840a6ade99). (tmax, 6), U" seconds",
278 U" (duration: ", Melder_fixedcxx . . $ Melder_fixed(5b9062840a6ade99). (tmax - tmin, 6), U" seconds)"
279 );
280 /*
281 Pitch statistics.
282 */
283 const double medianPitch = Pitch_getQuantilecxx . . $ Pitch_getQuantile(5072ddcaf167d3af). (pitch, tmin, tmax, 0.50, kPitch_unitcxx . . $ kPitch_unit#::HERTZcxx . . $ kPitch_unit#HERTZ.);
284 const double meanPitch = Pitch_getMeancxx . . $ Pitch_getMean(cc94e07c5e8f52a8). (pitch, tmin, tmax, kPitch_unitcxx . . $ kPitch_unit#::HERTZcxx . . $ kPitch_unit#HERTZ.);
285 const double stdevPitch = Pitch_getStandardDeviationcxx . . $ Pitch_getStandardDeviation(cc94e07c5e8f52a8). (pitch, tmin, tmax, kPitch_unitcxx . . $ kPitch_unit#::HERTZcxx . . $ kPitch_unit#HERTZ.);
286 const double minimumPitch = Pitch_getMinimumcxx . . $ Pitch_getMinimum(d2c3727f00a8ab5d). (pitch, tmin, tmax, kPitch_unitcxx . . $ kPitch_unit#::HERTZcxx . . $ kPitch_unit#HERTZ., 1);
287 const double maximumPitch = Pitch_getMaximumcxx . . $ Pitch_getMaximum(d2c3727f00a8ab5d). (pitch, tmin, tmax, kPitch_unitcxx . . $ kPitch_unit#::HERTZcxx . . $ kPitch_unit#HERTZ., 1);
288 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"Pitch:");
289 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Median pitch: ", Melder_fixedcxx . . $ Melder_fixed(5b9062840a6ade99). (medianPitch, 3), U" Hz");
290 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Mean pitch: ", Melder_fixedcxx . . $ Melder_fixed(5b9062840a6ade99). (meanPitch, 3), U" Hz");
291 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Standard deviation: ", Melder_fixedcxx . . $ Melder_fixed(5b9062840a6ade99). (stdevPitch, 3), U" Hz");
292 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Minimum pitch: ", Melder_fixedcxx . . $ Melder_fixed(5b9062840a6ade99). (minimumPitch, 3), U" Hz");
293 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Maximum pitch: ", Melder_fixedcxx . . $ Melder_fixed(5b9062840a6ade99). (maximumPitch, 3), U" Hz");
294 /*
295 Pulses statistics.
296 */
297 const double pmin = 0.8 / ceiling, pmax = 1.25 / floor; // minimum period, maximum period (abbreviated for space)
298 const MelderIntegerRangecxx . . $ MelderIntegerRange# pulseNumbers = PointProcess_getWindowPointscxx . . $ PointProcess_getWindowPoints(7cc368e5a055f865). (pulses, tmin, tmax);
299 const integercxx . . $ integer# numberOfPeriods = PointProcess_getNumberOfPeriodscxx . . $ PointProcess_getNumberOfPeriods(772da0d00886b03). (pulses, tmin, tmax, pmin, pmax, maximumPeriodFactor);
300 const double meanPeriod = PointProcess_getMeanPeriodcxx . . $ PointProcess_getMeanPeriod(64734cf3de218d2b). (pulses, tmin, tmax, pmin, pmax, maximumPeriodFactor);
301 const double stdevPeriod = PointProcess_getStdevPeriodcxx . . $ PointProcess_getStdevPeriod(64734cf3de218d2b). (pulses, tmin, tmax, pmin, pmax, maximumPeriodFactor);
302 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"Pulses:");
303 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Number of pulses: ", pulseNumbers.sizecxx . . $ MelderIntegerRange#size(57a65ae535d7db84).());
304 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Number of periods: ", numberOfPeriods);
305 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Mean period: ", Melder_fixedExponentcxx . . $ Melder_fixedExponent(b2de7e334b37c2bb). (meanPeriod, -3, 6), U" seconds");
306 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Standard deviation of period: ", Melder_fixedExponentcxx . . $ Melder_fixedExponent(b2de7e334b37c2bb). (stdevPeriod, -3, 6), U" seconds");
307 /*
308 Voicing.
309 */
310 const MelderFractioncxx . . $ MelderFraction# unvoicedFraction =
311 Pitch_getFractionOfLocallyUnvoicedFramescxx . . $ Pitch_getFractionOfLocallyUnvoicedFrames(13be60e20f2c1d0a). (pitch, tmin, tmax, ceiling, silenceThreshold, voicingThreshold);
312 const MelderCountAndFractioncxx . . $ MelderCountAndFraction# breaks =
313 PointProcess_getCountAndFractionOfVoiceBreakscxx . . $ PointProcess_getCountAndFractionOfVoiceBreaks(340987f96465c7ab). (pulses, tmin, tmax, pmax);
314 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"Voicing:");
315 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Fraction of locally unvoiced frames: ", Melder_percentcxx . . $ Melder_percent(5b9062840a6ade99). (unvoicedFraction.getcxx . . $ MelderFraction#get(21b6c25e127938e2).(), 3),
316 U" (", unvoicedFraction.numeratorcxx . . $ MelderFraction#numerator., U" / ", unvoicedFraction.denominatorcxx . . $ MelderFraction#denominator., U")"
317 );
318 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Number of voice breaks: ", breaks.countcxx . . $ MelderCountAndFraction#count.);
319 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Degree of voice breaks: ", Melder_percentcxx . . $ Melder_percent(5b9062840a6ade99). (breaks.getFractioncxx . . $ MelderCountAndFraction#getFraction(21b6c25e127938e2). (), 3),
320 U" (", Melder_fixedcxx . . $ Melder_fixed(5b9062840a6ade99). (breaks.numeratorcxx . . $ MelderCountAndFraction#numerator., 6), U" seconds / ", Melder_fixedcxx . . $ Melder_fixed(5b9062840a6ade99). (breaks.denominatorcxx . . $ MelderCountAndFraction#denominator., 6), U" seconds)"
321 );
322 /*
323 Jitter.
324 */
325 const double jitterLocal = PointProcess_getJitter_localcxx . . $ PointProcess_getJitter_local(64734cf3de218d2b). (pulses, tmin, tmax, pmin, pmax, maximumPeriodFactor);
326 const double jitterLocal_s = PointProcess_getJitter_local_absolutecxx . . $ PointProcess_getJitter_local_absolute(64734cf3de218d2b). (pulses, tmin, tmax, pmin, pmax, maximumPeriodFactor);
327 const double rap = PointProcess_getJitter_rapcxx . . $ PointProcess_getJitter_rap(64734cf3de218d2b). (pulses, tmin, tmax, pmin, pmax, maximumPeriodFactor);
328 const double ppq5 = PointProcess_getJitter_ppq5cxx . . $ PointProcess_getJitter_ppq5(64734cf3de218d2b). (pulses, tmin, tmax, pmin, pmax, maximumPeriodFactor);
329 const double ddp = PointProcess_getJitter_ddpcxx . . $ PointProcess_getJitter_ddp(64734cf3de218d2b). (pulses, tmin, tmax, pmin, pmax, maximumPeriodFactor);
330 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"Jitter:");
331 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Jitter (local): ", Melder_percentcxx . . $ Melder_percent(5b9062840a6ade99). (jitterLocal, 3));
332 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Jitter (local, absolute): ", Melder_fixedExponentcxx . . $ Melder_fixedExponent(b2de7e334b37c2bb). (jitterLocal_s, -6, 3), U" seconds");
333 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Jitter (rap): ", Melder_percentcxx . . $ Melder_percent(5b9062840a6ade99). (rap, 3));
334 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Jitter (ppq5): ", Melder_percentcxx . . $ Melder_percent(5b9062840a6ade99). (ppq5, 3));
335 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Jitter (ddp): ", Melder_percentcxx . . $ Melder_percent(5b9062840a6ade99). (ddp, 3));
336 /*
337 Shimmer.
338 */
339 double shimmerLocal, shimmerLocal_dB, apq3, apq5, apq11, dda;
340 PointProcess_Sound_getShimmer_multicxx . . $ PointProcess_Sound_getShimmer_multi(c8de293d41ce2932). (pulses, sound, tmin, tmax, pmin, pmax,
341 maximumPeriodFactor, maximumAmplitudeFactor,
342 & shimmerLocal, & shimmerLocal_dB, & apq3, & apq5, & apq11, & dda
343 );
344 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"Shimmer:");
345 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Shimmer (local): ", Melder_percentcxx . . $ Melder_percent(5b9062840a6ade99). (shimmerLocal, 3));
346 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Shimmer (local, dB): ", Melder_fixedcxx . . $ Melder_fixed(5b9062840a6ade99). (shimmerLocal_dB, 3), U" dB");
347 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Shimmer (apq3): ", Melder_percentcxx . . $ Melder_percent(5b9062840a6ade99). (apq3, 3));
348 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Shimmer (apq5): ", Melder_percentcxx . . $ Melder_percent(5b9062840a6ade99). (apq5, 3));
349 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Shimmer (apq11): ", Melder_percentcxx . . $ Melder_percent(5b9062840a6ade99). (apq11, 3));
350 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Shimmer (dda): ", Melder_percentcxx . . $ Melder_percent(5b9062840a6ade99). (dda, 3));
351 /*
352 Harmonicity.
353 */
354 const double meanAutocorrelation = Pitch_getMeanStrengthcxx . . $ Pitch_getMeanStrength(44948828c55500f8). (pitch, tmin, tmax, Pitch_STRENGTH_UNIT_AUTOCORRELATIONcxx . . $ `fon/Pitch.h:89:9`!);
355 const double meanNHR = Pitch_getMeanStrengthcxx . . $ Pitch_getMeanStrength(44948828c55500f8). (pitch, tmin, tmax, Pitch_STRENGTH_UNIT_NOISE_HARMONICS_RATIOcxx . . $ `fon/Pitch.h:90:9`!);
356 const double meanHNR_dB = Pitch_getMeanStrengthcxx . . $ Pitch_getMeanStrength(44948828c55500f8). (pitch, tmin, tmax, Pitch_STRENGTH_UNIT_HARMONICS_NOISE_DBcxx . . $ `fon/Pitch.h:91:9`!);
357 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"Harmonicity of the voiced parts only:");
358 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Mean autocorrelation: ", Melder_fixedcxx . . $ Melder_fixed(5b9062840a6ade99). (meanAutocorrelation, 6));
359 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Mean noise-to-harmonics ratio: ", Melder_fixedcxx . . $ Melder_fixed(5b9062840a6ade99). (meanNHR, 6));
360 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Mean harmonics-to-noise ratio: ", Melder_fixedcxx . . $ Melder_fixed(5b9062840a6ade99). (meanHNR_dB, 3), U" dB");
361 /*
362 H1 minus H2.
363 */
364 autoH1minusH2Tiercxx . . $ autoH1minusH2Tier# h1minusH2 = PointProcess_Sound_to_H1minusH2Tier_ucxx . . $ PointProcess_Sound_to_H1minusH2Tier_u(9aa57514c657ba33). (pulses, sound, tmin, tmax, pmin, pmax, maximumPeriodFactor);
365 const double meanOfThePoints = RealTier_getMean_points_ucxx . . $ RealTier_getMean_points_u(275ea9f7b70e8f4c). (h1minusH2.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), tmin, tmax);
366 const double meanOfTheCurve = RealTier_getMean_curve_ucxx . . $ RealTier_getMean_curve_u(275ea9f7b70e8f4c). (h1minusH2.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), tmin, tmax);
367 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"H1-minus-H2:");
368 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Mean of the points: ", Melder_fixedcxx . . $ Melder_fixed(5b9062840a6ade99). (meanOfThePoints, 3), U" dB");
369 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Mean of the curve: ", Melder_fixedcxx . . $ Melder_fixed(5b9062840a6ade99). (meanOfTheCurve, 3), U" dB");
370 } catch (MelderErrorcxx . . $ MelderError#) {
371 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (sound, U" & ", pitch, U" & ", pulses, U": voice report not computed.");
372 }
373 }
374
375 /* End of file VoiceAnalysis.cpp */