Nsound  0.9.4
Vocoder.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 //
3 // $Id: Vocoder.h 874 2014-09-08 02:21:29Z weegreenblobbie $
4 //
5 // Copyright (c) 2008 to Present Nick Hilton
6 //
7 // weegreenblobbie_yahoo_com (replace '_' with '@' and '.')
8 //
9 //-----------------------------------------------------------------------------
10 
11 //-----------------------------------------------------------------------------
12 //
13 // This program is free software; you can redistribute it and/or modify
14 // it under the terms of the GNU General Public License as published by
15 // the Free Software Foundation; either version 2 of the License, or
16 // (at your option) any later version.
17 //
18 // This program is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 // GNU Library General Public License for more details.
22 //
23 // You should have received a copy of the GNU General Public License
24 // along with this program; if not, write to the Free Software
25 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 //
27 //-----------------------------------------------------------------------------
28 #ifndef _NSOUND_VOCODER_H_
29 #define _NSOUND_VOCODER_H_
30 
31 #include <Nsound/Buffer.h>
32 
33 #include <vector>
34 
35 namespace Nsound
36 {
37 
38 class AudioStream;
39 class Buffer;
40 class Filter;
41 class FilterMovingAverage;
42 
43 //-----------------------------------------------------------------------------
44 class Vocoder
45 {
46  public:
47 
49  //
55  Vocoder(
56  const float64 & sample_rate,
57  const float64 & window_length,
58  const uint32 & n_bands,
59  const float64 & freq_max = 4000.0,
60  const bool use_mel_scale = true,
61  const bool plot_filter_bank = false);
62 
63  virtual ~Vocoder();
64 
65  Buffer
66  filter(const Buffer & voice, const Buffer & carrier);
67 
68  float64
69  filter(const float64 & voice, const float64 & carrier);
70 
71  float64
72  getSampleRate() const { return sample_rate_; };
73 
74  void
75  reset();
76 
77  protected:
78 
83 
84  typedef std::vector< Filter * > FilterVector;
85 
89 
90 };
91 
92 } // namespace
93 
94 // :mode=c++: jEdit modeline
95 #endif
unsigned int uint32
Definition: Nsound.h:153
uint32 n_bands_
Definition: Vocoder.h:81
double float64
Definition: Nsound.h:146
std::vector< Filter * > FilterVector
Definition: Vocoder.h:84
float64 getSampleRate() const
Definition: Vocoder.h:72
uint32 window_size_
Definition: Vocoder.h:80
virtual ~Vocoder()
Definition: Vocoder.cc:212
void reset()
Definition: Vocoder.cc:286
FilterVector filters_input_
Definition: Vocoder.h:86
FilterVector filters_output_
Definition: Vocoder.h:87
float64 freq_max_
Definition: Vocoder.h:82
float64 sample_rate_
Definition: Vocoder.h:79
A Buffer for storing audio samples.
Definition: Buffer.h:60
FilterVector moving_average_
Definition: Vocoder.h:88
Vocoder(const float64 &sample_rate, const float64 &window_length, const uint32 &n_bands, const float64 &freq_max=4000.0, const bool use_mel_scale=true, const bool plot_filter_bank=false)
Default Constructor.
Definition: Vocoder.cc:69
Buffer filter(const Buffer &voice, const Buffer &carrier)
Definition: Vocoder.cc:234