source: src/cvec.h @ 860ef4b

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 860ef4b was 66fb3ea, checked in by Paul Brossier <piem@piem.org>, 15 years ago

modified cvec to be mono

  • Property mode set to 100644
File size: 4.4 KB
Line 
1/*
2  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
3
4  This file is part of aubio.
5
6  aubio is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10
11  aubio is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  GNU General Public License for more details.
15
16  You should have received a copy of the GNU General Public License
17  along with aubio.  If not, see <http://www.gnu.org/licenses/>.
18
19*/
20
21#ifndef _CVEC_H
22#define _CVEC_H_
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/** \file
29
30  Complex buffers
31
32  This file specifies the cvec_t buffer type, which is used throughout aubio to
33  store complex data. Complex values are stored in terms of phase and
34  norm, within size/2+1 long vectors.
35
36*/
37
38/** Buffer for complex data */
39typedef struct {
40  uint_t length;   /**< length of buffer = (requested length)/2 + 1 */
41  smpl_t *norm;   /**< norm array of size [length] */
42  smpl_t *phas;   /**< phase array of size [length] */
43} cvec_t;
44
45/** cvec_t buffer creation function
46
47  This function creates a cvec_t structure holding two arrays of size
48  [length/2+1], corresponding to the norm and phase values of the
49  spectral frame. The length stored in the structure is the actual size of both
50  arrays, not the length of the complex and symetrical vector, specified as
51  creation argument.
52
53  \param length the length of the buffer to create
54
55*/
56cvec_t * new_cvec(uint_t length);
57/** cvec_t buffer deletion function
58
59  \param s buffer to delete as returned by new_cvec()
60
61*/
62void del_cvec(cvec_t *s);
63/** write norm value in a complex buffer
64
65  Note that this function is not used in the aubio library, since the same
66  result can be obtained by assigning vec->norm[position]. Its purpose
67  is to access these values from wrappers, as created by swig.
68
69  \param s vector to write to
70  \param data norm value to write in s->norm[position]
71  \param position sample position to write to
72
73*/
74void cvec_write_norm(cvec_t *s, smpl_t data, uint_t position);
75/** write phase value in a complex buffer
76
77  Note that this function is not used in the aubio library, since the same
78  result can be obtained by assigning vec->phas[position]. Its purpose
79  is to access these values from wrappers, as created by swig.
80
81  \param s vector to write to
82  \param data phase value to write in s->phas[position]
83  \param position sample position to write to
84
85*/
86void cvec_write_phas(cvec_t *s, smpl_t data, uint_t position);
87/** read norm value from a complex buffer
88
89  Note that this function is not used in the aubio library, since the same
90  result can be obtained with vec->norm[position]. Its purpose is to
91  access these values from wrappers, as created by swig.
92
93  \param s vector to read from
94  \param position sample position to read from
95
96*/
97smpl_t cvec_read_norm(cvec_t *s, uint_t position);
98/** read phase value from a complex buffer
99
100  Note that this function is not used in the aubio library, since the same
101  result can be obtained with vec->phas[position]. Its purpose is to
102  access these values from wrappers, as created by swig.
103
104  \param s vector to read from
105  \param position sample position to read from
106
107*/
108smpl_t cvec_read_phas(cvec_t *s, uint_t position);
109/** read norm data from a complex buffer
110
111  Note that this function is not used in the aubio library, since the same
112  result can be obtained with vec->norm. Its purpose is to access these values
113  from wrappers, as created by swig.
114
115  \param s vector to read from
116
117*/
118smpl_t * cvec_get_norm(cvec_t *s);
119/** read phase data from a complex buffer
120
121  Note that this function is not used in the aubio library, since the same
122  result can be obtained with vec->phas. Its purpose is to access these values
123  from wrappers, as created by swig.
124
125  \param s vector to read from
126
127*/
128smpl_t * cvec_get_phas(cvec_t *s);
129
130/** print out cvec data
131
132  \param s vector to print out
133
134*/
135void cvec_print(cvec_t *s);
136
137/** set all elements to a given value
138
139  \param s vector to modify
140  \param val value to set elements to
141
142*/
143void cvec_set(cvec_t *s, smpl_t val);
144
145/** set all elements to zero
146
147  \param s vector to modify
148
149*/
150void cvec_zeros(cvec_t *s);
151
152/** set all elements to ones
153
154  \param s vector to modify
155
156*/
157void cvec_ones(cvec_t *s);
158
159#ifdef __cplusplus
160}
161#endif
162
163#endif /* _CVEC_H */
164
Note: See TracBrowser for help on using the repository browser.