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