Nsound
0.9.4
Main Page
Namespaces
Classes
Files
File List
File Members
Nsound
FFTransform.h
Go to the documentation of this file.
1
//-----------------------------------------------------------------------------
2
//
3
// $Id: FFTransform.h 874 2014-09-08 02:21:29Z weegreenblobbie $
4
//
5
// Nsound is a C++ library and Python module for audio synthesis featuring
6
// dynamic digital filters. Nsound lets you easily shape waveforms and write
7
// to disk or plot them. Nsound aims to be as powerful as Csound but easy to
8
// use.
9
//
10
// Copyright (c) 2007-Present Nick Hilton
11
//
12
// weegreenblobbie_yahoo_com (replace '_' with '@' and '.')
13
//
14
//-----------------------------------------------------------------------------
15
16
//-----------------------------------------------------------------------------
17
//
18
// This program is free software; you can redistribute it and/or modify
19
// it under the terms of the GNU General Public License as published by
20
// the Free Software Foundation; either version 2 of the License, or
21
// (at your option) any later version.
22
//
23
// This program is distributed in the hope that it will be useful,
24
// but WITHOUT ANY WARRANTY; without even the implied warranty of
25
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26
// GNU Library General Public License for more details.
27
//
28
// You should have received a copy of the GNU General Public License
29
// along with this program; if not, write to the Free Software
30
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31
//
32
//-----------------------------------------------------------------------------
33
#ifndef _NSOUND_FFTRANSFORM_H_
34
#define _NSOUND_FFTRANSFORM_H_
35
36
#include <
Nsound/Nsound.h
>
37
#include <
Nsound/FFTChunk.h
>
38
#include <
Nsound/WindowType.h
>
39
40
namespace
Nsound
41
{
42
43
class
Buffer;
44
class
FFTChunk;
45
46
//-----------------------------------------------------------------------------
47
//
49
//
57
class
FFTransform
58
{
59
public
:
60
73
FFTransform
(
const
float64
& sample_rate);
74
75
77
~FFTransform
(){};
78
80
//
99
Buffer
100
fft
(
const
Buffer
& time_domain)
const
;
101
103
//
154
FFTChunkVector
155
fft
(
const
Buffer
& input,
int32
n_order,
int32
n_overlap = 0)
const
;
156
158
//
181
Buffer
182
ifft
(
const
FFTChunkVector
& input)
const
;
183
185
//
205
Buffer
206
ifft
(
const
Buffer
& frequency_domain)
const
;
207
209
static
210
int32
211
roundUp2
(
int32
raw);
212
214
void
215
setWindow
(
WindowType
type);
216
217
protected
:
218
220
uint32
sample_rate_
;
221
222
private
:
223
225
void
226
fft
(
Buffer
& real,
Buffer
& img,
int32
n_order)
const
;
227
228
WindowType
type_
;
229
230
};
// class BufferChunk
231
232
}
// namespace Nsound
233
234
#endif
235
236
// :mode=c++: jEdit modeline
Nsound::uint32
unsigned int uint32
Definition:
Nsound.h:153
FFTChunk.h
Nsound::FFTransform::~FFTransform
~FFTransform()
Destructor.
Definition:
FFTransform.h:77
Nsound::FFTransform::FFTransform
FFTransform(const float64 &sample_rate)
Definition:
FFTransform.cc:41
Nsound::FFTransform::ifft
Buffer ifft(const FFTChunkVector &input) const
Peforms an inverse FFT on each FFTChunk and concatenates the output.
Definition:
FFTransform.cc:207
Nsound.h
Nsound::float64
double float64
Definition:
Nsound.h:146
Nsound::FFTransform::setWindow
void setWindow(WindowType type)
A window is multiplied by the input prior to performing the transform, this help reduce artifacts nea...
Definition:
FFTransform.cc:292
Nsound::FFTransform::roundUp2
static int32 roundUp2(int32 raw)
Returns nearest power of 2 >= raw.
Definition:
FFTransform.cc:274
WindowType.h
Nsound::FFTransform::sample_rate_
uint32 sample_rate_
Samples per second.
Definition:
FFTransform.h:220
Nsound::FFTransform::type_
WindowType type_
Definition:
FFTransform.h:228
Nsound::FFTransform
A Class that performes the Fast Fouier Transfrom on a Buffer.
Definition:
FFTransform.h:57
Nsound::Buffer
A Buffer for storing audio samples.
Definition:
Buffer.h:60
Nsound::int32
signed int int32
Definition:
Nsound.h:142
Nsound::FFTransform::fft
Buffer fft(const Buffer &time_domain) const
Transforms the time_domain signal and calculates the FFT.
Definition:
FFTransform.cc:50
Nsound::FFTChunkVector
std::vector< FFTChunk > FFTChunkVector
Definition:
FFTChunk.h:119
Nsound::WindowType
WindowType
Definition:
WindowType.h:39
Generated on Sun Aug 23 2015 11:51:50 for Nsound by
1.8.6