1 // Copyright 2004 "Gilles Degottex"
3 // This file is part of "Music"
5 // "Music" is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published by
7 // the Free Software Foundation; either version 2.1 of the License, or
8 // (at your option) any later version.
10 // "Music" is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #ifndef _Convolution_h_
21 #define _Convolution_h_
30 //! do a convolution with a specfic wave for a desired note
33 //! the desired semi-tone from A3
35 //! the corresponding frequency
37 //! latency factor, used for statistical purpose (40.0)
38 const double m_latency_factor;
39 //! duration in seconds
40 const double m_duration;
42 //! the wave: the signal is convolued with
43 vector< complex<double> > m_wave;
46 complex<double> m_value;
50 * \param AFreq frequency of A3 (440.0)
51 * \param sampling_rate wave capture sampling rate (11khz;44khz)
52 * \param latency_factor latency factor [1;oo[
53 * \param gauss_factor the factor for the window fonction applied on the analysed sample (2.0)
54 * \param ht analysed semi-tone (-48;+48)
56 Convolution(double latency_factor, double gauss_factor, double ht);
58 //! return the size of the analyse (the algorithmical N)
59 size_t size() {return m_wave.size();}
61 //! compute a convolution
62 void apply(const deque<double>& buff, int start=0);
66 #endif // _Convolution_h_