annotate trunk/src/Modules/Strobes/ModuleParabola.h @ 277:6b4921704eb1

- Ported over HTK file output - Added some more meat to the Slaney IIR gammatone implementation - Ported over the AIM-MAT sf2003 parabola strobe algorithm - Finished making the SAI implementation compile - Ported over the strobe list class (now uses STL deques internally)
author tomwalters
date Thu, 18 Feb 2010 16:55:40 +0000
parents
children f469d936337f
rev   line source
tomwalters@277 1 // Copyright 2007-2010, Thomas Walters
tomwalters@277 2 //
tomwalters@277 3 // AIM-C: A C++ implementation of the Auditory Image Model
tomwalters@277 4 // http://www.acousticscale.org/AIMC
tomwalters@277 5 //
tomwalters@277 6 // This program is free software: you can redistribute it and/or modify
tomwalters@277 7 // it under the terms of the GNU General Public License as published by
tomwalters@277 8 // the Free Software Foundation, either version 3 of the License, or
tomwalters@277 9 // (at your option) any later version.
tomwalters@277 10 //
tomwalters@277 11 // This program is distributed in the hope that it will be useful,
tomwalters@277 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
tomwalters@277 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
tomwalters@277 14 // GNU General Public License for more details.
tomwalters@277 15 //
tomwalters@277 16 // You should have received a copy of the GNU General Public License
tomwalters@277 17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
tomwalters@277 18
tomwalters@277 19 /*!
tomwalters@277 20 * \file
tomwalters@277 21 * \brief SAI 2003 module - for any output frame rate
tomwalters@277 22 *
tomwalters@277 23 * \author Tom Walters <tcw24@cam.ac.uk>
tomwalters@277 24 * \date created 2007/03/28
tomwalters@277 25 * \version \$Id$
tomwalters@277 26 */
tomwalters@277 27
tomwalters@277 28 #ifndef _AIMC_MODULE_STROBES_PARABOLA_H_
tomwalters@277 29 #define _AIMC_MODULE_STROBES_PARABOLA_H_
tomwalters@277 30
tomwalters@277 31 #include <vector>
tomwalters@277 32
tomwalters@277 33 #include "Support/Module.h"
tomwalters@277 34 #include "Support/Parameters.h"
tomwalters@277 35 #include "Support/SignalBank.h"
tomwalters@277 36
tomwalters@277 37 /*!
tomwalters@277 38 * \class ModuleParabola "Modules/SAI/ModuleParabola.h"
tomwalters@277 39 * \brief SF 2003
tomwalters@277 40 */
tomwalters@277 41 namespace aimc {
tomwalters@277 42 using std::vector;
tomwalters@277 43 class ModuleParabola : public Module {
tomwalters@277 44 public:
tomwalters@277 45 ModuleParabola(Parameters *params);
tomwalters@277 46 virtual ~ModuleParabola();
tomwalters@277 47 void Process(const SignalBank& input);
tomwalters@277 48 private:
tomwalters@277 49 /*! \brief Prepare the module
tomwalters@277 50 * \param input Input signal bank
tomwalters@277 51 * \param output true on success false on failure
tomwalters@277 52 */
tomwalters@277 53 virtual bool InitializeInternal(const SignalBank& input);
tomwalters@277 54
tomwalters@277 55 virtual void ResetInternal();
tomwalters@277 56
tomwalters@277 57
tomwalters@277 58 //! \brief Number of samples over which the strobe should be decayed to zero
tomwalters@277 59 int strobe_decay_samples_;
tomwalters@277 60
tomwalters@277 61 /*! \brief Current strobe thresholds, one for each bank channel.
tomwalters@277 62 *
tomwalters@277 63 * This value is decayed over time.
tomwalters@277 64 */
tomwalters@277 65 vector<float> threshold_;
tomwalters@277 66
tomwalters@277 67 /*! \brief Signal value at the last strobe, one for each bank channel.
tomwalters@277 68 *
tomwalters@277 69 * This value is not decayed over time.
tomwalters@277 70 */
tomwalters@277 71 vector<float> last_threshold_;
tomwalters@277 72
tomwalters@277 73 //! \brief Parabola height parameter
tomwalters@277 74 float height_;
tomwalters@277 75
tomwalters@277 76 //! \brief Parabola width paramters
tomwalters@277 77 float parabw_;
tomwalters@277 78
tomwalters@277 79 //! \brief Parabola a value
tomwalters@277 80 vector<float> parab_a_;
tomwalters@277 81
tomwalters@277 82 //! \brief Parabola b value
tomwalters@277 83 vector<float> parab_b_;
tomwalters@277 84
tomwalters@277 85 //! \brief Parabola calculation variable
tomwalters@277 86 vector<float> parab_wnull_;
tomwalters@277 87
tomwalters@277 88 //! \brief Parabola calculation variable
tomwalters@277 89 vector<int> parab_var_samples_;
tomwalters@277 90
tomwalters@277 91 //! \brief Storage for the number of samples since the last strobe
tomwalters@277 92 vector<int> samples_since_last_strobe_;
tomwalters@277 93
tomwalters@277 94 vector<float> prev_sample_;
tomwalters@277 95 vector<float> curr_sample_;
tomwalters@277 96 vector<float> next_sample_;
tomwalters@277 97
tomwalters@277 98 float alpha_;
tomwalters@277 99 int channel_count_;
tomwalters@277 100 float sample_rate_;
tomwalters@277 101 float strobe_decay_time_;
tomwalters@277 102 int max_strobes_;
tomwalters@277 103 };
tomwalters@277 104 } // namespace aimc
tomwalters@277 105
tomwalters@277 106 #endif // _AIM_MODULE_STROBES_PARABOLA_H_