source: src/spectral/fft.h @ 51ee670

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 51ee670 was b511fa9, checked in by Paul Brossier <piem@piem.org>, 15 years ago

replace FOO_SUPPORT with HAVE_FOO, use float for jack_process function prototype

  • Property mode set to 100644
File size: 4.1 KB
RevLine 
[96fb8ad]1/*
[a47cd35]2   Copyright (C) 2003 Paul Brossier
3
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.
8
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.
13
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.
17   
[96fb8ad]18*/
19
[2afdb0f]20/** \file
21
22  Fast Fourier Transform object
23
24*/
[96fb8ad]25
26#ifndef FFT_H_
27#define FFT_H_
[66834b6]28
[2afdb0f]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. */
[96fb8ad]31#include <fftw3.h>
32
[3b3ec6c]33#ifdef HAVE_COMPLEX_H
[b511fa9]34#if HAVE_FFTW3F
[96fb8ad]35#define FFTW_TYPE fftwf_complex
36#else
37#define FFTW_TYPE fftw_complex
38#endif
[3b3ec6c]39#else
[b511fa9]40#if HAVE_FFTW3F
[d88ea06]41/** fft data type */
[3b3ec6c]42#define FFTW_TYPE float
43#else
[d88ea06]44/** fft data type */
[3b3ec6c]45#define FFTW_TYPE double
46#endif
47#endif
[96fb8ad]48
49#ifdef __cplusplus
50extern "C" {
51#endif
52
[d88ea06]53/** fft data type */
[96fb8ad]54typedef FFTW_TYPE fft_data_t;
55
[2afdb0f]56/** FFT object
57 
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).
62
63*/
[96fb8ad]64typedef struct _aubio_fft_t aubio_fft_t;
65
[2afdb0f]66/** create new FFT computation object
67
68  \param size length of the FFT
[aadd27a]69  \param channels number of channels
[2afdb0f]70
71*/
[aadd27a]72aubio_fft_t * new_aubio_fft(uint_t size, uint_t channels);
[2afdb0f]73/** delete FFT object
74
75  \param s fft object as returned by new_aubio_fft
76
77*/
[227564e]78void del_aubio_fft(aubio_fft_t * s);
[aadd27a]79
[2afdb0f]80/** compute forward FFT
81
82  \param s fft object as returned by new_aubio_fft
[aadd27a]83  \param input input signal
[2afdb0f]84  \param spectrum output spectrum
85
86*/
[aadd27a]87void aubio_fft_do (aubio_fft_t *s, fvec_t * input, cvec_t * spectrum);
[2afdb0f]88/** compute backward (inverse) FFT
89
90  \param s fft object as returned by new_aubio_fft
91  \param spectrum input spectrum
[aadd27a]92  \param output output signal
[2afdb0f]93
94*/
[aadd27a]95void aubio_fft_rdo (aubio_fft_t *s, cvec_t * spectrum, fvec_t * output);
[2afdb0f]96
[aadd27a]97/** compute forward FFT
98
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
[2afdb0f]102
103*/
[aadd27a]104void aubio_fft_do_complex (aubio_fft_t *s, fvec_t * input, fvec_t * compspec);
105/** compute backward (inverse) FFT from real/imag
106
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
[2afdb0f]110
111*/
[aadd27a]112void aubio_fft_rdo_complex (aubio_fft_t *s, fvec_t * compspec, fvec_t * output);
[96fb8ad]113
[aadd27a]114/** convert real/imag spectrum to norm/phas spectrum
[f88a326]115
[aadd27a]116  \param compspec real/imag input fft array
117  \param spectrum cvec norm/phas output array
[2afdb0f]118
119*/
[aadd27a]120void aubio_fft_get_spectrum(fvec_t * compspec, cvec_t * spectrum);
121/** convert real/imag spectrum to norm/phas spectrum
[2afdb0f]122
[aadd27a]123  \param compspec real/imag input fft array
124  \param spectrum cvec norm/phas output array
[2afdb0f]125
126*/
[aadd27a]127void aubio_fft_get_realimag(cvec_t * spectrum, fvec_t * compspec);
128
129/** compute phas spectrum from real/imag parts
[2afdb0f]130
[aadd27a]131  \param compspec real/imag input fft array
132  \param spectrum cvec norm/phas output array
[2afdb0f]133
134*/
[aadd27a]135void aubio_fft_get_phas(fvec_t * compspec, cvec_t * spectrum);
136/** compute imaginary part from the norm/phas cvec
[2afdb0f]137
[aadd27a]138  \param spectrum norm/phas input array
139  \param compspec real/imag output fft array
[2afdb0f]140
141*/
[aadd27a]142void aubio_fft_get_imag(cvec_t * spectrum, fvec_t * compspec);
[2afdb0f]143
[aadd27a]144/** compute norm component from real/imag parts
145
146  \param compspec real/imag input fft array
147  \param spectrum cvec norm/phas output array
[2afdb0f]148
149*/
[aadd27a]150void aubio_fft_get_norm(fvec_t * compspec, cvec_t * spectrum);
151/** compute real part from norm/phas components
152
153  \param spectrum norm/phas input array
154  \param compspec real/imag output fft array
[f88a326]155
[aadd27a]156*/
157void aubio_fft_get_real(cvec_t * spectrum, fvec_t * compspec);
[f88a326]158
[96fb8ad]159#ifdef __cplusplus
160}
161#endif
162
[aadd27a]163#endif // FFT_H_
Note: See TracBrowser for help on using the repository browser.