[96fb8ad] | 1 | /* |
---|
[b235c0e] | 2 | Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> |
---|
[e6a78ea] | 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 | |
---|
[96fb8ad] | 19 | */ |
---|
| 20 | |
---|
[2afdb0f] | 21 | /** \file |
---|
| 22 | |
---|
[78a42e2] | 23 | Fast Fourier Transform |
---|
[2afdb0f] | 24 | |
---|
[ad76ce2] | 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 | |
---|
[b8c0685] | 30 | \example src/spectral/test-fft.c |
---|
| 31 | |
---|
[2afdb0f] | 32 | */ |
---|
[96fb8ad] | 33 | |
---|
[b235c0e] | 34 | #ifndef _AUBIO_FFT_H |
---|
| 35 | #define _AUBIO_FFT_H |
---|
[66834b6] | 36 | |
---|
[96fb8ad] | 37 | #ifdef __cplusplus |
---|
| 38 | extern "C" { |
---|
| 39 | #endif |
---|
| 40 | |
---|
[2afdb0f] | 41 | /** FFT object |
---|
| 42 | |
---|
[ad76ce2] | 43 | This object computes forward and backward FFTs. |
---|
[2afdb0f] | 44 | |
---|
| 45 | */ |
---|
[96fb8ad] | 46 | typedef struct _aubio_fft_t aubio_fft_t; |
---|
| 47 | |
---|
[2afdb0f] | 48 | /** create new FFT computation object |
---|
| 49 | |
---|
| 50 | \param size length of the FFT |
---|
| 51 | |
---|
| 52 | */ |
---|
[d95ff38] | 53 | aubio_fft_t * new_aubio_fft (uint_t size); |
---|
[2afdb0f] | 54 | /** delete FFT object |
---|
| 55 | |
---|
| 56 | \param s fft object as returned by new_aubio_fft |
---|
| 57 | |
---|
| 58 | */ |
---|
[227564e] | 59 | void del_aubio_fft(aubio_fft_t * s); |
---|
[aadd27a] | 60 | |
---|
[2afdb0f] | 61 | /** compute forward FFT |
---|
| 62 | |
---|
| 63 | \param s fft object as returned by new_aubio_fft |
---|
[aadd27a] | 64 | \param input input signal |
---|
[2afdb0f] | 65 | \param spectrum output spectrum |
---|
| 66 | |
---|
| 67 | */ |
---|
[aadd27a] | 68 | void aubio_fft_do (aubio_fft_t *s, fvec_t * input, cvec_t * spectrum); |
---|
[2afdb0f] | 69 | /** compute backward (inverse) FFT |
---|
| 70 | |
---|
| 71 | \param s fft object as returned by new_aubio_fft |
---|
| 72 | \param spectrum input spectrum |
---|
[aadd27a] | 73 | \param output output signal |
---|
[2afdb0f] | 74 | |
---|
| 75 | */ |
---|
[aadd27a] | 76 | void aubio_fft_rdo (aubio_fft_t *s, cvec_t * spectrum, fvec_t * output); |
---|
[2afdb0f] | 77 | |
---|
[aadd27a] | 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 |
---|
[2afdb0f] | 83 | |
---|
| 84 | */ |
---|
[aadd27a] | 85 | void aubio_fft_do_complex (aubio_fft_t *s, 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 |
---|
[2afdb0f] | 91 | |
---|
| 92 | */ |
---|
[aadd27a] | 93 | void aubio_fft_rdo_complex (aubio_fft_t *s, fvec_t * compspec, fvec_t * output); |
---|
[96fb8ad] | 94 | |
---|
[aadd27a] | 95 | /** convert real/imag spectrum to norm/phas spectrum |
---|
[f88a326] | 96 | |
---|
[aadd27a] | 97 | \param compspec real/imag input fft array |
---|
| 98 | \param spectrum cvec norm/phas output array |
---|
[2afdb0f] | 99 | |
---|
| 100 | */ |
---|
[aadd27a] | 101 | void aubio_fft_get_spectrum(fvec_t * compspec, cvec_t * spectrum); |
---|
| 102 | /** convert real/imag spectrum to norm/phas spectrum |
---|
[2afdb0f] | 103 | |
---|
[aadd27a] | 104 | \param compspec real/imag input fft array |
---|
| 105 | \param spectrum cvec norm/phas output array |
---|
[2afdb0f] | 106 | |
---|
| 107 | */ |
---|
[aadd27a] | 108 | void aubio_fft_get_realimag(cvec_t * spectrum, fvec_t * compspec); |
---|
| 109 | |
---|
| 110 | /** compute phas spectrum from real/imag parts |
---|
[2afdb0f] | 111 | |
---|
[aadd27a] | 112 | \param compspec real/imag input fft array |
---|
| 113 | \param spectrum cvec norm/phas output array |
---|
[2afdb0f] | 114 | |
---|
| 115 | */ |
---|
[aadd27a] | 116 | void aubio_fft_get_phas(fvec_t * compspec, cvec_t * spectrum); |
---|
| 117 | /** compute imaginary part from the norm/phas cvec |
---|
[2afdb0f] | 118 | |
---|
[aadd27a] | 119 | \param spectrum norm/phas input array |
---|
| 120 | \param compspec real/imag output fft array |
---|
[2afdb0f] | 121 | |
---|
| 122 | */ |
---|
[aadd27a] | 123 | void aubio_fft_get_imag(cvec_t * spectrum, fvec_t * compspec); |
---|
[2afdb0f] | 124 | |
---|
[aadd27a] | 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 |
---|
[2afdb0f] | 129 | |
---|
| 130 | */ |
---|
[aadd27a] | 131 | void aubio_fft_get_norm(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 |
---|
[f88a326] | 136 | |
---|
[aadd27a] | 137 | */ |
---|
| 138 | void aubio_fft_get_real(cvec_t * spectrum, fvec_t * compspec); |
---|
[f88a326] | 139 | |
---|
[96fb8ad] | 140 | #ifdef __cplusplus |
---|
| 141 | } |
---|
| 142 | #endif |
---|
| 143 | |
---|
[b235c0e] | 144 | #endif /* _AUBIO_FFT_H */ |
---|