annotate src/Support/ERBTools.h @ 47:2204b3a05a28

-Reinstated original parameter-setting
author tomwalters
date Mon, 07 Jun 2010 08:34:49 +0000
parents c5f5e9569863
children
rev   line source
tomwalters@0 1 // Copyright 2006-2010, Thomas Walters
tomwalters@0 2 //
tomwalters@0 3 // AIM-C: A C++ implementation of the Auditory Image Model
tomwalters@0 4 // http://www.acousticscale.org/AIMC
tomwalters@0 5 //
tomwalters@45 6 // Licensed under the Apache License, Version 2.0 (the "License");
tomwalters@45 7 // you may not use this file except in compliance with the License.
tomwalters@45 8 // You may obtain a copy of the License at
tomwalters@0 9 //
tomwalters@45 10 // http://www.apache.org/licenses/LICENSE-2.0
tomwalters@0 11 //
tomwalters@45 12 // Unless required by applicable law or agreed to in writing, software
tomwalters@45 13 // distributed under the License is distributed on an "AS IS" BASIS,
tomwalters@45 14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
tomwalters@45 15 // See the License for the specific language governing permissions and
tomwalters@45 16 // limitations under the License.
tomwalters@0 17
tomwalters@0 18 /*! \file
tomwalters@5 19 * \brief ERB calculations
tomwalters@0 20 */
tomwalters@0 21
tomwalters@0 22 /*! \author: Thomas Walters <tom@acousticscale.org>
tomwalters@0 23 * \date 2010/01/23
tomwalters@23 24 * \version \$Id$
tomwalters@0 25 */
tomwalters@0 26
tomwalters@11 27 #ifndef AIMC_SUPPORT_ERBTOOLS_H_
tomwalters@11 28 #define AIMC_SUPPORT_ERBTOOLS_H_
tomwalters@0 29
tomwalters@15 30 #include <cmath>
tomwalters@0 31
tomwalters@0 32 namespace aimc {
tomwalters@0 33 class ERBTools {
tomwalters@0 34 public:
tomwalters@0 35 static float Freq2ERB(float freq) {
tomwalters@0 36 return 21.4f * log10(4.37f * freq / 1000.0f + 1.0f);
tomwalters@0 37 }
tomwalters@0 38
tomwalters@0 39 static float Freq2ERBw(float freq) {
tomwalters@0 40 return 24.7f * (4.37f * freq / 1000.0f + 1.0f);
tomwalters@0 41 }
tomwalters@5 42
tomwalters@5 43 static float ERB2Freq(float erb) {
tomwalters@5 44 return (pow(10, (erb / 21.4f)) - 1.0f) / 4.37f * 1000.0f;
tomwalters@5 45 }
tomwalters@0 46 };
tomwalters@0 47 }
tomwalters@0 48
tomwalters@11 49 #endif // AIMC_SUPPORT_ERBTOOLS_H_