aubio  0.4.9
fft.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
3 
4  This file is part of aubio.
5 
6  aubio 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  aubio 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 aubio. If not, see <http://www.gnu.org/licenses/>.
18 
19 */
20 
21 /** \file
22 
23  Fast Fourier Transform
24 
25  Depending on how aubio was compiled, FFT are computed using one of:
26  - [Ooura](http://www.kurims.kyoto-u.ac.jp/~ooura/fft.html)
27  - [FFTW3](http://www.fftw.org)
28  - [vDSP](https://developer.apple.com/library/mac/#documentation/Accelerate/Reference/vDSPRef/Reference/reference.html)
29 
30  \example spectral/test-fft.c
31 
32 */
33 
34 #ifndef AUBIO_FFT_H
35 #define AUBIO_FFT_H
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 /** FFT object
42 
43  This object computes forward and backward FFTs.
44 
45 */
46 typedef struct _aubio_fft_t aubio_fft_t;
47 
48 /** create new FFT computation object
49 
50  \param size length of the FFT
51 
52 */
54 /** delete FFT object
55 
56  \param s fft object as returned by new_aubio_fft
57 
58 */
59 void del_aubio_fft(aubio_fft_t * s);
60 
61 /** compute forward FFT
62 
63  \param s fft object as returned by new_aubio_fft
64  \param input input signal
65  \param spectrum output spectrum
66 
67 */
68 void aubio_fft_do (aubio_fft_t *s, const fvec_t * input, cvec_t * spectrum);
69 /** compute backward (inverse) FFT
70 
71  \param s fft object as returned by new_aubio_fft
72  \param spectrum input spectrum
73  \param output output signal
74 
75 */
76 void aubio_fft_rdo (aubio_fft_t *s, const cvec_t * spectrum, fvec_t * output);
77 
78 /** compute forward FFT
79 
80  \param s fft object as returned by new_aubio_fft
81  \param input real input signal
82  \param compspec complex output fft real/imag
83 
84 */
85 void aubio_fft_do_complex (aubio_fft_t *s, const fvec_t * input, fvec_t * compspec);
86 /** compute backward (inverse) FFT from real/imag
87 
88  \param s fft object as returned by new_aubio_fft
89  \param compspec real/imag input fft array
90  \param output real output array
91 
92 */
93 void aubio_fft_rdo_complex (aubio_fft_t *s, const fvec_t * compspec, fvec_t * output);
94 
95 /** convert real/imag spectrum to norm/phas spectrum
96 
97  \param compspec real/imag input fft array
98  \param spectrum cvec norm/phas output array
99 
100 */
101 void aubio_fft_get_spectrum(const fvec_t * compspec, cvec_t * spectrum);
102 /** convert real/imag spectrum to norm/phas spectrum
103 
104  \param compspec real/imag input fft array
105  \param spectrum cvec norm/phas output array
106 
107 */
108 void aubio_fft_get_realimag(const cvec_t * spectrum, fvec_t * compspec);
109 
110 /** compute phas spectrum from real/imag parts
111 
112  \param compspec real/imag input fft array
113  \param spectrum cvec norm/phas output array
114 
115 */
116 void aubio_fft_get_phas(const fvec_t * compspec, cvec_t * spectrum);
117 /** compute imaginary part from the norm/phas cvec
118 
119  \param spectrum norm/phas input array
120  \param compspec real/imag output fft array
121 
122 */
123 void aubio_fft_get_imag(const cvec_t * spectrum, fvec_t * compspec);
124 
125 /** compute norm component from real/imag parts
126 
127  \param compspec real/imag input fft array
128  \param spectrum cvec norm/phas output array
129 
130 */
131 void aubio_fft_get_norm(const fvec_t * compspec, cvec_t * spectrum);
132 /** compute real part from norm/phas components
133 
134  \param spectrum norm/phas input array
135  \param compspec real/imag output fft array
136 
137 */
138 void aubio_fft_get_real(const cvec_t * spectrum, fvec_t * compspec);
139 
140 #ifdef __cplusplus
141 }
142 #endif
143 
144 #endif /* AUBIO_FFT_H */
void aubio_fft_do_complex(aubio_fft_t *s, const fvec_t *input, fvec_t *compspec)
compute forward FFT
void aubio_fft_get_norm(const fvec_t *compspec, cvec_t *spectrum)
compute norm component from real/imag parts
void aubio_fft_get_realimag(const cvec_t *spectrum, fvec_t *compspec)
convert real/imag spectrum to norm/phas spectrum
void aubio_fft_get_phas(const fvec_t *compspec, cvec_t *spectrum)
compute phas spectrum from real/imag parts
aubio_fft_t * new_aubio_fft(uint_t size)
create new FFT computation object
void aubio_fft_rdo_complex(aubio_fft_t *s, const fvec_t *compspec, fvec_t *output)
compute backward (inverse) FFT from real/imag
void aubio_fft_do(aubio_fft_t *s, const fvec_t *input, cvec_t *spectrum)
compute forward FFT
void aubio_fft_get_spectrum(const fvec_t *compspec, cvec_t *spectrum)
convert real/imag spectrum to norm/phas spectrum
void del_aubio_fft(aubio_fft_t *s)
delete FFT object
Buffer for real data.
Definition: fvec.h:67
void aubio_fft_rdo(aubio_fft_t *s, const cvec_t *spectrum, fvec_t *output)
compute backward (inverse) FFT
Vector of real-valued phase and spectrum data.
Definition: cvec.h:63
unsigned int uint_t
unsigned integer
Definition: types.h:60
void aubio_fft_get_real(const cvec_t *spectrum, fvec_t *compspec)
compute real part from norm/phas components
void aubio_fft_get_imag(const cvec_t *spectrum, fvec_t *compspec)
compute imaginary part from the norm/phas cvec
struct _aubio_fft_t aubio_fft_t
FFT object.
Definition: fft.h:46