aubio
0.4.1
|
00001 /* 00002 Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> 00003 00004 This file is part of aubio. 00005 00006 aubio is free software: you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation, either version 3 of the License, or 00009 (at your option) any later version. 00010 00011 aubio is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with aubio. If not, see <http://www.gnu.org/licenses/>. 00018 00019 */ 00020 00021 /** \file 00022 00023 Phase vocoder object 00024 00025 This object implements a phase vocoder. The spectral frames are computed 00026 using a HanningZ window and a swapped version of the signal to simplify the 00027 phase relationships across frames. The window sizes and overlap are specified 00028 at creation time. 00029 00030 \example spectral/test-phasevoc.c 00031 00032 */ 00033 00034 #ifndef _AUBIO_PHASEVOC_H 00035 #define _AUBIO_PHASEVOC_H 00036 00037 #ifdef __cplusplus 00038 extern "C" { 00039 #endif 00040 00041 /** phasevocoder object */ 00042 typedef struct _aubio_pvoc_t aubio_pvoc_t; 00043 00044 /** create phase vocoder object 00045 00046 \param win_s size of analysis buffer (and length the FFT transform) 00047 \param hop_s step size between two consecutive analysis 00048 00049 */ 00050 aubio_pvoc_t * new_aubio_pvoc (uint_t win_s, uint_t hop_s); 00051 /** delete phase vocoder object 00052 00053 \param pv phase vocoder object as returned by new_aubio_pvoc 00054 00055 */ 00056 void del_aubio_pvoc(aubio_pvoc_t *pv); 00057 00058 /** compute spectral frame 00059 00060 This function accepts an input vector of size [hop_s]. The 00061 analysis buffer is rotated and filled with the new data. After windowing of 00062 this signal window, the Fourier transform is computed and returned in 00063 fftgrain as two vectors, magnitude and phase. 00064 00065 \param pv phase vocoder object as returned by new_aubio_pvoc 00066 \param in new input signal (hop_s long) 00067 \param fftgrain output spectral frame 00068 00069 */ 00070 void aubio_pvoc_do(aubio_pvoc_t *pv, fvec_t *in, cvec_t * fftgrain); 00071 /** compute signal from spectral frame 00072 00073 This function takes an input spectral frame fftgrain of size 00074 [buf_s] and computes its inverse Fourier transform. Overlap-add 00075 synthesis is then computed using the previously synthetised frames, and the 00076 output stored in out. 00077 00078 \param pv phase vocoder object as returned by new_aubio_pvoc 00079 \param fftgrain input spectral frame 00080 \param out output signal (hop_s long) 00081 00082 */ 00083 void aubio_pvoc_rdo(aubio_pvoc_t *pv, cvec_t * fftgrain, fvec_t *out); 00084 00085 /** get window size 00086 00087 \param pv phase vocoder to get the window size from 00088 00089 */ 00090 uint_t aubio_pvoc_get_win(aubio_pvoc_t* pv); 00091 /** get hop size 00092 00093 \param pv phase vocoder to get the hop size from 00094 00095 */ 00096 uint_t aubio_pvoc_get_hop(aubio_pvoc_t* pv); 00097 00098 #ifdef __cplusplus 00099 } 00100 #endif 00101 00102 #endif /* _AUBIO_PHASEVOC_H */