tomwalters@268: // Copyright 2006-2010, Thomas Walters
tomwalters@268: //
tomwalters@268: // AIM-C: A C++ implementation of the Auditory Image Model
tomwalters@268: // http://www.acousticscale.org/AIMC
tomwalters@268: //
tomwalters@268: // This program is free software: you can redistribute it and/or modify
tomwalters@268: // it under the terms of the GNU General Public License as published by
tomwalters@268: // the Free Software Foundation, either version 3 of the License, or
tomwalters@268: // (at your option) any later version.
tomwalters@268: //
tomwalters@268: // This program is distributed in the hope that it will be useful,
tomwalters@268: // but WITHOUT ANY WARRANTY; without even the implied warranty of
tomwalters@268: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
tomwalters@268: // GNU General Public License for more details.
tomwalters@268: //
tomwalters@268: // You should have received a copy of the GNU General Public License
tomwalters@268: // along with this program. If not, see .
tomwalters@268:
tomwalters@268: /*! \file
tomwalters@277: * \brief ERB calculations
tomwalters@268: */
tomwalters@268:
tomwalters@268: /*! \author: Thomas Walters
tomwalters@268: * \date 2010/01/23
tomwalters@268: * \version \$Id: ERBTools.h 1 2010-02-02 11:04:50Z tcw $
tomwalters@268: */
tomwalters@268:
tomwalters@283: #ifndef AIMC_SUPPORT_ERBTOOLS_H_
tomwalters@283: #define AIMC_SUPPORT_ERBTOOLS_H_
tomwalters@268:
tomwalters@287: #include
tomwalters@268:
tomwalters@268: namespace aimc {
tomwalters@268: class ERBTools {
tomwalters@268: public:
tomwalters@268: static float Freq2ERB(float freq) {
tomwalters@268: return 21.4f * log10(4.37f * freq / 1000.0f + 1.0f);
tomwalters@268: }
tomwalters@268:
tomwalters@268: static float Freq2ERBw(float freq) {
tomwalters@268: return 24.7f * (4.37f * freq / 1000.0f + 1.0f);
tomwalters@268: }
tomwalters@277:
tomwalters@277: static float ERB2Freq(float erb) {
tomwalters@277: return (pow(10, (erb / 21.4f)) - 1.0f) / 4.37f * 1000.0f;
tomwalters@277: }
tomwalters@268: };
tomwalters@268: }
tomwalters@268:
tomwalters@283: #endif // AIMC_SUPPORT_ERBTOOLS_H_