annotate trunk/src/Support/ERBTools.h @ 277:6b4921704eb1

- Ported over HTK file output - Added some more meat to the Slaney IIR gammatone implementation - Ported over the AIM-MAT sf2003 parabola strobe algorithm - Finished making the SAI implementation compile - Ported over the strobe list class (now uses STL deques internally)
author tomwalters
date Thu, 18 Feb 2010 16:55:40 +0000
parents e14c70d1b171
children ef14c9f2c1d2
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@268 6 // This program is free software: you can redistribute it and/or modify
tomwalters@268 7 // it under the terms of the GNU General Public License as published by
tomwalters@268 8 // the Free Software Foundation, either version 3 of the License, or
tomwalters@268 9 // (at your option) any later version.
tomwalters@268 10 //
tomwalters@268 11 // This program is distributed in the hope that it will be useful,
tomwalters@268 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
tomwalters@268 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
tomwalters@268 14 // GNU General Public License for more details.
tomwalters@268 15 //
tomwalters@268 16 // You should have received a copy of the GNU General Public License
tomwalters@268 17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
tomwalters@268 18
tomwalters@268 19 /*! \file
tomwalters@277 20 * \brief ERB calculations
tomwalters@268 21 */
tomwalters@268 22
tomwalters@268 23 /*! \author: Thomas Walters <tom@acousticscale.org>
tomwalters@268 24 * \date 2010/01/23
tomwalters@268 25 * \version \$Id: ERBTools.h 1 2010-02-02 11:04:50Z tcw $
tomwalters@268 26 */
tomwalters@268 27
tomwalters@268 28 #ifndef _AIMC_SUPPORT_ERBTOOLS_H_
tomwalters@268 29 #define _AIMC_SUPPORT_ERBTOOLS_H_
tomwalters@268 30
tomwalters@268 31 #include <math.h>
tomwalters@268 32
tomwalters@268 33 namespace aimc {
tomwalters@268 34 class ERBTools {
tomwalters@268 35 public:
tomwalters@268 36 static float Freq2ERB(float freq) {
tomwalters@268 37 return 21.4f * log10(4.37f * freq / 1000.0f + 1.0f);
tomwalters@268 38 }
tomwalters@268 39
tomwalters@268 40 static float Freq2ERBw(float freq) {
tomwalters@268 41 return 24.7f * (4.37f * freq / 1000.0f + 1.0f);
tomwalters@268 42 }
tomwalters@277 43
tomwalters@277 44 static float ERB2Freq(float erb) {
tomwalters@277 45 return (pow(10, (erb / 21.4f)) - 1.0f) / 4.37f * 1000.0f;
tomwalters@277 46 }
tomwalters@268 47 };
tomwalters@268 48 }
tomwalters@268 49
tomwalters@268 50 #endif // _AIMC_SUPPORT_ERBTOOLS_H_