Debian Codegraph @

dwtools/FilterBank.h

raw symbols SCIP
1 #cxx . . $ `<file>/dwtools/FilterBank.h`/ifndef _FilterBank_h_
2 #define _FilterBank_h_cxx . . $ `dwtools/FilterBank.h:2:9`!
3 /* FilterBank.h
4 *
5 * Copyright (C) 1993-2017 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 20010609
23 djmw 20020813 GPL header
24 djmw 20040702 Corrected MELTOBARK formula.
25 djmw 20110306 Latest modification.
26 */
27
28 #include "TableOfReal.h"cxx . . $ `<file>/stat/TableOfReal.h`/
29 #include "Spectrum.h"cxx . . $ `<file>/fon/Spectrum.h`/
30 #include "MFCC.h"cxx . . $ `<file>/dwtools/MFCC.h`/
31 #include "Intensity.h"cxx . . $ `<file>/fon/Intensity.h`/
32 #include "PCA.h"cxx . . $ `<file>/dwtools/PCA.h`/
33 #include "Pitch.h"cxx . . $ `<file>/fon/Pitch.h`/
34 #include "Spectrogram_extensions.h"cxx . . $ `<file>/dwtools/Spectrogram_extensions.h`/
35
36 #define HZTOMELcxx . . $ `dwtools/FilterBank.h:36:9`!(x) NUMhertzToMel2(x)
37 #define MELTOHZcxx . . $ `dwtools/FilterBank.h:37:9`!(x) NUMmelToHertz2(x)
38
39 #define FilterBank_DBREFcxx . . $ `dwtools/FilterBank.h:39:9`! 4e-10
40 #define FilterBank_DBFACcxx . . $ `dwtools/FilterBank.h:40:9`! 1.0
41 #define FilterBank_DBFLOORcxx . . $ `dwtools/FilterBank.h:41:9`! -20
42
43 #define FilterBank_HERTZcxx . . $ `dwtools/FilterBank.h:43:9`! 1
44 #define FilterBank_BARKcxx . . $ `dwtools/FilterBank.h:44:9`! 2
45 #define FilterBank_MELcxx . . $ `dwtools/FilterBank.h:45:9`! 3
46
47 // FilterBank, BarkFilter, MelFilter are deprecated as of october 2014.
48 // New types are BandFilterSpectrogram, BarkSpectrogram and MelSpectrogram.
49 // This interface is maintained because older scripts still have to work.
50
51 Thing_definecxx . . $ theClassInfo_FilterBank. (FilterBank, Matrix) {
52 virtual int v_getFrequencyScalecxx . . $ structFilterBank#v_getFrequencyScale(b126dc7c1de90089). ()
53 { return FilterBank_HERTZcxx . . $ `dwtools/FilterBank.h:43:9`!; }
54 virtual conststring32cxx . . $ conststring32# v_getFrequencyUnitcxx . . $ structFilterBank#v_getFrequencyUnit(1912f6684645c851). ()
55 { return U"Hz"; } // compatibility with BandFilterSpectrogram
56 };
57
58 Thing_definecxx . . $ autoSomeThing# (BarkFilter, FilterBank) {
59 int v_getFrequencyScalecxx . . $ structBarkFilter#v_getFrequencyScale(b126dc7c1de90089). ()
60 override { return FilterBank_BARKcxx . . $ `dwtools/FilterBank.h:44:9`!; }
61 conststring32cxx . . $ conststring32# v_getFrequencyUnitcxx . . $ structBarkFilter#v_getFrequencyUnit(1912f6684645c851). ()
62 override { return U"bark"; }
63 };
64
65 /*
66 Interpretation:
67 xmin, xmax, x1, dx, nx like Sampled.
68 ymin, ymax lowest and highest frequencies in Barks.
69 y1 mid of first filter (bark).
70 dy distance between filters (bark).
71 ny the number of filters.
72 */
73
74 double FilterBank_getFrequencyInHertzcxx . . $ FilterBank_getFrequencyInHertz(f618179bbeb74d99). (FilterBankcxx . . $ FilterBank# me, double f, int scale_from);
75 double FilterBank_getFrequencyInBarkcxx . . $ FilterBank_getFrequencyInBark(f618179bbeb74d99). (FilterBankcxx . . $ FilterBank# me, double f, int scale_from);
76 double FilterBank_getFrequencyInMelcxx . . $ FilterBank_getFrequencyInMel(f618179bbeb74d99). (FilterBankcxx . . $ FilterBank# me, double f, int scale_from);
77
78 int FilterBank_getFrequencyScalecxx . . $ FilterBank_getFrequencyScale(6ef85b3e738e5005). (FilterBankcxx . . $ FilterBank# me);
79
80 void FilterBank_drawFrequencyScalescxx . . $ FilterBank_drawFrequencyScales(3b4bf4f17039baaf). (FilterBankcxx . . $ FilterBank# me, Graphicscxx . . $ Graphics# g, int horizontalScale, double xmin,
81 double xmax, int verticalScale, double ymin, double ymax, bool garnish);
82
83 void BarkFilter_drawSekeyHansonFilterFunctionscxx . . $ BarkFilter_drawSekeyHansonFilterFunctions(6c231e8e2d9d4d95). (BarkFiltercxx . . $ BarkFilter# me, Graphicscxx . . $ Graphics# g,
84 int freqScale, int fromFilter, int toFilter, double zmin, double zmax,
85 int dbScale, double ymin, double ymax, bool garnish);
86
87 void FilterBank_drawTimeSlicecxx . . $ FilterBank_drawTimeSlice(eaeb02aa0d7d9306). (FilterBankcxx . . $ FilterBank# me, Graphicscxx . . $ Graphics# g, double t, double fmin, double fmax,
88 double min, double max, conststring32cxx . . $ conststring32# xlabel, bool garnish);
89
90 void FilterBank_paintcxx . . $ FilterBank_paint(739714278a9a32c1). (FilterBankcxx . . $ FilterBank# me, Graphicscxx . . $ Graphics# g, double xmin, double xmax, double ymin, double ymax, double minimum, double maximum, bool garnish);
91
92 autoBarkFiltercxx . . $ autoBarkFilter# BarkFilter_createcxx . . $ BarkFilter_create(ff43a0770e35e089). (double tmin, double tmax, integercxx . . $ integer# nt, double dt, double t1,
93 double fmin, double fmax, integercxx . . $ integer# nf, double df, double f1);
94
95 autoBarkFiltercxx . . $ autoBarkFilter# Matrix_to_BarkFiltercxx . . $ Matrix_to_BarkFilter(73b6906b8e8ee5ca). (Matrixcxx . . $ Matrix# me);
96
97 Thing_definecxx . . $ ClassInfo# (MelFilter, FilterBank) {
98 int v_getFrequencyScalecxx . . $ structMelFilter#v_getFrequencyScale(b126dc7c1de90089). ()
99 override { return FilterBank_MELcxx . . $ `dwtools/FilterBank.h:45:9`!; }
100 conststring32cxx . . $ conststring32# v_getFrequencyUnitcxx . . $ structMelFilter#v_getFrequencyUnit(1912f6684645c851). ()
101 override { return U"mel"; }
102 };
103
104 /*
105 Interpretation:
106 xmin, xmax, x1, dx, nx like Sampled.
107 ymin, ymax lowest and highest frequencies in mels.
108 y1 mid of first filter (mels).
109 dy distance between filters (mel).
110 ny the number of filters.
111 */
112
113 autoMelFiltercxx . . $ autoMelFilter# MelFilter_createcxx . . $ MelFilter_create(5fb42b2a68be7a2e). (double tmin, double tmax, integercxx . . $ integer# nt, double dt,
114 double t1, double fmin, double fmax, integercxx . . $ integer# nf, double df, double f1);
115
116 autoMelFiltercxx . . $ autoMelFilter# Matrix_to_MelFiltercxx . . $ Matrix_to_MelFilter(84a98a20af452fe9). (Matrixcxx . . $ Matrix#);
117
118 void MelFilter_drawFilterFunctionscxx . . $ MelFilter_drawFilterFunctions(df4c65681db2d2f). (MelFiltercxx . . $ MelFilter# me, Graphicscxx . . $ Graphics# g,
119 int freqScale, int fromFilter, int toFilter, double zmin, double zmax,
120 int dbScale, double ymin, double ymax, bool garnish);
121
122 autoMFCCcxx . . $ autoMFCC# MelFilter_to_MFCCcxx . . $ MelFilter_to_MFCC(22a90051c67ea9fb). (MelFiltercxx . . $ MelFilter# me, integercxx . . $ integer# numberOfCoefficients);
123
124 Thing_definecxx . . $ mutableFormantFilter# (FormantFilter, FilterBank) {
125 conststring32cxx . . $ conststring32# v_getFrequencyUnitcxx . . $ structFormantFilter#v_getFrequencyUnit(1912f6684645c851). ()
126 override { return U"Hz"; }
127 };
128
129 autoFormantFiltercxx . . $ autoFormantFilter# FormantFilter_createcxx . . $ FormantFilter_create(7aa8380541e38013). (double tmin, double tmax, integercxx . . $ integer# nt,
130 double dt, double t1, double fmin, double fmax, integercxx . . $ integer# nf, double df,
131 double f1);
132
133 void FormantFilter_drawFilterFunctionscxx . . $ FormantFilter_drawFilterFunctions(ad6e7a6810c80cfc). (FormantFiltercxx . . $ FormantFilter# me, Graphicscxx . . $ Graphics# g, double bandwidth,
134 int freqScale, int fromFilter, int toFilter, double zmin, double zmax,
135 int dbScale, double ymin, double ymax, bool garnish);
136
137 autoFormantFiltercxx . . $ autoFormantFilter# Matrix_to_FormantFiltercxx . . $ Matrix_to_FormantFilter(b47c060be779e6c7). (Matrixcxx . . $ Matrix# me);
138
139 void FilterBank_equalizeIntensitiescxx . . $ FilterBank_equalizeIntensities(f60660b89d92ea44). (FilterBankcxx . . $ FilterBank# me, double intensity_db);
140
141 autoMatrixcxx . . $ autoMatrix# FilterBank_to_Matrixcxx . . $ FilterBank_to_Matrix(f77d8cc2fd8808cf). (FilterBankcxx . . $ FilterBank# me);
142 /* Generieke ...Filters_to_Matrix */
143
144 autoSpectrumcxx . . $ autoSpectrum# FormantFilter_to_Spectrum_slicecxx . . $ FormantFilter_to_Spectrum_slice(8159583635ecc5bd). (FormantFiltercxx . . $ FormantFilter# me, double t);
145 /*
146 Calculate amplitude spectrum at time t.
147 power [i] = ref * 10 ^ (my z [i] [t] / 10)
148 spec -> z [1] [i] = sqrt (power [i]) = sqrt (ref) * 10 ^ (my z [i] [t] / (2*10))
149 spec -> z [2] [i] = 0
150 */
151
152 autoIntensitycxx . . $ autoIntensity# FilterBank_to_Intensitycxx . . $ FilterBank_to_Intensity(5cf457a2f9de6cf5). (FilterBankcxx . . $ FilterBank# me);
153
154 void FilterBank_PCA_drawComponentcxx . . $ FilterBank_PCA_drawComponent(5e897c6bdd63be44). (FilterBankcxx . . $ FilterBank# me, PCAcxx . . $ PCA# thee, Graphicscxx . . $ Graphics# g, integercxx . . $ integer# component, double dblevel,
155 double frequencyOffset, double scale, double tmin, double tmax, double fmin, double fmax);
156
157 // Convert old types to new types
158
159 autoMelSpectrogramcxx . . $ autoMelSpectrogram# MelFilter_to_MelSpectrogramcxx . . $ MelFilter_to_MelSpectrogram(ae664ad990d65fcc). (MelFiltercxx . . $ MelFilter# me);
160
161 autoBarkSpectrogramcxx . . $ autoBarkSpectrogram# BarkFilter_to_BarkSpectrogramcxx . . $ BarkFilter_to_BarkSpectrogram(3198f6d3e2bee165). (BarkFiltercxx . . $ BarkFilter# me);
162
163 autoSpectrogramcxx . . $ autoSpectrogram# FormantFilter_to_Spectrogramcxx . . $ FormantFilter_to_Spectrogram(74106c37cc71a848). (FormantFiltercxx . . $ FormantFilter# me);
164
165
166 autoMFCCcxx . . $ autoMFCC# MelFilter_to_MFCCcxx . . $ MelFilter_to_MFCC(22a90051c67ea9fb). (MelFiltercxx . . $ MelFilter# me, integercxx . . $ integer# numberOfCoefficients);
167 /*
168 Calculates the Cosine Transform of the filterbank values.
169 */
170
171 autoMelFiltercxx . . $ autoMelFilter# MFCC_to_MelFiltercxx . . $ MFCC_to_MelFilter(87cf6dca599818b7). (MFCCcxx . . $ MFCC# me, integercxx . . $ integer# firstCoefficient, integercxx . . $ integer# lastCoefficient);
172 /*
173 Calculates the Inverse CT of cepstral coefficients.
174 */
175
176 autoBarkFiltercxx . . $ autoBarkFilter# Sound_to_BarkFiltercxx . . $ Sound_to_BarkFilter(3d0d29d16197ca93). (Soundcxx . . $ Sound# me, double analysisWidth, double dt,
177 double f1_bark, double fmax_bark, double df_bark);
178 /*
179 Filtering with filters on a Bark scale as defined by
180 Andrew Sekey & Brian Hanson (1984), "Improved 1-Bark bandwidth
181 "auditory filter", Jasa 75, 1902-1904.
182 Although not explicitely stated the filter function is defined in the
183 power domain.
184 10 log F(z) = 15.8 + 7.5(z + 0.5) - 17.5 * sqrt(1 + (z + 0.5)^2)
185 */
186
187 autoMelFiltercxx . . $ autoMelFilter# Sound_to_MelFiltercxx . . $ Sound_to_MelFilter(35d960ad1882ab5e). (Soundcxx . . $ Sound# me, double analysisWidth, double dt,
188 double f1_mel, double fmax_mel, double df_mel);
189
190 autoFormantFiltercxx . . $ autoFormantFilter# Sound_to_FormantFiltercxx . . $ Sound_to_FormantFilter(22e27b3d9e3d85f4). (Soundcxx . . $ Sound# me, double analysisWidth,
191 double dt, double f1_hz, double fmax_hz, double df_hz, double relative_bw,
192 double pitchFloor, double pitchCeiling);
193
194 autoFormantFiltercxx . . $ autoFormantFilter# Sound_Pitch_to_FormantFiltercxx . . $ Sound_Pitch_to_FormantFilter(dfaf5d00a6a566f2). (Soundcxx . . $ Sound# me, Pitchcxx . . $ Pitch# thee,
195 double analysisWidth, double dt, double f1_hz, double fmax_hz,
196 double df_hz, double relative_bw);
197
198 autoSoundcxx . . $ autoSound# FilterBanks_crossCorrelatecxx . . $ FilterBanks_crossCorrelate(e3caaeea6952e24c). (FilterBankcxx . . $ FilterBank# me, FilterBankcxx . . $ FilterBank# thee, enum kSounds_convolve_scalingcxx . . $ kSounds_convolve_scaling# scaling,
199 enum kSounds_convolve_signalOutsideTimeDomaincxx . . $ kSounds_convolve_signalOutsideTimeDomain# signalOutsideTimeDomain);
200
201 autoSoundcxx . . $ autoSound# FilterBanks_convolvecxx . . $ FilterBanks_convolve(e3caaeea6952e24c). (FilterBankcxx . . $ FilterBank# me, FilterBankcxx . . $ FilterBank# thee, enum kSounds_convolve_scalingcxx . . $ kSounds_convolve_scaling# scaling,
202 enum kSounds_convolve_signalOutsideTimeDomaincxx . . $ kSounds_convolve_signalOutsideTimeDomain# signalOutsideTimeDomain);
203
204 #endif /* _FilterBank_h_ */