annotate src/Modules/BMM/ModuleGammatone.h @ 639:7c3671f98280

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