| 1 | #cxx . . $ `<file>/fon/Spectrum.h`/ifndef _Spectrum_h_ |
| 2 | #define _Spectrum_h_cxx . . $ `fon/Spectrum.h:2:9`! |
| 3 | /* Spectrum.h |
| 4 | * |
| 5 | * Copyright (C) 1992-2005,2007,2011,2015-2017,2019-2021 Paul Boersma |
| 6 | * |
| 7 | * This code is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or (at |
| 10 | * your option) any later version. |
| 11 | * |
| 12 | * This code is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 15 | * See the GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | /* Complex spectrum. */ |
| 22 | /* If it comes from a sound (expressed in Pa), the values are expressed in Pa/Hz. */ |
| 23 | |
| 24 | #include "Matrix.h"cxx . . $ `<file>/fon/Matrix.h`/ |
| 25 | #include "Graphics.h"cxx . . $ `<file>/sys/Graphics.h`/ |
| 26 | |
| 27 | #include "Spectrum_def.h"cxx . . $ `<file>/fon/Spectrum_def.h`/ |
| 28 | |
| 29 | /* |
| 30 | xmin // lowest frequency (Hz) |
| 31 | xmax // highest frequency (Hz) |
| 32 | nx // number of frequencies |
| 33 | dx // frequency step (Hz) |
| 34 | x1 // first frequency (Hz) |
| 35 | ymin = 1.0 // first row: real part |
| 36 | ymax = 2.0 // second row: imaginary part |
| 37 | ny = 2 // two rows |
| 38 | dy = y1 = 1.0 // y is row number |
| 39 | */ |
| 40 | |
| 41 | autoSpectrumcxx . . $ autoSpectrum# Spectrum_createcxx . . $ Spectrum_create(a338b9c326abb5ed). (double fmax, integercxx . . $ integer# nf); |
| 42 | /* Preconditions: |
| 43 | fmax > 0.0; |
| 44 | nf >= 2; |
| 45 | Postconditions: |
| 46 | my xmin == 0.0; |
| 47 | my xmax == fmax; |
| 48 | my nx == nf; |
| 49 | my dx == fmax / (nx - 1); |
| 50 | my x1 == 0.0; |
| 51 | my ymin == 1; |
| 52 | my ymax == 2; |
| 53 | my ny == 2; |
| 54 | my dy == 1; |
| 55 | my y1 == 1; |
| 56 | my z [1..ny] [1..nx] == 0.0; |
| 57 | */ |
| 58 | |
| 59 | int Spectrum_getPowerDensityRangecxx . . $ Spectrum_getPowerDensityRange(b7f07eef6e5a7855). (Spectrumcxx . . $ Spectrum# me, double *minimum, double *maximum); // return 0 if all zeroes |
| 60 | double Spectrum_getBandDensitycxx . . $ Spectrum_getBandDensity(df43ef1f71c811ae). (Spectrumcxx . . $ Spectrum# me, double fmin, double fmax); // Pa2 / Hz2 |
| 61 | double Spectrum_getBandEnergycxx . . $ Spectrum_getBandEnergy(df43ef1f71c811ae). (Spectrumcxx . . $ Spectrum# me, double fmin, double fmax); // Pa2 sec |
| 62 | double Spectrum_getBandDensityDifferencecxx . . $ Spectrum_getBandDensityDifference(7715ff80fa990619). (Spectrumcxx . . $ Spectrum# me, |
| 63 | double lowBandMin, double lowBandMax, double highBandMin, double HighBandMax); |
| 64 | double Spectrum_getBandEnergyDifferencecxx . . $ Spectrum_getBandEnergyDifference(7715ff80fa990619). (Spectrumcxx . . $ Spectrum# me, |
| 65 | double lowBandMin, double lowBandMax, double highBandMin, double highBandMax); |
| 66 | |
| 67 | /* |
| 68 | Spectral moments. |
| 69 | */ |
| 70 | double Spectrum_getCentreOfGravitycxx . . $ Spectrum_getCentreOfGravity(9217fce55a02ebba). (Spectrumcxx . . $ Spectrum# me, double power); |
| 71 | double Spectrum_getCentralMomentcxx . . $ Spectrum_getCentralMoment(df43ef1f71c811ae). (Spectrumcxx . . $ Spectrum# me, double moment, double power); |
| 72 | double Spectrum_getStandardDeviationcxx . . $ Spectrum_getStandardDeviation(9217fce55a02ebba). (Spectrumcxx . . $ Spectrum# me, double power); |
| 73 | double Spectrum_getSkewnesscxx . . $ Spectrum_getSkewness(9217fce55a02ebba). (Spectrumcxx . . $ Spectrum# me, double power); |
| 74 | double Spectrum_getKurtosiscxx . . $ Spectrum_getKurtosis(9217fce55a02ebba). (Spectrumcxx . . $ Spectrum# me, double power); |
| 75 | |
| 76 | void Spectrum_drawInsidecxx . . $ Spectrum_drawInside(d2c1ceecc2e1e81c). (Spectrumcxx . . $ Spectrum# me, Graphicscxx . . $ Graphics# g, double fmin, double fmax, double minimum, double maximum); |
| 77 | void Spectrum_drawcxx . . $ Spectrum_draw(a7ea7f35efa442f0). (Spectrumcxx . . $ Spectrum# me, Graphicscxx . . $ Graphics# g, double fmin, double fmax, double minimum, double maximum, bool garnish); |
| 78 | /* |
| 79 | Function: |
| 80 | draw a Spectrum into a Graphics. |
| 81 | Preconditions: |
| 82 | maximum > minimum; |
| 83 | Arguments: |
| 84 | [fmin, fmax]: frequencies in Hz; x domain of drawing; |
| 85 | Autowindowing: if fmax <= fmin, x domain of drawing is [my xmin, my xmax]. |
| 86 | [minimum, maximum]: power in dB/Hz; y range of drawing. |
| 87 | */ |
| 88 | void Spectrum_drawLogFreqcxx . . $ Spectrum_drawLogFreq(a7ea7f35efa442f0). (Spectrumcxx . . $ Spectrum# me, Graphicscxx . . $ Graphics# g, double fmin, double fmax, double minimum, double maximum, bool garnish); |
| 89 | |
| 90 | autoTablecxx . . $ autoTable# Spectrum_tabulatecxx . . $ Spectrum_tabulate(852e071d12db649b). (Spectrumcxx . . $ Spectrum# me, bool includeBinNumbers, bool includeFrequency, |
| 91 | bool includeRealPart, bool includeImaginaryPart, bool includeEnergyDensity, bool includePowerDensity); |
| 92 | autoTablecxx . . $ autoTable# Spectrum_tabulate_verbosecxx . . $ Spectrum_tabulate_verbose(2a630f3ac6f1af99). (Spectrumcxx . . $ Spectrum# me); |
| 93 | |
| 94 | autoSpectrumcxx . . $ autoSpectrum# Matrix_to_Spectrumcxx . . $ Matrix_to_Spectrum(420e75dee953934d). (Matrixcxx . . $ Matrix# me); |
| 95 | |
| 96 | autoMatrixcxx . . $ autoMatrix# Spectrum_to_Matrixcxx . . $ Spectrum_to_Matrix(bce19a848610ec35). (Spectrumcxx . . $ Spectrum# me); |
| 97 | |
| 98 | autoSpectrumcxx . . $ autoSpectrum# Spectrum_cepstralSmoothingcxx . . $ Spectrum_cepstralSmoothing(3011f41fa0714370). (Spectrumcxx . . $ Spectrum# me, double bandWidth); |
| 99 | |
| 100 | void Spectrum_passHannBandcxx . . $ Spectrum_passHannBand(4e1fbc861a283982). (Spectrumcxx . . $ Spectrum# me, double fmin, double fmax, double smooth); |
| 101 | void Spectrum_stopHannBandcxx . . $ Spectrum_stopHannBand(4e1fbc861a283982). (Spectrumcxx . . $ Spectrum# me, double fmin, double fmax, double smooth); |
| 102 | |
| 103 | MelderPointcxx . . $ MelderPoint# Spectrum_getNearestMaximumcxx . . $ Spectrum_getNearestMaximum(5c1dcaad34bb82aa). (Spectrumcxx . . $ Spectrum# me, double frequency); |
| 104 | |
| 105 | /* End of file Spectrum.h */ |
| 106 | #endif |