Debian Codegraph @

fon/manual_spectrum.cpp

raw symbols SCIP
1 /* manual_spectrum.cpp
2 *
3 * Copyright (C) 1992-2008,2010-2012,2014-2017,2019-2023,2025 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 "ManPagesM.h"cxx . . $ `<file>/sys/ManPagesM.h`/
20
21 #include "Sound.h"cxx . . $ `<file>/fon/Sound.h`/
22
23 enum class Decorationcxx . . $ Decoration# {
24 Nonecxx . . $ Decoration#None.,
25 Minimalcxx . . $ Decoration#Minimal.,
26 Fancycxx . . $ Decoration#Fancy.,
27 };
28
29 static void draw_SpectrumHanncxx . . $ draw_SpectrumHann(628cbd061440fe70). (Graphicscxx . . $ Graphics# g, double f1, double f2, bool stop, Decorationcxx . . $ Decoration# garnish) {
30 try {
31 const double fmin = ( garnish == Decorationcxx . . $ Decoration#::Fancycxx . . $ Decoration#Fancy. ? 300 : 0 );
32 const double fmax = ( garnish == Decorationcxx . . $ Decoration#::Fancycxx . . $ Decoration#Fancy. ? 1300 : 4000 );
33 const double df = ( garnish == Decorationcxx . . $ Decoration#::Fancycxx . . $ Decoration#Fancy. ? 1 : 4 );
34 autoSoundcxx . . $ autoSound# me = Sound_createcxx . . $ Sound_create(39ab106d6b9a0135). (1, fmin, fmax, (long) floorcxx . . $ floor(fee4f1d22bc8e617). ((fmax - fmin) / df) + 1, df, fmin);
35 constexpr double w = 100.0;
36 const double f1left = f1 - w, f1right = f1 + w, f2left = f2 - w, f2right = f2 + w;
37 constexpr double halfpibysmooth = NUMpicxx . . $ NUMpi. / (w + w);
38 Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (g, fmin, fmax, -0.1, 1.1);
39 for (integercxx . . $ integer# i = 1; i <= mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx.; i ++) {
40 const double f = mycxx . . $ `melder/melder.h:44:9`! x1cxx . . $ structSampled#x1. + (i - 1) * mycxx . . $ `melder/melder.h:44:9`! dxcxx . . $ structSampled#dx.;
41 mycxx . . $ `melder/melder.h:44:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i] = (
42 f < f1left ?
43 0.0
44 : f < f1right ?
45 ( f1 > 0.0 ? 0.5 - 0.5 * coscxx . . $ cos(fee4f1d22bc8e617). (halfpibysmooth * (f - f1left)) : 1.0 )
46 : f < f2left ?
47 1.0
48 : f < f2right ?
49 ( f2 < fmax ? 0.5 + 0.5 * coscxx . . $ cos(fee4f1d22bc8e617). (halfpibysmooth * (f - f2left)) : 1.0 )
50 :
51 0.0
52 );
53 }
54 if (stop)
55 for (integercxx . . $ integer# i = 1; i <= mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx.; i ++)
56 mycxx . . $ `melder/melder.h:44:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i] = 1.0 - mycxx . . $ `melder/melder.h:44:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i];
57 if (garnish != Decorationcxx . . $ Decoration#::Nonecxx . . $ Decoration#None.) {
58 Graphics_drawInnerBoxcxx . . $ Graphics_drawInnerBox(2d838ed765120c5d). (g);
59 Graphics_textLeftcxx . . $ Graphics_textLeft(48cf1f690ec61203). (g, true, U"Amplitude filter %H (%f)");
60 Graphics_markLeftcxx . . $ Graphics_markLeft(e82cc8dc402e8bd7). (g, 0.0, true, true, false, nullptr);
61 Graphics_markLeftcxx . . $ Graphics_markLeft(e82cc8dc402e8bd7). (g, 1.0, true, true, false, nullptr);
62 }
63 if (garnish == Decorationcxx . . $ Decoration#::Minimalcxx . . $ Decoration#Minimal.) {
64 Graphics_textBottomcxx . . $ Graphics_textBottom(48cf1f690ec61203). (g, true, U"Frequency %f (Hz)");
65 Graphics_markBottomcxx . . $ Graphics_markBottom(e82cc8dc402e8bd7). (g, 0.0, true, true, false, nullptr);
66 Graphics_markBottomcxx . . $ Graphics_markBottom(e82cc8dc402e8bd7). (g, 500.0, true, true, false, nullptr);
67 Graphics_markBottomcxx . . $ Graphics_markBottom(e82cc8dc402e8bd7). (g, 1000.0, true, true, false, nullptr);
68 Graphics_markBottomcxx . . $ Graphics_markBottom(e82cc8dc402e8bd7). (g, 2000.0, true, true, false, nullptr);
69 Graphics_markBottomcxx . . $ Graphics_markBottom(e82cc8dc402e8bd7). (g, 4000.0, true, true, false, nullptr);
70 }
71 if (garnish == Decorationcxx . . $ Decoration#::Fancycxx . . $ Decoration#Fancy.) {
72 Graphics_textBottomcxx . . $ Graphics_textBottom(48cf1f690ec61203). (g, true, U"Frequency %f");
73 Graphics_markBottomcxx . . $ Graphics_markBottom(e82cc8dc402e8bd7). (g, f1left, false, true, true, U"%f__1_-%w");
74 Graphics_markBottomcxx . . $ Graphics_markBottom(e82cc8dc402e8bd7). (g, f1, false, true, true, U"%f__1_");
75 Graphics_markBottomcxx . . $ Graphics_markBottom(e82cc8dc402e8bd7). (g, f1right, false, true, true, U"%f__1_+%w");
76 Graphics_markBottomcxx . . $ Graphics_markBottom(e82cc8dc402e8bd7). (g, f2left, false, true, true, U"%f__2_-%w");
77 Graphics_markBottomcxx . . $ Graphics_markBottom(e82cc8dc402e8bd7). (g, f2, false, true, true, U"%f__2_");
78 Graphics_markBottomcxx . . $ Graphics_markBottom(e82cc8dc402e8bd7). (g, f2right, false, true, true, U"%f__2_+%w");
79 Graphics_markRightcxx . . $ Graphics_markRight(e82cc8dc402e8bd7). (g, 1.0, false, true, false, U"0 dB");
80 Graphics_markLeftcxx . . $ Graphics_markLeft(e82cc8dc402e8bd7). (g, 0.5, true, true, true, nullptr);
81 Graphics_markRightcxx . . $ Graphics_markRight(e82cc8dc402e8bd7). (g, 0.5, false, true, false, U"-6 dB");
82 }
83 Graphics_setColourcxx . . $ Graphics_setColour(eb47b9513d3f4721). (g, stop ? Melder_BLUEcxx . . $ Melder_BLUE. : Melder_REDcxx . . $ Melder_RED.);
84 Sound_drawcxx . . $ Sound_draw(9ce2a9dfe752ed09). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), g, 0.0, 0.0, -0.1, 1.1, false, U"curve");
85 Graphics_setColourcxx . . $ Graphics_setColour(eb47b9513d3f4721). (g, Melder_BLACKcxx . . $ Melder_BLACK.);
86 } catch (MelderErrorcxx . . $ MelderError#) {
87 Melder_clearErrorcxx . . $ Melder_clearError(49f6e7a06ebc5aa8). ();
88 }
89 }
90 static void draw_SpectrumPassHanncxx . . $ draw_SpectrumPassHann(2d838ed765120c5d). (Graphicscxx . . $ Graphics# g) {
91 draw_SpectrumHanncxx . . $ draw_SpectrumHann(628cbd061440fe70). (g, 500.0, 1000.0, false, Decorationcxx . . $ Decoration#::Fancycxx . . $ Decoration#Fancy.);
92 }
93 static void draw_SpectrumPassHann_decomposecxx . . $ draw_SpectrumPassHann_decompose(2d838ed765120c5d). (Graphicscxx . . $ Graphics# g) {
94 draw_SpectrumHanncxx . . $ draw_SpectrumHann(628cbd061440fe70). (g, 0.0, 500.0, false, Decorationcxx . . $ Decoration#::Minimalcxx . . $ Decoration#Minimal.);
95 draw_SpectrumHanncxx . . $ draw_SpectrumHann(628cbd061440fe70). (g, 500, 1000, false, Decorationcxx . . $ Decoration#::Nonecxx . . $ Decoration#None.);
96 draw_SpectrumHanncxx . . $ draw_SpectrumHann(628cbd061440fe70). (g, 1000, 2000, false, Decorationcxx . . $ Decoration#::Nonecxx . . $ Decoration#None.);
97 draw_SpectrumHanncxx . . $ draw_SpectrumHann(628cbd061440fe70). (g, 2000, 4000, false, Decorationcxx . . $ Decoration#::Nonecxx . . $ Decoration#None.);
98 }
99 static void draw_SpectrumStopHanncxx . . $ draw_SpectrumStopHann(2d838ed765120c5d). (Graphicscxx . . $ Graphics# g) {
100 draw_SpectrumHanncxx . . $ draw_SpectrumHann(628cbd061440fe70). (g, 500, 1000, true, Decorationcxx . . $ Decoration#::Fancycxx . . $ Decoration#Fancy.);
101 }
102 static void draw_SpectrumStopHann_decomposecxx . . $ draw_SpectrumStopHann_decompose(2d838ed765120c5d). (Graphicscxx . . $ Graphics# g) {
103 draw_SpectrumHanncxx . . $ draw_SpectrumHann(628cbd061440fe70). (g, 500.0, 1000.0, false, Decorationcxx . . $ Decoration#::Minimalcxx . . $ Decoration#Minimal.);
104 draw_SpectrumHanncxx . . $ draw_SpectrumHann(628cbd061440fe70). (g, 500.0, 1000.0, true, Decorationcxx . . $ Decoration#::Nonecxx . . $ Decoration#None.);
105 }
106
107 void manual_spectrum_initcxx . . $ manual_spectrum_init(e57bd08652fa63a5). (ManPagescxx . . $ ManPages# me);
108 void manual_spectrum_initcxx . . $ manual_spectrum_init(e57bd08652fa63a5). (ManPagescxx . . $ ManPages# me) {
109
110 MAN_PAGES_BEGINcxx . . $ `sys/ManPagesM.h:27:9`!
111 R"~~~(
112 ################################################################################
113 "Ltas"
114 © Paul Boersma 2007-03-20
115
116 One of the @@types of objects@ in Praat.
117 #Ltas is short for Long-Term Average Spectrum.
118
119 An object of class Ltas represents the logarithmic @@power spectral density@ as a function of frequency,
120 expressed in dB/Hz relative to 2·10^^-5^ Pa.
121
122 Inside an Ltas object
123 =====================
124
125 With @Inspect, you will see the following attributes:
126
127 %x__%min_
128 : the bottom of the frequency domain, in hertz. Usually 0.
129
130 %x__%max_
131 : the top of the frequency domain, in hertz.
132
133 %n__%x_
134 : the number of frequency bins (≥ 1).
135
136 %dx
137 : the frequency step, or %%bin width%, in hertz.
138
139 %x__1_
140 : the frequency associated with the first bin, in hertz.
141 Usually equals %dx / 2, because the first bin tends to start at 0 hertz.
142
143 %z__1%i_, %i = 1 ... %n__%x_
144 : the power spectral density, expressed in dB.
145
146 ################################################################################
147 "Ltas: Average"
148 © Paul Boersma 2023-05-03
149
150 The command ##Average# becomes available under Combine when you select one or more Ltas objects.
151
152 When you choose ##Average#, a new @Ltas called “averaged” will appear in the list of objects.
153 This new Ltas will contain the average of the Ltases that you had selected.
154
155 Algorithm
156 =========
157 The averaging takes place in the energy domain. For instance, if you select three Ltases,
158 the values in the three Ltases will be converted from dB to Pa^2,
159 then added up, then divided by 3, then converted from Pa^2 to dB.
160
161 ################################################################################
162 )~~~"
163 MAN_PAGES_ENDcxx . . $ `sys/ManPagesM.h:28:9`!
164
165 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Ltas: Get bin number from frequency...", U"ppgb", 20140421)
166 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A @@Query submenu|query@ to the selected @Ltas object.")
167 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Return bin")
168 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"the band number belonging to the specified frequency, expressed as a real number.")
169 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Example")
170 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"If the Ltas has a bin width of 1000 Hz, and the lowest frequency is 0 Hz, "
171 "the bin number associated with a frequency of 1800 Hz is 2.3.")
172 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Scripting")
173 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"You can use this command to put the nearest bin centre into a script variable:")
174 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"selectObject: \"Ltas hallo\"")
175 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"bin = Get bin number from frequency: 1800")
176 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"nearestBin = round (bin)")
177 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"In this case, the value will not be written into the Info window. To round down or up, use")
178 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"leftBin = floor (bin)")
179 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"rightBin = ceiling (bin)")
180 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
181
182 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Ltas: Get bin width", U"ppgb", 20041122)
183 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A @@Query submenu|query@ to the selected @Ltas object.")
184 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Return value")
185 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"the with of a bin, expressed in hertz.")
186 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
187
188 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Ltas: Get frequency from bin number...", U"ppgb", 20041122)
189 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A @@Query submenu|query@ to the selected @Ltas object.")
190 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Return value")
191 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"the frequency (in hertz) associated with a specified bin number.")
192 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Setting")
193 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##Bin number")
194 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the bin number whose frequency is sought.")
195 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Algorithm")
196 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"the result is")
197 EQUATIONcxx . . $ `sys/ManPagesM.h:57:9`! (U"%f__1_ + (%binNumber - 1) · Δ%f")
198 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"where %f__1_ is the frequency associated with the centre of the first bin, "
199 "and Δ%f is the bin width.")
200 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
201
202 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Ltas: Get frequency of maximum...", U"ppgb", 20200912)
203 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A @@Query submenu|query@ to the selected @Ltas object.")
204 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Return value")
205 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"the frequency (in hertz) associated with the maximum energy density.")
206 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Settings")
207 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##From frequency (Hz)")
208 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##To frequency (Hz)")
209 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the selected frequency domain. Values outside this domain are ignored. "
210 "If ##To frequency# is not greater than ##From frequency#, "
211 "the entire frequency domain of the Ltas object is considered.")
212 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##Interpolation")
213 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the interpolation method (#none, #parabolic, #cubic, #sinc70, #sinc700) of the @@vector peak interpolation@. "
214 "The standard is #none because of the usual large binning. "
215 "If the Ltas was computed with @@Spectrum: To Ltas (1-to-1)@, "
216 "a #parabolic or #cubic interpolation would be more appropriate.")
217 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
218
219 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Ltas: Get frequency of minimum...", U"ppgb", 20200912)
220 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A @@Query submenu|query@ to the selected @Ltas object.")
221 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Return value")
222 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"the frequency (in hertz) associated with the minimum energy density.")
223 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Settings")
224 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##Time range (s)")
225 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the time range (%t__1_, %t__2_). Values outside this range are ignored. "
226 "If %t__1_ is not less than %t__2_, the entire frequency domain of the Ltas is considered.")
227 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"%%Interpolation")
228 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the interpolation method (#none, #parabolic, #cubic, #sinc) of the @@vector peak interpolation@. "
229 "The standard is #none because of the usual large binning. "
230 "If the Ltas was computed with @@Spectrum: To Ltas (1-to-1)@, "
231 "a #parabolic or #cubic interpolation would be more appropriate.")
232 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
233
234 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Ltas: Get highest frequency", U"ppgb", 20041122)
235 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A @@Query submenu|query@ to the selected @Ltas object.")
236 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Return value")
237 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"the highest frequency, expressed in hertz.")
238 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
239
240 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Ltas: Get lowest frequency", U"ppgb", 20041122)
241 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A @@Query submenu|query@ to the selected @Ltas object for its lowest frequency.")
242 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Return value")
243 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"the lowest frequency, expressed in Hertz. It is usually 0 Hz.")
244 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
245
246 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Ltas: Get maximum...", U"ppgb", 20200912)
247 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A @@Query submenu|query@ to the selected @Ltas object.")
248 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Return value")
249 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"the maximum value (in dB) within a specified frequency range.")
250 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Settings")
251 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##From frequency (Hz))")
252 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##To frequency (Hz)")
253 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the selected frequency domain. Values outside this domain are ignored. "
254 "If %%To frequency% is not greater than %%From frequency%, "
255 "the entire frequency domain of the Ltas object is considered.")
256 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"%%Interpolation")
257 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the interpolation method (#none, #parabolic, #cubic, #sinc70, #sinc700) of the @@vector peak interpolation@. "
258 "The standard is #none because of the usual large binning. "
259 "If the Ltas was computed with @@Spectrum: To Ltas (1-to-1)@, "
260 "a #parabolic or #cubic interpolation would be more appropriate.")
261 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
262
263 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Ltas: Get mean...", U"ppgb", 20041122)
264 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A @@Query submenu|query@ to the selected @Ltas object.")
265 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Return value")
266 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"the mean value (in dB) within a specified frequency range.")
267 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Settings")
268 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##From frequency (Hz))")
269 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##To frequency (Hz)")
270 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the frequency range. Values outside this range are ignored. "
271 "If ##To frequency# is not greater than ##From frequency#, the entire frequency domain of the Ltas is considered.")
272 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Algorithm")
273 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"The mean value between the frequencies %f__1_ and %f__2_ is defined as")
274 EQUATIONcxx . . $ `sys/ManPagesM.h:57:9`! (U"1/(%f__2_ - %f__1_) ∫__%%f%1_^^%%f%2^ %df %x(%f)")
275 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"where %x(%f) is the LTAS as a function of frequency, expressed in dB. "
276 "For our discrete Ltas object, this mean is approximated by")
277 EQUATIONcxx . . $ `sys/ManPagesM.h:57:9`! (U"1/%n ∑__%i=%m..%m+%n-1_ %x__%i_")
278 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"where %n is the number of band centres between %f__1_ and %f__2_.")
279 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
280
281 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Ltas: Get minimum...", U"ppgb", 20200912)
282 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A @@Query submenu|query@ to the selected @Ltas object.")
283 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Return value")
284 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"the minimum value (in dB) within a specified frequency range.")
285 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Settings")
286 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##From frequency (Hz))")
287 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##To frequency (Hz)")
288 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the selected frequency domain. Values outside this domain are ignored. "
289 "If ##To frequency# is not greater than ##From frequency#, "
290 "the entire frequency domain of the Ltas object is considered.")
291 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"%%Interpolation")
292 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the interpolation method (#none, #parabolic, #cubic, #sinc70, #sinc700) of the @@vector peak interpolation@. "
293 "The standard is #none because of the usual large binning. "
294 "If the Ltas was computed with @@Spectrum: To Ltas (1-to-1)@, "
295 "a #parabolic or #cubic interpolation would be more appropriate.")
296 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
297
298 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Ltas: Get number of bins", U"ppgb", 20041122)
299 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A @@Query submenu|query@ to the selected @Ltas object.")
300 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Return value")
301 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"the total number of frequency bins.")
302 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
303
304 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Ltas: Get standard deviation...", U"ppgb", 19991016)
305 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A @@Query submenu|query@ to the selected @Ltas object.")
306 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Return value")
307 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"the standard deviation (in dB) of the LTAS within a specified frequency domain.")
308 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Settings")
309 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##From frequency (Hz))")
310 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##To frequency (Hz)")
311 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the frequency window. Values outside this domain are ignored. "
312 "If ##To frequency# is not greater than ##From frequency#, the entire frequency domain of the Ltas is considered.")
313 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Algorithm")
314 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"The standard deviation between the frequencies %f__1_ and %f__2_ is defined as")
315 EQUATIONcxx . . $ `sys/ManPagesM.h:57:9`! (U"1/(%f__2_ – %f__1_) ∫__%%f%1_^^%%f%2^ %df (%x(%f) – %μ)^2")
316 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"where %x(%f) is the LTAS as a function of frequency, and %μ its mean. "
317 "For our discrete Ltas object, the standard deviation is approximated by")
318 EQUATIONcxx . . $ `sys/ManPagesM.h:57:9`! (U"1/(%n–1) ∑__%i=%m..%m+%n-1_ (%x__%i_ – %μ)^2")
319 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"where %n is the number of band centres between %f__1_ and %f__2_. Note the \"minus 1\".")
320 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
321
322 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Ltas: Get value at frequency...", U"ppgb", 20101228)
323 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A @@Query submenu|query@ to the selected @Ltas object.")
324 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Return value")
325 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"the value (in dB) at a specified frequency. "
326 "If %frequency is outside the bands of the Ltas, the result is 0.")
327 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Settings")
328 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##Frequency (Hz)")
329 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the frequency at which the value is to be evaluated.")
330 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"%%Interpolation")
331 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the interpolation method, see @@vector value interpolation@. "
332 "The standard is #None because binning is usually large.")
333 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
334
335 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Ltas: Get value in bin...", U"ppgb", 20041122)
336 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A @@Query submenu|query@ to the selected @Ltas object.")
337 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Return value")
338 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"the LTAS value (in dB) in a specified bin. "
339 "If the bin number is less than 1 or greater than the number of bin, the result is 0; "
340 "otherwise, it is %z [1] [%%bin number%].")
341 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Setting")
342 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##Bin number")
343 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the bin whose value is to be looked up.")
344 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
345
346 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Sound: To Spectrogram...", U"ppgb", 20211015)
347 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A command that creates a @Spectrogram from every selected @Sound object. "
348 "It performs a %%short-term spectral analysis%, which means that for a number of time points in the Sound, "
349 "Praat computes an approximation of the spectrum at that time. Each such spectrum is called an %%analysis frame%.")
350 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"For tutorial information, see @@Intro 3. Spectral analysis@.")
351 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Settings")
352 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##Window length (s)")
353 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the duration of the analysis window, in seconds. If this is 0.005 seconds, Praat uses for each frame "
354 "the part of the sound that lies between 0.0025 seconds before and 0.0025 seconds after the centre of that frame "
355 "(for Gaussian windows, Praat actually uses a bit more than that). "
356 "The window length determines the %bandwidth of the spectral analysis, i.e. the width of the horizontal line "
357 "in the spectrogram of a pure sine wave. "
358 "For a Gaussian window, the -3 dB bandwidth is 2*sqrt(6*ln(2))/(%π*%%Window length%), "
359 "or 1.2982804 / %%Window length%. "
360 "To get a “broad-band” spectrogram (bandwidth 260 Hz), set %%Window length% to 5 milliseconds; "
361 "to get a “narrow-band” spectrogram (bandwidth 43 Hz), set it to 30 milliseconds. "
362 "The other window shapes give slightly different values.")
363 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##Maximum frequency (Hz)")
364 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the maximum frequency subject to analysis, e.g. 5000 hertz. "
365 "If it is higher than the Nyquist frequency of the Sound (which is half its sampling frequency), "
366 "some values in the result will be zero (and will be drawn in white by @@Spectrogram: Paint...@).")
367 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##Time step (s)")
368 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the distance between the centres of subsequent frames, e.g. 0.002 seconds. "
369 "This determines the number of frames of the resulting Spectrogram. For instance, if the Sound is 1 second long, "
370 "and the time step is 2 milliseconds, the Spectrogram will consist of almost 500 frames "
371 "(not %exactly 500, because no reliable spectrum can be measured near the beginning and end of the sound). "
372 "See below for cases in which the time step of the resulting Spectrogram is different from what you supply here.")
373 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##Frequency step (Hz)")
374 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the frequency resolution, e.g. 20 Hertz. "
375 "This determines the number of frequency bands (%bins) of the resulting Spectrogram. For instance, if the %%Maximum frequency% "
376 "is 5000 Hz, and the frequency step is 20 Hz, the Spectrogram will consist of 250 frequency bands. "
377 "See below for cases in which the frequency step of the resulting Spectrogram is different from what you supply here.")
378 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##Window shape")
379 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"determines the shape of the analysis window. "
380 "You can choose from: #Gaussian, #Square (none, rectangular), #Hamming (raised sine-squared), "
381 "#Bartlett (triangular), #Welch (parabolic), and #Hanning (sine-squared). "
382 "The Gaussian window is superior, as it gives no sidelobes in your spectrogram; "
383 "it analyzes a factor of 2 slower than the other window shapes, "
384 "because the analysis is actually performed on twice as many samples per frame.")
385 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"For purposes of computation speed, Praat may decide to change the time step and the frequency step. "
386 "This is because the time step never needs to be smaller than 1/(8√%π) of the window length, "
387 "and the frequency step never needs to be smaller than (√%π)/8 of the inverse of the window length. "
388 "For instance, if the window length is 29 ms, the actual time step will never be less than 29/(8√%π) = 2.045 ms. "
389 "And if the window length is 5 ms, the actual frequency step will never be less than (√%π)/8/0.005 = 44.31 Hz.")
390 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Tests of the bandwidth")
391 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"You can check the bandwidth formula with the following procedure:")
392 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"! create a 1000-Hz sine wave, windowed by a 0.2-seconds Gaussian window.")
393 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"Create Sound from formula: \"gauss\", 1, 0.0, 1.0, 44100, \"sin(2*pi*1000*x) * exp(-3*((x-0.5)/0.1)^2)\"")
394 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"! compute its spectrum and look at its bandwidth")
395 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"To Spectrum: \"yes\"")
396 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"Draw: 980, 1020, 20, 80, \"yes\"")
397 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"Marks bottom every: 1, 2, \"yes\", \"yes\", \"yes\"")
398 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"Marks left every: 1, 2, \"yes\", \"yes\", \"yes\"")
399 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"! now you should see a peak at 1000 Hz with a 3 dB bandwidth of 7 Hz (20 dB: 17 Hz)")
400 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"! more precise: compute the position and width of the peak, and write them to the console")
401 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"Formula: ~ if x<980 or x>1020 then 0 else self fi")
402 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"To Formant (peaks): 20")
403 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"List: \"no\", \"yes\", 6, \"no\", 3, \"yes\", 3, \"yes\"")
404 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"! now you should be able to read that a peak was found at 999.99982 Hz")
405 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"! with a bandwidth of 6.497 Hz; the theory above predicted 6.491 Hz")
406 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"")
407 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"! The same, windowed by a 0.1-seconds Hamming window.")
408 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"Create Sound from formula: \"Hamming\", 1, 0.0, 1.0, 44100, ~ if x<0.4 or x>0.6 then 0 else sin(2*pi*1000*x)*(0.54+0.46*cos(pi*(x-0.5)/0.1)) fi")
409 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"To Spectrum: \"yes\"")
410 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"Formula: ~ if x<970 or x>1030 then 0 else self fi")
411 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"To Formant (peaks): 20")
412 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"List: \"no\", \"yes\", 6, \"no\", 3, \"yes\", 3, \"yes\"")
413 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"! peak at 999.99817 Hz, 3 dB bw 6.518 Hz, 20 dB bw 15 Hz, zero bw 20 Hz, sidelobe -42 dB")
414 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"")
415 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"! The same, windowed by a 0.1-seconds rectangular window.")
416 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"Create Sound from formula: \"rectangular\", 1, 0.0, 1.0, 44100, ~ if x<0.4 or x>0.6 then 0 else sin(2*pi*1000*x) fi")
417 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"To Spectrum: \"yes\"")
418 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"Formula: ~ if x<970 or x>1030 then 0 else self fi")
419 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"To Formant (peaks): 20")
420 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"List: \"no\", \"yes\", 6, \"no\", 3, \"yes\", 3, \"yes\"")
421 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"! peak at 999.99506 Hz, 3 dB bw 4.440 Hz, 20 dB bw 27 Hz, zero bw 10 Hz, sidelobe -14 dB")
422 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"")
423 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"! The same, windowed by a 0.1-seconds Hanning window.")
424 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"Create Sound from formula: \"Hanning\", 1, 0.0, 1.0, 44100, ~ if x<0.4 or x>0.6 then 0 else sin(2*pi*1000*x)*(0.5+0.5*cos(pi*(x-0.5)/0.1)) fi")
425 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"To Spectrum: \"yes\"")
426 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"Formula: ~ if x<970 or x>1030 then 0 else self fi")
427 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"To Formant (peaks): 20")
428 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"List: \"no\", \"yes\", 6, \"no\", 3, \"yes\", 3, \"yes\"")
429 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"! peak at 999.99945 Hz, 3 dB bw 7.212 Hz, 20 dB bw 16 Hz, zero bw 20 Hz, sidelobe -31 dB")
430 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"")
431 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"! The same, windowed by a 0.1-seconds triangular window.")
432 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"Create Sound from formula: \"triangular\", 1, 0.0, 1.0, 44100, ~ if x<0.4 or x>0.6 then 0 else sin(2*pi*1000*x)*(1-abs((x-0.5)/0.1)) fi")
433 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"To Spectrum: \"yes\"")
434 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"Formula: ~ if x<970 or x>1030 then 0 else self fi")
435 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"To Formant (peaks): 20")
436 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"List: \"no\", \"yes\", 6, \"no\", 3, \"yes\", 3, \"yes\"")
437 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"! peak at 999.99933 Hz, 3 dB bw 6.384 Hz, 20 dB bw 15 Hz, zero bw 20 Hz, sidelobe -26 dB")
438 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"")
439 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"! The same, windowed by a 0.1-seconds parabolic window.")
440 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"Create Sound from formula: \"parabolic\", 1, 0.0, 1.0, 44100, ~ if x<0.4 or x>0.6 then 0 else sin(2*pi*1000*x)*(1-((x-0.5)/0.1)^2) fi")
441 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"To Spectrum: \"yes\"")
442 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"Formula: ~ if x<970 or x>1030 then 0 else self fi")
443 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"To Formant (peaks): 20")
444 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"List: \"no\", \"yes\", 6, \"no\", 3, \"yes\", 3, \"yes\"")
445 CODEcxx . . $ `sys/ManPagesM.h:50:9`! (U"! peak at 999.99921 Hz, 3 dB bw 5.786 Hz, 20 dB bw 12 Hz, zero bw 15 Hz, sidelobe -21 dB")
446 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
447
448 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Sound: To Ltas (pitch-corrected)...", U"ppgb", 20061203)
449 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A command available in the #Spectrum menu if you select one or more @Sound objects. "
450 "It tries to compute an @Ltas of the spectral envelope of the voiced parts, "
451 "correcting away the influence of F0 in a way that does not sacrifice frequency selectivity. "
452 "The resulting Ltas is meant to reflect only the resonances (formants) in the vocal tract "
453 "and the envelope of the glottal source spectrum.")
454 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"The analysis method is described in @@Boersma & Kovacic (2006)@.")
455 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
456
457 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Sound: To Spectrum...", U"ppgb", 20041123)
458 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A command that appears in the #Spectrum menu if you select one or more @Sound objects. "
459 "It turns the selected Sound into a @Spectrum by an over-all spectral analysis, a %%Fourier transform%.")
460 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Setting")
461 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##Fast")
462 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"determines whether zeroes are appended to the sound such that the number of samples is a power of two. "
463 "This can appreciably speed up the Fourier transform.")
464 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Mathematical procedure")
465 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"For the Fourier transform, the Praat-defined @@time domain@ of the @Sound is ignored. "
466 "Instead, its time domain is considered to run from %t=0 to %t=%T, "
467 "where %t=0 is supposed to be aligned with the first sample, "
468 "and %T is the total duration of the samples, i.e. %%N%Δ%t, "
469 "where %N is the number of samples and Δ%t is the @@sampling period@. "
470 "Thus, the last sample lies at %t=%T–Δ%t.")
471 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"For a sound %x(%t), defined for all times %t in the domain (0, %T), "
472 "the complex spectrum %X(%f) for any frequency %f is the forward Fourier transform of %x(%t), with a negative exponent:")
473 EQUATIONcxx . . $ `sys/ManPagesM.h:57:9`! (U"%X(%f) = ∫__0_^^%T^ %x(%t) %e^^-2%%πift%^ %dt")
474 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"If the Sound is expressed in Pascal (Pa), the Spectrum is expressed in Pa·s, or Pa/Hz. "
475 "Since a @Spectrum object can only contain a finite number of frequency samples, "
476 "it is only computed for frequencies that are multiples of Δ%f = 1/%T. "
477 "The number of those frequencies is determined by the number of samples %N of the sound.")
478 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"If %N is odd, there will be %N frequency samples. For instance, if the sound has 20,457 samples, "
479 "the spectrum will be computed at the frequencies -10,228Δ%f, -10,227Δ%f, ..., –Δ%f, 0, +Δ%f, ..., "
480 "+10,227Δ%f, +10,228Δ%f. If we suppose that a frequency sample represents a frequency bin with a width of Δ%f, "
481 "we see that the frequency samples span adjacent frequency ranges, "
482 "e.g. the first sample runs from -10,228.5Δ%f to -10,227.5Δ%f, the second from -10,227.5Δ%f to -10,226.5Δ%f. "
483 "Together, the frequency samples span the frequency domain of the spectrum, "
484 "which runs from -%F to +%F, where %F = 10,228.5Δ%f. "
485 "We can see that this frequency equals one half of the @@sampling frequency@ of the original sound: "
486 "%F = 10,228.5Δ%f = 10,228.5/%T = 10,228.5/(20,457Δ%t) = 0.5/Δ%t. This is the so-called @@Nyquist frequency@.")
487 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"If %N is even, there will be %N+1 frequency samples. For instance, if the sound has 32,768 samples, "
488 "the spectrum will be computed at the frequencies -16,384Δ%f, -16,383Δ%f, ..., -Δ%f, 0, +Δ%f, ..., "
489 "+16,383Δ%f, +16,384Δ%f. Again, the frequency samples span adjacent frequency ranges, "
490 "but the first and last samples are only half as wide as the rest, "
491 "i.e. the first sample runs from -16,384Δ%f to -16,383.5Δ%f, the second from -16,383.5Δ%f to -16,382.5Δ%f, "
492 "and the last from +16,383.5Δ%f to +16,384Δ%f. "
493 "Together, the frequency samples again span the frequency domain of the spectrum, "
494 "which runs from –%F to +%F, where %F = 16,384Δ%f = 0.5/Δ%t, the Nyquist frequency.")
495 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Storage")
496 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"In a @Spectrum object, Praat stores the real and imaginary parts of the complex spectrum separately. "
497 "The real part is equal to the cosine transform:")
498 EQUATIONcxx . . $ `sys/ManPagesM.h:57:9`! (U"re %X(%f) = ∫__0_^^%T^ %x(%t) cos (2%%πft%) %dt")
499 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"The imaginary part is equal to the reverse of the sine transform:")
500 EQUATIONcxx . . $ `sys/ManPagesM.h:57:9`! (U"im %X(%f) = – ∫__0_^^%T^ %x(%t) sin (2%%πft%) %dt")
501 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"The complex spectrum can be reconstructed from the real and imaginary part as follows:")
502 EQUATIONcxx . . $ `sys/ManPagesM.h:57:9`! (U"%X(%f) = re %X(%f) + %i im %X(%f)")
503 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"Since the cosine is a symmetric function of %t and the sine is an antisymmetric function of %t, "
504 "the complex spectrum for a negative frequency is the complex conjugate of the complex spectrum for the corresponding "
505 "positive frequency:")
506 EQUATIONcxx . . $ `sys/ManPagesM.h:57:9`! (U"%X(-%f) = re %X(-%f) + %i im %X(-%f) = re %X(%f) - %i im %X(%f) = %X^*(%f)")
507 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"For purposes of storage, therefore, the negative frequencies are superfluous. "
508 "For this reason, the Spectrum object stores re %X(%f) and im %X(%f) only for frequencies %f = 0, Δ%f, 2Δ%f... "
509 "In the case of a sound with 20,457 samples, the Spectrum object contains the real part of %X(0) "
510 "(its imaginary part is always zero), and the real and imaginary parts of %X(%f) "
511 "for frequencies from Δ%f to 10,228Δ%f, which makes in total 1+2·10,228 = 20,457 real values. "
512 "In the case of a sound with 32,768 samples, the Spectrum object contains the real parts of %X(0) and %X(16,384Δ%f) "
513 "(their imaginary parts are always zero), and the real and imaginary parts of %X(%f) "
514 "for frequencies from Δ%f to 16,383Δ%f, which makes in total 2+2·16,383 = 32,768 real values.")
515 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"Since the negative frequencies have been removed, the frequency domain now runs from 0 to %F. "
516 "This means that the first frequency bin is now only 0.5Δ%f wide (i.e. as wide as the last bin for even-%N spectra), "
517 "which has consequences for computations of energies.")
518 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Behaviour")
519 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"If you perform @@Spectrum: To Sound@ on the resulting Spectrum object, "
520 "a Sound is created that is equal to the original Sound (or to the original Sound with appended zeroes).")
521 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Properties")
522 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"The frequency integral over the squared Spectrum equals the time integral over the squared Sound:")
523 EQUATIONcxx . . $ `sys/ManPagesM.h:57:9`! (U"∫__-%F_^^+%F^ |%X(%f)|^2 %df = ∫__0_^%T |%x(%t)|^2 %dt")
524 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"This is called %%Parceval's theorem%.")
525 /*
526 Copy... square
527 Formula... self^2
528 To Spectrum... yes
529 Formula... self * exp (- (x/50) ^ 2)
530 To Sound
531 Rename... smoothIntensity
532
533 the result is a smoothed version of your squared sound.
534 Perhaps divide the original by its square root:
535
536 select Sound square
537 Formula... self / sqrt (Sound_smoothIntensity [])
538 Play
539
540 > I also have a question about whether this would remove the contour or
541 > just normalize the loudness?
542
543 it removes the contour. I tested it. It works.
544 */
545 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
546
547 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Spectrogram", U"ppgb", 20070321)
548 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"One of the @@types of objects@ in Praat. For tutorial information, see @@Intro 3. Spectral analysis@.")
549 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"A Spectrogram object represents an acoustic time-frequency representation of a sound: "
550 "the @@power spectral density@ %PSD (%f, %t), expressed in Pa^2/Hz. "
551 "It is sampled into a number of points centred around equally spaced times %t__%i_ "
552 "and frequencies %f__%j_.")
553 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Inside a Spectrogram")
554 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"With @Inspect, you will see the following attributes:")
555 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"%xmin")
556 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"start time, in seconds.")
557 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"%xmax")
558 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"end time, in seconds.")
559 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"%nx")
560 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the number of times (≥ 1).")
561 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"%dx")
562 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"time step, in seconds.")
563 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"%x1")
564 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the time associated with the first column, in seconds. "
565 "This will usually be in the range [%xmin, %xmax]. "
566 "The time associated with the last column (i.e., %x1 + (%nx – 1) %dx)) "
567 "will also usually be in that range.")
568 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"%ymin")
569 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"lowest frequency, in Hertz. Normally 0.")
570 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"%ymax")
571 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"highest frequency, in Hertz.")
572 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"%ny")
573 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the number of frequencies (≥ 1).")
574 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"%dy")
575 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"frequency step, in Hertz.")
576 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"%y1")
577 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the frequency associated with the first row, in Hertz. Usually %dy / 2. "
578 "The frequency associated with the last row (i.e., %y1 + (%ny – 1) %dy)) "
579 "will often be %ymax - %dy / 2.")
580 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"%z__%ij_, %i = 1 ... %ny, %j = 1 ... %nx")
581 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the power spectral density, in Pa^2/Hz. ")
582 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
583
584 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Spectrogram: Formula...", U"ppgb", 20021206)
585 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A command for changing the data in all selected @Spectrogram objects.")
586 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"See the @Formulas tutorial for examples and explanations.")
587 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
588
589 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Spectrogram: Paint...", U"ppgb", 20030916)
590 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A command to draw the selected @Spectrogram object(s) into the @@Picture window@ in shades of grey.")
591 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Settings")
592 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##From time (s)")
593 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##To time (s)")
594 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the time domain along the %x axis.")
595 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##From frequency (Hz)")
596 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##To frequency (Hz)")
597 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the frequency domain along the %y axis.")
598 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##Dynamic range (dB)")
599 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"The global maximum of the spectrogram (after preemphasis) will always be drawn in black; "
600 "all values that are more than %%Dynamic range% dB below this maximum (after dynamic compression) "
601 "will be drawn in white. Values in-between have appropriate shades of grey.")
602 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##Preemphasis (dB/octave)")
603 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"determines the steepness of a high-pass filter, "
604 "i.e., how much the power of higher frequencies will be raised before drawing, as compared to lower frequencies. "
605 "Since the spectral slope of human vowels is approximately -6 dB per octave, "
606 "the standard value for this parameter is +6 dB per octave, "
607 "so that the spectrum is flattened and the higher formants look as strong as the lower ones.")
608 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##Dynamic compression")
609 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"determines how much stronger weak time frames should be made before drawing. "
610 "Normally, this parameter is between 0 and 1. If it is 0, there is no dynamic compression. "
611 "If it is 1, all time frames (vertical bands) will be drawn equally strong, "
612 "i.e., all of them will contain frequencies that are drawn in black. "
613 "If this parameter is 0.4 and the global maximum is at 80 dB, then a frame with a maximum at 20 dB "
614 "(which will normally be drawn all white if the dynamic range is 50 dB), "
615 "will be raised by 0.4 * (80 - 20) = 24 dB, "
616 "so that its maximum will be seen at 44 dB (thus making this frame visible).")
617 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
618
619 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Spectrogram: To Spectrum (slice)...", U"ppgb", 19961003)
620 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A command to create a @Spectrum object from every selected @Spectrogram object.")
621 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Purpose")
622 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"to extract the information contained in a Spectrogram at a certain time.")
623 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Algorithm")
624 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"The Spectrum will be constructed from one frame of the Spectrogram, "
625 "namely the frame whose centre is closed to the %time argument. ")
626 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
627
628 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Spectrum", U"ppgb", 20041123)
629 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"One of the @@types of objects@ in Praat. A Spectrum object represents "
630 "the complex spectrum as a function of frequency. "
631 "If the spectrum was created from a sound (which is expressed in units of Pascal), "
632 "the complex values are expressed in units Pa/Hz (Pascal per Hertz). "
633 "For detailed information, see @@Sound: To Spectrum...@.")
634 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Spectrum commands")
635 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"Creation:")
636 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Sound: To Spectrum...")
637 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"Queries:")
638 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: Get centre of gravity...")
639 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: Get standard deviation...")
640 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: Get skewness...")
641 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: Get kurtosis...")
642 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: Get central moment...")
643 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"Modification:")
644 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: Filter (pass Hann band)...")
645 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: Filter (stop Hann band)...")
646 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Formula...")
647 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"Conversion:")
648 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: To Ltas (1-to-1)")
649 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: To Spectrogram")
650 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"Synthesis:")
651 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: To Sound")
652 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
653
654 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Spectrum: Filter (pass Hann band)...", U"ppgb", 20030916)
655 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A command to modify every selected @Spectrum object.")
656 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"The complex values in the #Spectrum are multiplied by real-valued sine shapes and straight lines, according to the following figure:")
657 PICTUREcxx . . $ `sys/ManPagesM.h:58:9`! (5, 3, draw_SpectrumPassHann)
658 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Settings")
659 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##From frequency (Hz)# (standard value: 500 Hz)")
660 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the lower edge of the pass band (%f__1_ in the figure). The value zero is special: the filter then acts as a low-pass filter.")
661 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##To frequency (Hz)# (standard value: 1000 Hz)")
662 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the upper edge of the pass band (%f__2_ in the figure). The value zero is special: the filter then acts as a high-pass filter.")
663 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##Smoothing (Hz)# (standard value: 100 Hz)")
664 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the width of the region between pass and stop (%w in the figure).")
665 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Usage")
666 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"Because of its symmetric Hann-like shape, the filter is especially useful for decomposing the Spectrum into consecutive bands. "
667 "For instance, we can decompose the spectrum into the bands 0-500 Hz, 500-1000 Hz, 1000-2000 Hz, and 2000-\"0\" Hz:")
668 PICTUREcxx . . $ `sys/ManPagesM.h:58:9`! (5, 3, draw_SpectrumPassHann_decompose)
669 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"By adding the four bands together, we get the original spectrum again.")
670 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"A complementary filter is described at @@Spectrum: Filter (stop Hann band)...@.")
671 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"See the @Filtering tutorial for information on the need for smoothing and a comparative discussion of various filters.")
672 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
673
674 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Spectrum: Filter (stop Hann band)...", U"ppgb", 20030916)
675 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A command to modify every selected @Spectrum object.")
676 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"The complex values in the #Spectrum are multiplied by real-valued sine shapes and straight lines, according to the following figure:")
677 PICTUREcxx . . $ `sys/ManPagesM.h:58:9`! (5, 3, draw_SpectrumStopHann)
678 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Settings")
679 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##From frequency (Hz)# (standard value: 500 Hz)")
680 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the lower edge of the stop band (%f__1_ in the figure). The value zero is special: the filter then acts as a high-pass filter.")
681 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##To frequency (Hz)# (standard value: 1000 Hz)")
682 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the upper edge of the stop band (%f__2_ in the figure). The value zero is special: the filter then acts as a low-pass filter.")
683 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##Smoothing (Hz)# (standard value: 100 Hz)")
684 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the width of the region between stop and pass (%w in the figure).")
685 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Usage")
686 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"This filter is the complement from the pass-band filter (@@Spectrum: Filter (pass Hann band)...@). "
687 "For instance, we can decompose the spectrum into the above stop-band spectrum and a band from 500 to 1000 Hz:")
688 PICTUREcxx . . $ `sys/ManPagesM.h:58:9`! (5, 3, draw_SpectrumStopHann_decompose)
689 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"By adding the two spectra together, we get the original spectrum again.")
690 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"See the @Filtering tutorial for information on the need for smoothing and a comparative discussion of various filters.")
691 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
692
693 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Spectrum: Formula...", U"ppgb", 20021206)
694 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A command for changing the data in all selected @Spectrum objects.")
695 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"See the @Formulas tutorial for examples and explanations.")
696 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
697
698 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Spectrum: Get central moment...", U"ppgb", 20020323)
699 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A command to query the selected @Spectrum object.")
700 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"If the complex spectrum is given by %S(%f), the %%n%th central spectral moment is given by")
701 EQUATIONcxx . . $ `sys/ManPagesM.h:57:9`! (U"∫__0_^∞ (%f – %f__%c_)^%n |%S(%f)|^%p %df")
702 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"divided by the \"energy\"")
703 EQUATIONcxx . . $ `sys/ManPagesM.h:57:9`! (U"∫__0_^∞ |%S(%f)|^%p %df")
704 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"In this formula, %f__%c_ is the spectral centre of gravity (see @@Spectrum: Get centre of gravity...@). "
705 "Thus, the %%n%th central moment is the average of (%f – %f__%c_)^%n over the entire frequency domain, "
706 "weighted by |%S(%f)|^%p. For %p = 2, the weighting is done by the power spectrum, and for %p = 1, "
707 "the weighting is done by the absolute spectrum. A value of %p = 2/3 has been seen as well.")
708 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Settings")
709 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##Moment")
710 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the number %n in the formulas above. A number of 3 gives you the third central spectral moment. "
711 "It is not impossible to ask for fractional moments, e.g. %n = 1.5.")
712 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##Power")
713 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the quantity %p in the formula above. Common values are 2, 1, or 2/3.")
714 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Usage")
715 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"For %n = 1, the central moment should be zero, since the centre of gravity %f__%c_ is computed with "
716 "the same %p. For %n = 2, you get the variance of the frequencies in the spectrum; the standard deviation "
717 "of the frequency is the square root of this. For %n = 3, you get the non-normalized spectral skewness; "
718 "to normalize it, you can divide by the 1.5 power of the second moment. For %n = 4, you get the "
719 "non-normalized spectral kurtosis; to normalize it, you can divide by the square of the second moment "
720 "and subtract 3. Praat can directly give you the quantities mentioned here:")
721 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: Get centre of gravity...")
722 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: Get standard deviation...")
723 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: Get skewness...")
724 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: Get kurtosis...")
725 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
726
727 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Spectrum: Get centre of gravity...", U"ppgb", 20070225)
728 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A command to query the selected @Spectrum object.")
729 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"If the complex spectrum is given by %S(%f), where %f is the frequency, the %%centre of gravity% "
730 "is given by")
731 EQUATIONcxx . . $ `sys/ManPagesM.h:57:9`! (U"∫__0_^∞ %f |%S(%f)|^%p %df")
732 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"divided by the \"energy\"")
733 EQUATIONcxx . . $ `sys/ManPagesM.h:57:9`! (U"∫__0_^∞ |%S(%f)|^%p %df")
734 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"Thus, the centre of gravity is the average of %f over the entire frequency domain, "
735 "weighted by |%S(%f)|^%p. For %p = 2, the weighting is done by the power spectrum, and for %p = 1, "
736 "the weighting is done by the absolute spectrum. A value of %p = 2/3 has been seen as well.")
737 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Setting")
738 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##Power")
739 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the quantity %p in the formulas above. Common values are 2, 1, or 2/3.")
740 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Interpretation")
741 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"The spectral centre of gravity is a measure for how high the frequencies in a spectrum are on average. "
742 "For a sine wave with a frequency of 377 Hz, the centre of gravity is 377 Hz. You can easily check this "
743 "in Praat by creating such a sine wave (@@Create Sound from formula...@), then converting it to a Spectrum "
744 "(@@Sound: To Spectrum...@), then querying the mean frequency. For a white noise sampled at 22050 Hz, "
745 "the centre of gravity is 5512.5 Hz, i.e. one half of the @@Nyquist frequency@.")
746 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Related measures")
747 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"The centre of gravity is used in the computation of spectral moments:")
748 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: Get central moment...")
749 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: Get standard deviation...")
750 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: Get skewness...")
751 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: Get kurtosis...")
752 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
753
754 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Spectrum: Get kurtosis...", U"ppgb", 20020323)
755 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A command to query the selected @Spectrum object.")
756 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"The (normalized) kurtosis of a spectrum is the fourth central moment of this spectrum, "
757 "divided by the square of the second central moment, minus 3. "
758 "See @@Spectrum: Get central moment...@.")
759 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Setting")
760 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##Power")
761 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the quantity %p in the formula for the centre of gravity and the second and fourth central moment. "
762 "Common values are 2, 1, or 2/3.")
763 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Interpretation")
764 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"The kurtosis is a measure for how much the shape of the spectrum around the "
765 "%%centre of gravity% is different from a Gaussian shape. "
766 "For a white noise, the kurtosis is -6/5.")
767 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Related measures")
768 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: Get centre of gravity...")
769 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: Get central moment...")
770 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: Get standard deviation...")
771 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: Get skewness...")
772 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
773
774 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Spectrum: Get skewness...", U"ppgb", 20020323)
775 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A command to query the selected @Spectrum object.")
776 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"The (normalized) skewness of a spectrum is the third central moment of this spectrum, "
777 "divided by the 1.5 power of the second central moment. "
778 "See @@Spectrum: Get central moment...@.")
779 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Setting")
780 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##Power")
781 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the quantity %p in the formula for the centre of gravity and the second and third central moment. "
782 "Common values are 2, 1, or 2/3.")
783 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Interpretation")
784 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"The skewness is a measure for how much the shape of the spectrum below the "
785 "%%centre of gravity% is different from the shape above the mean frequency. "
786 "For a white noise, the skewness is zero.")
787 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Related measures")
788 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: Get centre of gravity...")
789 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: Get central moment...")
790 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: Get standard deviation...")
791 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: Get kurtosis...")
792 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
793
794 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Spectrum: Get standard deviation...", U"ppgb", 20020323)
795 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A command to query the selected @Spectrum object.")
796 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"The standard deviation of a spectrum is the square root of the second central moment of this spectrum. "
797 "See @@Spectrum: Get central moment...@.")
798 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Setting")
799 TERMcxx . . $ `sys/ManPagesM.h:42:9`! (U"##Power")
800 DEFINITIONcxx . . $ `sys/ManPagesM.h:46:9`! (U"the quantity %p in the formula for the centre of gravity and the second central moment. "
801 "Common values are 2, 1, or 2/3.")
802 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Interpretation")
803 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"The standard deviation is a measure for how much the frequencies in a spectrum can deviate from "
804 "the %%centre of gravity%. "
805 "For a sine wave, the standard deviation is zero. For a white noise, the standard deviation "
806 "is the @@Nyquist frequency@ divided by √12.")
807 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Related measures")
808 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: Get centre of gravity...")
809 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: Get central moment...")
810 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: Get skewness...")
811 LIST_ITEMcxx . . $ `sys/ManPagesM.h:38:9`! (U"• @@Spectrum: Get kurtosis...")
812 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
813
814 MAN_PAGES_BEGINcxx . . $ `sys/ManPagesM.h:27:9`!
815 R"~~~(
816 ################################################################################
817 "Spectrum: Tabulate (verbose)"
818 © Paul Boersma 2023-05-03
819
820 The command ##Tabulate (verbose)# becomes available under Tabulate
821 when you select exactly one @Spectrum object.
822
823 When you choose ##Tabulate (verbose)#, a new @Table (with the same name as the Spectrum)
824 will appear in the list of objects. When you ##View & Edit# this Table,
825 you will see:
826
827 A column called #bin.
828 : This contains the bin number, running from 1 to the number of frequency bins in the Spectrum.
829
830 A column called ##frequency (Hz)#.
831 : This is the frequency that is associated with the bin.
832 In a Spectrum that you created from a @Sound, the frequency that is associated with bin 1
833 is 0 Hz, and the frequency that is associated with the last bin is the @@Nyquist frequency@
834 of that Sound (i.e. half the sampling frequency). The frequency step between consecutive
835 bins is always the same, and we call this step the %%bin step%, abbreviated as %df.
836 Thus, bin 2 is centred at %df, bin 3 at 2%df, bin 4 at 3%df, and so on.
837
838 A column called ##re (Pa/Hz)#.
839 : This is the real part of the complex value of the spectrum in the bin.
840
841 A column called ##im (Pa/Hz)#.
842 : This is the imaginary part of the complex value of the spectrum in the bin.
843
844 A column called ##energy spectral density (Pa^2s/Hz)#.
845 : For most bins this is computed as the square of the real part plus the square of the imaginary part.
846 For bin 1 (where the imaginary part is zero) this is computed as 2 times the square of the real part.
847 If the number of the last bin is odd, the imaginary part will be zero, and the energy spectral density
848 is computed as 2 times the square of the real part. For an explanation of the factor of 2, see below.
849
850 A column called ##startOfBinWithinDomain (Hz)#.
851 : The first bin starts at 0 Hz and ends at 0.5%df, i.e. in the middle of the centres of bin 1 and bin 2.
852 The second bin starts at 0.5%df and ends at 1.5%df, the third starts at 1.5%df and ends at 2.5%df.
853 This column lists the beginnings of the bins. The part “within domain” refers to the fact
854 that all bins represent both positive and negative frequencies,
855 but we count only the frequencies in the domain of the Spectrum,
856 which runs from 0 Hz to the Nyquist frequency.
857
858 A column called ##endOfBinWithinDomain (Hz)#.
859 : This column is explained just above.
860
861 A column called ##binWidthWithinDomain (Hz)#.
862 : Bin 1 runs from 0 Hz to 0.5%df, so it has a width of 0.5%df.
863 Bin 2 runs from 0.5%df to 1.5%df, so it has a width of %df; the same goes for almost all remaining bins.
864 As for the last bin: if there are an odd number %N of bins,
865 then bin %N runs from (%N − 1.5)·%df to (%N − 1.0)·%df (which is the Nyquist frequency),
866 so its width is 0.5%df.
867
868 A column called ##binEnergy (Pa^2s)#.
869 : This is the bin’s energy spectral density times the width of the bin.
870 Thus, you get this mostly from multiplying the energy spectral density column by %df,
871 except for bin 1 and (if %N is odd) bin %N, where the energy spectral density
872 is multiplied by 0.5%df instead. The sum of all the values in this column is the
873 total energy of the signal, i.e. it should be equal to the average of the squares
874 of the samples of an original Sound, times the duration of that Sound.
875
876 A column called ##power spectral density (Pa^2/Hz)#.
877 : This is the @@power spectral density@ in the bin. It is computed as
878 the energy spectral density divided by the duration of the original sound,
879 which is the same as multiplication by %df. This column is almost the same
880 as the bin energy column, except for bin 1 and (if %N is odd) bin %N,
881 where it is twice as large.
882
883 ################################################################################
884 )~~~"
885 MAN_PAGES_ENDcxx . . $ `sys/ManPagesM.h:28:9`!
886
887 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Spectrum: To Ltas (1-to-1)", U"ppgb", 20141001)
888 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A command for converting each selected @Spectrum object into an @Ltas object without loss of frequency resolution.")
889 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Algorithm")
890 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"Each band %b__%i_ in the Ltas is computed from a single frequency sample %s__%i_ in the Spectrum as follows:")
891 EQUATIONcxx . . $ `sys/ManPagesM.h:57:9`! (U"%b__%i_ = 2 ((re (%s__%i_))^2 + (im (%s__%i_))^2) / 4.0·10^^-10^")
892 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"If the original Spectrum is expressible in Pa / Hz (sound pressure in air), the Ltas values "
893 "are in \"dB/Hz\" relative to the auditory threshold at 1000 Hz (2·10^^-5^ Pa).")
894 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
895
896 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Spectrum: To Sound", U"ppgb", 200411123)
897 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A command for creating a @Sound object from every selected @Spectrum object.")
898 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Mathematical procedure")
899 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"The reverse of the Fourier transform described in @@Sound: To Spectrum...@. "
900 "If the Spectrum is expressed in Pa/Hz, the Sound will be in Pascal. "
901 "The frequency integral over the Sound equals the time integral over the Spectrum.")
902 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Behaviour")
903 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"If you perform this command on a Spectrum object that was created earlier with @@Sound: To Spectrum...@, "
904 "the resulting Sound is equal to the Sound that was input to ##Sound: To Spectrum...#.")
905 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
906
907 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"Spectrum: To Spectrogram", U"ppgb", 19961003)
908 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"A command to create a @Spectrogram object from every selected @Spectrum object.")
909 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Purpose")
910 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"Format conversion.")
911 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Behaviour")
912 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"The Spectrogram will have only one frame (time slice).")
913 ENTRYcxx . . $ `sys/ManPagesM.h:36:9`! (U"Algorithm")
914 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"The values are computed as the sum of the squares of the real and imaginary parts of the Spectrum.")
915 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
916
917 MAN_BEGINcxx . . $ `sys/ManPagesM.h:33:9`! (U"SpectrumEditor", U"ppgb", 20030316)
918 INTROcxx . . $ `sys/ManPagesM.h:35:9`! (U"One of the @editors in Praat. It allows you to view, "
919 "zoom, and play a @Spectrum object.")
920 NORMALcxx . . $ `sys/ManPagesM.h:37:9`! (U"Clicking on one of the (maximally) 8 rectangles above or below the drawing area "
921 "lets you play a @Sound that is synthesized from a band-filtered part of the @Spectrum. "
922 "You can also copy the Spectrum, band-filtered with the @@frequency selection@, "
923 "or the Sound synthesized from this Spectrum, to the list of objects.")
924 MAN_ENDcxx . . $ `sys/ManPagesM.h:61:9`!
925
926 }
927
928 /* End of file manual_spectrum.cpp */