comparison trunk/src/Modules/SNR/ModuleNoise.h @ 305:ed91095d9240

-New AIMCopy main for the SSI features (temporary hack till I get a working module load system) -LocalMax strobe criterion. This is faster and better than the parabola version, which still seems buggy. -Noise generator module. Adds noise to a signal. Uses boost for the random number generator. -New options for the SSI -Slice now respects all its flags (oops!). -MATLAB functions for visualisation -Scripts for generating data to view in MATLAB -Script to download and build HTK - useful for running experiments
author tomwalters
date Thu, 25 Feb 2010 22:02:00 +0000
parents
children 30dde71d0230
comparison
equal deleted inserted replaced
304:e4f704f67ca6 305:ed91095d9240
1 // Copyright 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 * \author Thomas Walters <tom@acousticscale.org>
21 * \date created 2010/02/24
22 * \version \$Id$
23 */
24
25 #ifndef AIMC_MODULES_SNR_NOISE_H_
26 #define AIMC_MODULES_SNR_NOISE_H_
27
28 #include <boost/random.hpp>
29
30 #include "Support/Module.h"
31
32 namespace aimc {
33 class ModuleNoise : public Module {
34 public:
35 explicit ModuleNoise(Parameters *pParam);
36 virtual ~ModuleNoise();
37
38 /*! \brief Process a buffer
39 */
40 virtual void Process(const SignalBank &input);
41
42 private:
43 /*! \brief Reset the internal state of the module
44 */
45 virtual void ResetInternal();
46
47 /*! \brief Prepare the module
48 * \param input Input signal
49 * \param output true on success false on failure
50 */
51 virtual bool InitializeInternal(const SignalBank &input);
52
53 float sample_rate_;
54 int buffer_length_;
55 int channel_count_;
56
57 float multiplier_;
58
59 // Random number generator which yeilds Gaussian-distributed values by
60 // The generator is a Mersenne twister
61 boost::variate_generator<boost::mt19937,
62 boost::normal_distribution<float> >
63 gaussian_variate_;
64 };
65 } // namespace aimc
66
67 #endif // AIMC_MODULES_SNR_NOISE_H_