andrew@0: /* andrew@0: Copyright (C) 2003 Paul Brossier andrew@0: andrew@0: This program is free software; you can redistribute it and/or modify andrew@0: it under the terms of the GNU General Public License as published by andrew@0: the Free Software Foundation; either version 2 of the License, or andrew@0: (at your option) any later version. andrew@0: andrew@0: This program is distributed in the hope that it will be useful, andrew@0: but WITHOUT ANY WARRANTY; without even the implied warranty of andrew@0: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the andrew@0: GNU General Public License for more details. andrew@0: andrew@0: You should have received a copy of the GNU General Public License andrew@0: along with this program; if not, write to the Free Software andrew@0: Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. andrew@0: andrew@0: */ andrew@0: andrew@0: /** \file andrew@0: andrew@0: Phase vocoder object andrew@0: andrew@0: This object implements a phase vocoder. The spectral frames are computed andrew@0: using a HanningZ window and a swapped version of the signal to simplify the andrew@0: phase relationships across frames. The window sizes and overlap are specified andrew@0: at creation time. Multiple channels are fully supported. andrew@0: andrew@0: */ andrew@0: andrew@0: #ifndef _PHASEVOC_H andrew@0: #define _PHASEVOC_H andrew@0: andrew@0: #ifdef __cplusplus andrew@0: extern "C" { andrew@0: #endif andrew@0: andrew@0: /** phasevocoder object */ andrew@0: typedef struct _aubio_pvoc_t aubio_pvoc_t; andrew@0: andrew@0: /** create phase vocoder object andrew@0: andrew@0: \param win_s size of analysis buffer (and length the FFT transform) andrew@0: \param hop_s step size between two consecutive analysis andrew@0: \param channels number of channels andrew@0: andrew@0: */ andrew@0: aubio_pvoc_t * new_aubio_pvoc (ba_uint_t win_s, ba_uint_t hop_s, ba_uint_t channels); andrew@0: /** delete phase vocoder object andrew@0: andrew@0: \param pv phase vocoder object as returned by new_aubio_pvoc andrew@0: andrew@0: */ andrew@0: void del_aubio_pvoc(aubio_pvoc_t *pv); andrew@0: andrew@0: /** compute spectral frame andrew@0: andrew@0: This function accepts an input vector of size [channels]x[hop_s]. The andrew@0: analysis buffer is rotated and filled with the new data. After windowing of andrew@0: this signal window, the Fourier transform is computed and returned in andrew@0: fftgrain as two vectors, magnitude and phase. andrew@0: andrew@0: \param pv phase vocoder object as returned by new_aubio_pvoc andrew@0: \param in new input signal (hop_s long) andrew@0: \param fftgrain output spectral frame andrew@0: andrew@0: */ andrew@0: void aubio_pvoc_do(aubio_pvoc_t *pv, fvec_t *in, cvec_t * fftgrain); andrew@0: /** compute signal from spectral frame andrew@0: andrew@0: This function takes an input spectral frame fftgrain of size andrew@0: [channels]x[buf_s] and computes its inverse Fourier transform. Overlap-add andrew@0: synthesis is then computed using the previously synthetised frames, and the andrew@0: output stored in out. andrew@0: andrew@0: \param pv phase vocoder object as returned by new_aubio_pvoc andrew@0: \param fftgrain input spectral frame andrew@0: \param out output signal (hop_s long) andrew@0: andrew@0: */ andrew@0: void aubio_pvoc_rdo(aubio_pvoc_t *pv, cvec_t * fftgrain, fvec_t *out); andrew@0: andrew@0: /** get window size andrew@0: andrew@0: \param pv phase vocoder to get the window size from andrew@0: andrew@0: */ andrew@0: ba_uint_t aubio_pvoc_get_win(aubio_pvoc_t* pv); andrew@0: /** get hop size andrew@0: andrew@0: \param pv phase vocoder to get the hop size from andrew@0: andrew@0: */ andrew@0: ba_uint_t aubio_pvoc_get_hop(aubio_pvoc_t* pv); andrew@0: /** get channel number andrew@0: andrew@0: \param pv phase vocoder to get the number of channels from andrew@0: andrew@0: */ andrew@0: ba_uint_t aubio_pvoc_get_channels(aubio_pvoc_t* pv); andrew@0: andrew@0: #ifdef __cplusplus andrew@0: } andrew@0: #endif andrew@0: andrew@0: #endif