flatmax@674
|
1
|
flatmax@598
|
2 // Author Matt Flax <flatmax@>
|
flatmax@598
|
3 //
|
flatmax@598
|
4 // This C++ file is part of an implementation of Lyon's cochlear model:
|
flatmax@598
|
5 // "Cascade of Asymmetric Resonators with Fast-Acting Compression"
|
flatmax@598
|
6 // to supplement Lyon's upcoming book "Human and Machine Hearing"
|
flatmax@598
|
7 //
|
flatmax@598
|
8 // Licensed under the Apache License, Version 2.0 (the "License");
|
flatmax@598
|
9 // you may not use this file except in compliance with the License.
|
flatmax@598
|
10 // You may obtain a copy of the License at
|
flatmax@598
|
11 //
|
flatmax@598
|
12 // http://www.apache.org/licenses/LICENSE-2.0
|
flatmax@598
|
13 //
|
flatmax@598
|
14 // Unless required by applicable law or agreed to in writing, software
|
flatmax@598
|
15 // distributed under the License is distributed on an "AS IS" BASIS,
|
flatmax@598
|
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
flatmax@598
|
17 // See the License for the specific language governing permissions and
|
flatmax@598
|
18 // limitations under the License.
|
flatmax@598
|
19 #ifndef PSYCHOACOUSTICS_H_
|
flatmax@598
|
20 #define PSYCHOACOUSTICS_H_
|
flatmax@598
|
21
|
flatmax@598
|
22 #include "CARFACCommon.H"
|
flatmax@598
|
23
|
flatmax@598
|
24 class PsychoAcoustics {
|
flatmax@598
|
25 public:
|
flatmax@598
|
26 PsychoAcoustics() {}
|
flatmax@598
|
27 virtual ~PsychoAcoustics() {}
|
flatmax@598
|
28
|
flatmax@598
|
29 /** Auditory filter nominal Equivalent Rectangular Bandwidth
|
flatmax@598
|
30 Ref: Glasberg and Moore: Hearing Research, 47 (1990), 103-138
|
flatmax@598
|
31 ERB = 24.7 * (1 + 4.37 * CF_Hz / 1000);
|
flatmax@598
|
32 \param CFHz The central frequency to find the ERB at.
|
flatmax@598
|
33 \param ERBBreakFreq The linear scaling factor for frequency
|
flatmax@598
|
34 \param ERBQ The tuning of the rectangular bandwidth
|
flatmax@598
|
35 */
|
flatmax@598
|
36 static FP_TYPE Hz2ERB(FP_TYPE CFHz, FP_TYPE ERBBreakFreq=1000./4.37 /* 228.833 */, FP_TYPE ERBQ=1000./(24.7*4.37) /* 9.2645 */);
|
flatmax@598
|
37
|
flatmax@598
|
38 /** Auditory filter nominal Equivalent Rectangular Bandwidth
|
flatmax@598
|
39 Ref: Glasberg and Moore: Hearing Research, 47 (1990), 103-138
|
flatmax@598
|
40 ERB = 24.7 * (1 + 4.37 * CF_Hz / 1000);
|
flatmax@598
|
41 \param CFHz The central frequency to find the ERB at.
|
flatmax@598
|
42 \param ERBBreakFreq The linear scaling factor for frequency
|
flatmax@598
|
43 \param ERBQ The tuning of the rectangular bandwidth
|
flatmax@598
|
44 */
|
flatmax@598
|
45 static Array<FP_TYPE, Dynamic, 1> Hz2ERB(Array<FP_TYPE, Dynamic, 1> &CFHz, FP_TYPE ERBBreakFreq=1000./4.37 /* 228.833 */, FP_TYPE ERBQ=1000./(24.7*4.37) /* 9.2645 */);
|
flatmax@598
|
46 };
|
flatmax@598
|
47
|
flatmax@598
|
48 #endif // PSYCHOACOUSTICS_H_
|