source: src/cvec.h @ 9ae6e03

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 9ae6e03 was d1ec8cb, checked in by Paul Brossier <piem@piem.org>, 17 years ago

splitted sample.c into fvec.c and cvec.c, kept sample.h for convenience

  • Property mode set to 100644
File size: 6.2 KB
Line 
1/*
2   Copyright (C) 2003-2007 Paul Brossier <piem@piem.org>
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#ifndef _CVEC_H
21#define _CVEC_H_
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/** \file
28
29  Real and complex buffers
30
31  This file specifies the cvec_t buffer type, which is used throughout aubio to
32  store complex data. Complex values are stored in terms of phase and
33  norm, within size/2+1 long vectors.
34
35*/
36
37/** Spectrum buffer type */
38typedef struct _cvec_t cvec_t;
39/** Buffer for complex data */
40struct _cvec_t {
41  uint_t length;   /**< length of buffer = (requested length)/2 + 1 */
42  uint_t channels; /**< number of channels */
43  smpl_t **norm;   /**< norm array of size [length] * [channels] */
44  smpl_t **phas;   /**< phase array of size [length] * [channels] */
45};
46
47/** cvec_t buffer creation function
48
49  This function creates a cvec_t structure holding two arrays of size
50  [length/2+1] * channels, corresponding to the norm and phase values of the
51  spectral frame. The length stored in the structure is the actual size of both
52  arrays, not the length of the complex and symetrical vector, specified as
53  creation argument.
54
55  \param length the length of the buffer to create
56  \param channels the number of channels in the buffer
57
58*/
59cvec_t * new_cvec(uint_t length, uint_t channels);
60/** cvec_t buffer deletion function
61
62  \param s buffer to delete as returned by new_cvec()
63
64*/
65void del_cvec(cvec_t *s);
66/** write norm value in a complex buffer
67
68  Note that this function is not used in the aubio library, since the same
69  result can be obtained by assigning vec->norm[channel][position]. Its purpose
70  is to access these values from wrappers, as created by swig.
71
72  \param s vector to write to
73  \param data norm value to write in s->norm[channel][position]
74  \param channel channel to write to
75  \param position sample position to write to
76
77*/
78void cvec_write_norm(cvec_t *s, smpl_t data, uint_t channel, uint_t position);
79/** write phase value in a complex buffer
80
81  Note that this function is not used in the aubio library, since the same
82  result can be obtained by assigning vec->phas[channel][position]. Its purpose
83  is to access these values from wrappers, as created by swig.
84
85  \param s vector to write to
86  \param data phase value to write in s->phas[channel][position]
87  \param channel channel to write to
88  \param position sample position to write to
89
90*/
91void cvec_write_phas(cvec_t *s, smpl_t data, uint_t channel, uint_t position);
92/** read norm value from a complex buffer
93
94  Note that this function is not used in the aubio library, since the same
95  result can be obtained with vec->norm[channel][position]. Its purpose is to
96  access these values from wrappers, as created by swig.
97
98  \param s vector to read from
99  \param channel channel to read from
100  \param position sample position to read from
101
102*/
103smpl_t cvec_read_norm(cvec_t *s, uint_t channel, uint_t position);
104/** read phase value from a complex buffer
105
106  Note that this function is not used in the aubio library, since the same
107  result can be obtained with vec->phas[channel][position]. Its purpose is to
108  access these values from wrappers, as created by swig.
109
110  \param s vector to read from
111  \param channel channel to read from
112  \param position sample position to read from
113
114*/
115smpl_t cvec_read_phas(cvec_t *s, uint_t channel, uint_t position);
116/** write norm channel in a complex buffer
117
118  Note that this function is not used in the aubio library, since the same
119  result can be obtained by assigning vec->norm[channel]. Its purpose is to
120  access these values from wrappers, as created by swig.
121
122  \param s vector to write to
123  \param data norm vector of [length] samples to write in s->norm[channel]
124  \param channel channel to write to
125
126*/
127void cvec_put_norm_channel(cvec_t *s, smpl_t * data, uint_t channel);
128/** write phase channel in a complex buffer
129
130  Note that this function is not used in the aubio library, since the same
131  result can be obtained by assigning vec->phas[channel]. Its purpose is to
132  access these values from wrappers, as created by swig.
133
134  \param s vector to write to
135  \param data phase vector of [length] samples to write in s->phas[channel]
136  \param channel channel to write to
137
138*/
139void cvec_put_phas_channel(cvec_t *s, smpl_t * data, uint_t channel);
140/** read norm channel from a complex buffer
141
142  Note that this function is not used in the aubio library, since the same
143  result can be obtained with vec->norm[channel]. Its purpose is to access
144  these values from wrappers, as created by swig.
145
146  \param s vector to read from
147  \param channel channel to read from
148
149*/
150smpl_t * cvec_get_norm_channel(cvec_t *s, uint_t channel);
151/** write phase channel in a complex buffer
152
153  Note that this function is not used in the aubio library, since the same
154  result can be obtained with vec->phas[channel]. Its purpose is to access
155  these values from wrappers, as created by swig.
156
157  \param s vector to read from
158  \param channel channel to read from
159
160*/
161smpl_t * cvec_get_phas_channel(cvec_t *s, uint_t channel);
162/** read norm data from a complex buffer
163
164  Note that this function is not used in the aubio library, since the same
165  result can be obtained with vec->norm. Its purpose is to access these values
166  from wrappers, as created by swig.
167
168  \param s vector to read from
169
170*/
171smpl_t ** cvec_get_norm(cvec_t *s);
172/** read phase data from a complex buffer
173
174  Note that this function is not used in the aubio library, since the same
175  result can be obtained with vec->phas. Its purpose is to access these values
176  from wrappers, as created by swig.
177
178  \param s vector to read from
179
180*/
181smpl_t ** cvec_get_phas(cvec_t *s);
182
183#ifdef __cplusplus
184}
185#endif
186
187#endif /* _CVEC_H */
188
Note: See TracBrowser for help on using the repository browser.