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