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@4: // This program is free software: you can redistribute it and/or modify tomwalters@4: // it under the terms of the GNU General Public License as published by tomwalters@4: // the Free Software Foundation, either version 3 of the License, or tomwalters@4: // (at your option) any later version. tomwalters@4: // tomwalters@4: // This program is distributed in the hope that it will be useful, tomwalters@4: // but WITHOUT ANY WARRANTY; without even the implied warranty of tomwalters@4: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the tomwalters@4: // GNU General Public License for more details. tomwalters@4: // tomwalters@4: // You should have received a copy of the GNU General Public License tomwalters@4: // along with this program. If not, see . 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_