annotate trunk/src/Support/ERBTools.h @ 706:f8e90b5d85fd tip

Delete CARFAC code from this repository. It has been moved to https://github.com/google/carfac Please email me with your github username to get access. I've also created a new mailing list to discuss CARFAC development: https://groups.google.com/forum/#!forum/carfac-dev
author ronw@google.com
date Thu, 18 Jul 2013 20:56:51 +0000
parents 30dde71d0230
children
rev   line source
tomwalters@268 1 // Copyright 2006-2010, Thomas Walters
tomwalters@268 2 //
tomwalters@268 3 // AIM-C: A C++ implementation of the Auditory Image Model
tomwalters@268 4 // http://www.acousticscale.org/AIMC
tomwalters@268 5 //
tomwalters@318 6 // Licensed under the Apache License, Version 2.0 (the "License");
tomwalters@318 7 // you may not use this file except in compliance with the License.
tomwalters@318 8 // You may obtain a copy of the License at
tomwalters@268 9 //
tomwalters@318 10 // http://www.apache.org/licenses/LICENSE-2.0
tomwalters@268 11 //
tomwalters@318 12 // Unless required by applicable law or agreed to in writing, software
tomwalters@318 13 // distributed under the License is distributed on an "AS IS" BASIS,
tomwalters@318 14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
tomwalters@318 15 // See the License for the specific language governing permissions and
tomwalters@318 16 // limitations under the License.
tomwalters@268 17
tomwalters@268 18 /*! \file
tomwalters@277 19 * \brief ERB calculations
tomwalters@268 20 */
tomwalters@268 21
tomwalters@268 22 /*! \author: Thomas Walters <tom@acousticscale.org>
tomwalters@268 23 * \date 2010/01/23
tomwalters@296 24 * \version \$Id$
tomwalters@268 25 */
tomwalters@268 26
tomwalters@283 27 #ifndef AIMC_SUPPORT_ERBTOOLS_H_
tomwalters@283 28 #define AIMC_SUPPORT_ERBTOOLS_H_
tomwalters@268 29
tomwalters@287 30 #include <cmath>
tomwalters@268 31
tomwalters@268 32 namespace aimc {
tomwalters@268 33 class ERBTools {
tomwalters@268 34 public:
tomwalters@268 35 static float Freq2ERB(float freq) {
tomwalters@268 36 return 21.4f * log10(4.37f * freq / 1000.0f + 1.0f);
tomwalters@268 37 }
tomwalters@268 38
tomwalters@268 39 static float Freq2ERBw(float freq) {
tomwalters@268 40 return 24.7f * (4.37f * freq / 1000.0f + 1.0f);
tomwalters@268 41 }
tomwalters@277 42
tomwalters@277 43 static float ERB2Freq(float erb) {
tomwalters@277 44 return (pow(10, (erb / 21.4f)) - 1.0f) / 4.37f * 1000.0f;
tomwalters@277 45 }
tomwalters@268 46 };
tomwalters@268 47 }
tomwalters@268 48
tomwalters@283 49 #endif // AIMC_SUPPORT_ERBTOOLS_H_