aubio  0.4.1
spectral/fft.h
Go to the documentation of this file.
00001 /*
00002   Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
00003 
00004   This file is part of aubio.
00005 
00006   aubio is free software: you can redistribute it and/or modify
00007   it under the terms of the GNU General Public License as published by
00008   the Free Software Foundation, either version 3 of the License, or
00009   (at your option) any later version.
00010 
00011   aubio is distributed in the hope that it will be useful,
00012   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014   GNU General Public License for more details.
00015 
00016   You should have received a copy of the GNU General Public License
00017   along with aubio.  If not, see <http://www.gnu.org/licenses/>.
00018 
00019 */
00020 
00021 /** \file 
00022 
00023   Fast Fourier Transform
00024 
00025   Depending on how aubio was compiled, FFT are computed using one of:
00026     - [Ooura](http://www.kurims.kyoto-u.ac.jp/~ooura/fft.html)
00027     - [FFTW3](http://www.fftw.org)
00028     - [vDSP](https://developer.apple.com/library/mac/#documentation/Accelerate/Reference/vDSPRef/Reference/reference.html)
00029 
00030   \example src/spectral/test-fft.c
00031 
00032 */
00033 
00034 #ifndef _AUBIO_FFT_H
00035 #define _AUBIO_FFT_H
00036 
00037 #ifdef __cplusplus
00038 extern "C" {
00039 #endif
00040 
00041 /** FFT object
00042  
00043   This object computes forward and backward FFTs.
00044 
00045 */
00046 typedef struct _aubio_fft_t aubio_fft_t;
00047 
00048 /** create new FFT computation object
00049 
00050   \param size length of the FFT
00051 
00052 */
00053 aubio_fft_t * new_aubio_fft (uint_t size);
00054 /** delete FFT object 
00055 
00056   \param s fft object as returned by new_aubio_fft
00057 
00058 */
00059 void del_aubio_fft(aubio_fft_t * s);
00060 
00061 /** compute forward FFT
00062 
00063   \param s fft object as returned by new_aubio_fft
00064   \param input input signal 
00065   \param spectrum output spectrum 
00066 
00067 */
00068 void aubio_fft_do (aubio_fft_t *s, fvec_t * input, cvec_t * spectrum);
00069 /** compute backward (inverse) FFT
00070 
00071   \param s fft object as returned by new_aubio_fft
00072   \param spectrum input spectrum 
00073   \param output output signal 
00074 
00075 */
00076 void aubio_fft_rdo (aubio_fft_t *s, cvec_t * spectrum, fvec_t * output);
00077 
00078 /** compute forward FFT
00079 
00080   \param s fft object as returned by new_aubio_fft
00081   \param input real input signal 
00082   \param compspec complex output fft real/imag
00083 
00084 */
00085 void aubio_fft_do_complex (aubio_fft_t *s, fvec_t * input, fvec_t * compspec);
00086 /** compute backward (inverse) FFT from real/imag
00087 
00088   \param s fft object as returned by new_aubio_fft
00089   \param compspec real/imag input fft array 
00090   \param output real output array 
00091 
00092 */
00093 void aubio_fft_rdo_complex (aubio_fft_t *s, fvec_t * compspec, fvec_t * output);
00094 
00095 /** convert real/imag spectrum to norm/phas spectrum 
00096 
00097   \param compspec real/imag input fft array 
00098   \param spectrum cvec norm/phas output array 
00099 
00100 */
00101 void aubio_fft_get_spectrum(fvec_t * compspec, cvec_t * spectrum);
00102 /** convert real/imag spectrum to norm/phas spectrum 
00103 
00104   \param compspec real/imag input fft array 
00105   \param spectrum cvec norm/phas output array 
00106 
00107 */
00108 void aubio_fft_get_realimag(cvec_t * spectrum, fvec_t * compspec);
00109 
00110 /** compute phas spectrum from real/imag parts 
00111 
00112   \param compspec real/imag input fft array 
00113   \param spectrum cvec norm/phas output array 
00114 
00115 */
00116 void aubio_fft_get_phas(fvec_t * compspec, cvec_t * spectrum);
00117 /** compute imaginary part from the norm/phas cvec 
00118 
00119   \param spectrum norm/phas input array 
00120   \param compspec real/imag output fft array 
00121 
00122 */
00123 void aubio_fft_get_imag(cvec_t * spectrum, fvec_t * compspec);
00124 
00125 /** compute norm component from real/imag parts 
00126 
00127   \param compspec real/imag input fft array 
00128   \param spectrum cvec norm/phas output array 
00129 
00130 */
00131 void aubio_fft_get_norm(fvec_t * compspec, cvec_t * spectrum);
00132 /** compute real part from norm/phas components 
00133 
00134   \param spectrum norm/phas input array 
00135   \param compspec real/imag output fft array 
00136 
00137 */
00138 void aubio_fft_get_real(cvec_t * spectrum, fvec_t * compspec);
00139 
00140 #ifdef __cplusplus
00141 }
00142 #endif
00143 
00144 #endif /* _AUBIO_FFT_H */
 All Data Structures Files Functions Variables Typedefs Defines