[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 | |
---|
[a82cedc] | 21 | /** \file |
---|
[2afdb0f] | 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 | |
---|
[9bfef718] | 30 | \example spectral/test-fft.c |
---|
[b8c0685] | 31 | |
---|
[2afdb0f] | 32 | */ |
---|
[96fb8ad] | 33 | |
---|
[6f42c16] | 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 |
---|
[a82cedc] | 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); |
---|
[a82cedc] | 54 | /** delete FFT object |
---|
[2afdb0f] | 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 |
---|
[a82cedc] | 64 | \param input input signal |
---|
| 65 | \param spectrum output spectrum |
---|
[2afdb0f] | 66 | |
---|
| 67 | */ |
---|
[feb694b] | 68 | void aubio_fft_do (aubio_fft_t *s, const fvec_t * input, cvec_t * spectrum); |
---|
[2afdb0f] | 69 | /** compute backward (inverse) FFT |
---|
| 70 | |
---|
| 71 | \param s fft object as returned by new_aubio_fft |
---|
[a82cedc] | 72 | \param spectrum input spectrum |
---|
| 73 | \param output output signal |
---|
[2afdb0f] | 74 | |
---|
| 75 | */ |
---|
[feb694b] | 76 | void aubio_fft_rdo (aubio_fft_t *s, const 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 |
---|
[a82cedc] | 81 | \param input real input signal |
---|
[aadd27a] | 82 | \param compspec complex output fft real/imag |
---|
[2afdb0f] | 83 | |
---|
| 84 | */ |
---|
[feb694b] | 85 | void aubio_fft_do_complex (aubio_fft_t *s, const fvec_t * input, fvec_t * compspec); |
---|
[aadd27a] | 86 | /** compute backward (inverse) FFT from real/imag |
---|
| 87 | |
---|
| 88 | \param s fft object as returned by new_aubio_fft |
---|
[a82cedc] | 89 | \param compspec real/imag input fft array |
---|
| 90 | \param output real output array |
---|
[2afdb0f] | 91 | |
---|
| 92 | */ |
---|
[feb694b] | 93 | void aubio_fft_rdo_complex (aubio_fft_t *s, const fvec_t * compspec, fvec_t * output); |
---|
[96fb8ad] | 94 | |
---|
[a82cedc] | 95 | /** convert real/imag spectrum to norm/phas spectrum |
---|
[f88a326] | 96 | |
---|
[a82cedc] | 97 | \param compspec real/imag input fft array |
---|
| 98 | \param spectrum cvec norm/phas output array |
---|
[2afdb0f] | 99 | |
---|
| 100 | */ |
---|
[feb694b] | 101 | void aubio_fft_get_spectrum(const fvec_t * compspec, cvec_t * spectrum); |
---|
[a82cedc] | 102 | /** convert real/imag spectrum to norm/phas spectrum |
---|
[2afdb0f] | 103 | |
---|
[a82cedc] | 104 | \param compspec real/imag input fft array |
---|
| 105 | \param spectrum cvec norm/phas output array |
---|
[2afdb0f] | 106 | |
---|
| 107 | */ |
---|
[feb694b] | 108 | void aubio_fft_get_realimag(const cvec_t * spectrum, fvec_t * compspec); |
---|
[aadd27a] | 109 | |
---|
[a82cedc] | 110 | /** compute phas spectrum from real/imag parts |
---|
[2afdb0f] | 111 | |
---|
[a82cedc] | 112 | \param compspec real/imag input fft array |
---|
| 113 | \param spectrum cvec norm/phas output array |
---|
[2afdb0f] | 114 | |
---|
| 115 | */ |
---|
[feb694b] | 116 | void aubio_fft_get_phas(const fvec_t * compspec, cvec_t * spectrum); |
---|
[a82cedc] | 117 | /** compute imaginary part from the norm/phas cvec |
---|
[2afdb0f] | 118 | |
---|
[a82cedc] | 119 | \param spectrum norm/phas input array |
---|
| 120 | \param compspec real/imag output fft array |
---|
[2afdb0f] | 121 | |
---|
| 122 | */ |
---|
[feb694b] | 123 | void aubio_fft_get_imag(const cvec_t * spectrum, fvec_t * compspec); |
---|
[2afdb0f] | 124 | |
---|
[a82cedc] | 125 | /** compute norm component from real/imag parts |
---|
[aadd27a] | 126 | |
---|
[a82cedc] | 127 | \param compspec real/imag input fft array |
---|
| 128 | \param spectrum cvec norm/phas output array |
---|
[2afdb0f] | 129 | |
---|
| 130 | */ |
---|
[feb694b] | 131 | void aubio_fft_get_norm(const fvec_t * compspec, cvec_t * spectrum); |
---|
[a82cedc] | 132 | /** compute real part from norm/phas components |
---|
[aadd27a] | 133 | |
---|
[a82cedc] | 134 | \param spectrum norm/phas input array |
---|
| 135 | \param compspec real/imag output fft array |
---|
[f88a326] | 136 | |
---|
[aadd27a] | 137 | */ |
---|
[feb694b] | 138 | void aubio_fft_get_real(const cvec_t * spectrum, fvec_t * compspec); |
---|
[f88a326] | 139 | |
---|
[96fb8ad] | 140 | #ifdef __cplusplus |
---|
| 141 | } |
---|
| 142 | #endif |
---|
| 143 | |
---|
[6f42c16] | 144 | #endif /* AUBIO_FFT_H */ |
---|