andrew@0
|
1 /*
|
andrew@0
|
2 Copyright (C) 2003 Paul Brossier
|
andrew@0
|
3
|
andrew@0
|
4 This program is free software; you can redistribute it and/or modify
|
andrew@0
|
5 it under the terms of the GNU General Public License as published by
|
andrew@0
|
6 the Free Software Foundation; either version 2 of the License, or
|
andrew@0
|
7 (at your option) any later version.
|
andrew@0
|
8
|
andrew@0
|
9 This program is distributed in the hope that it will be useful,
|
andrew@0
|
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
andrew@0
|
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
andrew@0
|
12 GNU General Public License for more details.
|
andrew@0
|
13
|
andrew@0
|
14 You should have received a copy of the GNU General Public License
|
andrew@0
|
15 along with this program; if not, write to the Free Software
|
andrew@0
|
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
andrew@0
|
17
|
andrew@0
|
18 */
|
andrew@0
|
19
|
andrew@0
|
20 /** \file
|
andrew@0
|
21
|
andrew@0
|
22 Phase vocoder object
|
andrew@0
|
23
|
andrew@0
|
24 This object implements a phase vocoder. The spectral frames are computed
|
andrew@0
|
25 using a HanningZ window and a swapped version of the signal to simplify the
|
andrew@0
|
26 phase relationships across frames. The window sizes and overlap are specified
|
andrew@0
|
27 at creation time. Multiple channels are fully supported.
|
andrew@0
|
28
|
andrew@0
|
29 */
|
andrew@0
|
30
|
andrew@0
|
31 #ifndef _PHASEVOC_H
|
andrew@0
|
32 #define _PHASEVOC_H
|
andrew@0
|
33
|
andrew@0
|
34 #ifdef __cplusplus
|
andrew@0
|
35 extern "C" {
|
andrew@0
|
36 #endif
|
andrew@0
|
37
|
andrew@0
|
38 /** phasevocoder object */
|
andrew@0
|
39 typedef struct _aubio_pvoc_t aubio_pvoc_t;
|
andrew@0
|
40
|
andrew@0
|
41 /** create phase vocoder object
|
andrew@0
|
42
|
andrew@0
|
43 \param win_s size of analysis buffer (and length the FFT transform)
|
andrew@0
|
44 \param hop_s step size between two consecutive analysis
|
andrew@0
|
45 \param channels number of channels
|
andrew@0
|
46
|
andrew@0
|
47 */
|
andrew@0
|
48 aubio_pvoc_t * new_aubio_pvoc (ba_uint_t win_s, ba_uint_t hop_s, ba_uint_t channels);
|
andrew@0
|
49 /** delete phase vocoder object
|
andrew@0
|
50
|
andrew@0
|
51 \param pv phase vocoder object as returned by new_aubio_pvoc
|
andrew@0
|
52
|
andrew@0
|
53 */
|
andrew@0
|
54 void del_aubio_pvoc(aubio_pvoc_t *pv);
|
andrew@0
|
55
|
andrew@0
|
56 /** compute spectral frame
|
andrew@0
|
57
|
andrew@0
|
58 This function accepts an input vector of size [channels]x[hop_s]. The
|
andrew@0
|
59 analysis buffer is rotated and filled with the new data. After windowing of
|
andrew@0
|
60 this signal window, the Fourier transform is computed and returned in
|
andrew@0
|
61 fftgrain as two vectors, magnitude and phase.
|
andrew@0
|
62
|
andrew@0
|
63 \param pv phase vocoder object as returned by new_aubio_pvoc
|
andrew@0
|
64 \param in new input signal (hop_s long)
|
andrew@0
|
65 \param fftgrain output spectral frame
|
andrew@0
|
66
|
andrew@0
|
67 */
|
andrew@0
|
68 void aubio_pvoc_do(aubio_pvoc_t *pv, fvec_t *in, cvec_t * fftgrain);
|
andrew@0
|
69 /** compute signal from spectral frame
|
andrew@0
|
70
|
andrew@0
|
71 This function takes an input spectral frame fftgrain of size
|
andrew@0
|
72 [channels]x[buf_s] and computes its inverse Fourier transform. Overlap-add
|
andrew@0
|
73 synthesis is then computed using the previously synthetised frames, and the
|
andrew@0
|
74 output stored in out.
|
andrew@0
|
75
|
andrew@0
|
76 \param pv phase vocoder object as returned by new_aubio_pvoc
|
andrew@0
|
77 \param fftgrain input spectral frame
|
andrew@0
|
78 \param out output signal (hop_s long)
|
andrew@0
|
79
|
andrew@0
|
80 */
|
andrew@0
|
81 void aubio_pvoc_rdo(aubio_pvoc_t *pv, cvec_t * fftgrain, fvec_t *out);
|
andrew@0
|
82
|
andrew@0
|
83 /** get window size
|
andrew@0
|
84
|
andrew@0
|
85 \param pv phase vocoder to get the window size from
|
andrew@0
|
86
|
andrew@0
|
87 */
|
andrew@0
|
88 ba_uint_t aubio_pvoc_get_win(aubio_pvoc_t* pv);
|
andrew@0
|
89 /** get hop size
|
andrew@0
|
90
|
andrew@0
|
91 \param pv phase vocoder to get the hop size from
|
andrew@0
|
92
|
andrew@0
|
93 */
|
andrew@0
|
94 ba_uint_t aubio_pvoc_get_hop(aubio_pvoc_t* pv);
|
andrew@0
|
95 /** get channel number
|
andrew@0
|
96
|
andrew@0
|
97 \param pv phase vocoder to get the number of channels from
|
andrew@0
|
98
|
andrew@0
|
99 */
|
andrew@0
|
100 ba_uint_t aubio_pvoc_get_channels(aubio_pvoc_t* pv);
|
andrew@0
|
101
|
andrew@0
|
102 #ifdef __cplusplus
|
andrew@0
|
103 }
|
andrew@0
|
104 #endif
|
andrew@0
|
105
|
andrew@0
|
106 #endif
|