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