[96fb8ad] | 1 | /* |
---|
[e6a78ea] | 2 | Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org> |
---|
[96fb8ad] | 3 | |
---|
[e6a78ea] | 4 | This file is part of aubio. |
---|
[96fb8ad] | 5 | |
---|
[e6a78ea] | 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. |
---|
[96fb8ad] | 10 | |
---|
[e6a78ea] | 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/>. |
---|
[96fb8ad] | 18 | |
---|
| 19 | */ |
---|
| 20 | |
---|
[7011e8a] | 21 | /** \file |
---|
| 22 | |
---|
| 23 | Phase vocoder object |
---|
| 24 | |
---|
| 25 | This object implements a phase vocoder. The spectral frames are computed |
---|
| 26 | using a HanningZ window and a swapped version of the signal to simplify the |
---|
| 27 | phase relationships across frames. The window sizes and overlap are specified |
---|
| 28 | at creation time. Multiple channels are fully supported. |
---|
| 29 | |
---|
| 30 | */ |
---|
[96fb8ad] | 31 | |
---|
| 32 | #ifndef _PHASEVOC_H |
---|
| 33 | #define _PHASEVOC_H |
---|
| 34 | |
---|
| 35 | #ifdef __cplusplus |
---|
| 36 | extern "C" { |
---|
| 37 | #endif |
---|
| 38 | |
---|
| 39 | /** phasevocoder object */ |
---|
| 40 | typedef struct _aubio_pvoc_t aubio_pvoc_t; |
---|
| 41 | |
---|
[7011e8a] | 42 | /** create phase vocoder object |
---|
| 43 | |
---|
| 44 | \param win_s size of analysis buffer (and length the FFT transform) |
---|
| 45 | \param hop_s step size between two consecutive analysis |
---|
| 46 | \param channels number of channels |
---|
| 47 | |
---|
| 48 | */ |
---|
[96fb8ad] | 49 | aubio_pvoc_t * new_aubio_pvoc (uint_t win_s, uint_t hop_s, uint_t channels); |
---|
[7011e8a] | 50 | /** delete phase vocoder object |
---|
| 51 | |
---|
| 52 | \param pv phase vocoder object as returned by new_aubio_pvoc |
---|
| 53 | |
---|
| 54 | */ |
---|
[96fb8ad] | 55 | void del_aubio_pvoc(aubio_pvoc_t *pv); |
---|
| 56 | |
---|
[7011e8a] | 57 | /** compute spectral frame |
---|
| 58 | |
---|
| 59 | This function accepts an input vector of size [channels]x[hop_s]. The |
---|
| 60 | analysis buffer is rotated and filled with the new data. After windowing of |
---|
| 61 | this signal window, the Fourier transform is computed and returned in |
---|
| 62 | fftgrain as two vectors, magnitude and phase. |
---|
| 63 | |
---|
| 64 | \param pv phase vocoder object as returned by new_aubio_pvoc |
---|
| 65 | \param in new input signal (hop_s long) |
---|
| 66 | \param fftgrain output spectral frame |
---|
| 67 | |
---|
| 68 | */ |
---|
[96fb8ad] | 69 | void aubio_pvoc_do(aubio_pvoc_t *pv, fvec_t *in, cvec_t * fftgrain); |
---|
[7011e8a] | 70 | /** compute signal from spectral frame |
---|
| 71 | |
---|
| 72 | This function takes an input spectral frame fftgrain of size |
---|
| 73 | [channels]x[buf_s] and computes its inverse Fourier transform. Overlap-add |
---|
| 74 | synthesis is then computed using the previously synthetised frames, and the |
---|
| 75 | output stored in out. |
---|
| 76 | |
---|
| 77 | \param pv phase vocoder object as returned by new_aubio_pvoc |
---|
| 78 | \param fftgrain input spectral frame |
---|
| 79 | \param out output signal (hop_s long) |
---|
| 80 | |
---|
| 81 | */ |
---|
[96fb8ad] | 82 | void aubio_pvoc_rdo(aubio_pvoc_t *pv, cvec_t * fftgrain, fvec_t *out); |
---|
| 83 | |
---|
[7011e8a] | 84 | /** get window size |
---|
| 85 | |
---|
| 86 | \param pv phase vocoder to get the window size from |
---|
| 87 | |
---|
| 88 | */ |
---|
[96fb8ad] | 89 | uint_t aubio_pvoc_get_win(aubio_pvoc_t* pv); |
---|
[7011e8a] | 90 | /** get hop size |
---|
| 91 | |
---|
| 92 | \param pv phase vocoder to get the hop size from |
---|
| 93 | |
---|
| 94 | */ |
---|
[96fb8ad] | 95 | uint_t aubio_pvoc_get_hop(aubio_pvoc_t* pv); |
---|
[7011e8a] | 96 | /** get channel number |
---|
| 97 | |
---|
| 98 | \param pv phase vocoder to get the number of channels from |
---|
| 99 | |
---|
| 100 | */ |
---|
[96fb8ad] | 101 | uint_t aubio_pvoc_get_channels(aubio_pvoc_t* pv); |
---|
| 102 | |
---|
| 103 | #ifdef __cplusplus |
---|
| 104 | } |
---|
| 105 | #endif |
---|
| 106 | |
---|
| 107 | #endif |
---|