annotate trunk/src/Modules/BMM/ModuleGammatone.h @ 706:f8e90b5d85fd tip

Delete CARFAC code from this repository. It has been moved to https://github.com/google/carfac Please email me with your github username to get access. I've also created a new mailing list to discuss CARFAC development: https://groups.google.com/forum/#!forum/carfac-dev
author ronw@google.com
date Thu, 18 Jul 2013 20:56:51 +0000
parents 30dde71d0230
children
rev   line source
tomwalters@276 1 // Copyright 2009-2010, Thomas Walters
tomwalters@276 2 //
tomwalters@276 3 // AIM-C: A C++ implementation of the Auditory Image Model
tomwalters@276 4 // http://www.acousticscale.org/AIMC
tomwalters@276 5 //
tomwalters@318 6 // Licensed under the Apache License, Version 2.0 (the "License");
tomwalters@318 7 // you may not use this file except in compliance with the License.
tomwalters@318 8 // You may obtain a copy of the License at
tomwalters@276 9 //
tomwalters@318 10 // http://www.apache.org/licenses/LICENSE-2.0
tomwalters@276 11 //
tomwalters@318 12 // Unless required by applicable law or agreed to in writing, software
tomwalters@318 13 // distributed under the License is distributed on an "AS IS" BASIS,
tomwalters@318 14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
tomwalters@318 15 // See the License for the specific language governing permissions and
tomwalters@318 16 // limitations under the License.
tomwalters@276 17
tomwalters@276 18 /*! \file
tomwalters@276 19 * \brief Slaney's gammatone filterbank
tomwalters@276 20 *
tomwalters@276 21 * \author Thomas Walters <tom@acousticscale.org>
tomwalters@276 22 * \date created 2009/11/13
tomwalters@276 23 * \version \$Id$
tomwalters@288 24 *
tomwalters@288 25 * This is the version of the IIR gammatone used in Slaney's Auditory toolbox.
tomwalters@288 26 * The original verison as described in Apple Tech. Report #35 has a problem
tomwalters@288 27 * with the high-order coefficients at low centre frequencies and high sample
tomwalters@288 28 * rates. Since it is important that AIM-C can deal with these cases (for
tomwalters@288 29 * example for the Gaussian features), I've reiplemeted Slaney's alternative
tomwalters@288 30 * version which uses a cascade of four second-order filters in place of the
tomwalters@288 31 * eighth-order filter.
tomwalters@276 32 */
tomwalters@280 33 #ifndef _AIMC_MODULES_BMM_GAMMATONE_H_
tomwalters@280 34 #define _AIMC_MODULES_BMM_GAMMATONE_H_
tomwalters@276 35
tomwalters@276 36 #include <vector>
tomwalters@276 37
tomwalters@277 38 #include "Support/Module.h"
tomwalters@277 39 #include "Support/Parameters.h"
tomwalters@277 40 #include "Support/SignalBank.h"
tomwalters@277 41
tomwalters@276 42 namespace aimc {
tomwalters@276 43 using std::vector;
tomwalters@276 44 class ModuleGammatone : public Module {
tomwalters@276 45 public:
tomwalters@280 46 explicit ModuleGammatone(Parameters *params);
tomwalters@276 47 virtual ~ModuleGammatone();
tomwalters@280 48 /*! \brief Process a buffer
tomwalters@280 49 */
tomwalters@276 50 virtual void Process(const SignalBank &input);
tomwalters@276 51
tomwalters@276 52 private:
tomwalters@276 53 virtual bool InitializeInternal(const SignalBank& input);
tomwalters@276 54 virtual void ResetInternal();
tomwalters@288 55
tomwalters@288 56 // Filter coefficients
tomwalters@288 57 vector<vector<double> > b1_;
tomwalters@288 58 vector<vector<double> > b2_;
tomwalters@288 59 vector<vector<double> > b3_;
tomwalters@288 60 vector<vector<double> > b4_;
tomwalters@288 61 vector<vector<double> > a_;
tomwalters@288 62
tomwalters@288 63 vector<vector<double> > state_1_;
tomwalters@288 64 vector<vector<double> > state_2_;
tomwalters@288 65 vector<vector<double> > state_3_;
tomwalters@288 66 vector<vector<double> > state_4_;
tomwalters@288 67
tomwalters@288 68 vector<double> centre_frequencies_;
tomwalters@276 69 int num_channels_;
tomwalters@288 70 double max_frequency_;
tomwalters@288 71 double min_frequency_;
tomwalters@276 72 };
tomwalters@280 73 } // namespace aimc
tomwalters@280 74 #endif // _AIMC_MODULES_BMM_GAMMATONE_H_