| 1 | #ifndef _MultiSampledSpectrogram_h_ |
| 2 | #define _MultiSampledSpectrogram_h_ |
| 3 | /* MultiSampledSpectrogram.h |
| 4 | * |
| 5 | * Copyright (C) 2021-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 | #include "AnalyticSound.h" |
| 22 | #include "Graphics.h" |
| 23 | |
| 24 | |
| 25 | Thing_define (FrequencyBin, AnalyticSound) { |
| 26 | double v_getValueAtSample (integer isample, integer which, int unit) const |
| 27 | override; |
| 28 | }; |
| 29 | |
| 30 | #include "MultiSampledSpectrogram_def.h" |
| 31 | |
| 32 | /* |
| 33 | A MultiSampledSpectrogram is a spectrogram that is evenly sampled in the frequency domain (on some possibly non-linear frequency scale). |
| 34 | Each "sample" is a FrequencyBin with real and imaginary values. |
| 35 | The original sound can be reconstructed from the data in the frequency bins. |
| 36 | */ |
| 37 | |
| 38 | autoFrequencyBin FrequencyBin_create (double xmin, double xmax, integer nx, double dx, double x1); |
| 39 | |
| 40 | void FrequencyBin_formula (FrequencyBin me, conststring32 formula, Interpreter interpreter); |
| 41 | |
| 42 | double FrequencyBin_getValueAtX (FrequencyBin me, double x, kVector_valueInterpolation valueInterpolationType); |
| 43 | |
| 44 | autoSound FrequencyBin_to_Sound (FrequencyBin me); |
| 45 | |
| 46 | autoAnalyticSound FrequencyBin_to_AnalyticSound (FrequencyBin me); |
| 47 | |
| 48 | void MultiSampledSpectrogram_init (MultiSampledSpectrogram me, double tmin, double tmax, double fmin, double fmax, |
| 49 | integer numberOfFrequencies, double df, double f1, double frequencyResolutionInBins); |
| 50 | |
| 51 | void MultiSampledSpectrogram_formula (MultiSampledSpectrogram me, conststring32 formula, Interpreter interpreter); |
| 52 | |
| 53 | void MultiSampledSpectrogram_formula_part (MultiSampledSpectrogram me, double fromTime, double toTime, double fromFrequency, double toFrequency, conststring32 formula, Interpreter interpreter); |
| 54 | |
| 55 | void MultiSampledSpectrogram_paintInside (MultiSampledSpectrogram me, Graphics g, double tmin, double tmax, double fmin_hz, double fmax_hz, double dBRange); |
| 56 | |
| 57 | integer MultiSampledSpectrogram_getNumberOfFrames (MultiSampledSpectrogram me); |
| 58 | |
| 59 | void MultiSampledSpectrogram_getFrequencyBand (MultiSampledSpectrogram me, integer index, double *out_flow, double *out_fhigh); |
| 60 | |
| 61 | #endif /* MultiSampledSpectrogram_h_ */ |