| 1 | /* Sound_and_Spectrum.cpp |
| 2 | * |
| 3 | * Copyright (C) 1992-2005,2011,2012,2015-2021,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 2 of the License, or (at |
| 8 | * your option) any later version. |
| 9 | * |
| 10 | * This code is distributed in the hope that it will be useful, but |
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 13 | * See the GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | #include "Sound_and_Spectrum.h"cxx . . $ `<file>/fon/Sound_and_Spectrum.h`/ |
| 20 | #include "NUM2.h"cxx . . $ `<file>/dwsys/NUM2.h`/ |
| 21 | |
| 22 | autoSpectrumcxx . . $ autoSpectrum# Sound_to_Spectrumcxx . . $ Sound_to_Spectrum(e96f4d575d8eeb8c). (Soundcxx . . $ Sound# me, bool fast) { |
| 23 | try { |
| 24 | const integercxx . . $ integer# numberOfFourierSamples = ( fast ? Melder_iroundUpToPowerOfTwocxx . . $ Melder_iroundUpToPowerOfTwo(8ce0d1b217db7fd1). (mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx.) : mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx. ); |
| 25 | const integercxx . . $ integer# numberOfChannels = mycxx . . $ `melder/melder.h:44:9`! nycxx . . $ structSampledXY#ny.; |
| 26 | const integercxx . . $ integer# numberOfFrequencies = numberOfFourierSamples / 2 + 1; // 4 samples -> cos0 cos1 sin1 cos2; 5 samples -> cos0 cos1 sin1 cos2 sin2 |
| 27 | |
| 28 | autoVECcxx . . $ autoVEC# data = raw_VECcxx . . $ raw_VEC(e4395f764b859b1e). (numberOfFourierSamples); // raw, so make sure to fill each sample |
| 29 | columnMeans_VEC_outcxx . . $ columnMeans_VEC_out(4ac231a09fafb822). (datacxx . . $ vectorview#vectorview(eac9d6ec4c4bfecd)..partcxx . . $ autovector#part(2d8d48654ca64e70). (1, mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx.), mycxx . . $ `melder/melder.h:44:9`! zcxx . . $ structMatrix#z..allcxx . . $ automatrix#all(2114117ba8ed4224).()); |
| 30 | datacxx . . $ vectorview#vectorview(eac9d6ec4c4bfecd)..partcxx . . $ autovector#part(2d8d48654ca64e70). (mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx. + 1, numberOfFourierSamples) <<=cxx . . $ `operator<<=`(c555d170d72ff256). 0.0; |
| 31 | |
| 32 | autoNUMFourierTablecxx . . $ autoNUMFourierTable# fourierTable = NUMFourierTable_createcxx . . $ NUMFourierTable_create(10012c71e147318e). (numberOfFourierSamples); |
| 33 | NUMfft_forwardcxx . . $ NUMfft_forward(aea41fd94d07eee). (fourierTable.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), data.getcxx . . $ autovector#get(e8d1da7fe68a6585).()); |
| 34 | |
| 35 | autoSpectrumcxx . . $ autoSpectrum# thee = Spectrum_createcxx . . $ Spectrum_create(a338b9c326abb5ed). (0.5 / mycxx . . $ `melder/melder.h:44:9`! dxcxx . . $ structSampled#dx., numberOfFrequencies); |
| 36 | thycxx . . $ `melder/melder.h:45:9`! dxcxx . . $ structSampled#dx. = 1.0 / (mycxx . . $ `melder/melder.h:44:9`! dxcxx . . $ structSampled#dx. * numberOfFourierSamples); // override, just in case numberOfFourierSamples is odd |
| 37 | const VECcxx . . $ VEC# re = thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z..rowcxx . . $ automatrix#row(2d545b3cb3f8e666). (1); |
| 38 | const VECcxx . . $ VEC# im = thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z..rowcxx . . $ automatrix#row(2d545b3cb3f8e666). (2); |
| 39 | const double scaling = mycxx . . $ `melder/melder.h:44:9`! dxcxx . . $ structSampled#dx.; |
| 40 | re [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).1] = data [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1] * scaling; |
| 41 | im [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).1] = 0.0; |
| 42 | for (integercxx . . $ integer# i = 2; i < numberOfFrequencies; i ++) { |
| 43 | re [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i] = data [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i + i - 2] * scaling; // data [2], data [4], ... |
| 44 | im [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i] = data [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i + i - 1] * scaling; // data [3], data [5], ... |
| 45 | } |
| 46 | if ((numberOfFourierSamples & 1) != 0) { |
| 47 | if (numberOfFourierSamples > 1) { |
| 48 | re [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).numberOfFrequencies] = data [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).numberOfFourierSamples - 1] * scaling; |
| 49 | im [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).numberOfFrequencies] = data [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).numberOfFourierSamples] * scaling; |
| 50 | } |
| 51 | } else { |
| 52 | re [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).numberOfFrequencies] = data [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).numberOfFourierSamples] * scaling; |
| 53 | im [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).numberOfFrequencies] = 0.0; |
| 54 | } |
| 55 | return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 56 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 57 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not converted to Spectrum."); |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | autoSoundcxx . . $ autoSound# Spectrum_to_Soundcxx . . $ Spectrum_to_Sound(b9577246d0f6b8d7). (Spectrumcxx . . $ Spectrum# me) { |
| 62 | try { |
| 63 | const constVECcxx . . $ constVEC# re = mycxx . . $ `melder/melder.h:44:9`! zcxx . . $ structMatrix#z..rowcxx . . $ automatrix#row(2d545b3cb3f8e666). (1), im = mycxx . . $ `melder/melder.h:44:9`! zcxx . . $ structMatrix#z..rowcxx . . $ automatrix#row(2d545b3cb3f8e666). (2); |
| 64 | const double lastFrequency = mycxx . . $ `melder/melder.h:44:9`! x1cxx . . $ structSampled#x1. + (mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx. - 1) * mycxx . . $ `melder/melder.h:44:9`! dxcxx . . $ structSampled#dx.; |
| 65 | const bool originalNumberOfSamplesProbablyOdd = ( im [cxx . . $ constvector#`operator[]`(e616e229aa94bfcf).mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx.] != 0.0 || mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax. - lastFrequency > 0.25 * mycxx . . $ `melder/melder.h:44:9`! dxcxx . . $ structSampled#dx. ); |
| 66 | if (mycxx . . $ `melder/melder.h:44:9`! x1cxx . . $ structSampled#x1. != 0.0) |
| 67 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"A Fourier-transformable Spectrum must have a first frequency of 0 Hz, not ", mycxx . . $ `melder/melder.h:44:9`! x1, U" Hz."); |
| 68 | const integercxx . . $ integer# numberOfSamples = 2 * mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx. - ( originalNumberOfSamplesProbablyOdd ? 1 : 2 ); |
| 69 | autoSoundcxx . . $ autoSound# thee = Sound_createSimplecxx . . $ Sound_createSimple(fcb03a673f737ce). (1, 1.0 / mycxx . . $ `melder/melder.h:44:9`! dxcxx . . $ structSampled#dx., numberOfSamples * mycxx . . $ `melder/melder.h:44:9`! dxcxx . . $ structSampled#dx.); |
| 70 | const VECcxx . . $ VEC# amp = thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z..rowcxx . . $ automatrix#row(2d545b3cb3f8e666). (1); |
| 71 | const double scaling = mycxx . . $ `melder/melder.h:44:9`! dxcxx . . $ structSampled#dx.; |
| 72 | amp [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).1] = re [cxx . . $ constvector#`operator[]`(e616e229aa94bfcf).1] * scaling; |
| 73 | for (integercxx . . $ integer# i = 2; i < mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx.; i ++) { |
| 74 | amp [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i + i - 1] = re [cxx . . $ constvector#`operator[]`(e616e229aa94bfcf).i] * scaling; |
| 75 | amp [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i + i] = im [cxx . . $ constvector#`operator[]`(e616e229aa94bfcf).i] * scaling; |
| 76 | } |
| 77 | if (originalNumberOfSamplesProbablyOdd) { |
| 78 | amp [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).numberOfSamples] = re [cxx . . $ constvector#`operator[]`(e616e229aa94bfcf).mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx.] * scaling; |
| 79 | if (numberOfSamples > 1) |
| 80 | amp [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).2] = im [cxx . . $ constvector#`operator[]`(e616e229aa94bfcf).mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx.] * scaling; |
| 81 | } else { |
| 82 | amp [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).2] = re [cxx . . $ constvector#`operator[]`(e616e229aa94bfcf).mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx.] * scaling; |
| 83 | } |
| 84 | NUMrealftcxx . . $ NUMrealft(6864105cb93afedb). (amp, -1); |
| 85 | return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 86 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 87 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not converted to Sound."); |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | autoSpectrumcxx . . $ autoSpectrum# Spectrum_lpcSmoothingcxx . . $ Spectrum_lpcSmoothing(aa2e9b7f93a5d964). (Spectrumcxx . . $ Spectrum# me, int numberOfPeaks, double preemphasisFrequency) { |
| 92 | try { |
| 93 | const integercxx . . $ integer# numberOfCoefficients = 2 * numberOfPeaks; |
| 94 | |
| 95 | autoSoundcxx . . $ autoSound# sound = Spectrum_to_Soundcxx . . $ Spectrum_to_Sound(b9577246d0f6b8d7). (me); |
| 96 | VECpreemphasize_f_inplacecxx . . $ VECpreemphasize_f_inplace(963991e5268b1933). (soundcxx . . $ vectorview#vectorview(eac9d6ec4c4bfecd). ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). zcxx . . $ structMatrix#z..rowcxx . . $ automatrix#row(2d545b3cb3f8e666). (1), sound ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). dxcxx . . $ structSampled#dx., preemphasisFrequency); |
| 97 | autoVECcxx . . $ autoVEC# a = raw_VECcxx . . $ raw_VEC(e4395f764b859b1e). (numberOfCoefficients); |
| 98 | const double gain = VECburgcxx . . $ VECburg(5935962a19f9e6ab). (a.getcxx . . $ autovector#get(e8d1da7fe68a6585).(), soundcxx . . $ constvector#constvector(eac9d6ec4c4bfecd). ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). zcxx . . $ structMatrix#z..rowcxx . . $ automatrix#row(2d545b3cb3f8e666). (1)); |
| 99 | for (integercxx . . $ integer# i = 1; i <= numberOfCoefficients; i ++) |
| 100 | a [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i] = - a [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i]; |
| 101 | autoSpectrumcxx . . $ autoSpectrum# thee = Data_copycxx . . $ Data_copy(97a542a26794c80e). (me); |
| 102 | |
| 103 | const integercxx . . $ integer# nfft = 2 * (thycxx . . $ `melder/melder.h:45:9`! nxcxx . . $ structSampled#nx. - 1); |
| 104 | const integercxx . . $ integer# ndata = Melder_clippedRightcxx . . $ Melder_clippedRight(f80f7d6260b3ee3a). (numberOfCoefficients, nfft - 1); |
| 105 | const double scale = 10.0 * (gain > 0.0 ? sqrtcxx . . $ sqrt(fee4f1d22bc8e617). (gain) : 1.0) / numberOfCoefficients; |
| 106 | autoVECcxx . . $ autoVEC# data = zero_VECcxx . . $ zero_VEC(e4395f764b859b1e). (nfft); |
| 107 | data [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1] = 1.0; |
| 108 | for (integercxx . . $ integer# i = 1; i <= ndata; i ++) |
| 109 | data [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i + 1] = a [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i]; |
| 110 | NUMrealftcxx . . $ NUMrealft(6864105cb93afedb). (data.getcxx . . $ autovector#get(e8d1da7fe68a6585).(), 1); |
| 111 | const VECcxx . . $ VEC# re = thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z..rowcxx . . $ automatrix#row(2d545b3cb3f8e666). (1); |
| 112 | const VECcxx . . $ VEC# im = thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z..rowcxx . . $ automatrix#row(2d545b3cb3f8e666). (2); |
| 113 | re [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).1] = scale / data [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1]; |
| 114 | im [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).1] = 0.0; |
| 115 | const integercxx . . $ integer# halfnfft = nfft / 2; |
| 116 | for (integercxx . . $ integer# i = 2; i <= halfnfft; i ++) { |
| 117 | const double realPart = data [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i + i - 1], imaginaryPart = data [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i + i]; |
| 118 | re [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i] = scale / hypotcxx . . $ hypot(b71928d39fde4295). (realPart, imaginaryPart) / (1.0 + thycxx . . $ `melder/melder.h:45:9`! dxcxx . . $ structSampled#dx. * (i - 1) / preemphasisFrequency); |
| 119 | im [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i] = 0.0; |
| 120 | } |
| 121 | re [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).halfnfft + 1] = scale / data [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).2] / (1.0 + thycxx . . $ `melder/melder.h:45:9`! dxcxx . . $ structSampled#dx. * halfnfft / preemphasisFrequency); |
| 122 | im [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).halfnfft + 1] = 0.0; |
| 123 | return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 124 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 125 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not smoothed."); |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | autoSoundcxx . . $ autoSound# Sound_filter_formulacxx . . $ Sound_filter_formula(b2c64c2972f611b). (Soundcxx . . $ Sound# me, conststring32cxx . . $ conststring32# formula, Interpretercxx . . $ Interpreter# interpreter) { |
| 130 | try { |
| 131 | autoSoundcxx . . $ autoSound# thee = Data_copycxx . . $ Data_copy(97a542a26794c80e). (me); |
| 132 | if (mycxx . . $ `melder/melder.h:44:9`! nycxx . . $ structSampledXY#ny. == 1) { |
| 133 | autoSpectrumcxx . . $ autoSpectrum# spec = Sound_to_Spectrumcxx . . $ Sound_to_Spectrum(e96f4d575d8eeb8c). (me, true); |
| 134 | Matrix_formulacxx . . $ Matrix_formula(3b405620ba9cc26e). (spec.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), formula, interpreter, nullptr); |
| 135 | autoSoundcxx . . $ autoSound# him = Spectrum_to_Soundcxx . . $ Spectrum_to_Sound(b9577246d0f6b8d7). (spec.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 136 | thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z..rowcxx . . $ automatrix#row(2d545b3cb3f8e666). (1) <<=cxx . . $ `operator<<=`(adea042513329390). hiscxx . . $ `melder/melder.h:47:9`! zcxx . . $ structMatrix#z..rowcxx . . $ automatrix#row(2d545b3cb3f8e666). (1).partcxx . . $ vector#part(ae267db9e2c04be7). (1, thycxx . . $ `melder/melder.h:45:9`! nxcxx . . $ structSampled#nx.); |
| 137 | } else { |
| 138 | for (integercxx . . $ integer# ichan = 1; ichan <= mycxx . . $ `melder/melder.h:44:9`! nycxx . . $ structSampledXY#ny.; ichan ++) { |
| 139 | autoSoundcxx . . $ autoSound# channel = Sound_extractChannelcxx . . $ Sound_extractChannel(fdb1ba3dfee1bd33). (me, ichan); |
| 140 | autoSpectrumcxx . . $ autoSpectrum# spec = Sound_to_Spectrumcxx . . $ Sound_to_Spectrum(e96f4d575d8eeb8c). (channel.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), true); |
| 141 | Matrix_formulacxx . . $ Matrix_formula(3b405620ba9cc26e). (spec.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), formula, interpreter, nullptr); |
| 142 | autoSoundcxx . . $ autoSound# him = Spectrum_to_Soundcxx . . $ Spectrum_to_Sound(b9577246d0f6b8d7). (spec.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 143 | thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z..rowcxx . . $ automatrix#row(2d545b3cb3f8e666). (ichan) <<=cxx . . $ `operator<<=`(adea042513329390). hiscxx . . $ `melder/melder.h:47:9`! zcxx . . $ structMatrix#z..rowcxx . . $ automatrix#row(2d545b3cb3f8e666). (1).partcxx . . $ vector#part(ae267db9e2c04be7). (1, thycxx . . $ `melder/melder.h:45:9`! nxcxx . . $ structSampled#nx.); |
| 144 | } |
| 145 | } |
| 146 | return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 147 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 148 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not filtered (with formula)."); |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | autoSoundcxx . . $ autoSound# Sound_filter_passHannBandcxx . . $ Sound_filter_passHannBand(14181e1c5f839e03). (Soundcxx . . $ Sound# me, double fmin, double fmax, double smooth) { |
| 153 | try { |
| 154 | autoSoundcxx . . $ autoSound# thee = Data_copycxx . . $ Data_copy(97a542a26794c80e). (me); |
| 155 | if (mycxx . . $ `melder/melder.h:44:9`! nycxx . . $ structSampledXY#ny. == 1) { |
| 156 | autoSpectrumcxx . . $ autoSpectrum# spec = Sound_to_Spectrumcxx . . $ Sound_to_Spectrum(e96f4d575d8eeb8c). (me, true); |
| 157 | Spectrum_passHannBandcxx . . $ Spectrum_passHannBand(4e1fbc861a283982). (spec.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), fmin, fmax, smooth); |
| 158 | autoSoundcxx . . $ autoSound# him = Spectrum_to_Soundcxx . . $ Spectrum_to_Sound(b9577246d0f6b8d7). (spec.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 159 | thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z..rowcxx . . $ automatrix#row(2d545b3cb3f8e666). (1) <<=cxx . . $ `operator<<=`(adea042513329390). hiscxx . . $ `melder/melder.h:47:9`! zcxx . . $ structMatrix#z..rowcxx . . $ automatrix#row(2d545b3cb3f8e666). (1).partcxx . . $ vector#part(ae267db9e2c04be7). (1, thycxx . . $ `melder/melder.h:45:9`! nxcxx . . $ structSampled#nx.); |
| 160 | } else { |
| 161 | for (integercxx . . $ integer# ichan = 1; ichan <= mycxx . . $ `melder/melder.h:44:9`! nycxx . . $ structSampledXY#ny.; ichan ++) { |
| 162 | autoSoundcxx . . $ autoSound# channel = Sound_extractChannelcxx . . $ Sound_extractChannel(fdb1ba3dfee1bd33). (me, ichan); |
| 163 | autoSpectrumcxx . . $ autoSpectrum# spec = Sound_to_Spectrumcxx . . $ Sound_to_Spectrum(e96f4d575d8eeb8c). (channel.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), true); |
| 164 | Spectrum_passHannBandcxx . . $ Spectrum_passHannBand(4e1fbc861a283982). (spec.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), fmin, fmax, smooth); |
| 165 | autoSoundcxx . . $ autoSound# him = Spectrum_to_Soundcxx . . $ Spectrum_to_Sound(b9577246d0f6b8d7). (spec.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 166 | thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z..rowcxx . . $ automatrix#row(2d545b3cb3f8e666). (ichan) <<=cxx . . $ `operator<<=`(adea042513329390). hiscxx . . $ `melder/melder.h:47:9`! zcxx . . $ structMatrix#z..rowcxx . . $ automatrix#row(2d545b3cb3f8e666). (1).partcxx . . $ vector#part(ae267db9e2c04be7). (1, thycxx . . $ `melder/melder.h:45:9`! nxcxx . . $ structSampled#nx.); |
| 167 | } |
| 168 | } |
| 169 | return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 170 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 171 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not filtered (pass Hann band)."); |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | autoSoundcxx . . $ autoSound# Sound_filter_stopHannBandcxx . . $ Sound_filter_stopHannBand(14181e1c5f839e03). (Soundcxx . . $ Sound# me, double fmin, double fmax, double smooth) { |
| 176 | try { |
| 177 | autoSoundcxx . . $ autoSound# thee = Data_copycxx . . $ Data_copy(97a542a26794c80e). (me); |
| 178 | if (mycxx . . $ `melder/melder.h:44:9`! nycxx . . $ structSampledXY#ny. == 1) { |
| 179 | autoSpectrumcxx . . $ autoSpectrum# spec = Sound_to_Spectrumcxx . . $ Sound_to_Spectrum(e96f4d575d8eeb8c). (me, true); |
| 180 | Spectrum_stopHannBandcxx . . $ Spectrum_stopHannBand(4e1fbc861a283982). (spec.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), fmin, fmax, smooth); |
| 181 | autoSoundcxx . . $ autoSound# him = Spectrum_to_Soundcxx . . $ Spectrum_to_Sound(b9577246d0f6b8d7). (spec.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 182 | thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z..rowcxx . . $ automatrix#row(2d545b3cb3f8e666). (1) <<=cxx . . $ `operator<<=`(adea042513329390). hiscxx . . $ `melder/melder.h:47:9`! zcxx . . $ structMatrix#z..rowcxx . . $ automatrix#row(2d545b3cb3f8e666). (1).partcxx . . $ vector#part(ae267db9e2c04be7). (1, thycxx . . $ `melder/melder.h:45:9`! nxcxx . . $ structSampled#nx.); |
| 183 | } else { |
| 184 | for (integercxx . . $ integer# ichan = 1; ichan <= mycxx . . $ `melder/melder.h:44:9`! nycxx . . $ structSampledXY#ny.; ichan ++) { |
| 185 | autoSoundcxx . . $ autoSound# channel = Sound_extractChannelcxx . . $ Sound_extractChannel(fdb1ba3dfee1bd33). (me, ichan); |
| 186 | autoSpectrumcxx . . $ autoSpectrum# spec = Sound_to_Spectrumcxx . . $ Sound_to_Spectrum(e96f4d575d8eeb8c). (channel.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), true); |
| 187 | Spectrum_stopHannBandcxx . . $ Spectrum_stopHannBand(4e1fbc861a283982). (spec.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), fmin, fmax, smooth); |
| 188 | autoSoundcxx . . $ autoSound# him = Spectrum_to_Soundcxx . . $ Spectrum_to_Sound(b9577246d0f6b8d7). (spec.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 189 | thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z..rowcxx . . $ automatrix#row(2d545b3cb3f8e666). (ichan) <<=cxx . . $ `operator<<=`(adea042513329390). hiscxx . . $ `melder/melder.h:47:9`! zcxx . . $ structMatrix#z..rowcxx . . $ automatrix#row(2d545b3cb3f8e666). (1).partcxx . . $ vector#part(ae267db9e2c04be7). (1, thycxx . . $ `melder/melder.h:45:9`! nxcxx . . $ structSampled#nx.); |
| 190 | } |
| 191 | } |
| 192 | return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 193 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 194 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not filtered (stop Hann band)."); |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | /* End of file Sound_and_Spectrum.cpp */ |