Debian Codegraph @

dwtools/Spectrum_and_MultiSampledSpectrogram.cpp

raw symbols SCIP
1 /* Spectrum_and_MultiSampledSpectrogram.cpp
2 *
3 * Copyright (C) 2021-2022 David Weenink
4 *
5 * This code is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or (at
8 * your option) any later version.
9 *
10 * This code is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * 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 "Spectrum_and_AnalyticSound.h"cxx . . $ `<file>/dwtools/Spectrum_and_AnalyticSound.h`/
20 #include "Spectrum_and_MultiSampledSpectrogram.h"cxx . . $ `<file>/dwtools/Spectrum_and_MultiSampledSpectrogram.h`/
21 #include "Sound_and_Spectrum.h"cxx . . $ `<file>/fon/Sound_and_Spectrum.h`/
22 #include "Sound_extensions.h"cxx . . $ `<file>/dwtools/Sound_extensions.h`/
23 #include "Spectrum_extensions.h"cxx . . $ `<file>/dwtools/Spectrum_extensions.h`/
24 #include "NUM2.h"cxx . . $ `<file>/dwsys/NUM2.h`/
25
26 void Spectrum_into_MultiSampledSpectrogramcxx . . $ Spectrum_into_MultiSampledSpectrogram(49c964880100cdf6). (Spectrumcxx . . $ Spectrum# me, MultiSampledSpectrogramcxx . . $ MultiSampledSpectrogram# thee, double approximateTimeOverSampling,
27 kSound_windowShapecxx . . $ kSound_windowShape# filterShape)
28 {
29 try {
30 const integercxx . . $ integer# maximumFilterSize = mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx.;
31 autoVECcxx . . $ autoVEC# window = raw_VECcxx . . $ raw_VEC(e4395f764b859b1e). (maximumFilterSize);
32 thycxx . . $ `melder/melder.h:45:9`! numberOfSpectralValuescxx . . $ structMultiSampledSpectrogram#numberOfSpectralValues. = mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx.;
33 thycxx . . $ `melder/melder.h:45:9`! frequencyAmplificationscxx . . $ structMultiSampledSpectrogram#frequencyAmplifications. =cxx . . $ autovector#`operator=`(f4f0443dbfdd1e40). zero_VECcxx . . $ zero_VEC(e4395f764b859b1e). (thycxx . . $ `melder/melder.h:45:9`! numberOfSpectralValuescxx . . $ structMultiSampledSpectrogram#numberOfSpectralValues.);
34 for (integercxx . . $ integer# ifreq = 1; ifreq <= thycxx . . $ `melder/melder.h:45:9`! nxcxx . . $ structSampled#nx.; ifreq ++) {
35 double spectrum_fmin, spectrum_fmax;
36 MultiSampledSpectrogram_getFrequencyBandcxx . . $ MultiSampledSpectrogram_getFrequencyBand(334fcc698c6bfe6c). (thee, ifreq, & spectrum_fmin, & spectrum_fmax);
37 integercxx . . $ integer# spectrum_imin, spectrum_imax;
38 const integercxx . . $ integer# numberOfSpectralValues = Sampled_getWindowSamplescxx . . $ Sampled_getWindowSamples(fe99094ed5bb3f6a). (me, spectrum_fmin, spectrum_fmax, & spectrum_imin, & spectrum_imax);
39 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (numberOfSpectralValues > 0,
40 U"The number of spectral values for bin number ", ifreq, U" should be larger than zero.");
41 window.resizecxx . . $ autovector#resize(d91e89fbd57cd1). (numberOfSpectralValues);
42 windowShape_into_VECcxx . . $ windowShape_into_VEC(1bbc8fdbd7847e3). (filterShape, window.getcxx . . $ autovector#get(e8d1da7fe68a6585).());
43 autoAnalyticSoundcxx . . $ autoAnalyticSound# him = Spectrum_to_AnalyticSound_demodulateBandcxx . . $ Spectrum_to_AnalyticSound_demodulateBand(6317b4211f4fdb47). (me, spectrum_imin, spectrum_imax, approximateTimeOverSampling, window.getcxx . . $ autovector#get(e8d1da7fe68a6585).());
44 thycxx . . $ `melder/melder.h:45:9`! frequencyAmplificationscxx . . $ structMultiSampledSpectrogram#frequencyAmplifications..partcxx . . $ autovector#part(2d8d48654ca64e70). (spectrum_imin, spectrum_imax) +=cxx . . $ `operator+=`(adea042513329390). windowcxx . . $ constvectorview#constvectorview(eac9d6ec4c4bfecd)..getcxx . . $ autovector#get(e8d1da7fe68a6585).();
45 autoFrequencyBincxx . . $ autoFrequencyBin# bin = FrequencyBin_createcxx . . $ FrequencyBin_create(292198bd5fbe916d). (thycxx . . $ `melder/melder.h:45:9`! tmincxx . . $ structMultiSampledSpectrogram#tmin., thycxx . . $ `melder/melder.h:45:9`! tmaxcxx . . $ structMultiSampledSpectrogram#tmax., hiscxx . . $ `melder/melder.h:47:9`! nxcxx . . $ structSampled#nx., hiscxx . . $ `melder/melder.h:47:9`! dxcxx . . $ structSampled#dx., hiscxx . . $ `melder/melder.h:47:9`! x1cxx . . $ structSampled#x1.);
46 bin ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). zcxx . . $ structMatrix#z. =cxx . . $ automatrix#`operator=`(a0f46581f260c488). hiscxx . . $ `melder/melder.h:47:9`! zcxx . . $ structMatrix#z..movecxx . . $ automatrix#move(8771494f681de611).();
47 thycxx . . $ `melder/melder.h:45:9`! frequencyBinscxx . . $ structMultiSampledSpectrogram#frequencyBins.. addItem_movecxx . . $ CollectionOf#addItem_move(bcc0cff787be24fe). (bincxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f)..movecxx . . $ autoSomeThing#move(25acc3554b7d1642).());
48 if (ifreq == 1) {
49 /*
50 DC_BIN:
51 Fill with values from 0 Hz to the mid of the first window.
52 Multiply with a window only the part that overlaps with the first half of the first window.
53 */
54 const integercxx . . $ integer# numberOfRestSamples = Sampled_getWindowSamplescxx . . $ Sampled_getWindowSamples(fe99094ed5bb3f6a). (me, mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin., 0.5 * (spectrum_fmin + spectrum_fmax), & spectrum_imin, & spectrum_imax);
55 const integercxx . . $ integer# newWindowSize = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a). (numberOfRestSamples, window.sizecxx . . $ autovector#size. / 2);
56 VECcxx . . $ VEC# partialWindow = window.partcxx . . $ autovector#part(2d8d48654ca64e70). (window.sizecxx . . $ autovector#size. - newWindowSize + 1, window.sizecxx . . $ autovector#size.);
57 him =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Spectrum_to_AnalyticSound_demodulateBandcxx . . $ Spectrum_to_AnalyticSound_demodulateBand(6317b4211f4fdb47). (me, spectrum_imin, spectrum_imax, approximateTimeOverSampling, partialWindow);
58 thycxx . . $ `melder/melder.h:45:9`! frequencyAmplificationscxx . . $ structMultiSampledSpectrogram#frequencyAmplifications..partcxx . . $ autovector#part(2d8d48654ca64e70). (spectrum_imax - newWindowSize + 1, spectrum_imax) +=cxx . . $ `operator+=`(adea042513329390). partialWindowcxx . . $ constvectorview#constvectorview(eac9d6ec4c4bfecd).;
59 if (numberOfRestSamples > newWindowSize)
60 thycxx . . $ `melder/melder.h:45:9`! frequencyAmplificationscxx . . $ structMultiSampledSpectrogram#frequencyAmplifications..partcxx . . $ autovector#part(2d8d48654ca64e70). (1, spectrum_imax - newWindowSize ) +=cxx . . $ `operator+=`(c555d170d72ff256). 1.0;
61 thycxx . . $ `melder/melder.h:45:9`! zeroBincxx . . $ structMultiSampledSpectrogram#zeroBin. =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). FrequencyBin_createcxx . . $ FrequencyBin_create(292198bd5fbe916d). (thycxx . . $ `melder/melder.h:45:9`! tmincxx . . $ structMultiSampledSpectrogram#tmin., thycxx . . $ `melder/melder.h:45:9`! tmaxcxx . . $ structMultiSampledSpectrogram#tmax., hiscxx . . $ `melder/melder.h:47:9`! nxcxx . . $ structSampled#nx., hiscxx . . $ `melder/melder.h:47:9`! dxcxx . . $ structSampled#dx., hiscxx . . $ `melder/melder.h:47:9`! x1cxx . . $ structSampled#x1.);
62 thycxx . . $ `melder/melder.h:45:9`! zeroBincxx . . $ structMultiSampledSpectrogram#zeroBin. ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). zcxx . . $ structMatrix#z. =cxx . . $ automatrix#`operator=`(a0f46581f260c488). hiscxx . . $ `melder/melder.h:47:9`! zcxx . . $ structMatrix#z..movecxx . . $ automatrix#move(8771494f681de611).();
63 }
64 if (ifreq == thycxx . . $ `melder/melder.h:45:9`! nxcxx . . $ structSampled#nx.) {
65 /*
66 NYQUIST_BIN:
67 Fill with the part from the mid of the last window to the end.
68 Multiply with a window only the part that overlaps with the last half of the last window.
69 */
70 const integercxx . . $ integer# numberOfRestSamples = Sampled_getWindowSamplescxx . . $ Sampled_getWindowSamples(fe99094ed5bb3f6a). (me, 0.5 * (spectrum_fmin + spectrum_fmax), mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax., & spectrum_imin, & spectrum_imax);
71 const integercxx . . $ integer# newWindowSize = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a). (numberOfRestSamples, window.sizecxx . . $ autovector#size. / 2);
72 VECcxx . . $ VEC# partialWindow = window.partcxx . . $ autovector#part(2d8d48654ca64e70). (1, newWindowSize);
73 him =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Spectrum_to_AnalyticSound_demodulateBandcxx . . $ Spectrum_to_AnalyticSound_demodulateBand(6317b4211f4fdb47). (me, spectrum_imin, spectrum_imax, approximateTimeOverSampling, partialWindow);
74 thycxx . . $ `melder/melder.h:45:9`! frequencyAmplificationscxx . . $ structMultiSampledSpectrogram#frequencyAmplifications..partcxx . . $ autovector#part(2d8d48654ca64e70). (spectrum_imin, spectrum_imin + newWindowSize - 1) +=cxx . . $ `operator+=`(adea042513329390). partialWindowcxx . . $ constvectorview#constvectorview(eac9d6ec4c4bfecd).;
75 if (numberOfRestSamples > newWindowSize)
76 thycxx . . $ `melder/melder.h:45:9`! frequencyAmplificationscxx . . $ structMultiSampledSpectrogram#frequencyAmplifications..partcxx . . $ autovector#part(2d8d48654ca64e70). (spectrum_imin + newWindowSize, spectrum_imax) +=cxx . . $ `operator+=`(c555d170d72ff256). 1.0;
77 thycxx . . $ `melder/melder.h:45:9`! nyquistBincxx . . $ structMultiSampledSpectrogram#nyquistBin. =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). FrequencyBin_createcxx . . $ FrequencyBin_create(292198bd5fbe916d). (thycxx . . $ `melder/melder.h:45:9`! tmincxx . . $ structMultiSampledSpectrogram#tmin., thycxx . . $ `melder/melder.h:45:9`! tmaxcxx . . $ structMultiSampledSpectrogram#tmax., hiscxx . . $ `melder/melder.h:47:9`! nxcxx . . $ structSampled#nx., hiscxx . . $ `melder/melder.h:47:9`! dxcxx . . $ structSampled#dx., hiscxx . . $ `melder/melder.h:47:9`! x1cxx . . $ structSampled#x1.);
78 thycxx . . $ `melder/melder.h:45:9`! nyquistBincxx . . $ structMultiSampledSpectrogram#nyquistBin. ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). zcxx . . $ structMatrix#z. =cxx . . $ automatrix#`operator=`(a0f46581f260c488). hiscxx . . $ `melder/melder.h:47:9`! zcxx . . $ structMatrix#z..movecxx . . $ automatrix#move(8771494f681de611).();
79 }
80 }
81 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (thycxx . . $ `melder/melder.h:45:9`! frequencyBins.size == thycxx . . $ `melder/melder.h:45:9`! nx); // check invariant
82 } catch (MelderErrorcxx . . $ MelderError#) {
83 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": cannot calculate MultiSampledSpectrogram.");
84 }
85 }
86
87
88 autoSpectrumcxx . . $ autoSpectrum# MultiSampledSpectrogram_to_Spectrumcxx . . $ MultiSampledSpectrogram_to_Spectrum(f80e55b4ddb107af). (MultiSampledSpectrogramcxx . . $ MultiSampledSpectrogram# me) {
89 try {
90 const double duration = mycxx . . $ `melder/melder.h:44:9`! tmaxcxx . . $ structMultiSampledSpectrogram#tmax. - mycxx . . $ `melder/melder.h:44:9`! tmincxx . . $ structMultiSampledSpectrogram#tmin.;
91 const double nyquistFrequency = mycxx . . $ `melder/melder.h:44:9`! v_myFrequencyUnitToHertzcxx . . $ structMultiSampledSpectrogram#v_myFrequencyUnitToHertz(7e3a3c6b59947c6d). (mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax.);
92 const double samplingFrequency = 2.0 * nyquistFrequency;
93 const integercxx . . $ integer# numberOfSamples = Melder_iroundcxx . . $ `melder/melder_ftoi.h:78:9`! (duration * samplingFrequency);
94 const integercxx . . $ integer# numberOfFFTSamples = Melder_clippedLeftcxx . . $ Melder_clippedLeft(f80f7d6260b3ee3a). (2_integercxx . . $ `operator""_integer`(85240eb457c3721a)., Melder_iroundUpToPowerOfTwocxx . . $ Melder_iroundUpToPowerOfTwo(8ce0d1b217db7fd1). (numberOfSamples));
95 const integercxx . . $ integer# numberOfSpectralValues = numberOfFFTSamples / 2 + 1;
96 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (numberOfSpectralValues == mycxx . . $ `melder/melder.h:44:9`! numberOfSpectralValues);
97 autoSpectrumcxx . . $ autoSpectrum# thee = Spectrum_createcxx . . $ Spectrum_create(a338b9c326abb5ed). (nyquistFrequency, numberOfSpectralValues);
98 for (integercxx . . $ integer# ifreq = 1; ifreq <= mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx.; ifreq ++) {
99 integercxx . . $ integer# iflow, ifhigh;
100 const FrequencyBincxx . . $ FrequencyBin# frequencyBin = mycxx . . $ `melder/melder.h:44:9`! frequencyBinscxx . . $ structMultiSampledSpectrogram#frequencyBins..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).ifreq];
101 double flow, fhigh;
102 MultiSampledSpectrogram_getFrequencyBandcxx . . $ MultiSampledSpectrogram_getFrequencyBand(334fcc698c6bfe6c). (me, ifreq, & flow, & fhigh);
103 auto fillSpectrumPart = [&] (FrequencyBincxx . . $ FrequencyBin# fbin) {
104 autoSoundcxx . . $ autoSound# sound = FrequencyBin_to_Soundcxx . . $ FrequencyBin_to_Sound(88f382112297eb18). (fbin);
105 autoSpectrumcxx . . $ autoSpectrum# filter = Sound_to_Spectrumcxx . . $ Sound_to_Spectrum(e96f4d575d8eeb8c). (sound.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), false);
106 (void) Sampled_getWindowSamplescxx . . $ Sampled_getWindowSamples(fe99094ed5bb3f6a). (thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), flow, fhigh, & iflow, & ifhigh);
107 const integercxx . . $ integer# extraSample = ( iflow > 1 ? 1 : 0 );
108 thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z..partcxx . . $ automatrix#part(5c23e73480cfacfb). (1, 2, iflow, ifhigh) +=cxx . . $ `operator+=`(a7d93ba40fe22fe0). filtercxx . . $ constmatrixview#constmatrixview(c98a2930b9469e58). ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). zcxx . . $ structMatrix#z..partcxx . . $ automatrix#part(5c23e73480cfacfb). (1, 2, 1 + extraSample, ifhigh - iflow + 1 + extraSample);
109 };
110 fillSpectrumPart (cxx . . $ MultiSampledSpectrogram_to_Spectrum(f80e55b4ddb107af).$anonymous_type_0#`operator()`(4783e81d0acebf85).frequencyBin);
111 if (ifreq == 1) {
112 fhigh = 0.5 * (flow + fhigh);
113 flow = 0.0;
114 fillSpectrumPart (cxx . . $ MultiSampledSpectrogram_to_Spectrum(f80e55b4ddb107af).$anonymous_type_0#`operator()`(4783e81d0acebf85).mycxx . . $ `melder/melder.h:44:9`! zeroBincxx . . $ structMultiSampledSpectrogram#zeroBin..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
115 }
116 if (ifreq == mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx.) {
117 flow = 0.5 * (flow + fhigh);
118 fhigh = mycxx . . $ `melder/melder.h:44:9`! v_myFrequencyUnitToHertzcxx . . $ structMultiSampledSpectrogram#v_myFrequencyUnitToHertz(7e3a3c6b59947c6d). (mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax.);
119 fillSpectrumPart (cxx . . $ MultiSampledSpectrogram_to_Spectrum(f80e55b4ddb107af).$anonymous_type_0#`operator()`(4783e81d0acebf85).mycxx . . $ `melder/melder.h:44:9`! nyquistBincxx . . $ structMultiSampledSpectrogram#nyquistBin..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
120 }
121 }
122 /*
123 Make sure the imaginary part of the last spectral value is zero.
124 */
125 thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).2] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).numberOfSpectralValues] = 0.0;
126 /*
127 Correct for windowing effects
128 */
129 for (integercxx . . $ integer# ifreq = 1; ifreq <= mycxx . . $ `melder/melder.h:44:9`! frequencyAmplificationscxx . . $ structMultiSampledSpectrogram#frequencyAmplifications..sizecxx . . $ autovector#size.; ifreq ++)
130 if (mycxx . . $ `melder/melder.h:44:9`! frequencyAmplificationscxx . . $ structMultiSampledSpectrogram#frequencyAmplifications. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).ifreq] > 0.0) {
131 thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).ifreq] /= mycxx . . $ `melder/melder.h:44:9`! frequencyAmplificationscxx . . $ structMultiSampledSpectrogram#frequencyAmplifications. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).ifreq];
132 thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).2] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).ifreq] /= mycxx . . $ `melder/melder.h:44:9`! frequencyAmplificationscxx . . $ structMultiSampledSpectrogram#frequencyAmplifications. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).ifreq];
133 }
134
135 return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
136 } catch (MelderErrorcxx . . $ MelderError#) {
137 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": cannot convert to Spectrum.");
138 }
139 }
140
141 autoSpectrumcxx . . $ autoSpectrum# Sound_and_MultiSampledSpectrogram_to_Spectrumcxx . . $ Sound_and_MultiSampledSpectrogram_to_Spectrum(c1a18e113ea441a6). (Soundcxx . . $ Sound# me, MultiSampledSpectrogramcxx . . $ MultiSampledSpectrogram# thee) {
142 try {
143 autoSpectrumcxx . . $ autoSpectrum# himcxx . . $ autoSomeThing#autoSomeThing(49f6e7a06ebc5aa8).;
144 const double nyquistFrequency = 0.5 / mycxx . . $ `melder/melder.h:44:9`! dxcxx . . $ structSampled#dx.;
145 const double maximumFrequency = thycxx . . $ `melder/melder.h:45:9`! v_myFrequencyUnitToHertzcxx . . $ structMultiSampledSpectrogram#v_myFrequencyUnitToHertz(7e3a3c6b59947c6d). (thycxx . . $ `melder/melder.h:45:9`! xmaxcxx . . $ structFunction#xmax.);
146 if (maximumFrequency < nyquistFrequency) {
147 autoSoundcxx . . $ autoSound# resampled = Sound_resamplecxx . . $ Sound_resample(872961da5f5e69e5). (me, 2.0 * maximumFrequency, 50);
148 him =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Sound_to_Spectrumcxx . . $ Sound_to_Spectrum(e96f4d575d8eeb8c). (resampled.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), true);
149 } else {
150 him =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Sound_to_Spectrumcxx . . $ Sound_to_Spectrum(e96f4d575d8eeb8c). (me, true);
151 }
152 return himcxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
153 } catch (MelderErrorcxx . . $ MelderError#) {
154 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U" and", thee, U" cannot create a Spectrum.");
155 }
156 }
157
158 autoSoundcxx . . $ autoSound# MultiSampledSpectrogram_to_Sound_frequencyBincxx . . $ MultiSampledSpectrogram_to_Sound_frequencyBin(2b2008b6861fa653). (MultiSampledSpectrogramcxx . . $ MultiSampledSpectrogram# me, integercxx . . $ integer# frequencyBinNumber) {
159 try {
160 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (frequencyBinNumber > 0 && frequencyBinNumber <= mycxx . . $ `melder/melder.h:44:9`! nx,
161 U"The frequency bin number should be in the interval from 1 to ", mycxx . . $ `melder/melder.h:44:9`! nx, U".");
162 FrequencyBincxx . . $ FrequencyBin# frequencyBin = mycxx . . $ `melder/melder.h:44:9`! frequencyBinscxx . . $ structMultiSampledSpectrogram#frequencyBins..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).frequencyBinNumber];
163 return FrequencyBin_to_Soundcxx . . $ FrequencyBin_to_Sound(88f382112297eb18). (frequencyBin);
164 } catch (MelderErrorcxx . . $ MelderError#) {
165 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": could not create Sound from frequency bin ", frequencyBinNumber, U".");
166 }
167 }
168
169
170 autoAnalyticSoundcxx . . $ autoAnalyticSound# MultiSampledSpectrogram_to_AnalyticSound_frequencyBincxx . . $ MultiSampledSpectrogram_to_AnalyticSound_frequencyBin(ce28b1080d3e89c8). (MultiSampledSpectrogramcxx . . $ MultiSampledSpectrogram# me, integercxx . . $ integer# frequencyBinNumber) {
171 try {
172 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (frequencyBinNumber > 0 && frequencyBinNumber <= mycxx . . $ `melder/melder.h:44:9`! nx,
173 U"The frequency bin number should be in the interval from 1 to ", mycxx . . $ `melder/melder.h:44:9`! nx, U".");
174 FrequencyBincxx . . $ FrequencyBin# frequencyBin = mycxx . . $ `melder/melder.h:44:9`! frequencyBinscxx . . $ structMultiSampledSpectrogram#frequencyBins..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).frequencyBinNumber];
175 return FrequencyBin_to_AnalyticSoundcxx . . $ FrequencyBin_to_AnalyticSound(df39bac52a860c55). (frequencyBin);
176 } catch (MelderErrorcxx . . $ MelderError#) {
177 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": could not create Sound from frequency bin ", frequencyBinNumber, U".");
178 }
179 }
180
181 /* End of file Spectrum_and_MultiSampledSpectrogram.cpp */