| 1 | #ifndef _Spectrum_extensions_h_ |
| 2 | #define _Spectrum_extensions_h_ |
| 3 | /* Spectrum_extensions.h |
| 4 | * |
| 5 | * Copyright (C) 1993-2023 David Weenink |
| 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. See the GNU |
| 15 | * 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 | /* |
| 22 | djmw 20010114 |
| 23 | djmw 20020813 GPL header |
| 24 | djmw 20121022 Latest modification |
| 25 | */ |
| 26 | |
| 27 | #include "Spectrum.h" |
| 28 | #include "Sound.h" |
| 29 | #include "Graphics.h" |
| 30 | |
| 31 | autoSpectrum Spectrum_resample (Spectrum me, integer numberOfFrequencies); |
| 32 | |
| 33 | autoSpectrum Spectrum_compressFrequencyDomain (Spectrum me, double fmax, integer interpolationDepth, int freqscale, int method); |
| 34 | |
| 35 | autoSpectrum Spectrum_shiftFrequencies (Spectrum me, double shiftBy, double newMaximumFrequency, integer interpolationDepth); |
| 36 | // Shift will be plusminus dx/2 |
| 37 | |
| 38 | autoMatrix Spectrum_unwrap (Spectrum me); |
| 39 | /* |
| 40 | Unwrap the phases of the spectrum according to an algorithm by |
| 41 | Tribolet as published in: |
| 42 | |
| 43 | Tribolet, J.M. & Quatieri, T.F. (1979), Computation of the Complex |
| 44 | Spectrum, in: Programs for Digital Signal Processing, |
| 45 | Digital Signal Processing Committee (eds), IEEE Press, |
| 46 | chapter 7.1. |
| 47 | |
| 48 | First row of returned matrix contains the amplitudes-squared, |
| 49 | second row contains the unwrapped phases. |
| 50 | */ |
| 51 | |
| 52 | void Spectrum_drawPhases (Spectrum me, Graphics g, double fmin, double fmax, |
| 53 | double phase_min, double phase_max, int unwrap, bool garnish); |
| 54 | |
| 55 | autoSpectrum Spectra_multiply (Spectrum me, Spectrum thee); |
| 56 | |
| 57 | void Spectrum_conjugate (Spectrum me); |
| 58 | |
| 59 | void Spectrum_shiftPhaseBy90Degrees (Spectrum me); |
| 60 | void Spectrum_unshiftPhaseBy90Degrees (Spectrum me); |
| 61 | |
| 62 | void Spectrum_getMaximumInInterval (Spectrum me, double fromFrequencyHz, double toFrequencyHz, double *frequency, double *amplitude_dB); |
| 63 | |
| 64 | |
| 65 | #endif /* _Spectrum_extensions_h_ */ |