2 Copyright (C) 2003 Paul Brossier
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 Fast Fourier Transform object
29 /* note that <complex.h> is not included here but only in aubio_priv.h, so that
30 * c++ projects can still use their own complex definition. */
35 #define FFTW_TYPE fftwf_complex
37 #define FFTW_TYPE fftw_complex
42 #define FFTW_TYPE float
45 #define FFTW_TYPE double
54 typedef FFTW_TYPE fft_data_t;
58 This object computes forward and backward FFTs, using the complex type to
59 store the results. The phase vocoder or aubio_mfft_t objects should be
60 preferred to using directly aubio_fft_t. The FFT are computed using FFTW3
61 (although support for another library could be added).
64 typedef struct _aubio_fft_t aubio_fft_t;
66 /** create new FFT computation object
68 \param size length of the FFT
69 \param channels number of channels
72 aubio_fft_t * new_aubio_fft(uint_t size, uint_t channels);
75 \param s fft object as returned by new_aubio_fft
78 void del_aubio_fft(aubio_fft_t * s);
80 /** compute forward FFT
82 \param s fft object as returned by new_aubio_fft
83 \param input input signal
84 \param spectrum output spectrum
87 void aubio_fft_do (aubio_fft_t *s, fvec_t * input, cvec_t * spectrum);
88 /** compute backward (inverse) FFT
90 \param s fft object as returned by new_aubio_fft
91 \param spectrum input spectrum
92 \param output output signal
95 void aubio_fft_rdo (aubio_fft_t *s, cvec_t * spectrum, fvec_t * output);
97 /** compute forward FFT
99 \param s fft object as returned by new_aubio_fft
100 \param input real input signal
101 \param compspec complex output fft real/imag
104 void aubio_fft_do_complex (aubio_fft_t *s, fvec_t * input, fvec_t * compspec);
105 /** compute backward (inverse) FFT from real/imag
107 \param s fft object as returned by new_aubio_fft
108 \param compspec real/imag input fft array
109 \param output real output array
112 void aubio_fft_rdo_complex (aubio_fft_t *s, fvec_t * compspec, fvec_t * output);
114 /** convert real/imag spectrum to norm/phas spectrum
116 \param compspec real/imag input fft array
117 \param spectrum cvec norm/phas output array
120 void aubio_fft_get_spectrum(fvec_t * compspec, cvec_t * spectrum);
121 /** convert real/imag spectrum to norm/phas spectrum
123 \param compspec real/imag input fft array
124 \param spectrum cvec norm/phas output array
127 void aubio_fft_get_realimag(cvec_t * spectrum, fvec_t * compspec);
129 /** compute phas spectrum from real/imag parts
131 \param compspec real/imag input fft array
132 \param spectrum cvec norm/phas output array
135 void aubio_fft_get_phas(fvec_t * compspec, cvec_t * spectrum);
136 /** compute imaginary part from the norm/phas cvec
138 \param spectrum norm/phas input array
139 \param compspec real/imag output fft array
142 void aubio_fft_get_imag(cvec_t * spectrum, fvec_t * compspec);
144 /** compute norm component from real/imag parts
146 \param compspec real/imag input fft array
147 \param spectrum cvec norm/phas output array
150 void aubio_fft_get_norm(fvec_t * compspec, cvec_t * spectrum);
151 /** compute real part from norm/phas components
153 \param spectrum norm/phas input array
154 \param compspec real/imag output fft array
157 void aubio_fft_get_real(cvec_t * spectrum, fvec_t * compspec);