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