tomwalters@276: // Copyright 2009-2010, Thomas Walters tomwalters@276: // tomwalters@276: // AIM-C: A C++ implementation of the Auditory Image Model tomwalters@276: // http://www.acousticscale.org/AIMC tomwalters@276: // tomwalters@318: // Licensed under the Apache License, Version 2.0 (the "License"); tomwalters@318: // you may not use this file except in compliance with the License. tomwalters@318: // You may obtain a copy of the License at tomwalters@276: // tomwalters@318: // http://www.apache.org/licenses/LICENSE-2.0 tomwalters@276: // tomwalters@318: // Unless required by applicable law or agreed to in writing, software tomwalters@318: // distributed under the License is distributed on an "AS IS" BASIS, tomwalters@318: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. tomwalters@318: // See the License for the specific language governing permissions and tomwalters@318: // limitations under the License. tomwalters@276: tomwalters@276: /*! \file tomwalters@276: * \brief Slaney's gammatone filterbank tomwalters@276: * tomwalters@276: * \author Thomas Walters tomwalters@276: * \date created 2009/11/13 tomwalters@276: * \version \$Id$ tomwalters@288: * tomwalters@288: * This is the version of the IIR gammatone used in Slaney's Auditory toolbox. tomwalters@288: * The original verison as described in Apple Tech. Report #35 has a problem tomwalters@288: * with the high-order coefficients at low centre frequencies and high sample tomwalters@288: * rates. Since it is important that AIM-C can deal with these cases (for tomwalters@288: * example for the Gaussian features), I've reiplemeted Slaney's alternative tomwalters@288: * version which uses a cascade of four second-order filters in place of the tomwalters@288: * eighth-order filter. tomwalters@276: */ tomwalters@280: #ifndef _AIMC_MODULES_BMM_GAMMATONE_H_ tomwalters@280: #define _AIMC_MODULES_BMM_GAMMATONE_H_ tomwalters@276: tomwalters@276: #include tomwalters@276: tomwalters@277: #include "Support/Module.h" tomwalters@277: #include "Support/Parameters.h" tomwalters@277: #include "Support/SignalBank.h" tomwalters@277: tomwalters@276: namespace aimc { tomwalters@276: using std::vector; tomwalters@276: class ModuleGammatone : public Module { tomwalters@276: public: tomwalters@280: explicit ModuleGammatone(Parameters *params); tomwalters@276: virtual ~ModuleGammatone(); tomwalters@280: /*! \brief Process a buffer tomwalters@280: */ tomwalters@276: virtual void Process(const SignalBank &input); tomwalters@276: tomwalters@276: private: tomwalters@276: virtual bool InitializeInternal(const SignalBank& input); tomwalters@276: virtual void ResetInternal(); tomwalters@288: tomwalters@288: // Filter coefficients tomwalters@288: vector > b1_; tomwalters@288: vector > b2_; tomwalters@288: vector > b3_; tomwalters@288: vector > b4_; tomwalters@288: vector > a_; tomwalters@288: tomwalters@288: vector > state_1_; tomwalters@288: vector > state_2_; tomwalters@288: vector > state_3_; tomwalters@288: vector > state_4_; tomwalters@288: tomwalters@288: vector centre_frequencies_; tomwalters@276: int num_channels_; tomwalters@288: double max_frequency_; tomwalters@288: double min_frequency_; tomwalters@276: }; tomwalters@280: } // namespace aimc tomwalters@280: #endif // _AIMC_MODULES_BMM_GAMMATONE_H_